yazdmich

Untitled

Apr 10th, 2014
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.73 KB | None | 0 0
  1. ; --------------------------------------------------------------
  2. CLO ; Close unwanted windows.
  3. MOV AL,1 ; -->
  4. PUSH AL ; Push end flag to stack to prevent stack underflow
  5. Rep:
  6. IN 00 ; Wait for key press - Store it in AL.
  7. PUSH AL ; Push character to stack
  8. CMP AL,0D ; Was it the Enter key? (ASCII 0D)
  9. JNZ Rep ; No - jump back. Yes - continue.
  10. MOV DL,C0 ; Initilize counter
  11. POP AL ; Remove enter key from stack
  12. OUTP:
  13. POP AL ; Pop last value from stack to AL
  14. CMP AL,1 ; Is it 1 (end flag)?
  15. JZ BYE ; Yes - end. No - continue
  16. MOV [DL],AL ; Move character to VDU memory
  17. INC DL ; Increment counter
  18. JMP OUTP ; Output loop
  19. BYE:
  20. END
  21. ; --------------------------------------------------------------
Advertisement
Add Comment
Please, Sign In to add comment