Detecting and using the Function Key

Everything related to BASIC version 1.x (Oric 1 and Atmos) or HYPERBASIC (Telestrat).
Don't hesitate to give your small program samples, technical insights, or questions...
Post Reply
User avatar
Game master
Posts: 819
Joined: Sat Jan 07, 2006 12:07 am
Location: Luton, UK

Detecting and using the Function Key

Post by Twilighte » Sun Jan 29, 2006 11:51 pm

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.

User avatar
Pilot Officer
Posts: 64
Joined: Sun Jan 07, 2007 11:03 pm
Location: Scotland

Post by Pengwin » Thu Jun 07, 2007 7:26 pm

Thanks for that tip. It's something I wondered back in the day, but never got around to exploring.

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests