diff options
Diffstat (limited to 'engine/rtc')
-rw-r--r-- | engine/rtc/print_hours_mins.asm | 8 | ||||
-rw-r--r-- | engine/rtc/reset_password.asm | 32 | ||||
-rw-r--r-- | engine/rtc/restart_clock.asm | 39 | ||||
-rw-r--r-- | engine/rtc/rtc.asm | 29 | ||||
-rw-r--r-- | engine/rtc/timeset.asm | 118 |
5 files changed, 83 insertions, 143 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..1a5461b15 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 @@ -31,34 +31,34 @@ _ResetClock: ; 4d3b1 call PrintText ret -.text_okay ; 0x4d3fe +.text_okay ; Password OK. Select CONTINUE & reset settings. text_jump UnknownText_0x1c55db db "@" -.text_wrong ; 0x4d403 +.text_wrong ; Wrong password! text_jump UnknownText_0x1c560b db "@" -.text_askreset ; 0x4d408 +.text_askreset ; Reset the clock? text_jump UnknownText_0x1c561c db "@" -.NoYes_MenuHeader: ; 0x4d40d +.NoYes_MenuHeader: db 0 ; flags menu_coords 14, 7, SCREEN_WIDTH - 1, TEXTBOX_Y - 1 dw .NoYes_MenuData db 1 ; default option -.NoYes_MenuData: ; 0x4d415 +.NoYes_MenuData: db STATICMENU_CURSOR | STATICMENU_NO_TOP_SPACING ; flags db 2 ; items db "NO@" db "YES@" -ClockResetPassword: ; 4d41e +ClockResetPassword: call .CalculatePassword push de ld hl, wStringBuffer2 @@ -101,12 +101,12 @@ ClockResetPassword: ; 4d41e scf ret -.pleaseenterpasswordtext ; 0x4d463 +.pleaseenterpasswordtext ; Please enter the password. 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..5071fef48 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,21 +46,18 @@ RestartClock: ; 20021 (8:4021) ld [hl], b ld c, a ret -; 20047 (8:4047) -.Text_ClockTimeMayBeWrong: ; 0x20047 +.Text_ClockTimeMayBeWrong: ; The clock's time may be wrong. Please reset the time. text_jump UnknownText_0x1c40e6 db "@" -; 0x2004c -.Text_SetWithControlPad: ; 0x2004c +.Text_SetWithControlPad: ; Set with the Control Pad. Confirm: A Button Cancel: B Button text_jump UnknownText_0x1c411c db "@" -; 0x20051 -.SetClock: ; 20051 (8:4051) +.SetClock: ld a, 1 ld [wBuffer1], a ; which digit ld [wBuffer2], a @@ -105,19 +100,16 @@ RestartClock: ; 20021 (8:4021) .cancel ld a, $1 ret -; 200b0 (8:40b0) -.Text_IsThisOK: ; 0x200b0 +.Text_IsThisOK: ; Is this OK? text_jump UnknownText_0x1c415b db "@" -; 0x200b5 -.Text_ClockReset: ; 0x200b5 +.Text_ClockReset: ; The clock has been reset. text_jump UnknownText_0x1c4168 db "@" -; 0x200ba .joy_loop call JoyTextDelay_ForcehJoyDown @@ -193,7 +185,7 @@ RestartClock: ; 20021 (8:4021) xor a ret -.PrintTime: ; 2011f (8:411f) +.PrintTime: hlcoord 0, 5 ld b, 5 ld c, 18 @@ -217,17 +209,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 +230,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..06f800c45 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,25 +288,21 @@ PrintTwoDigitNumberRightAlign: ; 90867 (24:4867) lb bc, PRINTNUM_RIGHTALIGN | 1, 2 call PrintNum ret -; 90874 (24:4874) -Text_WokeUpOak: ; 0x90874 +Text_WokeUpOak: ; Zzz… Hm? Wha…? You woke me up! Will you check the clock for me? text_jump UnknownText_0x1bc29c db "@" -; 0x90879 -Text_WhatTimeIsIt: ; 0x90879 +Text_WhatTimeIsIt: ; What time is it? text_jump UnknownText_0x1bc2eb db "@" -; 0x9087e String_oclock: db "o'clock@" -; 90886 -Text_WhatHrs: ; 0x90886 +Text_WhatHrs: ; What?@ @ text_jump UnknownText_0x1bc2fd start_asm @@ -316,25 +310,21 @@ Text_WhatHrs: ; 0x90886 call DisplayHourOClock ld hl, .QuestionMark ret -; 90895 (24:4895) -.QuestionMark: ; 0x90895 +.QuestionMark: ; ? text_jump UnknownText_0x1bc305 db "@" -; 0x9089a -Text_HowManyMinutes: ; 0x9089a +Text_HowManyMinutes: ; How many minutes? text_jump UnknownText_0x1bc308 db "@" -; 0x9089f String_min: db "min.@" -; 908a4 -Text_WhoaMins: ; 0x908a4 +Text_WhoaMins: ; Whoa!@ @ text_jump UnknownText_0x1bc31b start_asm @@ -342,15 +332,13 @@ Text_WhoaMins: ; 0x908a4 call DisplayMinutesWithMinString ld hl, .QuestionMark ret -; 908b3 (24:48b3) -.QuestionMark: ; 0x908b3 +.QuestionMark: ; ? text_jump UnknownText_0x1bc323 db "@" -; 0x908b8 -OakText_ResponseToSetTime: ; 0x908b8 +OakText_ResponseToSetTime: start_asm decoord 1, 14 ld a, [wInitHourBuffer] @@ -379,35 +367,30 @@ OakText_ResponseToSetTime: ; 0x908b8 .day: ld hl, .yikes ret -; 908ec (24:48ec) -.overslept ; 0x908ec +.overslept ; ! I overslept! text_jump UnknownText_0x1bc326 db "@" -; 0x908f1 -.yikes ; 0x908f1 +.yikes ; ! Yikes! I over- slept! text_jump UnknownText_0x1bc336 db "@" -; 0x908f6 -.sodark ; 0x908f6 +.sodark ; ! No wonder it's so dark! text_jump UnknownText_0x1bc34f 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 +442,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 +497,8 @@ SetDayOfWeek: ; 90913 call WaitBGMap and a ret -; 909de -.PlaceWeekdayString: ; 909de +.PlaceWeekdayString: push hl ld a, [wTempDayOfWeek] ld e, a @@ -531,9 +512,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 @@ -552,28 +532,24 @@ SetDayOfWeek: ; 90913 .Friday: db " FRIDAY@" .Saturday: db "SATURDAY@" - -.WhatDayIsItText: ; 0x90a3f +.WhatDayIsItText: ; What day is it? text_jump UnknownText_0x1bc369 db "@" -; 0x90a44 -.ConfirmWeekdayText: ; 0x90a44 +.ConfirmWeekdayText: start_asm hlcoord 1, 14 call .PlaceWeekdayString ld hl, .IsIt ret -; 90a4f (24:4a4f) -.IsIt: ; 0x90a4f +.IsIt: ; , is it? text_jump UnknownText_0x1bc37a db "@" -; 0x90a54 -InitialSetDSTFlag: ; 90a54 +InitialSetDSTFlag: ld a, [wDST] set 7, a ld [wDST], a @@ -583,9 +559,8 @@ InitialSetDSTFlag: ; 90a54 ld hl, .Text call PlaceHLTextAtBC ret -; 90a6c -.Text: ; 90a6c +.Text: start_asm call UpdateTime ld a, [hHours] @@ -596,15 +571,13 @@ InitialSetDSTFlag: ; 90a54 farcall PrintHoursMins ld hl, .DSTIsThatOK ret -; 90a83 (24:4a83) -.DSTIsThatOK: ; 0x90a83 +.DSTIsThatOK: ; DST, is that OK? text_jump Text_DSTIsThatOK db "@" -; 0x90a88 -InitialClearDSTFlag: ; 90a88 +InitialClearDSTFlag: ld a, [wDST] res 7, a ld [wDST], a @@ -614,9 +587,8 @@ InitialClearDSTFlag: ; 90a88 ld hl, .Text call PlaceHLTextAtBC ret -; 90aa0 -.Text: ; 90aa0 +.Text: start_asm call UpdateTime ld a, [hHours] @@ -627,24 +599,21 @@ InitialClearDSTFlag: ; 90a88 farcall PrintHoursMins ld hl, .IsThatOK ret -; 90ab7 -.IsThatOK: ; 0x90ab7 +.IsThatOK: ; , is that OK? text_jump UnknownText_0x1c5ff1 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 +.Text: start_asm call UpdateTime @@ -694,14 +663,12 @@ DebugDisplayTime: ; 90abc .done ld hl, .NowOnDebug ret -; 90b13 -.NowOnDebug: ; 0x90b13 +.NowOnDebug: text "<PARA>Now on DEBUG…" prompt -; 0x90b23 -.PrintTime: ; 90b23 +.PrintTime: lb bc, 1, 3 call PrintNum ld [hl], "." @@ -715,9 +682,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 +699,7 @@ PrintHour: ; 90b3e (24:4b3e) call PrintTwoDigitNumberRightAlign ret -GetTimeOfDayString: ; 90b58 (24:4b58) +GetTimeOfDayString: ld a, c cp MORN_HOUR jr c, .nite @@ -750,12 +716,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 |