2023-07-24 12:13:11 -07:00
|
|
|
Timer::
|
2013-08-29 16:32:03 -07:00
|
|
|
reti
|
2023-07-27 15:07:07 -07:00
|
|
|
|
|
|
|
InitTime::
|
|
|
|
ld hl, wStartDay
|
|
|
|
ld [hli], a ; wStartDay
|
|
|
|
ld [hli], a ; wStartHour
|
|
|
|
ld [hli], a ; wStartMinute
|
|
|
|
ld [hl], a ; wStartSecond
|
|
|
|
ret
|
|
|
|
|
|
|
|
AdvanceTimeOfDay::
|
|
|
|
ld hl, .TimeOfDayOrder
|
|
|
|
ld a, [wTimeOfDay]
|
|
|
|
maskbits NUM_DAYTIMES
|
|
|
|
.loop
|
|
|
|
cp [hl]
|
|
|
|
inc hl
|
|
|
|
jr z, .gotTimeOfDay
|
|
|
|
jr .loop
|
|
|
|
.gotTimeOfDay
|
|
|
|
ld a, [hl]
|
|
|
|
ld [wTimeOfDay], a
|
|
|
|
cp MORN_F
|
|
|
|
ret nz
|
|
|
|
|
|
|
|
; advance wCurDay and clear daily timers on a transition from NITE to MORN
|
|
|
|
ld a, [wCurDay]
|
|
|
|
cp MAX_DAYS
|
|
|
|
jr z, .restart_days
|
|
|
|
inc a
|
|
|
|
jr .set_days
|
|
|
|
.restart_days
|
|
|
|
xor a
|
|
|
|
.set_days
|
|
|
|
ld [wCurDay], a
|
|
|
|
|
2024-02-04 05:23:58 -08:00
|
|
|
farcall ClearDailyTimers
|
2023-07-27 15:07:07 -07:00
|
|
|
|
|
|
|
ret
|
|
|
|
|
|
|
|
.TimeOfDayOrder:
|
2024-01-28 08:57:11 -08:00
|
|
|
db MORN_F, DAY_F, EVE_F, NITE_F, MORN_F
|