Part I: Shifting Operations The instructions in this part of the lab deal with manipulation of individual bits and bytes. The shift operations move the set of bits in a register a specified number of bit positions to the left or right. Logical Shifts: In general, logical operations treat the number as a string of bits rather than as a signed number. SHL and SHR are the two logical shifts. Arithmetic Shifts: Arithmetic shifts differ from logical shifts in that they preserve the sign bit. SAL and SAR are the two arithmetic shifts. |
Part II: Shifting Operations Write and run a complete Assembly program that prompts the user for a 32-bit signed number X and prints out the following values: TIP: Use the shifting operations. |
Part III: Sign Extensions Often it is necessary to sign-extend word data to a double word or byte data to a word. The three "convert" instructions covered in this part of the lab allow us to extend a byte to a word and a word to a double word. These instructions are:
|
Part IV: Signed Division and Signed Multiplication Show the content of all registers modified by the instruction segments beow. NOTE:
DW = WORD DD = DWORD |
Part V: Assembly Code Write an efficient portion of an assembly language program to calculate each of the following expressions. Declare each variable as a WORD. Assume that the result in each case fits exactly into a WORD. |