OSBYTE
Misc OS functions specified by accumulator
Table of Contents
Function |
Address | Vector | Description |
OSBYTE |
FFF4 | 20A | Misc OS functions specified by accumulator |
OSBYTE calls are a powerful and flexible way of invoking many of the available operating system facilities.
OSBYTE calls are specified by the contents of the accumulator (A register) in the 6502. This means that up to
256 different calls can be made.
The command line interpreter (see section 2.11) performs OSBYTE calls in response to *FX commands. This enables
the user to make OSBYTE calls from the keyboard or within BASIC programs. It should be noted however that no
results are returned by a *FX call and so it is inappropriate to use certain OSBYTEs in this way.
1 - &00 (0) OS Version
OSByte call |
Action |
Available on: |
(dec) |
(hex) |
BBC |
Master |
Electron |
0 |
00 |
Get OS version |
x |
x |
x |
Entry parameters
X |
0 execute BRK with message of OS version, <>0 RTS with OS version in X |
On exit:
A |
Preserved |
X |
OS version |
C |
Undefined |
This OSBYTE call returns the OS type in X or as a message via BRK if X=0 on entry.
Returned values
X |
OS version |
0 |
OS 1.00 or Electron OS 1.00 |
1 |
OS 1.20 or American OS |
2 - &01 (1) set user flag
OSByte call |
Action |
Available on: |
(dec) |
(hex) |
BBC |
Master |
Electron |
1 |
01 |
Set the user flag |
x |
x |
x |
Entry parameters
X |
The new value of the user flag |
On exit:
This OSBYTE call is left free for user applications and is not used by the operating system.
The user flag defaults to 0.
3 - &02 (2) select input stream
OSByte call |
Action |
Available on: |
(dec) |
(hex) |
BBC |
Master |
Electron |
2 |
02 |
Select input stream |
x |
x |
x |
Entry parameters
On exit:
A |
preserved |
X |
Old value |
C |
undefined |
Examples
*FX 2,0 X=0 keyboard selected, RS423 disabled
*FX 2,1 X=1 RS423 selected & enabled
*FX 2,2 X=2 keyboard selected, RS423 enabled
Default: *FX2,0
Electron
Any call with X<>0 will result in an unknown OSBYTE service call being made
to paged ROMs unless a previous call was recognised & changed the input source.
4 - &03 (3) select output stream
OSByte call |
Action |
Available on: |
(dec) |
(hex) |
BBC |
Master |
Electron |
3 |
03 |
Select output stream |
x |
x |
x |
Entry parameters
On exit:
This call selects the output streams to be used.
The X register contains the streams to use, one per bit:
Bit |
Output selected if bit is set |
0 |
Enables RS423 driver |
1 |
Disabled VDU driver |
2 |
Disabled printer driver |
3 |
Enables printer, independent on CTRL B/C or VDU 2,3 |
4 |
Disables spooled output |
5 |
Not used |
6 |
Disables printer driver unless char is preceded by VDU 1 |
7 |
Not used |
*FX 3,0 selects the default output:
- RS423 disabled
- VDU enabled
- Printer enabled if selected by VDU 2
- Spooled output enabled if selected by *SPOOL
Econet
Bit 3 should not be used to enable the printer as it might conflict with Econet claiming the printer.
Electron
If RS423 or printer output is selected on the Electron a paged ROM service call is issued.
If no suitable response is received the output is thrown away.
5 - &04 (4) enable/disable cursor editing
OSByte call |
Action |
Available on: |
(dec) |
(hex) |
BBC |
Master |
Electron |
4 |
04 |
Enable/Disable cursor editing |
x |
x |
x |
Entry parameters
X |
Status of the editiing keys |
On exit:
A |
preserved |
X |
Previous status of keys |
C |
undefined |
X=0 Enable cursor editing (default).
X=1 Disable editing, cursor keys return ASCII values like other keys.
X=2 Disable editing, cursor keys act as soft keys.
Key |
X=1 |
X=2 |
Hex Decimal |
Soft key |
COPY |
&87 135 |
11 |
LEFT |
&88 136 |
12 |
RIGHT |
&89 137 |
13 |
DOWN |
&8A 138 |
14 |
UP |
&8B 139 |
15 |
6 - Enable/Disable events
OSByte call |
Action |
Available on: |
(dec) |
(hex) |
BBC |
Master |
Electron |
13 |
0D |
Disable events |
x |
x |
x |
14 |
0E |
Enable events |
x |
x |
x |
Entry parameters
On exit:
A |
preserved |
X |
Old disable state: 0=disabled, >0 enabled |
C |
undefined |
OSBYTE 13 is used to disable specific events.
OSBYTE 14 is used th enable specific events.
Event type passed in X
X |
Event |
0 |
output buffer empty |
1 |
input buffer full |
2 |
character entering buffer |
3 |
ADC conversion complete |
4 |
start of vertical sync |
5 |
interval timer crossing 0 |
6 |
ESCAPE pressed |
7 |
RS423 RX error |
8 |
network error |
9 |
user |
7 - &72 (114) Shadow ram
*SHADOW equivalent
OSByte call |
Action |
Available on: |
(dec) |
(hex) |
BBC |
Master |
Electron |
114 |
72 |
Set shadow ram |
x |
x |
|
Shadow mode
Shadow mode is the option to force all screen's to use Shadow memory.
By default it is disabled so that mode's 0..7 on the BBC Micro will use system memory whilst modes 128..135 will use
shadow memory.
When shadow mode is enabled all modes use shadow memory.
e.g. 0..7 will have 128 added to give 128..135.
*FX114 or *FX114,0 is the equivalent of *SHADOW.
*FX114,1 is the equivalent of *SHADOW 1 .
8 - &8B (139) Select file options
*OPT equivalent
OSByte call |
Action |
Available on: |
(dec) |
(hex) |
BBC |
Master |
Electron |
139 |
8B |
Select file options |
x |
x |
x |
Entry parameters
On exit:
9 - &8C (140) Select tape filesystem
*TAPE equivalent
OSByte call |
Action |
Available on: |
(dec) |
(hex) |
BBC |
Master |
Electron |
140 |
8C |
Select tape filesystem |
x |
x |
x |
On exit:
10 - &8D (141) Select ROM filesystem
*TAPE equivalent
OSByte call |
Action |
Available on: |
(dec) |
(hex) |
BBC |
Master |
Electron |
141 |
8D |
Select ROM filesystem |
x |
x |
x |
On exit:
11 - &8E (142) Enter language ROM
OSByte call |
Action |
Available on: |
(dec) |
(hex) |
BBC |
Master |
Electron |
142 |
8E |
Enter language ROM |
x |
x |
x |
Entry parameters
The language ROM is entered via its entry point with A=1.
Locations &FD and &FE in zero page are set to point to the copyright message in the ROM.
This call does not return as the new Language will take over the machine.
12 - &8F (143) Issue paged ROM service call
OSByte call |
Action |
Available on: |
(dec) |
(hex) |
BBC |
Master |
Electron |
143 |
8F |
Issue paged ROM service call |
x |
x |
x |
Entry parameters
On exit:
A |
preserved |
X |
0 if a pages ROM claimed the service call |
C |
undefined |
Refer to the section about service roms on how this call works.
13 - &90 (144) Alter display parameters
*TV equivalent
OSByte call |
Action |
Available on: |
(dec) |
(hex) |
BBC |
Master |
Electron |
144 |
90 |
Alter display parameters |
x |
x |
|
Electron
On the Electron this is not implemented and returns with all registers preserved.
14 - Read/Write to mapped IO
OSByte call |
Action |
Available on: |
(dec) |
(hex) |
BBC |
Master |
Electron |
146 |
92 |
Read IO in &FCxx FRED |
x |
x |
x |
147 |
93 |
Write IO in &FCxx FRED |
x |
x |
x |
148 |
94 |
Read IO in &FDxx JIM |
x |
x |
x |
149 |
95 |
Write IO in &FDxx JIM |
x |
x |
x |
150 |
96 |
Read IO in &FExx SHEILA |
x |
x |
x |
151 |
97 |
Write IO in &FExx SHEILA |
x |
x |
x |
Entry parameters
X |
Address within specified page for the call |
On exit:
A |
preserved |
X |
undefined |
C |
undefined |
Refer to the hardware secion about the FRED, JIM & SHEILA 1MHz buses.
15 - MOS Variables
OSByte call |
Action |
Available on: |
(dec) |
(hex) |
BBC |
Master |
Electron |
166 |
A6 |
Read start address of OS variables low byte |
x |
x |
x |
167 |
A7 |
Read start address of OS variables high byte |
x |
x |
x |
168 |
A8 |
Read address of ROM pointer table low byte |
x |
x |
x |
169 |
A9 |
Read address of ROM pointer table high byte |
x |
x |
x |
170 |
AA |
Read address of ROM information table low byte |
x |
x |
x |
171 |
AB |
Read address of ROM information table high byte |
x |
x |
x |
172 |
AC |
Read address of keyboard translation table low byte |
x |
x |
x |
173 |
AD |
Read address of keyboard translation table high byte |
x |
x |
x |
174 |
AE |
Read VDU variables origin low byte |
x |
x |
x |
175 |
AF |
Read VDU variables origin high byte |
x |
x |
x |
176 |
B0 |
Read/Write CFS timeout counter |
x |
x |
x |
On exit:
A |
preserved |
X |
Old value |
C |
undefined |
The OSBYTE calls &A6 to &FF (166-255) read and write the MOS variables.
Reading & writing the variables are handled by the formula:
newValue = (oldValue AND Y) EOR X
The all return the old value in X and the next location in Y.
MOS Variables
The MOS variables start in memory from address &0236.
Each variable is accessible via OSBYTE calls 166..255.
The internal label .mosVariablesMinus166
refers to the address &0190 (= &0236-166) so that the lookup
is done by simply adding the accumulator to that address.
OSBYTE |
Variable |
Address |
Description |
166/167 |
mosVariables |
0236 |
Constant value .mosVariablesMinus166 |
168/169 |
romPointerTable |
0238 |
Constant value .extendedVectorSpace |
170/171 |
romPointerTable |
023A |
Constant value .extendedVectorSpace |
172/173 |
key translation table |
023C |
Constant value .extendedVectorSpace |