Subtraction of Two numbers in ASSEMBLY LANGUAGE -MASM 8086

Subtraction of Two numbers in ASSEMBLY LANGUAGE -MASM 8086

ORG 100H
.MODEL SMALL
.DATA
VAR1 DB 5, 2 DUP(?)
VAR2 DB 5, 2 DUP(?)
PROMPT DB 'ENTER FIRST NUMBER:', '$'
PROMPT1 DB 'ENTER SECOND NUMBER :', '$'
PROMPT2 DB 'RESULT OF FIRST AND SECOND NUMBER IS: ', '$'
.CODE
LEA DX,PROMPT
MOV AH,09H
INT 21H
;======================
MOV AH, 00
INT 16h
MOV VAR1,AL
MOV DL, AL
MOV AH, 2H
INT 21H
;======================
MOV DL,0AH
MOV AH,02H
INT 21H
MOV DL,0DH
MOV AH,02H
INT 21H
LEA DX,PROMPT1
MOV AH,09H
INT 21H
;=================================
MOV AH, 00
INT 16h
MOV VAR2,AL
MOV DL, AL
MOV AH, 2H
INT 21H
;======================
MOV DL,0AH
MOV AH,02H
INT 21H
MOV DL,0DH
MOV AH,02H
INT 21H
;===============================
SUB VAR1,30H
MOV BH,VAR1
SUB VAR2,30H
MOV BL,VAR2
SUB BH,BL
LEA DX,PROMPT2
MOV AH,09H
INT 21H
;==================================
ADD BH,30H
MOV VAR2,BH
MOV DL, BH
MOV AH, 2H
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