Prev: C959 Up: Map Next: CAE7
C9B7: Prepare To Display The Current Phase
Clears the cashbox flags, clears the screen and displays the phase number.
Prep_Display_Phase C9B7 LD HL,$0101 Writes 01 to both CashboxReference_Inactive and CashboxReference_Active.
C9BA LD ($D45C),HL
C9BD LD HL,$CC8D Clear down the deposit flags (copies 00 to each from DoorDeposited_01).
C9C0 LD DE,$CC8E
C9C3 LD BC,$000D
C9C6 LD (HL),$00
C9C8 LDIR
C9CA XOR A Call Clear_Screen (using 00).
C9CB CALL Clear_Screen
C9CE JR Display_Phase Jump to Display_Phase.
This routine has the ability to write any value across the screen buffer, however it's only ever called with A=00 (clear screen).
Clear_Screen C9D0 LD HL,$4000 Clears the screen buffer by writing 00 to all 6912 memory locations.
C9D3 LD DE,$4001
C9D6 LD BC,$1AFF
C9D9 LD (HL),A
C9DA LDIR
C9DC RET
Displays the current "phase".
Display_Phase C9DD LD HL,$CA4E Copies Phase_Copy into Progress_Buffer (05 bytes of text data).
C9E0 LD DE,$CA5C
C9E3 LD BC,$0005
C9E6 LDIR
C9E8 LD HL,($CA5A) Writes Phase_ASCII to Progress_Buffer (at $CA61 - just overwriting the numeric part).
C9EB LD ($CA61),HL
C9EE LD HL,$CA4A Call Progress_Base_10 with Phase.
C9F1 CALL Progress_Base_10
C9F4 LD HL,($CA61) Writes $CA61 back to Phase_ASCII.
C9F7 LD ($CA5A),HL
C9FA RET Return.
Displays the current "day".
Display_Day C9FB LD HL,$CA53 Copies Day_Copy into Progress_Buffer ($05 bytes of text data).
C9FE LD DE,$CA5C
CA01 LD BC,$0005
CA04 LDIR
CA06 LD HL,($CA58) Writes Day_ASCII to Progress_Buffer (at $CA61 - just overwriting the numeric part).
CA09 LD ($CA61),HL
CA0C LD HL,$CA4C Call Progress_Base_10 with Day.
CA0F CALL Progress_Base_10
CA12 LD HL,($CA61) Writes $CA61 back to Day_ASCII.
CA15 LD ($CA58),HL
CA18 RET Return.
This routine is for converting progress numbers into ASCII. On entry HL will be either Phase or Day.
Progress_Base_10 CA19 LD A,(HL) If the passed number is not more than 10 jump to Progress_Divisible_10.
CA1A INC A
CA1B CP $0A
CA1D JR NC,Progress_Divisible_10
CA1F LD (HL),A Stores the ASCII representation of the number at $CA62 (for Progress_Buffer). It adds ASCII "0" so for example 1 ends up being 1 + 30 = 31 (e.g. "1" in ASCII).
CA20 ADD A,$30
CA22 LD ($CA62),A
CA25 JR Print_Progress Jump to Print_Progress.
Ensures the progress digit remains 0-9. On entry HL will be either Phase or Day.
Progress_Divisible_10 CA27 LD (HL),$00 Reset the current progress digit to 00.
CA29 INC HL Use the secondary digit of the currently focused progress.
Note this doesn't account for a third digit and so leads to eventual corruption. Once past day/ phase "99", this will display "00" and past "09" the first ASCII digit doesn't point to any usable image data. Note however, this occurs after ~4 hours of game play so isn't especially an issue.
CA2A INC (HL) Increase this second digit by one.
CA2B LD A,(HL) Add ASCII "0" so for example 1 ends up being 1 + 30 = 31 (e.g. "1" in ASCII). Write this number to CA61 (for Progress_Buffer).
CA2C ADD A,$30
CA2E LD ($CA61),A
CA31 DEC HL Move back to point to the original location of HL.
CA32 LD A,(HL) Again, add ASCII "0" for this digit too. Write this number to $CA62 (for Progress_Buffer).
CA33 ADD A,$30
CA35 LD ($CA62),A
Prints the current progress buffer message to the screen.
Print_Progress CA38 LD HL,$CA5C Prints Progress_Buffer to the screen buffer at $486C using Print_TwoToneText.
Value Ink Paper Bright
07 07 00 00
03 03 00 00
CA3B LD DE,$486C
CA3E LD BC,$0703
CA41 CALL Print_TwoToneText
CA44 LD B,$50 Interrupt driven HALT loop ($50 cycles).
Progress_Halt_Loop CA46 HALT
CA47 DJNZ Progress_Halt_Loop
CA49 RET Return.
Phase CA4A DEFW $0006
Day CA4C DEFW $0001
Phase_Copy CA4E DEFM "PHASE" "PHASE".
Day_Copy CA53 DEFM " DAY " " DAY ".
Day_ASCII CA58 DEFM " 1" " 1".
Phase_ASCII CA5A DEFM " 6" " 6".
Progress_Buffer CA5C DEFM "PHASE 6",$FF This is a buffer - so text changes during play: "PHASE 6".
Clears the screen and displays the day number.
Prep_Display_Day CA64 XOR A Clears the screen by passing 00 to Clear_Screen.
CA65 CALL Clear_Screen
CA68 CALL Display_Day Call Display_Day.
CA6B RET Return.
Clear down the day/ progress states.
Init_Progress CA6C LD HL,$0000 Clears Phase and Day (writes 0000 to them).
CA6F LD ($CA4A),HL
CA72 LD ($CA4C),HL
CA75 LD A,$20 Writes ASCII space (20) to CA61 and ASCII "0" (30) to CA62 (i.e. writes " 0" to the numeric portion of Progress_Buffer).
CA77 LD HL,$CA61
CA7A LD (HL),A
CA7B INC HL
CA7C LD A,$30
CA7E LD (HL),A
CA7F RET Return.
Cashboxes_Completed_Flag CA80 DEFB $00
This entry point is used by the routine at Init_Title_Screen.
Cashboxes_Completed CA81 CALL Prep_Display_Phase_0
CA84 RET C
CA85 LD B,$10
Cashboxes_Flash_Loop CA87 PUSH BC
CA88 LD A,B
CA89 AND $01
CA8B CALL Deposit_Flash_Prep
CA8E LD B,$10
CA90 CALL Halt_Loop
CA93 POP BC
CA94 DJNZ Cashboxes_Flash_Loop
CA96 LD B,$30
CA98 CALL Halt_Loop
CA9B LD A,B
CA9C CALL Deposit_Flash_Prep
CA9F CALL Random_Number
CAA2 LD B,A
CAA3 LD A,R
CAA5 LD C,A
CAA6 ADD A,B
CAA7 LD D,A
CAA8 LD A,($CBCF)
CAAB LD HL,$CBB4
CAAE CALL $C3C0
CAB1 LD ($CBCF),A
CAB4 LD B,$00
CAB6 JP Halt_Loop
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 Jump to CC9B.
Prep_Display_Phase_0 CAC8 CALL Prep_Display_Phase
This entry point is used by the routines at Flash_Lives and CD47.
Prep_Display_Phase_1 CACB XOR A Writes 00 to D2FE.
CACC LD ($D2FE),A
CACF CALL Prep_Display_Phase_2
CAD2 JR $CAE7
Prep_Display_Phase_2 CAD4 CALL Populate_Door_Buffer Call Populate_Door_Buffer.
CAD7 CALL Draw_PlayWithDoors Call Draw_PlayWithDoors.
CADA CALL Life_Images Call Life_Images.
CADD CALL $CC9B Call CC9B.
CAE0 CALL Draw_Score Call Draw_Score.
CAE3 CALL ActiveDoors Call ActiveDoors.
CAE6 RET Return.
Prev: C959 Up: Map Next: CAE7