CIS 351

Intro to Assembly

Winter 2022

  1. Write the machine code that will perform this operation: add $10, $5, $3
  2. What operation does this line of machine code perform: 0x012c1020 = 0000 0001 0010 1100 0001 0000 0010 0000?
  3. Write an assembly function parrotTrouble that takes a Boolean and an int as input and returns true if the parrot is talking before 7:00 or after 20:59 (i.e., the hour is less than 7 or greater than 20.) (This is parrotTrouble from CodingBat.)
  4. What is the result of the following operations:
  5. Assume a register contains either 0 or 1. Using not alone won't "flip" 1 to 0 and 0 to 1. What operation can you add that will have the desired effect?
  6. We'll say that a number is "teen" if it is in the range 13..19 inclusive. Write a function that takes two int values as input and returns true if one or the other is teen, but not both. (This is loneTeen from CodingBat.)

Updated Tuesday, 8 February 2022, 2:57 PM

W3c Validation