shithub: pokered

Download patch

ref: d0c027be62b6ce19fc301b9b0c2921d1dc014c2e
parent: 9b5a97afc21438fffcfbd5e92b45b24b66deb280
author: IIMarckus <iimarckus@gmail.com>
date: Fri Nov 19 18:22:13 EST 2010

add the conserve battery delay function

hg-commit-id: db4f8980a3ec


--- a/pokered.asm
+++ b/pokered.asm
@@ -337,7 +337,24 @@
 .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