The actual decoding of the first 6 bytes for BASIC ROMs does not conform to the following and OS ROMs do not use a standard ROM header. Otherwise, all ROMs conform to the following and start at address &8000.
The meaning of the header bytes are:
The top 4 bits in the type byte should be set as follows:
The term "language ROM" does not necessarily mean the ROM contains a language. Rather, it means the ROM has code which makes it the current interactive system. In this way, View (the word processor) and ViewSheet (the spreadsheet application) are both considered languages as once you enter them, all interaction is with them until another language ROM is selected.
A service ROM is one which responds to a certain set of signals sent by the OS. These include indication that the system has been reset, signals inviting ROM code to request chunks of memory, etc. Also, all the "star" commands are implemented in this way. When the user types "*HELP", a signal is sent to each ROM's service routine for it to respond if it wishes. Similarly, any other "star" command is implemented in this way except "*BASIC" which is implemented by the OS and causes it to start the language routine of the BASIC ROM (which is why the BASIC ROM doesn't need a service routine). More of these signals shortly.
The standard convention for version strings is to have a single digit followed by a dot and then two further digits, however there is no requirement to stick to this format, though this convention will be used by all the examples here. The ROM version byte is not related to the version string. I have no idea what the distinction is so please don't ask. The version byte will be displayed by certain utilities (for example, "*ROMS" may use this on some systems).
A copyright string is required and must start with the three characters "(C)" or it will not be initialised by the OS and it will not be accessible.
The Tube address if present is the address the ROM will be loaded at across the Tube on a second processor. If the ROM has a relocate address, then it should be assembled with this address as its base address and not &8000 and for the chip that is located across the Tube rather than 6502 if that chip is different (say a Z80 coprocessor).
After the header is the actual executable machine code of the ROM. If the ROM is started as a language, then execution starts from the language address. The service routine is started by the OS to respond to various signals from time to time. Once started as a language, the ROM is free to opperate as necessary until such a time as another language ROM becomes active. In this way, the "language" might be a word processor, a programming language interface, or even a game and thus the coding of the language routine is outside the scope of this article. The following pages describe the various service events the OS sends to ROMS and how a ROM can respond. This will include responding to a particular keyword and restarting the ROM as a language (this is what the View ROM does when it detects the "*WORD" command, for example, and is the usual way for a language routine to start).