Friday, January 31, 2014

Assembly Language Program: Display a character and read two decimal digits and summation of some integer number

.model small
.stack 100h
.data
s1 db 'ENTER TWO NUMBER WHOSE SUM IS LESS THAN 10: $'
S2 DB 0AH,'THE SUM OF $'
S3 DB ' AND $'
S4 DB ' IS $'
A DB ?
B DB ?
C DB ?

.CODE

MAIN PROC

MOV AX,@DATA
MOV DS,AX

MOV AH,9
LEA DX,S1
INT 21H


MOV AH,2
MOV DL,0AH
INT 21H



MOV AH,2
MOV DL,'?'
INT 21H


MOV AH,1
INT 21H
MOV A,AL




MOV AH,1
INT 21H
MOV B,AL


MOV AH,9
LEA DX,S2
INT 21H

MOV AH,2
MOV DL,A
INT 21H

MOV AH,9
LEA DX,S3
INT 21H

MOV AH,2
MOV DL,B

INT 21H


MOV AH,9
LEA DX,S4
INT 21H

SUB A,48D
SUB B,48D
MOV AL,A
ADD AL,B
MOV C,AL

ADD C,48D



MOV AH,2
MOV DL,C

INT 21H

MOV AH,1
INT 21H

MOV AH,4CH
INT 21H

MAIN ENDP
END MAIN

No comments:

Post a Comment