Well, title says it all: if for example I input "a", then I get this "antered string: a" (sic!). I do something wrong and I can not figure out what is happening.
model tiny
.code
org 0100h
start:
mov ax,cs ;set data seg == code seg
mov ds,ax
mov dx,offset tm
mov ah,0ah
int 21h
mov dx,offset testm
mov ah,09h
int 21h
mov dx,offset tm
add dx,2h
mov ah,09h
int 21h
mov dx,offset tm
add dx,2h
mov ah,09h
int 21h
ret
tm db 255,255,255 dup("$")
testm db "Entered string: $"
End start
Int 21h/0Ah
stores the pressed Enter key as0Dh
. This is forInt 21h/09h
a "carriage return" and only a "carriage return". You need an additional "line feed". You can add the line feed (10h
) to the end of thetm
string or add a furtherInt 21h/09
procedure which points to a string only containing the two line feed characters and a terminating$
(crlf db 0Dh, 0Ah, "$"
).Instead of adding a line feed you can change the
0Dh
intm
to '$' to get the "raw" string:An elegant method is to utilize the WriteFile function
Int21h/40h
: