Machine types

From BeebWiki
Jump to: navigation, search

OSBYTE &00 and OSBYTE &81/INKEY-256 return values that can used to identify the system a program is running on.

OSBYTE 0,0 generates an error with the error string describing the host system, OSBYTE 0,<>0 returns a byte indicating what type of host hardware the program is running on. OSBYTE 129,255,0 (callable from BASIC with INKEY-256) returns a subvalue that indicates the specific type of host operating system.

OSBYTE 00 | INKEY-256 | Host system
---------------------------------------------------------------------
    0     |    &01    | Electron
---------------------------------------------------------------------
    1     |           | BBC B
          | &FFFFFFFF |  BBC OS 1.00/1.20
          |    &FE    |  BBC OS 1.10 (US)
          |    &FC    |  BBC OS 1.20 (Germany)
          |    &FA    |  Acorn Business Computer OS
---------------------------------------------------------------------
    2     |           | BBC B+
          |    &FF    |  Reuters Terminal (UK) (switchable with *UK)
          |    &FE    |  Reuters Terminal (US) (switchable with *US)
          |    &FB    |  BBC B+ OS 2.00
          |    &FA    |  Acorn Business Computer OS
---------------------------------------------------------------------
    3     |    &FD    | Master OS 3.20
---------------------------------------------------------------------
    4     |    &F7    | Master ET OS 4.00
---------------------------------------------------------------------
    5     |    &F5    | Master Compact OS 5.00
---------------------------------------------------------------------
    6     |    &Ax    | Archimedes/RISC OS system
          |    &A0    |  Archimedes Arthur 1.20
          |    &A1    |  RISC OS 2.00
          |    &A2    |  RISC OS 2.01
          |    &A3    |  RISC OS 3.00
          |    &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
          |           | (INKEY-256 AND &F0)=&A0 is TRUE for ARM systems
---------------------------------------------------------------------
    7     |    &AF    | Springboard
          |           | (INKEY-256 AND &F0)=&A0 is TRUE for ARM systems
---------------------------------------------------------------------
    8     |           | UNIX-type OS
          |    &F6    |  OpenBSD
          |    &F7    |  FreeBSD
          |    &F9    |  Linux
          |    &FE    |  NetBSD
---------------------------------------------------------------------
    9     |           | 6809-based host with Unix-style pathnames
---------------------------------------------------------------------
   17     |           | 6809-based host with BBC-style pathnames
---------------------------------------------------------------------
   28     |           | Commodore 64
---------------------------------------------------------------------
   29     |    &8x    | TI Calculator
          |    &83    |  TI-83+
          |    &84    |  TI-84+
---------------------------------------------------------------------
   30     |    &Dx    | Amstrad 464/664/6128, etc.
---------------------------------------------------------------------
   31     |    &Ex    | ZX Spectrum
          |    &E0    |  ZX Spectrum
---------------------------------------------------------------------
   32     |           | DOS or Windows
          |    &73    |  BBC BASIC for SDL ("s")
          |    &53    |  BBC BASIC for SDL ("S")
          |    &57    |  BBC BASIC for Windows ("W")
          |    &FA    |  DOS with Brandy BASIC
          |    &FC    |  Windows 32 with Brandy BASIC
          |    ---    |  DOS BBCBASIC-86 does not support INKEY-256
---------------------------------------------------------------------
   57     |           | 6809-based host with DOS-style pathnames
---------------------------------------------------------------------
   --     |    &00    | RM Nimbus
   --     |    &F5    | Amiga (Brandy Basic)
   --     |    &F8    | MacOS X (Brandy Basic)
   --     |    &FB    | Beos (Brandy Basic)
---------------------------------------------------------------------

Note that OSBYTE &00 and INKEY-256 return the host system, the main I/O hardware, which may not necessarily be the system the program is running on. For instance, a 6502 second processor emulator running on RISC OS will return 6 from OSBYTE 0 and an ARM CoProcessor connected to a BBC Master will return &03.

It is hard to determine what hardware the actual program is running on, but a BASIC program can easily find what version of BASIC it is running on, which in most cases is sufficient.

Jgharston 23:42, 2 December 2008 (UTC) Jgharston (talk) 00:29, 16 June 2018 (CEST)