Skip to content

Instantly share code, notes, and snippets.

@hjpotter92
Last active December 20, 2015 20:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hjpotter92/6191404 to your computer and use it in GitHub Desktop.
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
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