summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcus Huderle <huderlem@gmail.com>2015-03-01 16:50:07 -0800
committerMarcus Huderle <huderlem@gmail.com>2015-03-01 16:50:07 -0800
commit9bc3ff06624d3e51c972c993b1dbd15925265756 (patch)
tree94b90af07c6ae10ca2b62feecf9524497c801507
parent513cf38fa305d369cf5b792acbaf171a0543bcaf (diff)
Dump routine that loads initial high scores.
-rwxr-xr-xdata/initial_high_scores.asm2
-rwxr-xr-xmain.asm42
2 files changed, 41 insertions, 3 deletions
diff --git a/data/initial_high_scores.asm b/data/initial_high_scores.asm
index 000896c..9fa945e 100755
--- a/data/initial_high_scores.asm
+++ b/data/initial_high_scores.asm
@@ -1,4 +1,4 @@
-InitialRedHighScores: ; 0xd42e
+InitialHighScores: ; 0xd42e
; TODO: Use text instead of raw bytes for the names.
bigBCD6 50000000
db $4e, $49, $4e ; "NIN"
diff --git a/main.asm b/main.asm
index 3648d1e..3a5174a 100755
--- a/main.asm
+++ b/main.asm
@@ -3984,9 +3984,47 @@ SongBanks: ; 0xc77e
db MUSIC_NAME_ENTRY,BANK(Music_NameEntry)
; 0xc7ac
-INCBIN "baserom.gbc",$c7ac,$d42e - $c7ac
+INCBIN "baserom.gbc",$c7ac,$d3ff - $c7ac
+
+CopyInitialHighScores: ; 0xd3ff
+ ld hl, InitialHighScores
+ ld de, wRedHighScore1Points
+ call CopyInitialHighScoresForStage
+ ld hl, InitialHighScores
+ ld de, wBlueHighScore1Points
+
+CopyInitialHighScoresForStage: ; 0xd40e
+; input: hl = address of high score entries
+; de = destination address for high score entries to be copied
+ ld b, $5 ; 5 high score entries to copy
+.copyHighScoreEntry
+ ld c, $6 ; high score points are 6 bytes long
+.copyPoints
+ ld a, [hli]
+ ld [de], a
+ inc de
+ dec c
+ jr nz, .copyPoints
+ ld c, $3 ; name is 3 bytes
+.copyName
+ ld a, [hli]
+ sub $37
+ ld [de], a
+ inc de
+ dec c
+ jr nz, .copyName
+ ld c, $4
+.asm_d424 ; TODO: what are these 4 bytes used for?
+ ld a, [hli]
+ ld [de], a
+ inc de
+ dec c
+ jr nz, .asm_d424
+ dec b
+ jr nz, .copyHighScoreEntry
+ ret
-INCLUDE "data/initial_high_scores.asm"
+INCLUDE "data/initial_high_scores.asm" ; 0xd42e
INCBIN "baserom.gbc",$d46f,$d71c - $d46f