Changes
/* MC Boot Program: BD13,05DC */OCR page 20
The CRT Controller is then set up. There are two alternative sets of values for this, one for 50 Hz frame scan and the other for 60 Hz. The set to be used is determined by reading port B, bit 4. If this bit is true, 50 Hz values are used, while the 60 Hz values are used if the bit is false, this being determined by the presence of Link 4 on the main printed circuit board.
The tables are read backwards, which can be a little confusing at first, and the outputs alternate between BCXX, which selects the register to be set, and BDXX, which performs the actual setting.
Then MC START PROGRAM is entered at 060E with DE=065C and HL=0000. The contents of DE point to the display routine for the main title, which is called at an appropriate point. The zero value in HL means that ROM 0 will be entered at C006. This will normally invoke the BASIC interpreter, unless an external ROM responds to 0. C006 is the standard upper ROM entry point.
Before discussing MC START PROGRAM, it will be convenient to look at a program which calls it, having first loaded the necessary data:
== MC Boot Program: BD13,05DC ==
On entry to this function, HL must hold the address of a loading routine, which must be designed to return with carry set and the program start address in HL if the load is successful, or with carry clear if the load fails.
The stack is reset by SP=C000, this being the normal stack position, and sound RESET is called to silence the Sound Generator. Interrupt is disabled, and &FF is output to port F8FF, requiring that all external peripherals devices should be reset.
KL CHOKE OFF is called to clear the B100-B1BF area to zeroes, though the previous contents of (B1A9/B) are first saved. (B1A9/A) holds the last-used foreground ROM entry address, which is copied to DE, while (B1AB) holds the last-used foreground ROM number, which is copied to B. (Note that the number of the ROM in current use is held in (B1A8), which is not preserved here.) If (B1AB) holds &FF the routine returns with C, D and E all zeroed.
Back in the main BOOT routine, HL is restored to its value on entry and DE, BC and HL are pushed. KM RESET is called to initialise the Key Manager, TXT RESET is called to initialise the text screen, assisted by a call to SCR RESET, and U ROM ENABLE is called to bring the upper ROM into action.
HL is popped, and the loading program it defines is entered, using an odd little subroutine that consists solely of the JP (HL) instruction. BC and DE are popped.
== Scanned pages ==