summaryrefslogtreecommitdiff
path: root/engine/rtc/rtc.asm
diff options
context:
space:
mode:
Diffstat (limited to 'engine/rtc/rtc.asm')
-rw-r--r--engine/rtc/rtc.asm29
1 files changed, 9 insertions, 20 deletions
diff --git a/engine/rtc/rtc.asm b/engine/rtc/rtc.asm
index 37e24c1ed..4a8aab50a 100644
--- a/engine/rtc/rtc.asm
+++ b/engine/rtc/rtc.asm
@@ -9,9 +9,8 @@ Unreferenced_StopRTC:
ld [MBC3RTC], a
call CloseSRAM
ret
-; 14019
-StartRTC: ; 14019
+StartRTC:
ld a, SRAM_ENABLE
ld [MBC3SRamEnable], a
call LatchClock
@@ -22,9 +21,8 @@ StartRTC: ; 14019
ld [MBC3RTC], a
call CloseSRAM
ret
-; 14032
-GetTimeOfDay:: ; 14032
+GetTimeOfDay::
; get time of day based on the current hour
ld a, [hHours] ; hour
ld hl, TimesOfDay
@@ -46,9 +44,8 @@ GetTimeOfDay:: ; 14032
ld a, [hl]
ld [wTimeOfDay], a
ret
-; 14044
-TimesOfDay: ; 14044
+TimesOfDay:
; hours for the time of day
; 0400-0959 morn | 1000-1759 day | 1800-0359 nite
db MORN_HOUR, NITE_F
@@ -56,16 +53,14 @@ TimesOfDay: ; 14044
db NITE_HOUR, DAY_F
db MAX_HOUR, NITE_F
db -1, MORN_F
-; 1404e
Unreferenced_1404e:
db 20, NITE_F
db 40, MORN_F
db 60, DAY_F
db -1, MORN_F
-; 14056
-StageRTCTimeForSave: ; 14056
+StageRTCTimeForSave:
call UpdateTime
ld hl, wRTC
ld a, [wCurDay]
@@ -77,9 +72,8 @@ StageRTCTimeForSave: ; 14056
ld a, [hSeconds]
ld [hli], a
ret
-; 1406a
-SaveRTC: ; 1406a
+SaveRTC:
ld a, $a
ld [MBC3SRamEnable], a
call LatchClock
@@ -93,9 +87,8 @@ SaveRTC: ; 1406a
ld [sRTCStatusFlags], a
call CloseSRAM
ret
-; 14089
-StartClock:: ; 14089
+StartClock::
call GetClock
call Function1409b
call FixDays
@@ -107,9 +100,8 @@ StartClock:: ; 14089
.skip_set
call StartRTC
ret
-; 1409b
-Function1409b: ; 1409b
+Function1409b:
ld hl, hRTCDayHi
bit 7, [hl]
jr nz, .set_bit_7
@@ -123,9 +115,8 @@ Function1409b: ; 1409b
ld a, %10000000
call RecordRTCStatus ; set bit 7 on sRTCStatusFlags
ret
-; 140ae
-Function140ae: ; 140ae
+Function140ae:
call CheckRTCStatus
ld c, a
and %11000000 ; Day count exceeded 255 or 16383
@@ -160,9 +151,8 @@ Function140ae: ; 140ae
.dont_update
xor a
ret
-; 140ed
-_InitTime:: ; 140ed
+_InitTime::
call GetClock
call FixDays
ld hl, hRTCSeconds
@@ -206,4 +196,3 @@ _InitTime:: ; 140ed
.okay_days
ld [de], a
ret
-; 1412a