Write a program to enter and print it using
assembly program.
Write assembly program to enter number and print it.
Enter number and print it in assembly program.
Program:-
PRINT MACRO MSG
PUSH AX
PUSH DX
MOV
AH,09H
MOV
DX,OFFSET MSG
INT 21H
POP DX
POP AX
ENDM
DATA SEGMENT
IMSG DB
13,10,"ENTER THE NUMBER :$"
OMSG DB
13,10,"Your Entered number:$"
NUM1 Dw
0
NUM2 Dw
0
DATA ENDS
CODE SEGMENT
ASSUME
CS:CODE,DS:DATA
READNUM
PROCPUSH AX
PUSH
BX
PUSH
CX
MOV
CX,0
MOV
BX,10
MOV
DX,0
R1:
MOV
AH,01H
INT
21H
CMP
AL,13
JE
E1
SUB
AL,48
MOV
CL,AL
MOV
AX,DX
MUL
BX
ADD
AX,CX
MOV
DX,AX ;IN DX EXACT VALUE STORE
JMP
R1
E1:
POP
CX
POP
BX
POP
AX
READNUM
ENDP
PRINTNUM
PROC
PUSH
BX
PUSH
CX
PUSH
DX
MOV
CX,0
MOV
BX,10
R2:
MOV
DX,0
DIV
BX
ADD
DX,48
PUSH
DX
ADD
CX,1
CMP
AX,10
JGE
R2
PUSH
AX
INC
CX
MOV
AH,02
PNUM:
POP
DX
INT
21H
LOOP
PNUM
POP
DX
POP
CX
POP
BX
POP
AX
RET
PRINTNUM
ENDP
START:
MOV
AX,DATA
MOV
DS,AX
PRINT
IMSG
CALL
READNUM
PRINT OMSG
MOV AX,DX
;USER ENTERED DATA STORED IN THE DX
CALL PRINTNUM ;USE AX TO PRINT DATA
MOV
AH,4CH
INT
21H
CODE
ENDS
END
START
Output:-
No comments:
Post a Comment