Difference between revisions of "OSBYTE &00"
m (Changed =32 to >=32 for DOS/Windows) |
(→Implementations) |
||
Line 27: | Line 27: | ||
second processor will always be told what the I/O host is regardless of | second processor will always be told what the I/O host is regardless of | ||
what the host is and what the second processor is. | what the host is and what the second processor is. | ||
+ | |||
+ | ==Platform capabilities== | ||
+ | Over time the OSBYTE 0 return value has evolved to become a bitmap representing | ||
+ | the capabilities of the host system, primarily of the file system structure. | ||
+ | * <code>%000x0xxx</code> Filenames are '''directory.filename/extension''', eg BBC, RISC OS | ||
+ | * <code>%000x1xxx</code> Filenames are '''directory/filename.extension''', eg Unix, CP/M | ||
+ | * <code>%nnnxxxxx</code> Filenames are '''directory\filename.extension''', eg DOS, Windows | ||
+ | |||
+ | This can also be represented as: | ||
+ | * <code>%000x0xxx</code> Directory seperator is <code>'.'</code> | ||
+ | * <code>%000x1xxx</code> Directory seperator is <code>'/'</code> | ||
+ | * <code>%nnnxxxxx</code> Directory seperator is <code>'\'</code> | ||
+ | |||
+ | * <code>%000x0xxx</code> Extension seperator is <code>'/'</code> | ||
+ | * <code>%nnnxnxxx</code> Extension seperator is <code>'.'</code> | ||
+ | |||
+ | This allow programs to use code similar to the following: | ||
+ | A%=0:X%=1:os%=((USR&FFF4)AND&FF00)DIV256 | ||
+ | d$=".":s$="/":IF(os%AND-24):d$="/":s$=".":IF(os%AND-32):d$="\" | ||
+ | filename$=dir$+d$+name$+s$+ext$ | ||
==See also== | ==See also== |
Revision as of 22:22, 26 June 2017
Contents
OSBYTE &00 (0) - Identify Host/Operating System
On entry, X=0 - Generate error giving host and OS type X<>0 - Return host/OS in X On exit, X=host/OS type: 0 Electron 1 BBC 2 BBC B+ 3 Master 128 4 Master ET 5 Master Compact 6 Arthur or RISC OS 7 Springboard 8 UNIX or UNIX-type system 28 Commodore 64/128 29 Texas Instruments calculator 30 Amstrad CPC 31 Sinclair ZX Spectrum >=32 IBM PC-type system (DOS, Windows, etc.)
Implementations
Early documentation refers to OSBYTE 0 as returning the OS version. As more systems were developed, it became more correct to refer to it returning a value indicating the host. For example, code running on a second processor will always be told what the I/O host is regardless of what the host is and what the second processor is.
Platform capabilities
Over time the OSBYTE 0 return value has evolved to become a bitmap representing the capabilities of the host system, primarily of the file system structure.
-
%000x0xxx
Filenames are directory.filename/extension, eg BBC, RISC OS -
%000x1xxx
Filenames are directory/filename.extension, eg Unix, CP/M -
%nnnxxxxx
Filenames are directory\filename.extension, eg DOS, Windows
This can also be represented as:
-
%000x0xxx
Directory seperator is'.'
-
%000x1xxx
Directory seperator is'/'
-
%nnnxxxxx
Directory seperator is'\'
-
%000x0xxx
Extension seperator is'/'
-
%nnnxnxxx
Extension seperator is'.'
This allow programs to use code similar to the following:
A%=0:X%=1:os%=((USR&FFF4)AND&FF00)DIV256 d$=".":s$="/":IF(os%AND-24):d$="/":s$=".":IF(os%AND-32):d$="\" filename$=dir$+d$+name$+s$+ext$
See also
Jgharston 22:41, 6 September 2007 (BST)