Prev: 49094 Up: Map Next: 49164
49113: Handler: Game Clock
Used by the routine at GameEntryPoint.
Handle the game ticker.
Handler_GameClock 49113 LD HL,(40925) Increment *CurrentTime_Ticker by one.
49116 INC HL
49117 LD (40925),HL
Handle the clock minutes.
49120 LD HL,40927 Increment *CurrentTime_Minutes by one.
49123 INC (HL)
49124 LD A,(HL) Return if *HL is not equal to 60 (e.g. it's less than 60 minutes).
49125 CP 60
49127 RET NZ
The minutes is at 60, which is invalid - so handle rolling the clock hour digits.
49128 LD (HL),0 Reset the minutes back to 0 at *HL.
Handle the clock hours.
49130 LD HL,40928 Increment *CurrentTime_Hour by one.
49133 INC (HL)
49134 LD A,(HL) Jump to Handler_GameClock_AM_PM if *HL is not equal to 13 (e.g. it's less than 13 o'clock).
49135 CP 13
49137 JR NZ,Handler_GameClock_AM_PM
The hours is at 13. which is invalid - so handle rolling the clock.
49139 LD (HL),1 Reset the hours back to 1 at *HL.
49141 RET Return.
Is it midday yet?
Handler_GameClock_AM_PM 49142 CP 12 Return if *HL is not equal to 12.
49144 RET NZ
It's either midday or midnight, so flip between AM and PM.
49145 LD A,(40930) A=*Messaging_AM_PM.
Smart way of altering the letter from "a" to "p" and back again.
Letter Bits
"a" 01100001
"p" 01110000
49148 XOR %00010001 Flip bits 0, 4.
49150 LD (40930),A Write this back to *Messaging_AM_PM.
If the clock went from PM to AM, handle rolling the day of the week.
49153 CP 97 Return if A is not equal to ASCII 97 ("a").
49155 RET NZ
49156 LD A,(40929) Increment *CurrentDayOfWeek by one.
49159 INC A
49160 LD (40929),A
49163 RET Return.
Prev: 49094 Up: Map Next: 49164