Page 1 of 1

Detecting and using the Function Key

Posted: Sun Jan 29, 2006 11:51 pm
by Twilighte
The FUNCT key is found on the Atmos and Telestrat computers.
In both manuals, their is no mention of how to read it, but it is quite simple.
In fact, the clever boys at Oric decided to make it behave like a shift key, so instead of providing 101 function keys, they provided a single Function key that could potentially be used with any other key on the keyboard (and under machine code, combining it with Shift and Ctrl, many more combinations can be achieved).
You can read the Function key from location $0209 or 521 (Decimal).
The contents of this location depends on which key is pressed.

56 - No key pressed
162 - Control Key
164 - Left Shift Key
165 - Funct Key
167 - Right Shift Key

Note that values are in decimal
To detect this key in BASIC is simple...

Code: Select all

10 IF PEEK(521)=165 THEN PRINT"Funct key pressed"
However, this may only be achieved in a running loop because Funct will not terminate a GET or INPUT statement.
To have the program wait for a Function (With another key), we would do this.

Code: Select all

10 A$ = KEY$:IF PEEK(521)<>165 OR A$="" THEN 10
Explanation of this line
When the Function key is pressed, the first condition will not be met but the second will still prevent termination of the loop.
When Funct + Key(Black) then both conditions will not be met and the loop will terminate.

Posted: Thu Jun 07, 2007 7:26 pm
by Pengwin
Thanks for that tip. It's something I wondered back in the day, but never got around to exploring.