Exercise 3      Name       ____________________   Points __/35

1. ( 9 points)    Perform the following additions involving 8-bit binary integers in the modulo 28 number system. Give result register and CF, OF, SF, and ZF flag values. A solved example is given.
Example

Mov Al, 00111011B        Mov Bl, 10110101B      Mov Bh, 10110011B      Mov Ah, 11101011B
Add Al, 01011001B        Add Bl, 00110011B      Add Bh, 01011011B      Add Ah, 11110010B
 00111011             a)  10110101          b)  10110011           c)   11101011
+01011001                +00110011             +01011011               +11110010
 10010100

Al=10010100              Bl=                       Bh=                 Ah=
CF=0                     CF=                       CF=                 CF=
OF=1                     OF=                       OF=                 OF=
ZF=0                     ZF=                       ZF=                 ZF=
SF=1                     SF=                       SF=                 SF=

2. ( 9 points)    Perform the following subtractions involving 8-bit binary integers in the modulo 28 number system by adding the two's complement of the subtrahend to the minuend. Give result resgister and CF, OF, SF, and ZF flag values. Remember that CF is complemented for subtraction. A solved example is given.

Example

Mov Ah, 00111011B
Sub Ah, 01011001B               2's Comp
                                               Ah=11100010
 00111011        59             00111011       CF=1
-01011001   =   -89     =>     +10100111       OF=0
                -30             11100010       ZF=0
                                               SF=1
    Mov Ah, 10110101B    Mov Ch, 10110011B          Mov Dh, 11101011B
    Sub Ah, 00110011B    Sub Ch, 01011011B          Sub Dh, 11110010B

a)     10110101        b)     10110011            c)     11101011
      -00110011              -01011011                  -11110010
 
 

        Ah=                   Ch=                        Dh=
        CF=                   CF=                        CF=
        OF=                   OF=                        OF=
        ZF=                   ZF=                        ZF=
        SF=                   SF=                        SF=
 

3. ( 9 points)    Perform the following multiplication operations involving 8-bit binary integers in the modulo 28 number system, giving result in binary. Give result regsiter and OF flag value. A solved example is given.

Example
    Mov  Al, 4         Al       64        Ah = 00000001
    Mov  Cl, 64    => *Cl   =>  *4   =>   Al = 00000000
    Mul  Cl            Ax      256        OF = 1
 

a)   Mov  Al,  4        Ah =            b)   Mov  Al,  4        Ah =
     Mov  Cl, 32        Al =                 Mov  Cl, 128       Al =
     Imul Cl            OF =                 Mul  Cl            OF =
 
 

c)   Mov  Al, -4        Ah =
     Mov  Cl, 32        Al =
     Imul Cl            OF =
 
 
 
 

 4. ( 8 points)    Perform the following division operations involving 8-bit binary integers in the modulo 28 number system, giving result register in binary. A solved example is given.

Example
    Mov  Ah, 1
    Mov  Al, 7           Al          65            Ah = 00000011
    Mov  Cl, 4    => Cl/ Ax   =>  4/263       =>   Al = 01000001
    Div  Cl              Ah           3

     Mov  Ah,  0                             Mov  Ah, 255
a)   Mov  Al, 32        Ah =            b)   Mov  Al,   0       Ah =
     Mov  Cl,  5        Al =                 Mov  Cl, 128       Al =
     Div  Cl                                 Div  Cl
 
 

c)   Mov  Al, -32                       d)   Mov  Al, -32
     Cbw                 Ah =                Cbw                Ah =
     Mov  Cl,   5        Al =                Mov  Cl, -5        Al =
     Idiv Cl                                 Idiv Cl


Document last modified: