Technical Information

Application Development Manual | Detecting M1 key presses

Detecting M1 key presses


Assigning key data to the M1 key allows the user application program to detect M1 key presses.


Detailed Description

By default, the INKEY$ function cannot detect M1 key presses because the key has no key data assigned to it. The program must first assign any string with a KEY statement.

The same applies to the M2 key.

For further details on key numbers, refer to Appendix E "Key Number Assignment on the Keyboard" in the BHT-BASIC Programmer's Manual.

Wait until M1 key pressed
 "m" then       ' if key not M1
goto waitM1                ' wait for next key press
print "M1"
Wait until M2 key pressed
  key 31, "n"
private waitM2$
wait 0,&h01                  ' wait for key press
waitM2$ = inkey$             ' read key data for key pressed
if waitM2$ <> "n" then       ' if key not M2
goto waitM2                ' wait for next key press
print "M2"

Contact us