Support interrupts for different platforms
Currently only C64/6502 is properly supported with interrupts.
Make a solution allowing for platform-specific / CPU-specific interrupt support.
- Support Platform ROM ISR's: The system ROM ISR addresses are different on different platforms.
- Support Different CPU's features: 65C02+ has PHX/PHY, ...
Design
- The default interrupt type is specified in the platform
.TGT-file under tag"interrupt" - The default interrupt type can be overridden using #pragma interrupt(type)
- An interrupt function can be declared using the default type by adding
__interrupt - An interrupt function can be declared using a specific type by adding
__interrupt(type) - if the type name contains the word "clobber" then the compiler calculates exactly which registers are clobbered by the interrupt procedure and replaces "clobber" with "none"/"cloba"/"clobx"/"clobax"/"clob..."/"all" depending on which registers are clobbered.
- The interrupt entry and exit ASM is generated through the ASM fragment system choosing the best ASM for the current CPU. The fragment names are
-
isr_type_entry(where type is the interrupt type name) -
isr_type_exit(where type is the interrupt type name)
-
The built-in interrupt types are:
-
rom_sys_c64/rom_sys_vic20/rom_sys_cx16: Enters through ROM. Exits through the ROM with the system ISR code (scanning keyboard, showing cursor etc.) -
rom_min_c64/rom_min_vic20/rom_min_cx16: Enters through ROM. Exits through the ROM with minimal code (jumps to stack pulls) -
hardware_all: Enters and exits by saving and restoring all registers. -
hardware_none: Enters and exits by saving and restoring no registers. -
hardware_clobber: Enters and exits by saving and restoring the clobbered registers.
Edited by Jesper Balman Gravgaard