Suspend the user application program, waiting for a key press.
This particular WAIT statement waits for port 0 bit 0 to go to 1, indicating that there is data in the keyboard buffer.
To wait until ENT, F1, or other specific key is pressed, use this WAIT statement to wait for a key press, read the key data with the INKEY$ function, and thus determine which key was pressed.
The following table gives the default key assignments.
|Key||Default key data|
|ENT||Carriage return (0Dh)|
For further details on keys other than the above, refer to Appendix E "Key Number Assignment on the Keyboard" in the BHT-BASIC Programmer's Manual.
private waitENT$ waitENT: wait 0,&h01 ' wait for key press waitENT$ = inkey$ ' read key data for key pressed if waitENT$ <> chr$(&h0D) then ' if key not ENT goto waitENT ' wait for next key press endif print "ENT"
private waitkey$ waitkey: wait 0,&h01 ' wait for key press waitkey$ = inkey$ ' read key data for key pressed select waitkey$ case "A": ' if F1 key print "F1" ' display key name case "B": ' if F2 key print "F2" ' display key name case else: ' if key not F1 or F2 goto waitkey ' wait for next key press end select