Closed gardners closed 5 years ago
Related to the above, Nebulus also JMPs to $EA7E in the end of its IRQ routine:
.C:2d7d 20 06 30 JSR $3006
.C:2d80 EE 19 D0 INC $D019
.C:2d83 4C 7E EA JMP $EA7E
.C:2d86 A9 FF LDA #$FF
.C:2d88 18 CLC
.C:2d89 69 03 ADC #$03
We know $EA81 is the do-nothing exit from IRQ, so $EA7E is 3 bytes earlier, and thus presumably calls some function within the IRQ handler, without doing everything. Quick google reveals:
https://csdb.dk/forums/index.php?roomid=11&topicid=5776
Basically $EA7E has an instruction that clears the CIA interrupt flag. Basically we need to read $DC0D to achieve this. We have the choice of LDA, LDX or LDY. It is really a free random choice, because the following instructions pop all registers off the stack.
Now gets to crack screen, and "PLAY HIGHSCORE OR TRAINER GAME [H/T]?" message, but doesn't proceed any further.
That code is a tight loop calling $FFE4 (get character of input) and checking for T/H. $FFE4 should already be implemented, but no input is read. This is almost certainly because IOINIT isn't at the correct location, and so no CIA interrupts are triggered, and thus the keyboard is not scanned.
All fixed. Nebulus now works (tested by playing level one and first fish intermission through).
Nebulus sets $0314/$0315 to $EA31 and calls $FDA3:
We therefore need to implement the callable part of the IRQ handler at $EA31, i.e., the part after the vector call. Vector insertion for IRQs should already be there.
$FDA3 is IOINIT "Initialise CIA I/O devices" according to p238 of Compute's Mapping the 64. We therefore need to make sure that this routine is at that location. I think at the moment IOINIT also initialises the VIC-II, which should be moved elsewhere, probably into CINIT?