Hi There:
C:\masm32\macros\macros.asm
;; ------------------------------------------------------
;; display user defined text, default text or none if
;; NULL is specified and wait for a keystroke to continue
;; ------------------------------------------------------
inkey MACRO user_text:VARARG
IFDIF <user_text>,<NULL> ;; if user text not "NULL"
IFNB <user_text> ;; if user text not blank
print user_text ;; print user defined text
ELSE ;; else
print "Press any key to continue ..." ;; print default text
ENDIF
ENDIF
call wait_key
push eax ;; << Note Push
print chr$(13,10)
pop eax ;; << Note Pop
ENDM
If you don't have the push and pop you get 2 which
is the length of the CRLF, and explains
why the CMP don't work after you call inkey.
Regards herge
herge,
I wrote the following in the szlen thread. Perhaps you missed it?
Quote
The inkey macro works correctly within the boundaries of what it was designed to do. The inkey function should not be expected to function in a polcat sort of way.
Use the getkey macro which calls ret_key if you expect to receive a value.
Paul
Hi PBrennick:
What's a polcat?
@@:
inkey chr$(9, 9, 9, 9, 9, "-- Hit X Key --") ; **
getkey
cmp AL,"x"
jz @F
cmp AL,"X"
jnz @B
@@:
exit
Thanks.
Regards herge
herge,
There is a secret in how to use the macros supplied with MASM32, actually bother to look at the help file for the macros, thats what its there for.
"inkey" macro. ===>> Wait for user key input
Examples.
inkey
inkey NULL
inkey "Press a key to continue ..."
etc .....
Use the "getkey" macro to obtain the key that was pressed, documented in the same help file.