Prev: F225 Up: Map Next: F7C7
F7AA: Sets up the classic ZX Spectrum IM2 "257-byte table" interrupt vector trick
Fills $BC00-$BDBD with the byte $BD so that, whatever the low byte of the interrupt vector happens to be, the CPU always resolves it to the single byte at $BDBD; patches that byte to a JP opcode ($C3) whose operand ($BDBE/$BDBF) is set to frame_interrupt_handler, making $F8AD the interrupt handler for every subsequent interrupt. Sets I to the table's page and enables IM 2.
setup_im2_interrupt_table F7AA LD HL,$BC00
F7AD LD A,H
F7AE LD B,$00
F7B0 LD C,$BD
setup_im2_interrupt_table_0 F7B2 LD (HL),C
F7B3 INC HL
F7B4 DJNZ setup_im2_interrupt_table_0
F7B6 LD (HL),C
F7B7 LD I,A
F7B9 IM 2
F7BB LD A,$C3
F7BD LD ($BDBD),A
F7C0 LD HL,$F8AD
F7C3 LD ($BDBE),HL
F7C6 RET
Prev: F225 Up: Map Next: F7C7