Difference between revisions of "OSBYTE &D7"

From BeebWiki
Jump to: navigation, search
(~~)
(Appearances in MOS 1.20: *FX 215,0 applies when?)
Line 77: Line 77:
 
value one less than the proper value (modulo 256) while it is running.
 
value one less than the proper value (modulo 256) while it is running.
  
The <tt>INC</tt> instruction sets the Z flag according to the restored value
+
On successful completion of the <tt>*/!BOOT</tt> command, the <tt>INC</tt>
at &0267.  If the value is not zero then the following <tt>BNE</tt> branches
+
instruction sets the Z flag according to the restored value at &0267.  If
to select a language ROM to enter.  Otherwise <code>*FX 215,0</code> is in
+
the value is not zero then the following <tt>BNE</tt> branches to select a
effect; the MOS falls through and selects the Cassette Filing System at 1200
+
language ROM to enter.  Otherwise <code>*FX 215,0</code> is in effect: the
 +
MOS first selects the Cassette Filing System at 1200
 
baud.<ref name="mos125">MOS 1.25 also prints a line of garbage.</ref>
 
baud.<ref name="mos125">MOS 1.25 also prints a line of garbage.</ref>
  

Revision as of 19:34, 25 October 2021

OSBYTE &D7 (215) - Enable/Disable Startup Message

   The Tube system replaces the startup computer message, and this call is
   used to do this. It can only be acted on by a paged ROM, since no other
   software has had a chance to load, only 2 bits are defined:
   b0=0=supress startup message
     =1=message as normal
   b7=0=computer hangs if there's a !Boot file error in the ROM filing system
     =0=computer hangs if there's a !Boot file error in the DISC filing system

Specification

 6502  On entry: On exit:
A =&D7 preserved
X =0 no startup message, hangup on RFS boot error
=1 no startup message, hangup on disc boot error
=128 startup message, hangup on RFS boot error
=129 startup message, hangup on disc boot error
previous value
Y =0 change both settings
=1 preserve error setting
=128 preserve message setting
=129 preserve both settings
contents of next location

Description

In OS 1.20 this variable resides at &0267 and is initialised to &81 on soft break, CTRL BREAK and power up. It is then interrogated later in the startup routine. The clients which may alter this variable in time for its use are, in chronological order:

  • Test hardware on the 1 MHz bus, which raises an interrupt and presents an entry vector at &FDFE
  • Code at the break intercept vector, set up by OSBYTE calls &F7, &F8 and &F9
  • Paged ROMs during service calls &FF, &01, &02, &FE and &03 (deprecated.) Service call &FE automatically disables the startup message if claimed.

A filing system ROM has the ability, during service call &03, to inhibit hangup on boot error for both itself and RFS though this is also deprecated.

Appearances in MOS 1.20

The OSBYTE &D7 variable is mentioned in the following places in the MOS 1.20 code (taken from Geoff Cox's disassembly):

   ...
   DB5F	LDX #&FE    ;issue call for Tube to explode character set etc.
   DB61	LDY &027A   ;Y=FF if tube present else Y=0
   DB64	JSR &F168   ;and make call via F168
   
   DB67	AND &0267   ;if A=&FE and bit 7 of 0267 is set then continue
   DB6A	BPL &DB87   ;else ignore start up message
   DB6C	LDY #&02    ;output to screen
   DB6E	JSR &DEA9   ;'BBC Computer ' message
   ...

JSR &F168 returns A=X=0 if the service call is claimed, A=X=&FF if unclaimed. Either setting *FX 215,n with n < 128 or claiming call &FE ensures that the startup message is not printed.

   ...
   DBA9	LDX #&D2    ;
   DBAB	LDY #&EA    ;
   DBAD	DEC &0267   ;decrement ignore start up message flag
   DBB0	JSR OSCLI   ;and execute */!BOOT
   DBB3	INC &0267   ;restore start up message flag
   DBB6	BNE &DBBE   ;if not zero then DBBE
   
   DBB8	LDA #&00    ;else A=0
   DBBA	TAX         ;X=0
   DBBB	JSR &F137   ;set tape speed
   ...

A short time later in the startup sequence; here, service call &03 has not been claimed and booting is requested, so the MOS has selected the ROM Filing System and is attempting to execute a boot file from ROM. The paired DEC and INC instructions invert bit 0 during the OSCLI call so that, if it had been clear, it is set while executing the command and hangs the machine in the event of reaching a BRK instruction. Bit 0 is set by default and RFS does not hang on a boot error.

The MOS does not look at bit 7 during OSCLI, but the boot command will see a value one less than the proper value (modulo 256) while it is running.

On successful completion of the */!BOOT command, the INC instruction sets the Z flag according to the restored value at &0267. If the value is not zero then the following BNE branches to select a language ROM to enter. Otherwise *FX 215,0 is in effect: the MOS first selects the Cassette Filing System at 1200 baud.[1]

The MOS source code assembling the instruction at &DBB6 reads:

    BNE DNRFS ;[ALWAYS jump, do not reset filing system]

and so Acorn expected the equivalent of *FX 215,0 not to occur during startup. *FX 215,2 is an unofficial setting that preserves the filing system selection after booting from ROM.

   ...
   DC54	LDY #&00    ;Y=0 to point to byte after BRK
   DC56	JSR &DEB1   ;print message
   
   DC59	LDA &0267   ;if BIT 0 set and DISC EXEC error
   DC5C	ROR         ;occurs
   DC5D	BCS &DC5D   ;hang up machine!!!!
   ...

Lastly here is the start of the default BRK handler referenced by BRKV until a language replaces it with its own. Bit 0 decides whether to halt or continue: if it is set, the CPU loops forever; if clear, the current language is re-entered or a language is chosen from the available ROMs.

Effect

Two important errors affected by OSBYTE &D7 are:

  • File not found while searching for !BOOT in the RFS
  • Language? while searching for a language ROM.

Both are common errors in the BBC Micro: the former arising from keys being held down on BREAK and no bootable ROM present, the latter being raised if no language ROM is present.

To improve behaviour in such cases, Acorn opted to trap File not found and allow a language to start up regardless. Language? is unrecoverable in MOS 1.20 until a hardware change is made, and like other errors occurring so early the best response is to halt the machine.

Note that Language? behaves as a disc boot error for this purpose: enabling disc boot errors to proceed allows re-entry into the language selection routine, and with no language present, the micro enters an endless loop.

Reuse

Once startup is complete and a language installs its own BRK handler, all eight bits of this variable can be reused for temporary storage. If the default BRK handler may still be invoked, bits 7..1 remain free. The contents are destroyed on any type of reset and so accommodation for DEC &0267 or INC &0267 need not be made.

See Also

Jgharston 22:56, 26 May 2009 (UTC)
  1. MOS 1.25 also prints a line of garbage.