Conversion of HEX to BCD in Assembly -masm 8086

Conversion of HEX to BCD in Assembly -masm 8086

org 100h
.model small
.data
hex dw 0FFFFH
counter db 0
.code
;initilize Data Segment
mov ax,@DATA
mov DS,ax
mov ax,hex
mov bx,000Ah
L:
inc counter
div bx
push dx
cmp ax,0
mov dx,00h
je exit
jmp L
exit:
mov cl,counter
mov ch,00h
L1:
pop dx
add dl,30h
mov ah,02h
int 21h
LOOP L1
;to terminate program
mov ah,4ch
int 21h
ret

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s