BCD Addition and Subtraction

;PROGRAM TO PERFORM ADDITION AND SUBTRACTION OF TWO BCD NUMBERS



data segment

opr1 dw 1924h

opr2 dw 1432h

sum dw 2 dup(0)

subt dw 2 dup(0)

data ends

code segment

assume cs:code, ds:data

start:

mov ax,data

mov ds,ax

mov ax,opr1

mov bx,opr2

add ax,bx

daa

mov sum,ax

jnc next

inc [sum+2]

next:

mov ax,opr1

sub ax,bx

das

mov subt,ax

int 3

code ends

end start

No comments:

Post a Comment