I found this ASM routine to get the key pressed. ASM routine to get key pressed Now I would like to include it to a Turbo Basic routine, but do not know how to do this. Can anyone here tell me how it is be done? THanks
EDIT: I found a way: $INLINE, but How can I convert my asm code to Machine Language, that I can inline it into my basic program?
EDIT: I had no success in putting this QBASIC with Asm Code in it into an TURBO BASIC Program. I would be thankful for any help how to do it:
DECLARE FUNCTION GetKeyH% ()
CLS
DO
LOCATE 10, 10
PRINT "Key = "; HEX$(GetKeyH%); " "
LOOP UNTIL INKEY$ = CHR$(27)
END
and the ASM PART:
Dosseg
.model medium, basic
.286
.stack
.code
Even
public getkeyh ; make getkeyh public
getkeyh proc far basic uses bp dx ; save registers
in al,60h
xchg dx,ax
xor ax,ax ; assume no key
test dl,10000000b
jnz short getkeyhD
mov al,dl
getkeyhD: ret
getkeyh endp ; end of procedure
end ; end of assembly code
EDIT: THANKS a lot to the Answer of Mr Michael Petch below. Moreover I could see that this ASM routine is also a solution to CTL and ALT KEYS pressed
