![]() |
Routines |
| Prev: 25752 | Up: Map | Next: 25840 |
|
Used by the routine at HandlerPlayer.
Adds one second to the time taken every 50 frames. The time is held as three BCD bytes from Time_1: hours (a single digit), minutes and seconds.
|
||||
| HandlerTime | 25799 | LD A,(23672) | Fetch the frame counter from FRAMES. | |
| 25802 | CP 50 | Return if less than 50 frames (one second) have passed. | ||
| 25804 | RET C | |||
| 25805 | SUB 50 | Take 50 frames off the frame counter. | ||
| 25807 | LD (23672),A | Write the remaining frames back to FRAMES. | ||
|
Update the time from the smallest unit upwards.
Handles the "seconds".
|
||||
| 25810 | LD HL,24115 | Point HL at the seconds of the time (Time_3). | ||
| 25813 | LD A,(HL) | Grab the seconds. | ||
| 25814 | INC A | Add one second. | ||
| 25815 | DAA | Convert to BCD and write seconds back to Time_3. | ||
| 25816 | LD (HL),A | |||
| 25817 | CP 96 | Return unless seconds have reached 96. | ||
| 25819 | RET NZ | |||
| 25820 | LD (HL),0 | Reset seconds to 0. | ||
|
Handles the "minutes".
|
||||
| 25822 | DEC HL | Point HL at the minutes of the time (Time_2). | ||
| 25823 | LD A,(HL) | Grab the minutes. | ||
| 25824 | INC A | Add one minute. | ||
| 25825 | DAA | Convert to BCD and write minutes back to Time_2. | ||
| 25826 | LD (HL),A | |||
| 25827 | CP 96 | Return unless minutes have reached 96. | ||
| 25829 | RET NZ | |||
| 25830 | LD (HL),0 | Reset minutes to 0. | ||
|
Handles the "hours".
|
||||
| 25832 | DEC HL | Point HL at the hours of the time (Time_1). | ||
| 25833 | LD A,(HL) | Grab the hours. | ||
| 25834 | INC A | Add one hour. | ||
| 25835 | DAA | Convert to BCD. | ||
| 25836 | AND %00001111 | Keep only bits 0-3 (so the hours are a single digit). | ||
| 25838 | LD (HL),A | Write hours back to Time_1. | ||
| 25839 | RET | Return. | ||
| Prev: 25752 | Up: Map | Next: 25840 |