Prev: CA80 Up: Map Next: CAE7
CA81: Run a phase and bonus level until completed or game over
Used by the routine at Init_Title_Screen.
Cashboxes_Completed CA81 CALL Cashboxes_Completed_0 Initialize everything and run the phase.
CA84 RET C Return we've run out of lives.
At this point, the phase has been complete successfully, so flash the deposit boxes.
CA85 LD B,$10 Flash the deposit boxes 10 times.
Cashboxes_Flash_Loop CA87 PUSH BC Remember this.
CA88 LD A,B Alternate between 0 and 1 for each iteration.
CA89 AND $01
CA8B CALL Deposit_Flash_Prep Display or hide all boxes.
CA8E LD B,$10 Pause.
CA90 CALL Halt_Loop
CA93 POP BC Restore number of times.
CA94 DJNZ Cashboxes_Flash_Loop Loop if there is more to do.
CA96 LD B,$30 Pause.
CA98 CALL Halt_Loop
CA9B LD A,B A is now 0.
CA9C CALL Deposit_Flash_Prep Set the initial state up and run the phase.
Get three random times from three separate sources, and run the duel with them.
CA9F CALL Random_Number Generate a random number.
CAA2 LD B,A Put this in B as the delay before the first dueller draws.
CAA3 LD A,R Store R in C as the delay before the second dueller draws.
CAA5 LD C,A
CAA6 ADD A,B Combine the two previous values (ignoring overflow).
CAA7 LD D,A Put this in D as the delay before the third dueller draws.
CAA8 LD A,($CBCF) The value in CBCF is never used.
CAAB LD HL,$CBB4 Point to data that will be copied to Print_TwoToneText_Alias.
CAAE CALL $C3C0 Run the duel.
CAB1 LD ($CBCF),A Set CBCF to 1 if the duel completed successfully, or 0 if player lost a life.
CAB4 LD B,$00 Pause and return.
CAB6 JP Halt_Loop
This routine sets or clears all the deposit flags, then displays them. This is used to flash the display at the end of a phase.
Deposit_Flash_Prep CAB9 LD HL,$CC8D Writes A across all the deposit flags (copies to each from DoorDeposited_01).
CABC LD DE,$CC8E
CABF LD BC,$000D
CAC2 LD (HL),A
CAC3 LDIR
CAC5 JP $CC9B Redraw the boxes.
This entry point is used by the routine in Cashboxes_Completed.
Cashboxes_Completed_0 CAC8 CALL Prep_Display_Phase Print "day n" (if required) and "phase n".
Initialize the state of play, either from starting a new phase or losing a life. This entry point is used by the routines at Flash_Lives and CD47.
Cashboxes_Completed_1 CACB XOR A Clear the "mistakes" bit field at Mistakes.
CACC LD ($D2FE),A
CACF CALL Cashboxes_Completed_2
CAD2 JR $CAE7 Jump to the main loop.
Initialize some things.
Cashboxes_Completed_2 CAD4 CALL Populate_Door_Buffer Initialize door flags.
CAD7 CALL Draw_PlayWithDoors Initialize the playfield.
CADA CALL Life_Images Display the "life" images.
CADD CALL $CC9B Display the deposit boxes.
CAE0 CALL Draw_Score Display the score.
CAE3 CALL ActiveDoors Highlight the active doors.
CAE6 RET Return.
Prev: CA80 Up: Map Next: CAE7