If "inkey" is a procedure or a function, what does it do and how do you work it?
Its a macro that calls a procedure in the masm32 library. It stops program execution until you press a key.
Hutch, is the key then available? Thank you for your reply.
Just have a look at the source in the library, its really simple code.
Quote from: hutch-- on March 04, 2022, 05:16:42 PM
Just have a look at the source in the library, its really simple code.
The inkey macro calls wait_key, which is at \Masm32\m32lib\wait_key.asm
I see wait_key but I still haven't found "inkey". I don't know which library it's in. There're only about fifty libraries on my C: drive.
Thank you for the info.
Well, if you can't find the macro, just CALL wait_key. Does the same thing.
Hi deeR44,
The inkey macro is defined in the file :
\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
print chr$(13,10)
ENDM
deeR44,
"inkey" is a MACRO that calls a procedure in the MASM32 library, wait_key.asm.
The "inkey" macro is in the "\masm32\macros" directory and the file the macro is in is "macros.asm".
Why is it like this ????
The macro is easier to use and it stops a console app from exiting when its finished so you can see any results before it closes.
Hi Hi deeR44,
As Hutch said, the macro is easier to use. A modified version of the Microsoft example translated to Masm :
include \masm32\include\masm32rt.inc
.code
start:
invoke crt_printf,\
CTXT("Press any key to continue.",13,10)
@@:
invoke crt__kbhit
test eax,eax
jz @b
invoke crt__getch
invoke crt_printf,\
CTXT("Key struck was %c"),eax
invoke ExitProcess,0
END start
Thank all of you for the excellent help!