![]() |
Routines |
| Prev: 7407 | Up: Map | Next: 74A4 |
|
Used by the routines at Handler_LevelComplete, Handler_DisplayMothershipBonus, TitleScreen and StartGame.
Initialises a new level, setting up the phase data, alien colours and player position.
|
|||||
| InitialiseLevel | 740C | LD HL,$6680 | Clear 006C bytes from 6680 onwards. | ||
| 740F | LD DE,$6681 | ||||
| 7412 | LD BC,$006C | ||||
| 7415 | LD (HL),B | ||||
| 7416 | LDIR | ||||
|
Evaluate the last phase.
|
|||||
| 7418 | LD HL,$66F1 | A=*Phase. | |||
| 741B | LD A,(HL) | ||||
| 741C | SUB $04 | Subtract 04 from *Phase. | |||
|
Self-modifying code; see 703E.
Point to the bullet count.
|
|||||
| 741E | LD DE,$703F | DE=703F. | |||
|
Is this the last phase?..
|
|||||
| 7421 | JR NZ,NextPhase | Jump to NextPhase if *Phase minus 04 is not equal to 00. | |||
|
The last phase was phase 04 so reset back to phase 00.
|
|||||
| 7423 | LD (HL),A | Write 00 to *Phase. | |||
|
Update the bullet count back to one shot.
|
|||||
| 7424 | INC A | Write 01 to *703F. | |||
| 7425 | LD (DE),A | ||||
| 7426 | PUSH HL | Stash the phase pointer on the stack. | |||
| 7427 | CALL GameIntro | Call GameIntro. | |||
| 742A | POP HL | Restore the phase pointer from the stack. | |||
| 742B | JR SetPhaseAlienCount | Jump to SetPhaseAlienCount. | |||
|
Move onto the next phase.
|
|||||
| NextPhase | 742D | INC (HL) | Increment *Phase by one. | ||
|
Update the bullet count to four shots.
|
|||||
| 742E | LD A,$04 | Write 04 to *703F. | |||
| 7430 | LD (DE),A | ||||
|
Set up the number of aliens.
|
|||||
| SetPhaseAlienCount | 7431 | LD A,(HL) | A=*Phase. | ||
| 7432 | PUSH AF | Stash the current phase on the stack. | |||
| 7433 | AND %00000110 | Keep only bits 1-2 to single out the following phases:
|
|||
|
Set the default number of aliens.
|
|||||
| 7435 | LD HL,$667F | Set *AlienCount to 08 aliens. | |||
| 7438 | LD (HL),$08 | ||||
| 743A | JR NZ,SetAlienPhaseData | Jump to SetAlienPhaseData if *Phase is either 02 03 or 04. | |||
|
Else, set the numher of aliens for phases 00 and 01.
|
|||||
| 743C | LD (HL),$0F | Set *AlienCount to 0F aliens. | |||
|
Now set up the phase data.
|
|||||
| SetAlienPhaseData | 743E | LD HL,$6637 | HL=Table_AlienPhaseData_02_03. | ||
| 7441 | POP AF | Restore the current phase from the stack. | |||
| 7442 | OR A | Jump to InitialisePhase01 if the current phase is not 00. | |||
| 7443 | JR NZ,InitialisePhase01 | ||||
| 7445 | LD HL,$65FB | HL=Table_AlienPhaseData_00. | |||
| 7448 | JR CopyPhaseData | Jump to CopyPhaseData. | |||
|
If this is phase 01 initialise it.
|
|||||
| InitialisePhase01 | 744A | CP $01 | Jump to InitialisePhase04 if the current phase is not 01. | ||
| 744C | JR NZ,InitialisePhase04 | ||||
| 744E | LD HL,$6619 | HL=Table_AlienPhaseData_01. | |||
| 7451 | JR CopyPhaseData | Jump to CopyPhaseData. | |||
|
If this is phase 04 initialise it.
|
|||||
| InitialisePhase04 | 7453 | CP $04 | Jump to CopyPhaseData if the current phase is not 04. | ||
| 7455 | JR NZ,CopyPhaseData | ||||
| 7457 | LD HL,$6647 | HL=Table_AlienPhaseData_04. | |||
|
Copy the phase data to the active phase data.
|
|||||
| CopyPhaseData | 745A | LD DE,$65DD | Copy *AlienCount multiplied by 02 bytes from the phase data to Table_CurrentAlienPhaseData. | ||
| 745D | LD A,($667F) | ||||
| 7460 | ADD A,A | ||||
| 7461 | LD C,A | ||||
| 7462 | LDIR | ||||
|
Is this phase 01?
|
|||||
| 7464 | LD A,($66F1) | Jump to Initialise_Phase_02 if *Phase is not equal to 01. | |||
| 7467 | CP $01 | ||||
| 7469 | JR NZ,Initialise_Phase_02 | ||||
|
Set the alien colouring for phase 01.
Set the bird alien colouring to produce.
|
|||||
| 746B | LD BC,$4304 | Set B to INK:MAGENTA, PAPER:BLACK (BRIGHT), and C to GREEN. | |||
| 746E | JR InitialiseLevel_SetColors | Jump to InitialiseLevel_SetColors. | |||
|
Is this phase 02?
|
|||||
| Initialise_Phase_02 | 7470 | CP $02 | Jump to Initialise_Phase_03 if *Phase is not equal to 02. | ||
| 7472 | JR NZ,Initialise_Phase_03 | ||||
|
Set the alien colouring for phase 02.
Set the Pheenix colouring to produce:
|
|||||
| 7474 | LD B,$41 | Set both B and C to INK:BLUE, PAPER:BLACK (BRIGHT). | |||
| 7476 | LD C,B | ||||
| 7477 | JR InitialiseLevel_SetColors | Jump to InitialiseLevel_SetColors. | |||
|
Is this phase 03?
|
|||||
| Initialise_Phase_03 | 7479 | CP $03 | Jump to Initialise_Phase_Default if *Phase is not equal to 03. | ||
| 747B | JR NZ,Initialise_Phase_Default | ||||
|
Set the alien colouring for phase 03.
Set the Pheenix colouring to produce:
|
|||||
| 747D | LD B,$43 | Set both B and C to INK:MAGENTA, PAPER:BLACK (BRIGHT). | |||
| 747F | LD C,B | ||||
| 7480 | JR InitialiseLevel_SetColors | Jump to InitialiseLevel_SetColors. | |||
|
This is either phase 00 or 04. Set the bird alien colouring to produce:
|
|||||
| Initialise_Phase_Default | 7482 | LD BC,$0643 | Set B to YELLOW, and C to INK:MAGENTA, PAPER:BLACK (BRIGHT). | ||
|
Set the alien colourings.
|
|||||
| InitialiseLevel_SetColors | 7485 | LD ($667D),BC | Write B to *Pheenix_Colour_01 and C to *Pheenix_Colour_02. | ||
|
Set the players ship starting position.
|
|||||
| 7489 | LD HL,$66ED | Write CE to *PlayerAttributeBufferPosition. | |||
| 748C | LD (HL),$CE | ||||
| 748E | LD A,($66F1) | Stash *Phase on the stack. | |||
| 7491 | PUSH AF | ||||
|
The TransitionEffect shouldn't play out for the first phase.
|
|||||
| 7492 | AND %00000110 | Call TransitionEffect if *Phase is either 02 03 or 04. | |||
| 7494 | CALL NZ,TransitionEffect | ||||
| 7497 | CALL PrintHeader | Call PrintHeader. | |||
|
The alien mothership is only shown in phase 04.
|
|||||
| 749A | POP AF | Call Draw_AlienMothership if *Phase is 04. | |||
| 749B | CP $04 | ||||
| 749D | CALL Z,Draw_AlienMothership | ||||
| 74A0 | CALL DrawShip | Call DrawShip. | |||
| 74A3 | RET | Return. | |||
| Prev: 7407 | Up: Map | Next: 74A4 |