10-08-2011, 11:39 PM
Use the multikeys function in the library which returns non zero (True) if ANY of the given keys is pressed.
Predefined key constants are in the KEY.BAS file. Read there.
Notice you can use | as in C or bOR to test for multiple values simultaneously.
So the above test checks for ENTER or SPACE pressed.
The function is much faster than INKEY$ and can check multiple keys pressing (limited by the ZX hardware)
Code:
#include <keys.bas>
DO
IF MultiKeys(KEYSPACE | KEYENTER) THEN
PRINT "Space or Enter pressed"
END IF
LOOP : REM Repeat forever since no condition specified
Notice you can use | as in C or bOR to test for multiple values simultaneously.
So the above test checks for ENTER or SPACE pressed.
The function is much faster than INKEY$ and can check multiple keys pressing (limited by the ZX hardware)