fork download
  1.  
  2.  
  3. ; copied from c:\emu8086\emu8086.inc
  4. GET_STRING PROC NEAR
  5. PUSH AX
  6. PUSH CX
  7. PUSH DI
  8. PUSH DX
  9.  
  10. MOV CX, 0 ; char counter.
  11.  
  12. CMP DX, 1 ; buffer too small?
  13. JBE empty_buffer ;
  14.  
  15. DEC DX ; reserve space for last zero.
  16.  
  17.  
  18. ;============================
  19. ; loop to get and processes key presses:
  20.  
  21. wait_for_key:
  22.  
  23. MOV AH, 0 ; get pressed key.
  24. INT 16h
  25.  
  26. CMP AL, 13 ; 'RETURN' pressed?
  27. JZ exit
  28.  
  29.  
  30. CMP AL, 8 ; 'BACKSPACE' pressed?
  31. JNE add_to_buffer
  32. JCXZ wait_for_key ; nothing to remove!
  33. DEC CX
  34. DEC DI
  35. PUTC 8 ; backspace.
  36. PUTC ' ' ; clear position.
  37. PUTC 8 ; backspace again.
  38. JMP wait_for_key
  39.  
  40. add_to_buffer:
  41.  
  42. CMP CX, DX ; buffer is full?
  43. JAE wait_for_key ; if so wait for 'BACKSPACE' or 'RETURN'...
  44.  
  45. MOV [DI], AL
  46. INC DI
  47. INC CX
  48.  
  49. ; print the key:
  50. MOV AH, 0Eh
  51. INT 10h
  52.  
  53. JMP wait_for_key
  54. ;============================
  55.  
  56.  
  57. ; terminate by null:
  58. MOV [DI], 0
  59.  
  60. empty_buffer:
  61.  
  62. POP DX
  63. POP DI
  64. POP CX
  65. POP AX
  66. RET
  67. GET_STRING ENDP
  68.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.s: Assembler messages:
prog.s:3: Error: no such instruction: `copied from c:\emu8086\emu8086.inc'
prog.s:4: Error: no such instruction: `get_string PROC NEAR'
prog.s:10: Error: too many memory references for `mov'
prog.s:10: Error: no such instruction: `char counter.'
prog.s:12: Error: too many memory references for `cmp'
prog.s:12: Error: no such instruction: `buffer too small?'
prog.s:15: Error: no instruction mnemonic suffix given and no register operands; can't size instruction
prog.s:15: Error: no such instruction: `reserve space for last zero.'
prog.s:18: Error: junk at end of line, first unrecognized character is `='
prog.s:19: Error: junk `get and processes key presses:' after expression
prog.s:23: Error: too many memory references for `mov'
prog.s:23: Error: no such instruction: `get pressed key.'
prog.s:24: Error: junk `h' after expression
prog.s:24: Error: operand size mismatch for `int'
prog.s:26: Error: too many memory references for `cmp'
prog.s:26: Error: junk at end of line, first unrecognized character is `8'
prog.s:30: Error: too many memory references for `cmp'
prog.s:30: Error: junk at end of line, first unrecognized character is `6'
prog.s:32: Error: no such instruction: `nothing to remove!'
prog.s:33: Error: no instruction mnemonic suffix given and no register operands; can't size instruction
prog.s:34: Error: no instruction mnemonic suffix given and no register operands; can't size instruction
prog.s:35: Error: no such instruction: `putc 8'
prog.s:35: Error: no such instruction: `backspace.'
prog.s:36: Error: no such instruction: `putc 32'
prog.s:36: Error: no such instruction: `clear position.'
prog.s:37: Error: no such instruction: `putc 8'
prog.s:37: Error: no such instruction: `backspace again.'
prog.s:42: Error: too many memory references for `cmp'
prog.s:42: Error: no such instruction: `buffer is full?'
prog.s:43: Error: no such instruction: `if so wait for 66ACKSPACE32or 82ETURN46..'
prog.s:45: Error: invalid char '[' beginning operand 1 `[DI]'
prog.s:46: Error: no instruction mnemonic suffix given and no register operands; can't size instruction
prog.s:47: Error: no instruction mnemonic suffix given and no register operands; can't size instruction
prog.s:49: Error: no such instruction: `print the key:'
prog.s:50: Error: too many memory references for `mov'
prog.s:51: Error: junk `h' after expression
prog.s:51: Error: operand size mismatch for `int'
prog.s:54: Error: junk at end of line, first unrecognized character is `='
prog.s:58: Error: no such instruction: `terminate by null:'
prog.s:59: Error: invalid char '[' beginning operand 1 `[DI]'
prog.s:68: Error: no such instruction: `get_string ENDP'
stdout
Standard output is empty