Last active
December 20, 2015 20:38
-
-
Save hjpotter92/6191404 to your computer and use it in GitHub Desktop.
Take a number as input and print it To be shown on 2013-08-12
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
TITLE Program01: Take a number as input and print it | |
.MODEL SMALL | |
.STACK 100H | |
.DATA | |
PROMPT DB "Please input the number: ", 13, 10, '$' | |
CR EQU 13 | |
LF EQU 10 | |
.CODE | |
MAIN PROC | |
MOV AX, @DATA | |
MOV DS, AX | |
MOV AH, 9 | |
LEA DX, PROMPT | |
INT 21H | |
MOV AH, 1 | |
XOR BX, BX | |
XOR CX, CX | |
INPUT: | |
INT 21H | |
CMP AL, CR | |
JE SHOW | |
CMP AL, LF | |
JE SHOW | |
MOV BL, AL | |
PUSH BX | |
INC CX | |
JMP INPUT | |
SHOW: | |
MOV AH, 2 | |
DISP: | |
POP BX | |
MOV DL, BL | |
INT 21H | |
LOOP DISP | |
MOV AH, 76 | |
INT 21H | |
MAIN ENDP | |
END MAIN |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment