Some notes on the *BASIC command BBC BASIC does not have a service entry, so cannot check for the *BASIC command itself. The MOS assists BASIC by providing a *BASIC command that enters the BASIC ROM. These are some notes about the *BASIC command and it's associated OSBYTE &BB (187). On RESET the MOS sets the BASIC ROM number held in OSBYTE &BB to &FF. The MOS then builds a table of ROM information scanning for valid sideways ROMs. It sets the BASIC ROM number to the highest numbered ROM found with no service entry, indicated by bit 7 of the ROM type byte being zero. The *BASIC command checks the BASIC ROM number. If bit 7 is clear, then the ROM is entered as a language. If bit 7 is set, then the *BASIC command is passed to sideways ROMs and the current filing system as an unknown command. Obviously, code can change the BASIC ROM number. In particular an alternative BASIC ROM could change the BASIC ROM number on startup. To do this it should set the BASIC ROM number to its own ROM number if it wishes the *BASIC command to simply enter it as a language. It should set the BASIC ROM number to its own ROM number with bit 7 set to have the *BASIC command passed as an unknown command. This gives the ROM the opportunity to parse any parameters after the *BASIC command. Once it has done this, it should then enter itself as a language with OSBYTE &8E (142). As the BASIC ROM number is passed to OSBYTE &8E if b7=0 then each bit has the same interpretation as for OSBYTE &8E. The OSBYTE &BB value can be seen as follows: --------------------------------- | E | N | | | R | R | R | R | --------------------------------- E=0 => Enter ROM number R at language entry point E=1 => Pass "BASIC" command to all ROMs service entry point N=0 => Automatically relocate if possible N=1 => Do not automatically relocate R=ROM number of BASIC Code similar to the following could be called on service call 1. .SERVICE1 PHA \ SAVE SERVICE CALL NUMBER TYA PHA \ SAVE Y PARAMETER TXA \ HOLDS CURRENT ROM NUMBER ORA #&80 \ SET BIT 7 TAX LDA #&BB LDY #&00 JSR OSBYTE \ WRITE BASIC ROM NUMBER LDX &F4 \ RESTORE ROM NUMBER TO X PLA TAY \ RESTORE Y PARAMETER PLA \ RESTORE SERVICE CALL NUMBER RTS Code that reads OSBYTE &BB should check that it equals &FF as indicating that there is no BASIC present. If it is not &FF, then bit 7 should be ignored. The following sample code will do this. LDA #&BB LDX #&00 LDY #&FF JSR OSBYTE \ READ BASIC ROM NUMBER INX BEQ NOBASIC \ ROM NUMBER IS &FF, NO BASIC PRESENT DEX \ X CONTAINS BASIC ROM NUMBER TAX AND #&7F \ REMOVE BIT 7 History ------- -Nov-1983 Original Acorn document 12-Aug-2006 Added 'N' bit from MOS 3.50 documentation