summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIIMarckus <iimarckus@gmail.com>2011-04-09 20:19:29 -0600
committerIIMarckus <iimarckus@gmail.com>2011-04-09 20:19:29 -0600
commit5e0e4a4ea07964cf4ab31cc02d56f79cdc06f4b6 (patch)
tree9dbcc9e8292aeac3de8367b39e454dba589ee8d2
parentc7737ee3d3cf0f9d284198400befad1ff101a8d1 (diff)
This function waits for a Vblank to go by.
Rename ConserveBattery to DelayFrame, and Delay to DelayFrames. hg-commit-id: 66b020480494
-rw-r--r--pokered.asm31
1 files changed, 16 insertions, 15 deletions
diff --git a/pokered.asm b/pokered.asm
index 5b015614..52ec6522 100644
--- a/pokered.asm
+++ b/pokered.asm
@@ -395,18 +395,19 @@ ClearScreen: ; 190F
INCBIN "baserom.gbc",$1922,$20AF - $1922
-ConserveBattery: ; 20AF
-; loads 1 into $FFD6 and returns when $FFD6 == 0
-; delays by halting to conserve battery power
-; XXX what zeroes $FFD6?
+DelayFrame: ; 20AF
+; delay for one frame
ld a,1
ld [$FFD6],a
+
+; wait for the next Vblank, halting to conserve battery
.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
@@ -579,11 +580,11 @@ Bankswitch: ; 35D6
INCBIN "baserom.gbc",$35EC,$3739 - $35EC
-Delay: ; 3739
-; wait n times, where n is the value in c
- call ConserveBattery
+DelayFrames: ; 3739
+; wait n frames, where n is the value in c
+ call DelayFrame
dec c
- jr nz,Delay
+ jr nz,DelayFrames
ret
INCBIN "baserom.gbc",$3740,$3A87 - $3740
@@ -616,7 +617,7 @@ INCBIN "baserom.gbc",$3C5F,$3DD7 - $3C5F
Delay3: ; 3DD7
; call Delay with a parameter of 3
ld c,3
- jp Delay
+ jp DelayFrames
INCBIN "baserom.gbc",$3DDC,$3E6D - $3DDC
@@ -735,7 +736,7 @@ OakSpeech: ; 6115
ld [$FFB8],a
ld [$2000],a
ld c,4
- call Delay
+ call DelayFrames
ld de,$4180
ld hl,$8000
ld bc,$050C
@@ -744,7 +745,7 @@ OakSpeech: ; 6115
ld bc,$0400
call $62A4
ld c,4
- call Delay
+ call DelayFrames
ld de,$7042
ld bc,$0400
call $62A4
@@ -763,7 +764,7 @@ OakSpeech: ; 6115
ld [$FFB8],a
ld [$2000],a
ld c,$14
- call Delay
+ call DelayFrames
ld hl,$C40A
ld b,7
ld c,7
@@ -772,7 +773,7 @@ OakSpeech: ; 6115
ld a,1
ld [$CFCB],a
ld c,$32
- call Delay
+ call DelayFrames
call $20D8
jp ClearScreen
HelloWelcomeText:
@@ -792,8 +793,8 @@ FadeInIntroSprite:
.next\@
ld a,[hli]
ld [$FF47],a
- ld c,$A
- call Delay
+ ld c,10
+ call DelayFrames
dec b
jr nz,.next\@
ret