Hey all, I've been working on this little program in NASM 16 bit assembly, under a windows operating system.
It works, I just have a problem. If you don't pass it any arguments, it fails to see that there is an end of line character.
You pass arguments as..
and it responds "Press a to continue . . ."
If you don't pass anything, by just saying
then it responds "Press to continue . . ." and will not exit unless I "End now"
Here's my code, any nudge in the right direction would be appreciated.
NOTE: I am using my own library for this, so if you do not recognize some commands, that is why.. Hopefuly you can see the basic idea of what's happening though, I always try to comment on every line.
[org 0100h] %include "Library.asm" [section .text] string msg1 ;Display "Press" arg ;Grab the arguments off the stack mov si,bx ;LODSB! jmp GRABKEY ;Get the FIRST argument GRABKEY: lodsb ;Advance ONE character in SI cmp al,0d ;Check if End of Line je INVALID ;If it is, exit with ERRORLEVEL 0 mov [character],al ;Store this character in a word string character ;Display the character string msg2 ;Display "to continue. . ." jmp INPUTKEY ;Start asking for the key INPUTKEY: input [character] ;Use library procedure to check\compare AL ;For the key passed as an argument je VALIDPRESS ;If it's equal, we can leave! jmp INPUTKEY ;Loop if it's not equal INVALID: exit 0 VALIDPRESS: exit 1 [section .data] character dw 0, "$" msg1 db "Press ", "$" msg2 db "to continue . . .", 13, 10, "$"