Prev: CBE1 Up: Map Next: D1D0
D1AA: Game Entry Point
GameEntryPoint D1AA DI Disable interrupts.
D1AB LD SP,$FFFA SP=FFFA.
Write FD from InterruptLowOrderByteJumpTable for 0100 bytes. All will become clear soon...
D1AE LD HL,$FE00 HL=InterruptLowOrderByteJumpTable.
D1B1 LD BC,$00FD Set a counter in B of 00 (as it's a DJNZ this is really 0100) and set C to FD for the value to write.
WriteInterruptJumpAddress_Loop D1B4 LD (HL),C Write FD to *HL.
D1B5 INC HL Increment HL by one.
D1B6 DJNZ WriteInterruptJumpAddress_Loop Decrease counter by one and loop back to WriteInterruptJumpAddress_Loop until counter is zero.
One more for luck...
D1B8 LD (HL),C Write C to *HL.
This sets interrupt mode 02; when the system generates an interrupt, it'll use the high-order byte set here, together with a low-order byte generated from the system to form a 16-bit address to jump to.
As we've just set FD to every address, this means that every generated interrupt will jump to FEFD which in turn will jump to F85D.
D1B9 LD A,$FE Set FE as the high-order byte in I.
D1BB LD I,A
D1BD IM 2 Set interrupt mode 02.
D1BF LD HL,$5843 Write 5843 (attribute buffer location) to *SelectedMenuItem_ScreenPosition.
D1C2 LD ($D877),HL
D1C5 LD A,$01 Write 01 ("keyboard") to *SelectedMenuItem.
D1C7 LD ($EB38),A
D1CA LD HL,$EB64 Write InputHandler_Keyboard to *Pointer_InputControl.
D1CD LD ($EB36),HL
Continue on to Game_Loop.
Prev: CBE1 Up: Map Next: D1D0