summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcus Huderle <huderlem@gmail.com>2015-03-05 21:01:44 -0800
committerMarcus Huderle <huderlem@gmail.com>2015-03-05 21:01:44 -0800
commit2f503c0af4ab4229e1549fcce683132d0bdd3c25 (patch)
treef953d1379d877bc5e81f2ba8029b16a1b25708e3
parent581e85d2753083608b6b296801dbedd88f1b8db8 (diff)
Routine that draws the timer in the top-right corner of the screen during various events.
-rwxr-xr-xmain.asm30
-rwxr-xr-xwram.asm11
2 files changed, 39 insertions, 2 deletions
diff --git a/main.asm b/main.asm
index 82db89d..c9f8093 100755
--- a/main.asm
+++ b/main.asm
@@ -5539,7 +5539,35 @@ RedStageInitialMaps: ; 0x16605
db ROCK_MOUNTAIN
db LAVENDER_TOWN
-INCBIN "baserom.gbc",$1660c,$18000 - $1660c
+INCBIN "baserom.gbc",$1660c,$175f5 - $1660c
+
+DrawTimer: ; 0x175f5
+; Loads the OAM data for the timer in the top-right corner of the screen.
+ ld a, [wTimerMinutes]
+ and $f
+ call DrawTimerDigit
+ ld a, $a ; colon
+ call DrawTimerDigit
+ ld a, [wTimerSeconds]
+ swap a
+ and $f
+ call DrawTimerDigit ; tens digit of the minutes
+ ld a, [wTimerSeconds]
+ and $f
+ call DrawTimerDigit ; ones digit of the minutes
+ ret
+
+INCBIN "baserom.gbc",$17615,$17625 - $17615
+
+DrawTimerDigit: ; 0x17625
+ add $b1 ; the timer digits' OAM ids start at $b1
+ call LoadOAMData
+ ld a, b
+ add $8
+ ld b, a
+ ret
+
+INCBIN "baserom.gbc",$1762f,$18000 - $1762f
SECTION "bank6", ROMX, BANK[$6]
diff --git a/wram.asm b/wram.asm
index 06f8f8d..5c389e2 100755
--- a/wram.asm
+++ b/wram.asm
@@ -13,7 +13,16 @@ wOAMBuffer:: ; d000
; buffer for OAM data. Copied to OAM by DMA
ds 4 * 40
- ds $869
+ ds $4da
+
+wTimerSeconds:: ; 0xd57a
+ ds 1
+wTimerMinutes:: ; 0xd57b
+ ds 1
+wTimerFrames:: ; 0xd57c
+ ds 1
+
+ ds $38c
wTitleScreenCursorSelection:: ; 0xd909
; 0 = Game Start