21 Program to add 2 BCD numbers in 8086 Microprocessor

Code:

; PROGRAM TO ADD 2 BCD NUMBERS

.MODEL SMALL
.STACK 100
.CODE
   MOV AL , 09H
   MOV BL , 06H

   ADD AL , BL
   DAA         ; It converts the result of the addition
               ; of two packed BCD numbers into a packed BCD number.
   ; if lower nibble of AL > 9 or AF=1
         ; then AL = AL +06
   ; if higher nibble of AL > 9 or CF=1
         ; then Al = AL +60
   ; if both conditions are satisfied
        ; then AL = AL +66
   MOV DL , AL
   MOV AH , 2
   INT 21H

   MOV AH , 4CH
   INT 21H
END




Ouput: OF DEBUGGER


Previous
Next Post »