Integer Arithmetic Solution

1.      In the following code sequence, show the value of AL after each shift or rotate instruction has executed. Credit will NOT be given for answers that do not show work.

                                   

              mov al, 32h               

              rol al, 3            ;      A: al =

              mov al, D2h

              ror al, 1            ;      B: al =

              stc

              mov al, 3Bh

              rcl al, 2            ;      C: al =

              stc

              mov al, 17h

              rcr al, 1            ;      D: al =

 

 

2.      Write instructions that calculate EAX*23 using binary multiplication.

 

3.      The time stamp of a file uses bits 0-2 for hours, bits 3-7 for days, bits 8-11 for months, and bits 12-15 for years.  Write instructions that extract the months and copy the value to a byte variable named “months”.

 

4.      What will be the contents of AX and DX after the following operation?

 

            mov dx, 0

       mov ax, 3456h

       mov cx, 2300h

       mul cx

 

5.      Implement the following expression in assembly language, using 32-bit unsigned operands:

           

            Alpha = (Alpha + Beta) * (Gamma - Delta) / Iota

           

 

6.      What will be the values of DX:AX after the following instructions execute?  What might be the use of such a sequence of instructions in a 16-bit computer?

 

            mov ax, 1h

       mov dx, 0h

       sub ax, 1h

       sbb dx, 0

 

7.      Write a program that adds two operands using extended addition.  See textbook pg 257. 

Use the following:

Blue           BYTE 12h, 14h, 34h, 23h, 65h. 78h, 56h, 99h, 20h, 05h

Yellow       BYTE 41h, 25h, 23h, 45h, 12h, BCh, CDh, F1h, 10h, 09h

Green         BYTE 10 dup(0)

Display the contents of the array Green.  
Powered by