Build tool/BIOSReleaseEvent
From MSX Game Library
Build tool option BIOSReleaseEvent is used to add a callback function to be called just before BIOS is switched out from page 0. It allows you to have an initialization code that runs while the BIOS is still accessible at page 0. For example, to detect the presence of an MSX-Music device using the BIOS routines for cross-slot reading.
This applies to target formats that place the ROM on page 0 (ROM_48K_ISR, ROM_64K_ISR, ROM_NEO8, and ROM_NEO16), as well as ROM formats that place RAM on page 0 (via the InstallRAMISR option).
Usage
To use this option, the user must provide a function that will be called by the boot process just before the BIOS is removed from page 0 (to make room for the cartridge or memory).
Function prototype:
void BIOS_OnRelease();
Call Context
You must be fully aware of the program's initialization context at the time the BIOS_OnRelease callback function is executed. This context depends on the type of target format.
ROM in page 0
- The global variables have been initialized (so they have their predefined values)
- The main() function has not yet been called (so no program-specific initialization has taken place yet)
- The mapper has not yet been initialized;
- the selected segments are those selected by default by the hardware at the physical level (see https://www.msx.org/wiki/MegaROM_Mappers);
- mapper initialization will take place immediately after the return from the BIOS_OnRelease function and will overwrite any changes made in the callback;
- Only page 1 of memory space points to the program in ROM
RAM in page 0
- The global variables have been initialized (so they have their predefined values)
- The main() function has not yet been called (so no program-specific initialization has taken place yet)
- The mapper has been initialized (see Initial slot configuration)
- Pages 1 and 2 of memory point to the program in ROM