Hey all,
Trying to use the Dos I/O function to read console input character by character. I have reserved a buffer using resb and I am trying to read characters into my buffer and then outputting. Any pointers on what I am doing wrong or how to achieve my goal will be appreciated. Here is a snip of my code.:
_main:
mov dx, [buffer]
mov si, dx ; point to input buffer
L1: mov ah, 1
int 21h
cmp al, 0Dh ; check for CR
je L2
mov [si], al ; store the character
inc si ; increment buffer pointer
loop L1
L2: mov BYTE [si], '$' ;insert null terminator
inc si ; increment buffer pointer
mov BYTE [si], 0Dh ; insert carriage return
L3: mov ah, 9
mov edx, buffer ; load buffer into edx
int 21h ; output buffer
When running this program I see error:
The NTVDM CPU has encountered an illegal instruction.
CS:022e IP:00df OP:ff ff 1e ff ff
Thanks in advance for any assistance.