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, 10100100B      Mov Bh, 11010011B      Mov Ah, 11101011B
Add Al, 01011001B        Add Bl, 01010011B      Add Bh, 01011101B      Add Ah, 00111011B

 00111011             a)  10100100          b)  11010011           c)   11101011
+01011001                +01010011             +01011101               +00111011
 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, 11110100B    Mov Ch, 01110010B          Mov Dh, 11101111B
    Sub Ah, 01110011B    Sub Ch, 01001011B          Sub Dh, 00110011B

a)     11110100        b)     01110010            c)     11101111
      -01110011              -01001011                  -00110011
 
 

        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 register 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,  3        Ah =            b)   Mov  Al,  -8       Ah =
     Mov  Cl, 41        Al =                 Mov  Cl, 128       Al =
     Imul Cl            OF =                 Mul  Cl            OF =
 
 

c)   Mov  Al, -8        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

     xor  Ah, Ah                             Mov  Ah, 255
a)   Mov  Al, 32        Ah =            b)   Mov  Al,   0       Ah =
     Mov  Cl,  6        Al =                 Mov  Cl,  64       Al =
     Div  Cl                                 Div  Cl
 
 

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


Document last modified: