Dividsion of 8-bit BCD numbers in Assembly -masm 8086

Dividsion of 8-bit BCD numbers in Assembly -masm 8086

org 100h
.model small
.data
A DB 21
B DB 2
.code
;Initilize data segment
mov ax,@DATA
mov DS,ax
mov ah,00h
mov al,a
mov bl,b
div bl
mov bx,ax
; converting hex to decimal by diving A
mov al,bl
mov ah,00h
mov cl,0Ah
div cl
; Quotiont
mov cx,ax
mov dl,cl
add dl,30h
mov ah,02h
int 21h
;remainder
mov dl,ch
add dl,30h
mov ah,02h
int 21h
;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