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
|
|
|
|
|
|
|
|
call ClearDailyTimers
|
|
|
|
|
|
|
|
ret
|
|
|
|
|
|
|
|
.TimeOfDayOrder:
|
2023-07-31 03:32:36 -07:00
|
|
|
db MORN_F, DAY_F, NITE_F, EVE_F, MORN_F
|