summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIIMarckus <iimarckus@gmail.com>2010-11-19 23:22:13 -0700
committerIIMarckus <iimarckus@gmail.com>2010-11-19 23:22:13 -0700
commitd0c027be62b6ce19fc301b9b0c2921d1dc014c2e (patch)
tree5f8960cd7043bb405af1bd0125bf991236d68452
parent9b5a97afc21438fffcfbd5e92b45b24b66deb280 (diff)
add the conserve battery delay function
hg-commit-id: db4f8980a3ec
-rw-r--r--pokered.asm19
1 files changed, 18 insertions, 1 deletions
diff --git a/pokered.asm b/pokered.asm
index 9228162b..5e3d70d0 100644
--- a/pokered.asm
+++ b/pokered.asm
@@ -337,7 +337,24 @@ incbin "baserom.gbc",$39E,$1627 - $39E
.GotBank\@
jp $24FD
-INCBIN "baserom.gbc",$1665,$2442 - $1665
+INCBIN "baserom.gbc",$1665,$20AF - $1665
+
+ConserveBattery: ; 20AF
+; loads 1 into $FFD6 and returns when $FFD6 == 0
+; delays by halting to conserve battery power
+; XXX what zeroes $FFD6?
+ ld a,1
+ ld [$FFD6],a
+.halt\@
+ db $76 ; XXX this is a hack--rgbasm adds a nop after this instr
+ ; even when ints are enabled
+ ld a,[$FFD6]
+ and a
+ jr nz,.halt\@
+ ret
+
+INCBIN "baserom.gbc",$20BA,$2442 - $20BA
+
; XXX where is the pointer to this data?
MartInventories: ; 2442
; first byte $FE, next byte # of items, last byte $FF