summaryrefslogtreecommitdiff
path: root/engine/rtc
diff options
context:
space:
mode:
Diffstat (limited to 'engine/rtc')
-rw-r--r--engine/rtc/print_hours_mins.asm8
-rw-r--r--engine/rtc/reset_password.asm20
-rw-r--r--engine/rtc/restart_clock.asm27
-rw-r--r--engine/rtc/rtc.asm29
-rw-r--r--engine/rtc/timeset.asm68
5 files changed, 55 insertions, 97 deletions
diff --git a/engine/rtc/print_hours_mins.asm b/engine/rtc/print_hours_mins.asm
index eb7dc1619..f4abc0c1b 100644
--- a/engine/rtc/print_hours_mins.asm
+++ b/engine/rtc/print_hours_mins.asm
@@ -1,4 +1,4 @@
-Unreferenced_Function1dd6a9: ; 1dd6a9
+Unreferenced_Function1dd6a9:
ld a, b
ld b, c
ld c, a
@@ -13,7 +13,7 @@ Unreferenced_Function1dd6a9: ; 1dd6a9
pop bc
ret
-PrintHoursMins: ; 1dd6bb (77:56bb)
+PrintHoursMins:
; Hours in b, minutes in c
ld a, b
cp 12
@@ -59,5 +59,5 @@ PrintHoursMins: ; 1dd6bb (77:56bb)
call PlaceString
ret
-String_AM: db "AM@" ; 1dd6fc
-String_PM: db "PM@" ; 1dd6ff
+String_AM: db "AM@"
+String_PM: db "PM@"
diff --git a/engine/rtc/reset_password.asm b/engine/rtc/reset_password.asm
index fd5007ba7..1130544df 100644
--- a/engine/rtc/reset_password.asm
+++ b/engine/rtc/reset_password.asm
@@ -1,4 +1,4 @@
-_ResetClock: ; 4d3b1
+_ResetClock:
farcall BlankScreen
ld b, SCGB_DIPLOMA
call GetSGBLayout
@@ -58,7 +58,7 @@ _ResetClock: ; 4d3b1
db "NO@"
db "YES@"
-ClockResetPassword: ; 4d41e
+ClockResetPassword:
call .CalculatePassword
push de
ld hl, wStringBuffer2
@@ -106,7 +106,7 @@ ClockResetPassword: ; 4d41e
text_jump UnknownText_0x1c562e
db "@"
-.updateIDdisplay ; 4d468
+.updateIDdisplay
hlcoord 14, 15
ld de, wStringBuffer2
ld c, 5
@@ -129,7 +129,7 @@ ClockResetPassword: ; 4d41e
ld [hl], "▲"
ret
-.dpadinput ; 4d490
+.dpadinput
ld a, b
and D_LEFT
jr nz, .left
@@ -186,7 +186,7 @@ ClockResetPassword: ; 4d41e
ld [hl], 9
ret
-.getcurrentdigit ; 4d4d5
+.getcurrentdigit
ld a, [wStringBuffer2 + 5]
ld e, a
ld d, $0
@@ -194,7 +194,7 @@ ClockResetPassword: ; 4d41e
add hl, de
ret
-.ConvertDecIDToBytes: ; 4d4e0
+.ConvertDecIDToBytes:
ld hl, 0
ld de, wStringBuffer2 + 4
ld bc, 1
@@ -206,7 +206,7 @@ ClockResetPassword: ; 4d41e
ld bc, 1000
call .ConvertToBytes
ld bc, 10000
-.ConvertToBytes: ; 4d501
+.ConvertToBytes:
ld a, [de]
dec de
push hl
@@ -218,7 +218,7 @@ ClockResetPassword: ; 4d41e
add hl, bc
ret
-.CalculatePassword: ; 4d50f
+.CalculatePassword:
ld a, BANK(sPlayerData)
call GetSRAMBank
ld de, 0
@@ -234,7 +234,7 @@ ClockResetPassword: ; 4d41e
call CloseSRAM
ret
-.ComponentFromNumber: ; 4d533
+.ComponentFromNumber:
ld a, [hli]
add e
ld e, a
@@ -245,7 +245,7 @@ ClockResetPassword: ; 4d41e
jr nz, .ComponentFromNumber
ret
-.ComponentFromString: ; 4d53e
+.ComponentFromString:
ld a, [hli]
cp "@"
ret z
diff --git a/engine/rtc/restart_clock.asm b/engine/rtc/restart_clock.asm
index 5fbac80dd..a36ef31eb 100644
--- a/engine/rtc/restart_clock.asm
+++ b/engine/rtc/restart_clock.asm
@@ -1,4 +1,4 @@
-RestartClock_GetWraparoundTime: ; 20000 (8:4000)
+RestartClock_GetWraparoundTime:
push hl
dec a
ld e, a
@@ -16,9 +16,8 @@ endr
ld c, [hl]
pop hl
ret
-; 20015 (8:4015)
-.WrapAroundTimes: ; 20015
+.WrapAroundTimes:
dw wBuffer4
db 7, 4
@@ -27,9 +26,8 @@ endr
dw wBuffer6
db 60, 15
-; 20021
-RestartClock: ; 20021 (8:4021)
+RestartClock:
; If we're here, we had an RTC overflow.
ld hl, .Text_ClockTimeMayBeWrong
call PrintText
@@ -48,7 +46,6 @@ RestartClock: ; 20021 (8:4021)
ld [hl], b
ld c, a
ret
-; 20047 (8:4047)
.Text_ClockTimeMayBeWrong: ; 0x20047
; The clock's time may be wrong. Please reset the time.
@@ -62,7 +59,7 @@ RestartClock: ; 20021 (8:4021)
db "@"
; 0x20051
-.SetClock: ; 20051 (8:4051)
+.SetClock:
ld a, 1
ld [wBuffer1], a ; which digit
ld [wBuffer2], a
@@ -105,7 +102,6 @@ RestartClock: ; 20021 (8:4021)
.cancel
ld a, $1
ret
-; 200b0 (8:40b0)
.Text_IsThisOK: ; 0x200b0
; Is this OK?
@@ -193,7 +189,7 @@ RestartClock: ; 20021 (8:4021)
xor a
ret
-.PrintTime: ; 2011f (8:411f)
+.PrintTime:
hlcoord 0, 5
ld b, 5
ld c, 18
@@ -217,17 +213,15 @@ RestartClock: ; 20021 (8:4021)
ld a, [wBuffer1]
ld [wBuffer2], a
ret
-; 20160 (8:4160)
-.unreferenced ; 20160
+.unreferenced
; unused
ld a, [wBuffer3]
ld b, a
call Coord2Tile
ret
-; 20168
-.PlaceChars: ; 20168 (8:4168)
+.PlaceChars:
push de
call RestartClock_GetWraparoundTime
ld a, [wBuffer3]
@@ -240,14 +234,11 @@ RestartClock: ; 20021 (8:4021)
add hl, bc
ld [hl], e
ret
-; 2017c (8:417c)
-UnreferencedString_HourJP: ; 2017c
+UnreferencedString_HourJP:
; unused
db "じ@" ; HR
-; 2017e
-UnreferencedString_MinuteJP: ; 2017e
+UnreferencedString_MinuteJP:
; unused
db "ふん@" ; MIN
-; 20181
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
diff --git a/engine/rtc/timeset.asm b/engine/rtc/timeset.asm
index eda3094e1..6c05d686c 100644
--- a/engine/rtc/timeset.asm
+++ b/engine/rtc/timeset.asm
@@ -1,7 +1,7 @@
TIMESET_UP_ARROW EQUS "\"♂\"" ; $ef
TIMESET_DOWN_ARROW EQUS "\"♀\"" ; $f5
-InitClock: ; 90672 (24:4672)
+InitClock:
; Ask the player to set the time.
ld a, [hInMenu]
push af
@@ -120,7 +120,7 @@ InitClock: ; 90672 (24:4672)
ld [hInMenu], a
ret
-.ClearScreen: ; 90783 (24:4783)
+.ClearScreen:
xor a
ld [hBGMapMode], a
hlcoord 0, 0
@@ -131,7 +131,7 @@ InitClock: ; 90672 (24:4672)
ld [hBGMapMode], a
ret
-SetHour: ; 90795 (24:4795)
+SetHour:
ld a, [hJoyPressed]
and A_BUTTON
jr nz, .Confirm
@@ -183,7 +183,7 @@ SetHour: ; 90795 (24:4795)
scf
ret
-DisplayHourOClock: ; 907de (24:47de)
+DisplayHourOClock:
push hl
ld a, [wInitHourBuffer]
ld c, a
@@ -195,9 +195,8 @@ DisplayHourOClock: ; 907de (24:47de)
call PlaceString
pop hl
ret
-; 907f1 (24:47f1)
-UnreferencedFunction907f1: ; 907f1
+UnreferencedFunction907f1:
ld h, d
ld l, e
push hl
@@ -222,9 +221,8 @@ UnreferencedFunction907f1: ; 907f1
inc hl
inc hl
ret
-; 90810
-SetMinutes: ; 90810 (24:4810)
+SetMinutes:
ld a, [hJoyPressed]
and A_BUTTON
jr nz, .a_button
@@ -273,7 +271,7 @@ SetMinutes: ; 90810 (24:4810)
scf
ret
-DisplayMinutesWithMinString: ; 90859 (24:4859)
+DisplayMinutesWithMinString:
ld de, wInitMinuteBuffer
call PrintTwoDigitNumberRightAlign
inc hl
@@ -281,7 +279,7 @@ DisplayMinutesWithMinString: ; 90859 (24:4859)
call PlaceString
ret
-PrintTwoDigitNumberRightAlign: ; 90867 (24:4867)
+PrintTwoDigitNumberRightAlign:
push hl
ld a, " "
ld [hli], a
@@ -290,7 +288,6 @@ PrintTwoDigitNumberRightAlign: ; 90867 (24:4867)
lb bc, PRINTNUM_RIGHTALIGN | 1, 2
call PrintNum
ret
-; 90874 (24:4874)
Text_WokeUpOak: ; 0x90874
; Zzz… Hm? Wha…? You woke me up! Will you check the clock for me?
@@ -306,7 +303,6 @@ Text_WhatTimeIsIt: ; 0x90879
String_oclock:
db "o'clock@"
-; 90886
Text_WhatHrs: ; 0x90886
; What?@ @
@@ -316,7 +312,6 @@ Text_WhatHrs: ; 0x90886
call DisplayHourOClock
ld hl, .QuestionMark
ret
-; 90895 (24:4895)
.QuestionMark: ; 0x90895
; ?
@@ -332,7 +327,6 @@ Text_HowManyMinutes: ; 0x9089a
String_min:
db "min.@"
-; 908a4
Text_WhoaMins: ; 0x908a4
; Whoa!@ @
@@ -342,7 +336,6 @@ Text_WhoaMins: ; 0x908a4
call DisplayMinutesWithMinString
ld hl, .QuestionMark
ret
-; 908b3 (24:48b3)
.QuestionMark: ; 0x908b3
; ?
@@ -379,7 +372,6 @@ OakText_ResponseToSetTime: ; 0x908b8
.day:
ld hl, .yikes
ret
-; 908ec (24:48ec)
.overslept ; 0x908ec
; ! I overslept!
@@ -399,15 +391,14 @@ OakText_ResponseToSetTime: ; 0x908b8
db "@"
; 0x908fb
-TimeSetBackgroundGFX: ; 908fb
+TimeSetBackgroundGFX:
INCBIN "gfx/new_game/timeset_bg.1bpp"
-TimeSetUpArrowGFX: ; 90903
+TimeSetUpArrowGFX:
INCBIN "gfx/new_game/up_arrow.1bpp"
-TimeSetDownArrowGFX: ; 9090b
+TimeSetDownArrowGFX:
INCBIN "gfx/new_game/down_arrow.1bpp"
-; 90913
-SetDayOfWeek: ; 90913
+SetDayOfWeek:
ld a, [hInMenu]
push af
ld a, $1
@@ -459,9 +450,8 @@ SetDayOfWeek: ; 90913
pop af
ld [hInMenu], a
ret
-; 90993
-.GetJoypadAction: ; 90993
+.GetJoypadAction:
ld a, [hJoyPressed]
and A_BUTTON
jr z, .not_A
@@ -515,9 +505,8 @@ SetDayOfWeek: ; 90913
call WaitBGMap
and a
ret
-; 909de
-.PlaceWeekdayString: ; 909de
+.PlaceWeekdayString:
push hl
ld a, [wTempDayOfWeek]
ld e, a
@@ -531,9 +520,8 @@ SetDayOfWeek: ; 90913
pop hl
call PlaceString
ret
-; 909f2
-.WeekdayStrings: ; 909f2
+.WeekdayStrings:
; entries correspond to wCurDay constants (see constants/wram_constants.asm)
dw .Sunday
dw .Monday
@@ -565,7 +553,6 @@ SetDayOfWeek: ; 90913
call .PlaceWeekdayString
ld hl, .IsIt
ret
-; 90a4f (24:4a4f)
.IsIt: ; 0x90a4f
; , is it?
@@ -573,7 +560,7 @@ SetDayOfWeek: ; 90913
db "@"
; 0x90a54
-InitialSetDSTFlag: ; 90a54
+InitialSetDSTFlag:
ld a, [wDST]
set 7, a
ld [wDST], a
@@ -583,9 +570,8 @@ InitialSetDSTFlag: ; 90a54
ld hl, .Text
call PlaceHLTextAtBC
ret
-; 90a6c
-.Text: ; 90a6c
+.Text:
start_asm
call UpdateTime
ld a, [hHours]
@@ -596,7 +582,6 @@ InitialSetDSTFlag: ; 90a54
farcall PrintHoursMins
ld hl, .DSTIsThatOK
ret
-; 90a83 (24:4a83)
.DSTIsThatOK: ; 0x90a83
; DST, is that OK?
@@ -604,7 +589,7 @@ InitialSetDSTFlag: ; 90a54
db "@"
; 0x90a88
-InitialClearDSTFlag: ; 90a88
+InitialClearDSTFlag:
ld a, [wDST]
res 7, a
ld [wDST], a
@@ -614,9 +599,8 @@ InitialClearDSTFlag: ; 90a88
ld hl, .Text
call PlaceHLTextAtBC
ret
-; 90aa0
-.Text: ; 90aa0
+.Text:
start_asm
call UpdateTime
ld a, [hHours]
@@ -627,7 +611,6 @@ InitialClearDSTFlag: ; 90a88
farcall PrintHoursMins
ld hl, .IsThatOK
ret
-; 90ab7
.IsThatOK: ; 0x90ab7
; , is that OK?
@@ -635,14 +618,13 @@ InitialClearDSTFlag: ; 90a88
db "@"
; 0x90abc
-DebugDisplayTime: ; 90abc
+DebugDisplayTime:
hlcoord 1, 14
lb bc, 3, SCREEN_WIDTH - 2
call ClearBox
ld hl, .Text
call PlaceHLTextAtBC
ret
-; 90acc
.Text: ; 0x90acc
start_asm
@@ -694,14 +676,13 @@ DebugDisplayTime: ; 90abc
.done
ld hl, .NowOnDebug
ret
-; 90b13
.NowOnDebug: ; 0x90b13
text "<PARA>Now on DEBUG…"
prompt
; 0x90b23
-.PrintTime: ; 90b23
+.PrintTime:
lb bc, 1, 3
call PrintNum
ld [hl], "."
@@ -715,9 +696,8 @@ DebugDisplayTime: ; 90abc
lb bc, PRINTNUM_LEADINGZEROS | 1, 2
call PrintNum
ret
-; 90b3e
-PrintHour: ; 90b3e (24:4b3e)
+PrintHour:
ld l, e
ld h, d
push bc
@@ -733,7 +713,7 @@ PrintHour: ; 90b3e (24:4b3e)
call PrintTwoDigitNumberRightAlign
ret
-GetTimeOfDayString: ; 90b58 (24:4b58)
+GetTimeOfDayString:
ld a, c
cp MORN_HOUR
jr c, .nite
@@ -750,12 +730,10 @@ GetTimeOfDayString: ; 90b58 (24:4b58)
.day
ld de, .day_string
ret
-; 90b71 (24:4b71)
.nite_string: db "NITE@"
.morn_string: db "MORN@"
.day_string: db "DAY@"
-; 90b7f
AdjustHourForAMorPM:
; Convert the hour stored in c (0-23) to a 1-12 value