![]() |
Routines |
| Prev: C7C0 | Up: Map | Next: C941 |
|
Displays the title screen and on return, sets the control method and initiates variables for a new game.
|
||||
| Init_Title_Screen | C7E5 | LD HL,$CBB4 | Calls TitleScreen with HL=Copied_5B80. | |
| C7E8 | CALL TitleScreen | |||
| C7EB | LD B,$00 | Unused. | ||
| C7ED | LD A,($5CB0) | Grab the value stored at Controller and if it is $01 then jump ahead to Set_Control_Alias which writes Controls_Keyboard to Control_Routine_Alias. | ||
| C7F0 | LD HL,$D39B | |||
| C7F3 | DEC A | |||
| C7F4 | JR Z,Set_Control_Alias | |||
| C7F6 | LD HL,$D392 | Write Controls_Joystick to Control_Routine_Alias. | ||
| Set_Control_Alias | C7F9 | LD ($CE12),HL | ||
|
Resets all game variables/ states ready for a new game.
|
||||
| C7FC | LD HL,$CD86 | Clears the score (writes 00 over seven bytes from Scoredigit06). | ||
| C7FF | LD DE,$CD87 | |||
| C802 | LD (HL),$00 | |||
| C804 | LD BC,$0006 | |||
| C807 | LDIR | |||
| Starting_Lives | C809 | LD A,$03 | Initialise number of lives (Lives) to 03. | |
| C80B | LD ($CC59),A | |||
| C80E | LD HL,$0101 | Initialise cash deposit box position (CashboxReference_Inactive) to 0101. (position 1) | ||
| C811 | LD ($D45C),HL | |||
| C814 | LD HL,$0000 | Flag all doors as being empty. | ||
| C817 | LD ($CE14),HL | |||
| C81A | LD ($CE16),HL | |||
| C81D | LD ($CE18),HL | |||
| C820 | LD HL,$2020 | Clear day / phase text buffers at Day_ASCII and Phase_ASCII to 2020 (ASCII space-space). | ||
| C823 | LD ($CA58),HL | |||
| C826 | LD ($CA5A),HL | |||
| C829 | LD HL,$CC8D | Clear down the deposit flags (copies 00 to each from DoorDeposited_01). | ||
| C82C | LD DE,$CC8E | |||
| C82F | LD BC,$000D | |||
| C832 | LD (HL),$00 | |||
| C834 | LDIR | |||
| C836 | XOR A | Set the border to black. | ||
| C837 | OUT ($FE),A | |||
| C839 | INC A | Write 01 to CBCF. | ||
| C83A | LD ($CBCF),A | |||
| C83D | CALL Init_Progress | Set attributes to print "Day" / "Phase". | ||
| C840 | CALL Set_Day_Attributes | |||
| C843 | CALL Prep_Display_Day | Print the current day. | ||
| C846 | LD A,$03 | Set the default door speed multiplier in CE1B to 03. Note that this value never changes. | ||
| C848 | LD ($CE1B),A | |||
| C84B | LD HL,$0500 | Set the default game speed at CE1C to 0500. | ||
| C84E | LD ($CE1C),HL | |||
| C851 | LD A,$01 | Writes 01 to D191. This indicates the reward screen should be displayed at the end of day 2. | ||
| C853 | LD ($D191),A | |||
| C856 | LD A,($5CB1) | Grabs the chosen starting phase in Level, if it's phase 1 then jump to Phase_01. HL points to the current phase (Phase). | ||
| C859 | LD HL,$CA4A | |||
| C85C | DEC A | |||
| C85D | JR Z,Phase_01 | |||
|
The player has chosen phase 3 or 6, so adjust the gameplay.
|
||||
| C85F | CALL $C941 | Speed the game up twice (to phase 3) and set the phase counter to 3. | ||
| C862 | INC (HL) | |||
| C863 | CALL $C941 | |||
| C866 | INC (HL) | |||
| C867 | DEC A | If phase 3 then move onto the appropriate logic. | ||
| C868 | JR Z,Init_Title_Screen_0 | |||
|
The player has chosen phase 6, so adjust the gameplay.
|
||||
| C86A | CALL $C941 | Speed the game up three times (to phase 6) and set the phase counter to 6. | ||
| C86D | INC (HL) | |||
| C86E | CALL $C941 | |||
| C871 | INC (HL) | |||
| C872 | CALL $C941 | |||
| C875 | INC (HL) | |||
| C876 | JR Init_Title_Screen_1 | Move forward to the appropriate logic. | ||
|
The player has chosen phase 1, start with the defaults.
|
||||
| Phase_01 | C878 | LD HL,$CE42 | Writes the character choosing routine Choose_Default_Set to Chooser_Routine_Buffer. | |
| C87B | LD ($CE1F),HL | |||
| C87E | CALL Cashboxes_Completed | Run this phase. | ||
| C881 | RET C | Return if the game's over. | ||
|
Phase 2
|
||||
| C882 | LD HL,$CE6F | Writes the character choosing routine Choose_Bandit_03 to Chooser_Routine_Buffer. | ||
| C885 | LD ($CE1F),HL | |||
| C888 | CALL $C941 | Speed the game up. | ||
| C88B | CALL Cashboxes_Completed | Run this phase. | ||
| C88E | RET C | Return if the game's over. | ||
|
Phase 3
|
||||
| Init_Title_Screen_0 | C88F | LD HL,$CE5F | Writes the character choosing routine Choose_Bandit_02 to Chooser_Routine_Buffer. | |
| C892 | LD ($CE1F),HL | |||
| C895 | CALL $C941 | Speed the game up. | ||
| C898 | CALL Cashboxes_Completed | Run this phase. | ||
| C89B | RET C | Return if the game's over. | ||
|
Phase 4
|
||||
| C89C | LD HL,$CE55 | Writes the character choosing routine Choose_Julius to Chooser_Routine_Buffer. | ||
| C89F | LD ($CE1F),HL | |||
| C8A2 | CALL $C941 | Speed the game up. | ||
| C8A5 | CALL Cashboxes_Completed | Run this phase. | ||
| C8A8 | RET C | Return if the game's over. | ||
|
Phase 5
|
||||
| C8A9 | LD HL,$CE7E | Writes the character choosing routine Choose_Bandit_04 to Chooser_Routine_Buffer. | ||
| C8AC | LD ($CE1F),HL | |||
| C8AF | CALL $C941 | Speed the game up. | ||
| C8B2 | CALL Cashboxes_Completed | Run this phase. | ||
| C8B5 | RET C | Return if the game's over. | ||
|
Phase 6
|
||||
| Init_Title_Screen_1 | C8B6 | LD HL,$CE8D | Writes the character choosing routine Choose_Bandit_05 to Chooser_Routine_Buffer. | |
| C8B9 | LD ($CE1F),HL | |||
| C8BC | CALL $C941 | Speed the game up. | ||
| C8BF | CALL Cashboxes_Completed | Run this phase. | ||
| C8C2 | RET C | Return if the game's over. | ||
|
Phase 7
|
||||
| C8C3 | LD HL,$CE9C | Writes the character choosing routine Choose_Bandit_06 to Chooser_Routine_Buffer. | ||
| C8C6 | LD ($CE1F),HL | |||
| C8C9 | CALL $C941 | Speed the game up. | ||
| C8CC | CALL Cashboxes_Completed | Run this phase. | ||
| C8CF | RET C | Return if the game's over. | ||
|
Phase 8
|
||||
| C8D0 | LD HL,$CE9C | Writes the character choosing routine Choose_Bandit_06 to Chooser_Routine_Buffer. | ||
| C8D3 | LD ($CE1F),HL | |||
| C8D6 | CALL $C941 | Speed the game up. | ||
| C8D9 | CALL Set_Dusk_Attributes | Change from day to dusk. | ||
| C8DC | CALL Cashboxes_Completed | Run this phase. | ||
| C8DF | RET C | Return if the game's over. | ||
|
Phase 9
|
||||
| C8E0 | LD HL,$CE9C | Writes the character choosing routine Choose_Bandit_06 to Chooser_Routine_Buffer. | ||
| C8E3 | LD ($CE1F),HL | |||
| C8E6 | CALL $C941 | Speed the game up. | ||
| C8E9 | CALL Set_Night_Attributes | Change from dusk to night. | ||
| C8EC | CALL Cashboxes_Completed | Run this phase. | ||
| C8EF | RET C | Return if the game's over. | ||
|
Day 2 / Phase 10 (loops for subsequent days)
|
||||
| Init_Title_Screen_2 | C8F0 | CALL Set_Day_Attributes | Change from night back to day. | |
| C8F3 | CALL Prep_Display_Day | New day (day 2). | ||
| C8F6 | LD B,$07 | Seven daytime phases on day 2, all with every character. | ||
| Init_Title_Screen_3 | C8F8 | PUSH BC | Remember this | |
| C8F9 | CALL Cashboxes_Completed | Run this phase. | ||
| C8FC | POP BC | Restore phase counter (so stack is correct for next instruction). | ||
| C8FD | RET C | Return if the game's over. | ||
|
Phase 11 - 16
|
||||
| C8FE | PUSH BC | Remember counter again. | ||
| C8FF | CALL $C941 | Speed the game up. | ||
| C902 | POP BC | Restore phase counter again. | ||
| C903 | DJNZ Init_Title_Screen_3 | Loop back if there are more phases to run. | ||
|
Phase 17
|
||||
| C905 | CALL Set_Dusk_Attributes | Change from day to dusk. | ||
| C908 | CALL Cashboxes_Completed | Run this phase. | ||
| C90B | RET C | Return if the game's over. | ||
|
Phase 18
|
||||
| C90C | CALL Set_Night_Attributes | Change from dusk to night. | ||
| C90F | CALL Cashboxes_Completed | Run this phase. | ||
| C912 | RET C | Return if the game's over. | ||
|
Phase 19 and beyond
|
||||
| C913 | LD HL,$D191 | Having got through all the phases, are we on day 2? Also reset the flag so the reward screen isn't shown for day 3 and above. | ||
| C916 | LD A,(HL) | |||
| C917 | LD (HL),$00 | |||
| C919 | AND A | |||
| C91A | JR Z,Init_Title_Screen_2 | Jump back if we're not | ||
| C91C | LD HL,$CBB4 | We have completed two days, display the reward screen. | ||
| C91F | LD DE,$5B80 | |||
| C922 | LD BC,$0040 | |||
| C925 | LDIR | |||
| C927 | CALL Sheriff_Star | Display the reward screen. | ||
| C92A | CALL Halt_Loop | Wait for 0400 cycles | ||
| C92D | CALL Halt_Loop | |||
| C930 | CALL Halt_Loop | |||
| C933 | CALL Halt_Loop | |||
| Init_Title_Screen_4 | C936 | XOR A | Wait for a key to be pressed. Read the keyboard to bits 0-4 ... ... and turn on bits 5-7. If no key is pressed, this will set A to 0. Loop round if this is the case. | |
| C937 | IN A,($FE) | |||
| C939 | OR $E0 | |||
| C93B | INC A | |||
| C93C | JR Z,Init_Title_Screen_4 | |||
| C93E | NOP | |||
| C93F | JR Init_Title_Screen_2 | Loop back for another day. | ||
| Prev: C7C0 | Up: Map | Next: C941 |