Disables Amstrad CPC firmware, preventing it from being executed at every CPU interrupt.
u16 cpct_disableFirmware ()
call cpct_disableFirmware_asm
<u16> | Present interrupt handler code (normally, pointer to firmware ROM code). This value should be stored to restore it later, if required. |
Disables the firmware modifying the interrupt vector at memory location 0x38. Normally, firmware routines are called and executed at every interrupt and the ROM entry point is stored at 0x38 (a 16-bit address where the firmware code starts). This function substitutes the 2 bytes located at 0x38 by 0xC9FB, (0xFB = EI, 0xC9 = RET), which basically does nothing at each interruption (restores interrupts and returns).
Before inserting 0xC9FB at 0x38, the 2 bytes lying there are saved into DE. These 2 bytes are returned to the caller, to let them be stored and restored later on, if normal firmware operation (or previous interrupt handler) is required. cpct_reenableFirmware may be used for this restoring operation.
HL
16 bytes
Case | microSecs (us) | CPU Cycles -------------------------------------- Any | 22 | 88 --------------------------------------
This function was coded copying and modifying cpc_disableFirmware from CPCRSLib by Raul Simarro.