Skip to content

BASIC KEY Functions

Sean P. Harrington edited this page Feb 4, 2025 · 8 revisions

GETKEY

TYPE: plusBASIC system function

FORMAT: GETKEY

Action: Waits for a key press, then returns the value of that key.

  • In ASCII mode, returns the ASCII value of the key pressed.
  • In scan-code mode, return the key-down

Note: The GETKEY function causes your plusBASIC program to wait until a key has been pressed. If you need to check for a key press as part of a program loop that performs other tasks while waiting for a key press, use INKEY, below.


GETKEY$

TYPE: plusBASIC system function

FORMAT: GETKEY$

Action: As above, but returns a string containing the ASCII character or scan code.

Note: The GETKEY$ function causes your plusBASIC program to wait until a key has been pressed. If you need to check for a key press as part of a program loop that performs other tasks while waiting for a key press, use INKEY$, below.

INKEY

TYPE: plusBASIC system function

FORMAT: INKEY

Action: Returns the value of the last key pressed.

  • In ASCII mode, returns the ASCII value of the key pressed.
  • In scan-code mode, return the key-down

Note: At the beginning of each plusBASIC statement, the system reads the keyboard to check for a Ctrl-C, which can discard a keypress that has been queued. The result is that your plusBASIC program may appear to ignore keystrokes. This behavior can be disabled using the statement SET BREAK OFF, although this will also disable Ctrl-C from breaking out of a running program.


INKEY$

TYPE: BASIC system function

FORMAT: INKEY$

Action: As above, but returns a string containing the ASCII character or scan code.

Aquarius ASCII Codes

Dec Hex Chr Dec Hex Chr Dec Hex Chr Dec Hex Chr
32 20 Sc 64 40 @ 96 60 ` 128 80 F1
33 21 ! 65 41 A 97 61 a 129 81 F2
34 22 " 66 42 B 98 62 b 130 82 F3
35 23 # 67 43 C 99 63 c 131 83 F4
36 24 $ 68 44 D 100 64 d 132 84 F5
37 25 % 69 45 E 101 65 e 133 85 F6
38 26 & 70 46 F 102 66 f 134 86 F7
39 27 ' 71 47 G 103 67 g 135 87 F8
40 28 ( 72 48 H 104 68 h 136 88
41 29 ) 73 49 I 105 69 i 137 89 Pause
42 2A * 74 4A J 106 6A j 138 8A PgUp
43 2B + 75 4B K 107 6B k 139 8B PgDn
44 2C , 76 4C L 108 6C l 140 8C ShfTab
45 2D - 77 4D M 109 6D m 141 8D
46 2E . 78 4E N 110 6E n 142 8E CrsrRt
47 2F / 79 4F O 111 6F o 143 8F CrsrUp
48 30 0 80 50 P 112 70 p 144 90 F9
49 31 1 81 51 Q 113 71 q 145 91 F10
50 32 2 82 52 R 114 72 r 146 92 F11
51 33 3 83 53 S 115 73 s 147 93 F12
52 34 4 84 54 T 116 74 t 148 94 F13
53 35 5 85 55 U 117 75 u 149 95 F14
54 36 6 86 56 V 118 76 v 150 96 F15
55 37 7 87 57 W 119 77 w 151 97 F16
56 38 8 88 58 X 120 78 x 152 98
57 39 9 89 59 Y 121 79 y 153 99
58 3A : 90 5A Z 122 7A z 154 9A End
59 3B ; 91 5B [ 123 7B { 155 9B Home
60 3C < 92 5C \ 124 7C | 156 9C
61 3D = 93 5D ] 125 7D } 157 9D Ins
62 3E > 94 5E ^ 126 7E ~ 158 9E CrsrLf
63 3F ? 95 5F _ 127 7F Del 159 9F CrsrDn

KEY

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
  • 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.

Aquarius Key Codes

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
Clone this wiki locally