![]() |
Routines |
Prev: BFC6 | Up: Map | Next: C00C |
Used by the routine at GameEntryPoint.
|
||||||||||
Handle the game ticker.
|
||||||||||
Handler_GameClock | BFD9 | LD HL,($9FDD) | Increment *CurrentTime_Ticker by one. | |||||||
BFDC | INC HL | |||||||||
BFDD | LD ($9FDD),HL | |||||||||
Handle the clock minutes.
|
||||||||||
BFE0 | LD HL,$9FDF | Increment *CurrentTime_Minutes by one. | ||||||||
BFE3 | INC (HL) | |||||||||
BFE4 | LD A,(HL) | Return if *HL is not equal to 60 (e.g. it's less than 60 minutes). | ||||||||
BFE5 | CP $3C | |||||||||
BFE7 | RET NZ | |||||||||
The minutes is at 60, which is invalid - so handle rolling the clock hour digits.
|
||||||||||
BFE8 | LD (HL),$00 | Reset the minutes back to 00 at *HL. | ||||||||
Handle the clock hours.
|
||||||||||
BFEA | LD HL,$9FE0 | Increment *CurrentTime_Hour by one. | ||||||||
BFED | INC (HL) | |||||||||
BFEE | 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). | ||||||||
BFEF | CP $0D | |||||||||
BFF1 | JR NZ,Handler_GameClock_AM_PM | |||||||||
The hours is at 13. which is invalid - so handle rolling the clock.
|
||||||||||
BFF3 | LD (HL),$01 | Reset the hours back to 01 at *HL. | ||||||||
BFF5 | RET | Return. | ||||||||
Is it midday yet?
|
||||||||||
Handler_GameClock_AM_PM | BFF6 | CP $0C | Return if *HL is not equal to 12. | |||||||
BFF8 | RET NZ | |||||||||
It's either midday or midnight, so flip between AM and PM.
|
||||||||||
BFF9 | LD A,($9FE2) | A=*Messaging_AM_PM. | ||||||||
Smart way of altering the letter from "a" to "p" and back again.
|
||||||||||
BFFC | XOR %00010001 | Flip bits 0, 4. | ||||||||
BFFE | LD ($9FE2),A | Write this back to *Messaging_AM_PM. | ||||||||
If the clock went from PM to AM, handle rolling the day of the week.
|
||||||||||
C001 | CP $61 | Return if A is not equal to ASCII 61 ("a"). | ||||||||
C003 | RET NZ | |||||||||
C004 | LD A,($9FE1) | Increment *CurrentDayOfWeek by one. | ||||||||
C007 | INC A | |||||||||
C008 | LD ($9FE1),A | |||||||||
C00B | RET | Return. |
Prev: BFC6 | Up: Map | Next: C00C |