Sega Master System / Mark III / Game Gear
The SF-7000 Initial Program Loader ROM uses all of the Z80's interrupt vectors to provide capabilities to software running on the device, when enabled.
They will usually be accessed using the
call instructions, with the exception of $00 which does not return, and thus is entered with a
This is the normal boot entry point. It performs self-test routines and then attempts to boot from disk.
The self-test routines are:
If all self-test routines complete without error, it proceeds to boot normally.
Turns on the disk controller, spins up the disk, checks that the disk is spinning fast enough (approximately 350RPM), and sets up the correct drive parameters in the FDC. A side effect is that the disk seeks to track 0, sector 1. This should be called before using other IPL ROM disk commands. It also serves as a disk presence check - the most likely reason for an error is because no disk is inserted.
Reads a 256-byte sector from the disk to the specified address in RAM.
When the IPL ROM is active (as it must be to use this function), RAM addresses $0000..$3fff cannot be read, but they can be written, so there is no problem to load data to these addresses. Some software (eg. Disk Basic) will not work if this is not the case.
Writes a 256-byte sector from the specified address in RAM to the disk. It then pauses, and attempts to read it back. If there is no problem, it returns; otherwise, it will repeat the process up to 256 times before failing. The read back process does not attempt to verify that the data read matches what was written, probably because the low-level disk data checksums provide sufficient error-checking.
Formats the entire disk and writes a blank directory and empty FAT.
This will start up a program that allows you to copy and format disks.
This bypasses the self-test routines (marks them as complete without performing them), and jumps straight to the booting process.
There is no functionality hooked up to this entry point; it will return (almost) immediately.
The boot process does the following:
|0||%00000000||No line ints, turn off features|
|1||%11010000||Display enable, mode 1|
|2||%00000010||Tilemap address $0800|
|3||$00||Colour table address|
|4||$03||Pattern generator address|
|5||$00||Sprite table address|
|6||$00||Sprite tile number modifier|
|7||$f1||Backdrop color 1|
There are some other useful routines in the IPL ROM that do not have API-like entry points, but are useful and are used by some software. These routines will use memory in the $fc00-$fcff range so software using them must avoid that range. All functions listed below are known to be used by at least one disk program. The function names are unofficial.
This routine will display the null-terminated string pointed to by hl to the screen using the IPL's console emulation routines. The string consists of ASCII text and control characters. The available control characters are:
|$00||End of string|
|$08||Backspace (BS, \b)|
|$0a||New line (LF, \r)|
|$0c||Clear screen (FF, \f)|
Apart from these control characters, the only other characters that can be displayed are those in the 7-bit ASCII range (values $20 to $7f), so the SC-3000 font's extended characters are unavailable. The only difference in the available characters are that $5c "\" is displayed as "¥" (yen symbol) and $5f "_" is displayed as "π" (lowercase greek letter pi).
This will wait for the user to press any key, apart from the modifying keys like Shift, Ctrl, cursors, etc, which are ignored. The effect of the Shift key is taken into account, so for example the returned value could be 'a' or 'A' depending on whether Shift was held while the A key was pressed.
Plays a 2kHz sound for 51ms, followed by silence for 51ms. This is repeated