summaryrefslogtreecommitdiff
path: root/engine/rtc
diff options
context:
space:
mode:
authorentrpntr <entrpntr@gmail.com>2020-05-22 18:02:48 -0400
committerentrpntr <entrpntr@gmail.com>2020-05-22 18:02:48 -0400
commit871da041159c18dc3ca502461fef384e3965948f (patch)
tree9f63459624fa04bb83d49e9035c6195c0bfc6e49 /engine/rtc
parentd2ea8f80d195bd9550561ded0b6d3022052d9989 (diff)
Disassemble remainder of bank $70.
Diffstat (limited to 'engine/rtc')
-rw-r--r--engine/rtc/print_hours_mins.asm76
1 files changed, 76 insertions, 0 deletions
diff --git a/engine/rtc/print_hours_mins.asm b/engine/rtc/print_hours_mins.asm
new file mode 100644
index 00000000..faa69756
--- /dev/null
+++ b/engine/rtc/print_hours_mins.asm
@@ -0,0 +1,76 @@
+Unreferenced_Function1c0a0d:
+ ld a, b
+ ld b, c
+ ld c, a
+ push bc
+ push de
+ ld hl, sp+$2
+ ld d, h
+ ld e, l
+ pop hl
+ lb bc, PRINTNUM_LEADINGZEROS | 2, 5
+ call PrintNum
+ pop bc
+ ret
+
+PrintHoursMins:
+; Hours in b, minutes in c
+ ld a, b
+ cp 12
+ push af
+ jr c, .AM
+ jr z, .PM
+ sub 12
+ jr .PM
+.AM:
+ or a
+ jr nz, .PM
+ ld a, 12
+.PM:
+ ld b, a
+; Crazy stuff happening with the stack
+ push bc
+ ld hl, sp+$1
+ push de
+ push hl
+ pop de
+ pop hl
+ ld [hl], " "
+ lb bc, 1, 2
+ call PrintNum
+ ld [hl], ":"
+ inc hl
+ ld d, h
+ ld e, l
+ ld hl, sp+$0
+ push de
+ push hl
+ pop de
+ pop hl
+ lb bc, PRINTNUM_LEADINGZEROS | 1, 2
+ call PrintNum
+ pop bc
+ ld de, String_AM
+ pop af
+ jr c, .place_am_pm
+ ld de, String_PM
+.place_am_pm
+ inc hl
+ call PlaceString
+ ret
+
+String_AM: db "AM@"
+String_PM: db "PM@"
+
+UpdateTimePredef::
+ call UpdateTime
+ ld hl, wDSTBackupDay
+ ld a, [wCurDay]
+ ld [hli], a ; wDSTBackupDay
+ ldh a, [hHours]
+ ld [hli], a ; wDSTBackupHours
+ ldh a, [hMinutes]
+ ld [hli], a ; wDSTBackupMinutes
+ ldh a, [hSeconds]
+ ld [hli], a ; wDSTBackupSeconds
+ ret