I'm back at it with Arcana again! The game got a FastROM patch
for loading from faster banks, but every interrupt it reverts to SlowROM again until RTI. I wanna fix that since it's running 243 SlowROM commands every frame.
$00/8335 C2 30 REP #$30 A:0820 X:0A04 Y:003D D:1E00 DB:7E S:1FEA P:envmxdIzc HC:0110 VC:225 FC:57 I:00
$00/8337 48 PHA A:0820 X:0A04 Y:003D D:1E00 DB:7E S:1FEA P:envmxdIzc HC:0140 VC:225 FC:57 I:00
$00/8338 DA PHX A:0820 X:0A04 Y:003D D:1E00 DB:7E S:1FE8 P:envmxdIzc HC:0178 VC:225 FC:57 I:00
$00/8339 5A PHY A:0820 X:0A04 Y:003D D:1E00 DB:7E S:1FE6 P:envmxdIzc HC:0216 VC:225 FC:57 I:00
$00/833A 0B PHD A:0820 X:0A04 Y:003D D:1E00 DB:7E S:1FE4 P:envmxdIzc HC:0254 VC:225 FC:57 I:00
$00/833B F4 00 00 PEA $0000 A:0820 X:0A04 Y:003D D:1E00 DB:7E S:1FE2 P:envmxdIzc HC:0292 VC:225 FC:57 I:00
$00/833E 2B PLD A:0820 X:0A04 Y:003D D:1E00 DB:7E S:1FE0 P:envmxdIzc HC:0340 VC:225 FC:57 I:00
$00/833F 8B PHB A:0820 X:0A04 Y:003D D:0000 DB:7E S:1FE2 P:envmxdIZc HC:0384 VC:225 FC:57 I:00
$00/8340 4B PHK A:0820 X:0A04 Y:003D D:0000 DB:7E S:1FE1 P:envmxdIZc HC:0414 VC:225 FC:57 I:00
$00/8341 AB PLB A:0820 X:0A04 Y:003D D:0000 DB:7E S:1FE0 P:envmxdIZc HC:0444 VC:225 FC:57 I:00
$00/8342 E2 20 SEP #$20 A:0820 X:0A04 Y:003D D:0000 DB:00 S:1FE1 P:envmxdIZc HC:0480 VC:225 FC:57 I:00
$00/8344 AD 10 42 LDA $4210 [$00:4210] A:0820 X:0A04 Y:003D D:0000 DB:00 S:1FE1 P:envMxdIZc HC:0510 VC:225 FC:57 I:00
$00/8347 E6 20 INC $20 [$00:0020] A:08C2 X:0A04 Y:003D D:0000 DB:00 S:1FE1 P:eNvMxdIzc HC:0588 VC:225 FC:57 I:00
$00/8349 C2 20 REP #$20 A:08C2 X:0A04 Y:003D D:0000 DB:00 S:1FE1 P:envMxdIzc HC:0634 VC:225 FC:57 I:00
$00/834B AD 55 10 LDA $1055 [$00:1055] A:08C2 X:0A04 Y:003D D:0000 DB:00 S:1FE1 P:envmxdIzc HC:0664 VC:225 FC:57 I:00
$00/834E D0 03 BNE $03 [$8353] A:0000 X:0A04 Y:003D D:0000 DB:00 S:1FE1 P:envmxdIZc HC:0712 VC:225 FC:57 I:00
$00/8350 20 79 83 JSR $8379 [$00:8379] A:0000 X:0A04 Y:003D D:0000 DB:00 S:1FE1 P:envmxdIZc HC:0736 VC:225 FC:57 I:00
$00/8373 AB PLB A:0000 X:FFFE Y:000F D:0000 DB:00 S:1FE1 P:envmxdIZC HC:0634 VC:235 FC:57 I:00
$00/8374 2B PLD A:0000 X:FFFE Y:000F D:0000 DB:7E S:1FE2 P:envmxdIzC HC:0670 VC:235 FC:57 I:00
$00/8375 7A PLY A:0000 X:FFFE Y:000F D:1E00 DB:7E S:1FE4 P:envmxdIzC HC:0714 VC:235 FC:57 I:00
$00/8376 FA PLX A:0000 X:FFFE Y:003D D:1E00 DB:7E S:1FE6 P:envmxdIzC HC:0758 VC:235 FC:57 I:00
$00/8377 68 PLA A:0000 X:0A04 Y:003D D:1E00 DB:7E S:1FE8 P:envmxdIzC HC:0802 VC:235 FC:57 I:00
$00/8378 40 RTI A:0820 X:0A04 Y:003D D:1E00 DB:7E S:1FEA P:envmxdIzC HC:0846 VC:235 FC:57 I:00
It saves A, X, Y, D, B to the stack, loads $0000 into D (sets the direct page to 0000), and loads K the bank byte into B the bank register. Problem is, despite the FastROM patch
setting the ROM type to FastROM, the interrupt jumps to bank 00 instead of bank 80. So I want to set the bank to $80, figure I can put something at 8340 where I spaced it out. But, there's only 2 bytes there, so I need to jump somewhere else and take some of the following code with me.
My first thought, I might be over-complicating things. Do naturally fastrom games stay in FastROM during interrupts? Is there somewhere that handles the interrupt vector and sets the bank?
Second thought, from reading 65816 Basics
I can only change the bank (K) by jumping long. So I jump to $80/Fxxx, PHK, PLB, start appending the overwritten code... and then what? If I return to run the rest, I'll be back to SlowROM. I could copy the entire subroutine to the end of the bank and jump there, but that seems silly. Any brighter ideas or something I missed? Trying to reduce the commands needed since this code's really prevalent.