Prev: 29268 Up: Map Next: 29453
29385: Handler: Level Complete
Used by the routine at Handler_LevelReset.
Skip over anything fancy if the game is in demo mode.
Handler_LevelComplete 29385 LD A,(26355) Jump to InitialiseLevel if *Flag_ActiveDemoMode is active.
29388 OR A
29389 JP NZ,InitialiseLevel
The alien mothership only appears in phase 4 so skip over all the clearing routine unless this is phase 4.
29392 LD A,(26353) If *Phase is not equal to 4 call PrintHeader and then jump to LevelComplete_DrawShip.
29395 CP 4
29397 CALL NZ,PrintHeader
29400 JR NZ,LevelComplete_DrawShip
Clear the mothership phase playfield.
29402 CALL PrintLives Call PrintLives.
29405 LD HL,22848 HL=22848 (attribute buffer location).
29408 LD C,2 Set a row counter in C for 2 rows.
ClearMothership_RowLoop 29410 LD B,224 Set a column counter in B for 224 columns.
ClearMothership_Loop 29412 PUSH BC Stash the row, column counters and attribute buffer pointer on the stack.
29413 PUSH HL
29414 LD A,(HL) Jump to ClearMothership_Next if the attribute byte being pointed to is either INK:RED, PAPER:BLACK (2) or INK:BLACK, PAPER:RED (16).
29415 CP 2
29417 JR Z,ClearMothership_Next
29419 CP 16
29421 JR Z,ClearMothership_Next
29423 CP 22 Is the attribute byte being pointed to INK:YELLOW, PAPER:RED?
29425 LD A,0 Set A to BLACK (0).
29427 JR NZ,ClearMothership_Write Jump to ClearMothership_Write if the attribute byte being pointed to is INK:YELLOW, PAPER:RED.
29429 LD A,16 Set A to INK:BLACK, PAPER:RED (16).
ClearMothership_Write 29431 LD (HL),A Write the attribute value in A to the attribute buffer.
29432 CALL ConvertAttributeToScreenBufferAddress Call ConvertAttributeToScreenBufferAddress.
29435 XOR A Set A to 0 (clearing/ empty value).
29436 LD B,8 Set a line counter in B (8 lines in a character block).
ClearMothership_ClearLine_Loop 29438 LD (HL),A Write the empty data to the screen buffer pointer.
29439 INC H Move down one pixel line in the screen buffer.
29440 DJNZ ClearMothership_ClearLine_Loop Decrease the line counter by one and loop back to ClearMothership_ClearLine_Loop until all 8 lines of the character block have been erased.
ClearMothership_Next 29442 POP HL Restore the attribute buffer pointer from the stack.
29443 INC HL Move to the next attribute byte.
29444 POP BC Restore the row and column counters from the stack.
29445 DJNZ ClearMothership_Loop Decrease the column counter by one and loop back to ClearMothership_Loop until all of the column blocks have been erased.
29447 DEC C Decrease the row counter by one.
29448 JR NZ,ClearMothership_RowLoop Jump back to ClearMothership_RowLoop until all of the rows have been processed.
Redraw the players ship on the screen.
LevelComplete_DrawShip 29450 CALL DrawShip Call DrawShip.
Prev: 29268 Up: Map Next: 29453