Routines |
Prev: CBDE | Up: Map | Next: D22E |
|
||||
DemoEntryPoint | D1AA | DI | Disable interrupts. | |
D1AB | LD ($D22E),SP | Stash the current stack pointer at *Storage_StackPointer. | ||
D1AF | LD SP,$FFFA | SP=FFFA. | ||
Write FD from InterruptLowOrderByteJumpTable for 0100 bytes. All will become clear soon...
|
||||
D1B2 | LD HL,$FE00 | HL=FE00. | ||
D1B5 | 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 | D1B8 | LD (HL),C | Write FD to *HL. | |
D1B9 | INC HL | Increment HL by one. | ||
D1BA | DJNZ WriteInterruptJumpAddress_Loop | Decrease counter by one and loop back to WriteInterruptJumpAddress_Loop until counter is zero. | ||
One more for luck...
|
||||
D1BC | 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 F47A.
|
||||
D1BD | LD A,$FE | Set FE as the high-order byte in I. | ||
D1BF | LD I,A | |||
D1C1 | IM 2 | Interrupt mode 02. | ||
This entry point is used by the routine at StartGame.
|
||||
DemoEntryPoint_0 | D1C3 | DI | Disable interrupts. | |
D1C4 | LD HL,$61A8 | Write 61A8 to *D5B0. | ||
D1C7 | LD ($D5B0),HL | |||
D1CA | LD BC,$0000 | Write 0000 to: | ||
D1CD | LD ($D590),BC | |||
D1D1 | LD ($D591),BC | |||
D1D5 | LD ($E0D0),BC | |||
D1D9 | XOR A | Write 00 to *D589. | ||
D1DA | LD ($D589),A | |||
Print the in-game surround.
|
||||
D1DD | LD A,$05 | Set border colour to CYAN. | ||
D1DF | OUT ($FE),A | |||
D1E1 | LD HL,$C2A6 | HL=Data_PlayareaSurround. | ||
D1E4 | CALL UnpackScreenData | Call UnpackScreenData. | ||
Set the starting lives.
|
||||
D1E7 | LD A,$04 | Write 04 to *Lives. | ||
D1E9 | LD ($D543),A | |||
D1EC | LD HL,$5ADA | Write 5ADA (attribute buffer location) to *D58E. | ||
D1EF | LD ($D58E),HL | |||
Initialise the new game with the level 1 data.
|
||||
D1F2 | LD HL,$D232 | Write Table_LevelData to *Pointer_CurrentLevelData. | ||
D1F5 | LD ($D230),HL | |||
Note, this level counter counts down instead of up.
|
||||
D1F8 | LD B,$01 | Set a counter in B for the total number of levels (01). | ||
This level counter is used for display purposes.
|
||||
D1FA | XOR A | Write 00 to *Level. | ||
D1FB | LD ($D58A),A | |||
The game loops here in-game to begin a new level.
|
||||
DemoEntryPoint_1 | D1FE | PUSH BC | Stash the level counter on the stack. | |
D1FF | LD HL,($D230) | HL=*Pointer_CurrentLevelData. | ||
D202 | LD E,(HL) | DE=current level data pointer. | ||
D203 | INC HL | |||
D204 | LD D,(HL) | |||
D205 | INC HL | Increment the level data pointer by one to point to the next level. | ||
D206 | LD ($D230),HL | Write the next level pointer to *Pointer_CurrentLevelData. | ||
D209 | EX DE,HL | Exchange the DE and HL registers. | ||
D20A | LD A,($D58A) | A=*Level. | ||
D20D | INC A | Increment A by one. | ||
D20E | DAA | DAA. | ||
D20F | LD ($D58A),A | Write A to *Level. | ||
D212 | CALL Game_Initialisation | Call Game_Initialisation. | ||
D215 | LD A,$01 | A=01. | ||
D217 | POP BC | Restore BC from the stack. | ||
D218 | PUSH BC | Stash BC on the stack. | ||
D219 | CALL Print_HelperPreviewImage | Call Print_HelperPreviewImage. | ||
D21C | CALL Colourise_PreviewGrid | Call Colourise_PreviewGrid. | ||
D21F | EI | Enable interrupts. | ||
D220 | CALL StartGame | Call StartGame. | ||
D223 | POP BC | Restore BC from the stack. | ||
D224 | DJNZ DemoEntryPoint_1 | Decrease counter by one and loop back to DemoEntryPoint_1 until counter is zero. | ||
D226 | LD SP,($D22E) | Restore the original stack pointer from *Storage_StackPointer. | ||
D22A | IM 1 | Interrupt mode 01. | ||
D22C | EI | Enable interrupts. | ||
D22D | RET | Return. |
Prev: CBDE | Up: Map | Next: D22E |