|  | Routines | 
| Prev: 51545 | Up: Map | Next: 51943 | 
|  | |||||||||||||||
| 
Clears the cashbox flags, clears the screen and displays the phase number.
 | |||||||||||||||
| Prep_Display_Phase | 51639 | LD HL,257 | Writes 1 to both CashboxReference_Inactive and CashboxReference_Active. | ||||||||||||
| 51642 | LD (54364),HL | ||||||||||||||
| 51645 | LD HL,52365 | Clear down the deposit flags (copies 0 to each from DoorDeposited_01). | |||||||||||||
| 51648 | LD DE,52366 | ||||||||||||||
| 51651 | LD BC,13 | ||||||||||||||
| 51654 | LD (HL),0 | ||||||||||||||
| 51656 | LDIR | ||||||||||||||
| 51658 | XOR A | Call Clear_Screen (using 0). | |||||||||||||
| 51659 | CALL Clear_Screen | ||||||||||||||
| 51662 | 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=0 (clear screen).
 | |||||||||||||||
| Clear_Screen | 51664 | LD HL,16384 | Clears the screen buffer by writing 0 to all 6912 memory locations. | ||||||||||||
| 51667 | LD DE,16385 | ||||||||||||||
| 51670 | LD BC,6911 | ||||||||||||||
| 51673 | LD (HL),A | ||||||||||||||
| 51674 | LDIR | ||||||||||||||
| 51676 | RET | ||||||||||||||
| 
Displays the current "phase".
 | |||||||||||||||
| Display_Phase | 51677 | LD HL,51790 | Copies Phase_Copy into Progress_Buffer (5 bytes of text data). | ||||||||||||
| 51680 | LD DE,51804 | ||||||||||||||
| 51683 | LD BC,5 | ||||||||||||||
| 51686 | LDIR | ||||||||||||||
| 51688 | LD HL,(51802) | Writes Phase_ASCII to Progress_Buffer (at $CA61 - just overwriting the numeric part). | |||||||||||||
| 51691 | LD (51809),HL | ||||||||||||||
| 51694 | LD HL,51786 | Call Progress_Base_10 with Phase. | |||||||||||||
| 51697 | CALL Progress_Base_10 | ||||||||||||||
| 51700 | LD HL,(51809) | Writes $CA61 back to Phase_ASCII. | |||||||||||||
| 51703 | LD (51802),HL | ||||||||||||||
| 51706 | RET | Return. | |||||||||||||
| 
Displays the current "day".
 | |||||||||||||||
| Display_Day | 51707 | LD HL,51795 | Copies Day_Copy into Progress_Buffer ($05 bytes of text data). | ||||||||||||
| 51710 | LD DE,51804 | ||||||||||||||
| 51713 | LD BC,5 | ||||||||||||||
| 51716 | LDIR | ||||||||||||||
| 51718 | LD HL,(51800) | Writes Day_ASCII to Progress_Buffer (at $CA61 - just overwriting the numeric part). | |||||||||||||
| 51721 | LD (51809),HL | ||||||||||||||
| 51724 | LD HL,51788 | Call Progress_Base_10 with Day. | |||||||||||||
| 51727 | CALL Progress_Base_10 | ||||||||||||||
| 51730 | LD HL,(51809) | Writes $CA61 back to Day_ASCII. | |||||||||||||
| 51733 | LD (51800),HL | ||||||||||||||
| 51736 | RET | Return. | |||||||||||||
| Progress_Base_10 | 51737 | LD A,(HL) | If the passed number is not more than 10 jump to Progress_Divisible_10. | ||||||||||||
| 51738 | INC A | ||||||||||||||
| 51739 | CP 10 | ||||||||||||||
| 51741 | JR NC,Progress_Divisible_10 | ||||||||||||||
| 51743 | 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 + 48 = 49 (e.g. "1" in ASCII). | |||||||||||||
| 51744 | ADD A,48 | ||||||||||||||
| 51746 | LD (51810),A | ||||||||||||||
| 51749 | JR Print_Progress | Jump to Print_Progress. | |||||||||||||
| Progress_Divisible_10 | 51751 | LD (HL),0 | Reset the current progress digit to 0. | ||||||||||||
| 51753 | 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.
 | |||||||||||||||
| 51754 | INC (HL) | Increase this second digit by one. | |||||||||||||
| 51755 | LD A,(HL) | Add ASCII "0" so for example 1 ends up being 1 + 48 = 49 (e.g. "1" in ASCII). Write this number to 51809 (for Progress_Buffer). | |||||||||||||
| 51756 | ADD A,48 | ||||||||||||||
| 51758 | LD (51809),A | ||||||||||||||
| 51761 | DEC HL | Move back to point to the original location of HL. | |||||||||||||
| 51762 | LD A,(HL) | Again, add ASCII "0" for this digit too. Write this number to $CA62 (for Progress_Buffer). | |||||||||||||
| 51763 | ADD A,48 | ||||||||||||||
| 51765 | LD (51810),A | ||||||||||||||
| 
Prints the current progress buffer message to the screen.
 | |||||||||||||||
| Print_Progress | 51768 | LD HL,51804 | Prints Progress_Buffer to the screen buffer at $486C using Print_TwoToneText. 
 | ||||||||||||
| 51771 | LD DE,18540 | ||||||||||||||
| 51774 | LD BC,1795 | ||||||||||||||
| 51777 | CALL Print_TwoToneText | ||||||||||||||
| 51780 | LD B,80 | Interrupt driven HALT loop ($50 cycles). | |||||||||||||
| Progress_Halt_Loop | 51782 | HALT | |||||||||||||
| 51783 | DJNZ Progress_Halt_Loop | ||||||||||||||
| 51785 | RET | Return. | |||||||||||||
| Phase | 51786 | DEFW 6 | |||||||||||||
| Day | 51788 | DEFW 1 | |||||||||||||
| Phase_Copy | 51790 | DEFM "PHASE" | "PHASE". | ||||||||||||
| Day_Copy | 51795 | DEFM " DAY " | " DAY ". | ||||||||||||
| Day_ASCII | 51800 | DEFM " 1" | " 1". | ||||||||||||
| Phase_ASCII | 51802 | DEFM " 6" | " 6". | ||||||||||||
| Progress_Buffer | 51804 | DEFM "PHASE 6",255 | This is a buffer - so text changes during play: "PHASE 6". | ||||||||||||
| 
Clears the screen and displays the day number.
 | |||||||||||||||
| Prep_Display_Day | 51812 | XOR A | Clears the screen by passing 0 to Clear_Screen. | ||||||||||||
| 51813 | CALL Clear_Screen | ||||||||||||||
| 51816 | CALL Display_Day | Call Display_Day. | |||||||||||||
| 51819 | RET | Return. | |||||||||||||
| 
Clear down the day/ progress states.
 | |||||||||||||||
| Init_Progress | 51820 | LD HL,0 | Clears Phase and Day (writes 0000 to them). | ||||||||||||
| 51823 | LD (51786),HL | ||||||||||||||
| 51826 | LD (51788),HL | ||||||||||||||
| 51829 | LD A,32 | Writes ASCII space (32) to 51809 and ASCII "0" (48) to 51810 (i.e. writes " 0" to the numeric portion of Progress_Buffer). | |||||||||||||
| 51831 | LD HL,51809 | ||||||||||||||
| 51834 | LD (HL),A | ||||||||||||||
| 51835 | INC HL | ||||||||||||||
| 51836 | LD A,48 | ||||||||||||||
| 51838 | LD (HL),A | ||||||||||||||
| 51839 | RET | Return. | |||||||||||||
| Cashboxes_Completed_Flag | 51840 | DEFB 0 | |||||||||||||
| 
This entry point is used by the routine at Init_Title_Screen.
 | |||||||||||||||
| Cashboxes_Completed | 51841 | CALL Prep_Display_Phase_0 | |||||||||||||
| 51844 | RET C | ||||||||||||||
| 51845 | LD B,16 | ||||||||||||||
| Cashboxes_Flash_Loop | 51847 | PUSH BC | |||||||||||||
| 51848 | LD A,B | ||||||||||||||
| 51849 | AND 1 | ||||||||||||||
| 51851 | CALL Deposit_Flash_Prep | ||||||||||||||
| 51854 | LD B,16 | ||||||||||||||
| 51856 | CALL Halt_Loop | ||||||||||||||
| 51859 | POP BC | ||||||||||||||
| 51860 | DJNZ Cashboxes_Flash_Loop | ||||||||||||||
| 51862 | LD B,48 | ||||||||||||||
| 51864 | CALL Halt_Loop | ||||||||||||||
| 51867 | LD A,B | ||||||||||||||
| 51868 | CALL Deposit_Flash_Prep | ||||||||||||||
| 51871 | CALL Random_Number | ||||||||||||||
| 51874 | LD B,A | ||||||||||||||
| 51875 | LD A,R | ||||||||||||||
| 51877 | LD C,A | ||||||||||||||
| 51878 | ADD A,B | ||||||||||||||
| 51879 | LD D,A | ||||||||||||||
| 51880 | LD A,(52175) | ||||||||||||||
| 51883 | LD HL,52148 | ||||||||||||||
| 51886 | CALL 50112 | ||||||||||||||
| 51889 | LD (52175),A | ||||||||||||||
| 51892 | LD B,0 | ||||||||||||||
| 51894 | JP Halt_Loop | ||||||||||||||
| Deposit_Flash_Prep | 51897 | LD HL,52365 | Writes A across all the deposit flags (copies to each from DoorDeposited_01). | ||||||||||||
| 51900 | LD DE,52366 | ||||||||||||||
| 51903 | LD BC,13 | ||||||||||||||
| 51906 | LD (HL),A | ||||||||||||||
| 51907 | LDIR | ||||||||||||||
| 51909 | JP 52379 | Jump to 52379. | |||||||||||||
| Prep_Display_Phase_0 | 51912 | CALL Prep_Display_Phase | |||||||||||||
| 
This entry point is used by the routines at Flash_Lives and 52551.
 | |||||||||||||||
| Prep_Display_Phase_1 | 51915 | XOR A | Writes 0 to 54014. | ||||||||||||
| 51916 | LD (54014),A | ||||||||||||||
| 51919 | CALL Prep_Display_Phase_2 | ||||||||||||||
| 51922 | JR 51943 | ||||||||||||||
| Prep_Display_Phase_2 | 51924 | CALL Populate_Door_Buffer | Call Populate_Door_Buffer. | ||||||||||||
| 51927 | CALL Draw_PlayWithDoors | Call Draw_PlayWithDoors. | |||||||||||||
| 51930 | CALL Life_Images | Call Life_Images. | |||||||||||||
| 51933 | CALL 52379 | Call 52379. | |||||||||||||
| 51936 | CALL Draw_Score | Call Draw_Score. | |||||||||||||
| 51939 | CALL ActiveDoors | Call ActiveDoors. | |||||||||||||
| 51942 | RET | Return. | |||||||||||||
| Prev: 51545 | Up: Map | Next: 51943 |