Difference between revisions of "OSBYTE &81"

From BeebWiki
Jump to: navigation, search
(Added more Brandy Basic, and PDP11.)
(Added extensions.)
Line 3: Line 3:
  
 
     Action: Read key with time limit
 
     Action: Read key with time limit
     X=0..255
+
     On entry: X=0..255
    Y=0..127
+
              Y=0..127
     On exit C=0 character read, Y=0, X=character read
+
     On exit:  Cy=0 character read, Y=0, X=character read
            C=1, Y=255 timed out
+
              Cy=1, Y=255 timed out
            C=1, Y=27  ESCAPE was pressed
+
              Cy=1, Y=27  ESCAPE was pressed
 +
    The caller can test for either Y=0 or Cy=0 for a valid returned character.
  
 
     Action: Read OS version
 
     Action: Read OS version
     X=0
+
     On entry: X=0
    Y=255
+
              Y=255
     On exit X=value identifying OS
+
     On exitX=value identifying the host OS
            X=&00 BBC A/B with OS 0.10
+
              X=&00 BBC A/B with OS 0.10
            X=&00 RM Nimus
+
              X=&00 RM Nimus
            X=&01 Acorn Electron OS
+
              X=&01 Acorn Electron OS
            X=&FF BBC Micro OS 1.00/1.20/1.23, Reuters OS R0.3 with *UK
+
              X=&FF BBC Micro OS 1.00/1.20/1.23, Reuters OS R0.3 with *UK
            X=&FE BBC Micro (American OS A1.0), Reuters OS R0.3 with *US
+
              X=&FE BBC Micro (American OS A1.0), Reuters OS R0.3 with *US
            X=&FE NetBSD
+
              X=&FE NetBSD
            X=&FD Master 128 MOS 3.20/3.50
+
              X=&FD Master 128 MOS 3.20/3.50
            X=&FC BBC Micro (West German MOS) - see note
+
              X=&FC BBC Micro (West German MOS) - see note
            X=&FC Windows 32
+
              X=&FC Windows 32
            X=&FB BBC B+ 64/128 (OS 2.00)
+
              X=&FB BBC B+ 64/128 (OS 2.00)
            X=&FB Beos (Brandy Basic)
+
              X=&FB Beos (Brandy Basic)
            X=&FA Acorn Business Computer OS 1.00/2.00
+
              X=&FA Acorn Business Computer OS 1.00/2.00
            X=&FA Cambridge Workstation OS 2.10
+
              X=&FA Cambridge Workstation OS 2.10
            X=&FA DOS with DJGPP extender (Brandy Basic)
+
              X=&FA DOS with DJGPP extender (Brandy Basic)
            X=&F9 Linux
+
              X=&F9 Linux
            X=&F8 MacOS X (Brandy Basic)
+
              X=&F8 MacOS X (Brandy Basic)
            X=&F7 Master ET MOS 4
+
              X=&F7 Master ET MOS 4
            X=&F7 FreeBSD
+
              X=&F7 FreeBSD
            X=&F6 OpenBSD
+
              X=&F6 OpenBSD
            X=&F5 Master Compact MOS 5
+
              X=&F5 Master Compact MOS 5
            X=&F5 Amiga (Brandy Basic)
+
              X=&F5 Amiga (Brandy Basic)
            X=&F4 Master 128 MOS 3.26
+
              X=&F4 Master 128 MOS 3.26
            X=&F4 GNU FreeBSD (Brandy Basic)
+
              X=&F4 GNU FreeBSD (Brandy Basic)
            X=&F3 GNU (Brandy Basic)
+
              X=&F3 GNU (Brandy Basic)
            X=&Ex Spectrum
+
              X=&Ex Spectrum
            X=&Dx Amstrad 464/664/6128, etc.
+
              X=&Dx Amstrad 464/664/6128, etc.
            X=&Cx Commodore 64/64+/128, etc.
+
              X=&Cx Commodore 64/64+/128, etc.
            X=&Bx PDP11 Unix
+
              X=&Bx PDP11 Unix
            X=&B7 PDP11 Unix Version 7
+
              X=&B7 PDP11 Unix Version 7
            X=&B6 PDP11 Unix Version 6
+
              X=&B6 PDP11 Unix Version 6
            X=&Ax ARM-based systems
+
              X=&Ax ARM-based systems
            X=&A0 Arthur 1.20
+
              X=&A0 Arthur 1.20
            X=&A1 RISC OS 2.00
+
              X=&A1 RISC OS 2.00
            X=&A2 RISC OS 2.01
+
              X=&A2 RISC OS 2.01
            X=&A3 RISC OS 3.0x
+
              X=&A3 RISC OS 3.0x
            X=&A4 RISC OS 3.1x
+
              X=&A4 RISC OS 3.1x
            X=&A5 RISC OS 3.50
+
              X=&A5 RISC OS 3.50
            X=&A6 RISC OS 3.60
+
              X=&A6 RISC OS 3.60
            X=&A7 RISC OS 3.7x
+
              X=&A7 RISC OS 3.7x
            X=&A8 RISC OS 4.0x
+
              X=&A8 RISC OS 4.0x
            X=&A9 RISC OS 4.3x
+
              X=&A9 RISC OS 4.3x
            X=&AA RISC OS 5.xx
+
              X=&AA RISC OS 5.xx
            X=&AF Springboard  (An ARM-based development system plugged into a PC)
+
              X=&AF Springboard  (An ARM-based development system plugged into a PC)
            X=&8x TI Calculator
+
              X=&8x TI Calculator
            X=&68 6809 system
+
              X=&68 6809 system
            X=&63 6309 system
+
              X=&63 6309 system
            X=&73 BBC BASIC for ARM CPU on SDL abstraction (ie ASC"s")
+
              X=&73 BBC BASIC for ARM CPU on SDL abstraction (ie ASC"s")
            X=&57 BBC BASIC for Windows (ie ASC"W")
+
              X=&57 BBC BASIC for Windows (ie ASC"W")
            X=&53 BBC BASIC for Intel CPU on SDL abstraction (ie ASC"S")
+
              X=&53 BBC BASIC for Intel CPU on SDL abstraction (ie ASC"S")
 
      
 
      
 
     The known examples of German BBC MOS return X=&FF.
 
     The known examples of German BBC MOS return X=&FF.
  
 
     Action: Scan for a range of keys
 
     Action: Scan for a range of keys
     X=1..127 lowest internal key number to start at EOR &7F
+
     On entry: X=1..127 lowest internal key number to start at EOR &7F
    Y=255
+
              Y=255
     On exit X=internal key number pressed (or 255 for none)
+
     On exitX=internal key number pressed (or 255 for none)
  
 
     Action: Scan for a particular key
 
     Action: Scan for a particular key
     X=128..255 internal key number to scan for EOR &80
+
     On entry: X=128..255 internal key number to scan for EOR &80
    Y=255
+
              Y=255
     On exit X=Y=0 for as not pressed
+
     On exitX=Y=0 for as not pressed
            X=Y=255 the key was being pressed
+
              X=Y=255 the key was being pressed
 +
 
 +
==Extensions==
 +
The parameter to OSBYTE &81 is a 16-bit number. The standard implementation interprets that as:
 +
  <&8000  - wait for keypress
 +
  &FF00+nn - scan for BBC keypress
 +
  &FF00    - return host machine type
 +
 
 +
A parameter of &8000-&FEFF is undefined. Some systems extend INKEY as follows:
 +
  &FE00+nn - scan for low level DOS/Window VK_xxxx keypress (cZ80Tube, console library)
 +
  &FC00+nn - scan for low level SDL1.2 SDK_xxx keypress (Brandy Basic SDL builds)
 +
  &8000+nn - wait for keypress, return 16-bit character code (cZ80Tube, console library)
 +
 
 +
==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
  
 
==See Also==
 
==See Also==
Line 81: Line 100:
 
[[User:Jgharston|Jgharston]] 21:56, 26 May 2009 (UTC)
 
[[User:Jgharston|Jgharston]] 21:56, 26 May 2009 (UTC)
 
[[User:Jgharston|Jgharston]] ([[User talk:Jgharston|talk]]) 05:20, 23 June 2018 (CEST)
 
[[User:Jgharston|Jgharston]] ([[User talk:Jgharston|talk]]) 05:20, 23 June 2018 (CEST)
 +
[[User:Jgharston|Jgharston]] ([[User talk:Jgharston|talk]]) 22:09, 25 August 2019 (CEST)

Revision as of 21:09, 25 August 2019

OSBYTE &81 (129) - Read Key with Time Limit or Machine Type. Called by BASIC's =INKEY function.

   Action: Read key with time limit
    On entry: X=0..255
              Y=0..127
    On exit:  Cy=0 character read, Y=0, X=character read
              Cy=1, Y=255 timed out
              Cy=1, Y=27  ESCAPE was pressed
    The caller can test for either Y=0 or Cy=0 for a valid returned character.
   Action: Read OS version
    On entry: X=0
              Y=255
    On exit:  X=value identifying the host OS
              X=&00 BBC A/B with OS 0.10
              X=&00 RM Nimus
              X=&01 Acorn Electron OS
              X=&FF BBC Micro OS 1.00/1.20/1.23, Reuters OS R0.3 with *UK
              X=&FE BBC Micro (American OS A1.0), Reuters OS R0.3 with *US
              X=&FE NetBSD
              X=&FD Master 128 MOS 3.20/3.50
              X=&FC BBC Micro (West German MOS) - see note
              X=&FC Windows 32
              X=&FB BBC B+ 64/128 (OS 2.00)
              X=&FB Beos (Brandy Basic)
              X=&FA Acorn Business Computer OS 1.00/2.00
              X=&FA Cambridge Workstation OS 2.10
              X=&FA DOS with DJGPP extender (Brandy Basic)
              X=&F9 Linux
              X=&F8 MacOS X (Brandy Basic)
              X=&F7 Master ET MOS 4
              X=&F7 FreeBSD
              X=&F6 OpenBSD
              X=&F5 Master Compact MOS 5
              X=&F5 Amiga (Brandy Basic)
              X=&F4 Master 128 MOS 3.26
              X=&F4 GNU FreeBSD (Brandy Basic)
              X=&F3 GNU (Brandy Basic)
              X=&Ex Spectrum
              X=&Dx Amstrad 464/664/6128, etc.
              X=&Cx Commodore 64/64+/128, etc.
              X=&Bx PDP11 Unix
              X=&B7 PDP11 Unix Version 7
              X=&B6 PDP11 Unix Version 6
              X=&Ax ARM-based systems
              X=&A0 Arthur 1.20
              X=&A1 RISC OS 2.00
              X=&A2 RISC OS 2.01
              X=&A3 RISC OS 3.0x
              X=&A4 RISC OS 3.1x
              X=&A5 RISC OS 3.50
              X=&A6 RISC OS 3.60
              X=&A7 RISC OS 3.7x
              X=&A8 RISC OS 4.0x
              X=&A9 RISC OS 4.3x
              X=&AA RISC OS 5.xx
              X=&AF Springboard   (An ARM-based development system plugged into a PC)
              X=&8x TI Calculator
              X=&68 6809 system
              X=&63 6309 system
              X=&73 BBC BASIC for ARM CPU on SDL abstraction (ie ASC"s")
              X=&57 BBC BASIC for Windows (ie ASC"W")
              X=&53 BBC BASIC for Intel CPU on SDL abstraction (ie ASC"S")
   
   The known examples of German BBC MOS return X=&FF.
   Action: Scan for a range of keys
    On entry: X=1..127 lowest internal key number to start at EOR &7F
              Y=255
    On exit:  X=internal key number pressed (or 255 for none)
   Action: Scan for a particular key
    On entry: X=128..255 internal key number to scan for EOR &80
              Y=255
    On exit:  X=Y=0 for as not pressed
              X=Y=255 the key was being pressed

Extensions

The parameter to OSBYTE &81 is a 16-bit number. The standard implementation interprets that as:

 <&8000   - wait for keypress
 &FF00+nn - scan for BBC keypress
 &FF00    - return host machine type

A parameter of &8000-&FEFF is undefined. Some systems extend INKEY as follows:

 &FE00+nn - scan for low level DOS/Window VK_xxxx keypress (cZ80Tube, console library)
 &FC00+nn - scan for low level SDL1.2 SDK_xxx keypress (Brandy Basic SDL builds)
 &8000+nn - wait for keypress, return 16-bit character code (cZ80Tube, console library)

See Also

See Also

Jgharston 21:56, 26 May 2009 (UTC) Jgharston (talk) 05:20, 23 June 2018 (CEST) Jgharston (talk) 22:09, 25 August 2019 (CEST)