-
Notifications
You must be signed in to change notification settings - Fork 7
BASIC KEY Function
Sean P. Harrington edited this page Mar 2, 2024
·
6 revisions
TYPE: BASIC system function
FORMAT: KEY ( keycode )
Action: Returns a logical value (0 = FALSE, !0 = TRUE) when the key indicated by keycode is pressed. Note that keycode is not the CHR code!
- keycode is the key matrix index code of the key to check
Code | Key | Code | Key | Code | Key | Code | Key | |||
---|---|---|---|---|---|---|---|---|---|---|
0 | = | 16 | 9 | 32 | 6 | 48 | 3 | |||
1 | BKSP | 17 | O | 33 | Y | 49 | E | |||
2 | : | 18 | K | 34 | G | 50 | S | |||
3 | Return | 19 | M | 35 | V | 51 | Z | |||
4 | ; | 20 | N | 36 | C | 52 | Space | |||
5 | . | 21 | J | 37 | F | 53 | A | |||
6 | Insert | 22 | CsrLf | 38 | PgUp | 54 | Menu | |||
7 | Delete | 23 | CsrDn | 39 | PgDn | 55 | Tab | |||
8 | - | 24 | 8 | 40 | 5 | 56 | 2 | |||
9 | / | 25 | I | 41 | T | 57 | W | |||
10 | 0 | 26 | 7 | 42 | 4 | 58 | 1 | |||
11 | P | 27 | U | 43 | R | 59 | Q | |||
12 | L | 28 | H | 44 | D | 60 | Shift | |||
13 | , | 29 | B | 45 | X | 61 | Ctrl | |||
14 | CsrUp | 30 | Home | 46 | Pause | 62 | Alt | |||
15 | CrsRt | 31 | End | 47 | PrtSc | 63 | GUI |
- Illegal Quantity error results if keycode is not between 0-63.
Examples:
PRINT KEY(3)
...and keep the RETURN key pressed.
Prints
-1
because the RETURN key was pressed when evaluated.
PRINT KEY(0)
...with no other key pressed.
Prints
0
because the EQUAL key was NOT pressed when evaluated.
100 REM Check for "w" key
200 if key(57) then print "w"
300 print" "
400 goto 100
Prints the letter "w" whenever the "w" key is pressed, and the letters scroll up the screen.