Difference between revisions of "INKEY"
m (Slight formatting changes.) |
(Reuters, Cambridge Workstation.) |
||
Line 58: | Line 58: | ||
&00 RM Nimus<ref>Network User, Jan/Feb 1988, p9</ref> | &00 RM Nimus<ref>Network User, Jan/Feb 1988, p9</ref> | ||
&01 Acorn Electron MOS | &01 Acorn Electron MOS | ||
− | &FF BBC Micro OS 1.00/1.20 | + | &FF BBC Micro OS 1.00/1.20/1.23 |
− | &FE BBC Micro (American | + | &FF Reuters Terminal OS R0.3 (switched with *UK) |
+ | &FE BBC Micro (American OS A1.0) | ||
+ | &FE Reuters Terminal OS R0.3 (switched with *US) | ||
&FE NetBSD | &FE NetBSD | ||
&FD Master 128 MOS 3.20 | &FD Master 128 MOS 3.20 | ||
&FC BBC Micro (West German MOS) | &FC BBC Micro (West German MOS) | ||
&FC Windows 32 | &FC Windows 32 | ||
− | &FB BBC B+ 64/128 ( | + | &FB BBC B+ 64/128 (OS 2.00) |
&FB Beos (Brandy Basic) | &FB Beos (Brandy Basic) | ||
− | &FA Acorn | + | &FA Acorn Business Computer OS 2.00 |
+ | &FA Cambridge Workstation OS 2.10 | ||
&FA DOS with Brandy BASIC | &FA DOS with Brandy BASIC | ||
&F9 Linux | &F9 Linux | ||
&F8 MacOS X (Brandy Basic) | &F8 MacOS X (Brandy Basic) | ||
− | &F7 Master ET | + | &F7 Master ET MOS 4.00 |
&F7 FreeBSD | &F7 FreeBSD | ||
&F6 OpenBSD | &F6 OpenBSD | ||
− | &F5 Compact | + | &F5 Compact MOS 5.00/5.10/5.11 |
&F5 Amiga (Brandy Basic) | &F5 Amiga (Brandy Basic) | ||
&F4 Master 128 MOS 3.26 | &F4 Master 128 MOS 3.26 | ||
Line 93: | Line 96: | ||
&AF Springboard | &AF Springboard | ||
(INKEY-256 AND &F0)=&A0 gives TRUE for ARM hardware | (INKEY-256 AND &F0)=&A0 gives TRUE for ARM hardware | ||
+ | &8x TI Calculator | ||
&73 BBC BASIC for ARM CPU on SDL abstraction (ie ASC"s") | &73 BBC BASIC for ARM CPU on SDL abstraction (ie ASC"s") | ||
&68 6809 system | &68 6809 system |
Revision as of 04:15, 23 June 2018
INKEY and INKEY$ are BASIC functions to:
- wait a specified time for a character from the input stream
- test for a keypress
- return a value indicating the machine host/operating system type
Availability | Present in all versions of BBC BASIC. | |
Syntax | <numeric> = INKEY <numeric>
|
<string> = INKEY$ <numeric>
|
Token (hex) | A6 (function)
|
BF (function)
|
Description | Reads an character from the input stream. |
Contents
Description
INKEY
and INKEY$
call OSBYTE &81.
INKEY
returns a character or -1 for no character,
INKEY$
returns a one-character string or a null string if
nothing returned.
Wait for input character
Argument: >=0 Returns: >=0, character returned -1, timed out Example: key%=INKEY(200) REPEAT:k%=INKEY(10):PROCtick:UNTIL k%>-1 Some systems allow a delay value with b15 set to return a 16-bit "deep" keyvalue distinguishing between special keys, such as function keys, and top-bit characters.[1][2] Example: REPEAT:key%=INKEY(&80C8):UNTIL key%>-1 IF key%=&190 THEN PRINT "Shift-f0 pressed"
Scan for a particular key
Argument: -1..-128, negative key number Returns: TRUE, key pressed FALSE, key not pressed
Scan for a range of keys
Argument: -129...-255, lowest internal key number to start at EOR&7F Returns: internal key number pressed, or 255 for none
Check machine type
Argument: -256 Returns: A value indicating the host (I/O) machine type: &00 BBC B with MOS 0.10 &00 RM Nimus[3] &01 Acorn Electron MOS &FF BBC Micro OS 1.00/1.20/1.23 &FF Reuters Terminal OS R0.3 (switched with *UK) &FE BBC Micro (American OS A1.0) &FE Reuters Terminal OS R0.3 (switched with *US) &FE NetBSD &FD Master 128 MOS 3.20 &FC BBC Micro (West German MOS) &FC Windows 32 &FB BBC B+ 64/128 (OS 2.00) &FB Beos (Brandy Basic) &FA Acorn Business Computer OS 2.00 &FA Cambridge Workstation OS 2.10 &FA DOS with Brandy BASIC &F9 Linux &F8 MacOS X (Brandy Basic) &F7 Master ET MOS 4.00 &F7 FreeBSD &F6 OpenBSD &F5 Compact MOS 5.00/5.10/5.11 &F5 Amiga (Brandy Basic) &F4 Master 128 MOS 3.26 &Ex Spectrum &Dx Amstrad 464/664/6128, etc. &Cx Commodore 64/64+/128, etc. &Ax Arthur/RISC OS &A0 Arthur 1.20 &A1 RISC OS 2.00 &A2 RISC OS 2.01 &A3 RISC OS 3.0x &A4 RISC OS 3.1x &A5 RISC OS 3.50 &A6 RISC OS 3.60 &A7 RISC OS 3.7x &A8 RISC OS 4.0x &A9 RISC OS 4.3x &AA RISC OS 5.xx &AF Springboard (INKEY-256 AND &F0)=&A0 gives TRUE for ARM hardware &8x TI Calculator &73 BBC BASIC for ARM CPU on SDL abstraction (ie ASC"s") &68 6809 system &63 6309 system &57 BBC BASIC for Windows (ie ASC"W") &53 BBC BASIC for Intel CPU on SDL abstraction (ie ASC"S")
Depending on what the program needs to know, OSBYTE &00 is usually the more appropriate call to make.
See Also
- http://mdfs.net/Docs/Comp/BBC/Osbyte80
- http://mdfs.net/Docs/Comp/Acorn/HostVals
- http://mdfs.net/Docs/Comp/Acorn/Hosts
- What BASIC is running
- Negative INKEY numbers
References
- ↑ http://mdfs.net/Docs/Comp/KeyMap/Regular
- ↑ http://mdfs/net/System/C/Lib/console.txt
- ↑ Network User, Jan/Feb 1988, p9
Jgharston 12:27, 28 May 2009 (UTC)