For instance, in page 2, the address to jump to the IRQ routine is in $0229 (ROM 1.0) or $0245 (ROM 1.1). The difference $245 - $229 = $1C.
If I want to change this address, I can code
STA $0229,Y
having pre-loaded Y with 0 or $1C according to the ROM I'm using. Which means I must test the ROM before...
Except that there are ROM locations, for instance $FF47, which hold the value $00 in ROM 1.0, and $1C in ROM 1.1!
Such specific ROM locations will allow to directly set the right value, no matter the ROM version.
So to change the IRQ routine address on Oric-1 or Oric-Atmos, I should simply have to write:
Code: Select all
AC 47 FF LDY $FF47 ;ROM 1.1: add 1C to the interrupt address; ROM 1.0: add zero to interrupt address
A9 50 LDA #$50 ;redirectinq IRQ
99 29 02 STA $0229,Y ;to $0150
A9 01 LDA #$01 ;ROM1.0: 229-22A ; ROM 1.1: 245-246
99 2A 02 STA $022A,Y
I wonder if such trick has been used before?
PS: it won't work if the difference is larger than 255 bytes (maximum Y value).