![]() |
Routines |
| Prev: 95D7 | Up: Map | Next: 961B |
|
Used by the routine at UpdateFixedEntities.
Called whenever FRAMES has changed. Once 32 frames have passed, FRAMES is reduced by that, the seconds in ClockSeconds are increased (in BCD), the minutes in ClockMinutes when the seconds reach 60 and the hours in ClockHours when the minutes reach 60 and then the clock is printed on the screen.
|
||||
| ClockTick | 95DA | LD A,($5C78) | Fetch FRAMES. | |
| 95DD | CP $32 | Return if fewer than 32 frames have passed. | ||
| 95DF | RET C | |||
| 95E0 | SUB $32 | Subtract 32 as a second has passed. | ||
| 95E2 | LD ($5C78),A | Update FRAMES. | ||
| 95E5 | LD HL,$5E3F | Point HL at the clock seconds at ClockSeconds. | ||
| 95E8 | LD A,(HL) | Fetch the seconds. | ||
| 95E9 | INC A | Increment the seconds. | ||
| 95EA | DAA | Convert it to BCD. | ||
| 95EB | LD (HL),A | Write it back. | ||
| 95EC | CP $60 | Jump to ClockTick_Print if the seconds have not reached 60. | ||
| 95EE | JR NZ,ClockTick_Print | |||
| 95F0 | LD (HL),$00 | Reset the seconds to 00. | ||
| 95F2 | DEC HL | Move HL on to the minutes. | ||
| 95F3 | LD A,(HL) | Fetch the minutes. | ||
| 95F4 | INC A | Increment the minutes. | ||
| 95F5 | DAA | Convert it to BCD. | ||
| 95F6 | LD (HL),A | Write it back. | ||
| 95F7 | CP $60 | Jump to ClockTick_Print if the minutes have not reached 60. | ||
| 95F9 | JR NZ,ClockTick_Print | |||
| 95FB | LD (HL),$00 | Reset the minutes to 00. | ||
| 95FD | DEC HL | Move HL on to the hours. | ||
| 95FE | LD A,(HL) | Fetch the hours. | ||
| 95FF | INC A | Increment the hours. | ||
| 9600 | DAA | Convert it to BCD. | ||
| 9601 | AND %00001111 | Keep only bits 0-3. | ||
| 9603 | LD (HL),A | Write it back. | ||
|
Print the clock.
|
||||
| ClockTick_Print | 9604 | LD HL,$40C8 | HL=40C8 (screen buffer location). | |
|
This entry point is used by the routine at GameStats.
|
||||
| PrintClock | 9607 | CALL ScreenAddress | Call ScreenAddress to get the screen address. | |
| 960A | LD DE,$5E3D | Point DE at the clock hours at ClockHours. | ||
| 960D | LD B,$02 | B=02. | ||
| 960F | CALL PrintScore_LowDigit | Call PrintScore_LowDigit to print the last digit of the hours and both digits of the minutes. | ||
| 9612 | LD DE,$5E3F | Point DE at the clock seconds at ClockSeconds. | ||
| 9615 | INC HL | Move HL on to the next character position. | ||
| 9616 | LD B,$01 | B=01. | ||
| 9618 | JP PrintScore_Loop | Jump to PrintScore_Loop to print both digits of the seconds. | ||
| Prev: 95D7 | Up: Map | Next: 961B |