UMBC CMSC 211

UMBC | CSEE


Operations for Multiple Precision

There are two instructions for multi-byte operations:
adc	dest, source		;dest = dest + source + CarryFlag
sbc	dest, source		;dest = dest - source - CarryFlag
  
Now we can do something like:
carry   carry   carry   carry   carry
   A4      A3      A2      A1      A0
+  B4      B3      B2      B1      B0
-----   -----   -----   -----   -----
   C4      C3      C2      C1      C0
  
Now we can have the following code:
;  Multiple precision addition
        mov   eax, A0
        add   eax, B0
        mov   C0, eax           ; Does not affect the carry flag!
        mov   eax, A1           ; Does not affect the carry flag!
        adc   eax, B1
        mov   C1, eax           ; Does not affect the carry flag!
        mov   eax, A2           ; Does not affect the carry flag!
        adc   eax, B2
        mov   C2, eax           ; Does not affect the carry flag!
        mov   eax, A3           ; Does not affect the carry flag!
        adc   eax, B3
        mov   C3, eax           ; Does not affect the carry flag!
        mov   eax, A4           ; Does not affect the carry flag!
        adc   eax, B4
        mov   C4, eax           ; Does not affect the carry flag!
  
Check this out, 4 x 32 = 160 bit value!!!! That ought to be big enough for your starting monthly salary!

There are two other instructions that do not affect the carry flag, inc and dec.

MPPUTDEC.ASM


UMBC | CSEE