Subtraction of 8-bit BCD numbers in Assembly – masm 8086

Subtraction of 8-bit BCD numbers in Assembly – masm 8086

org 100h
.model small
.data
A DB 34
B DB 17
.code
;Initilize data segment
mov ax,@DATA
mov DS,ax
mov al,a
sub al,b
; converting hex to decimal by diving A
mov ah,00h
mov bh,0Ah
div bh
; 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