BCD to Binary conversion

;PROGRAM TO CONVERT BCD NUMBER TO BINARY NUMBER

data segment

bcd equ 4567h

result dw ?

data ends

code segment

assume cs:code, ds:data

start:

mov ax,data

mov ds,ax

mov bx,bcd

mov ax,0h

mov cx,0h

again0:

cmp bx,0h

jz endprg

mov al,bl

sub al,01h

das

mov bl,al

mov al,bh

sbb al,00h

das

mov bh,al

inc cx

jmp again0

endprg:

mov result,cx

int 3

code ends

end start

No comments:

Post a Comment