summaryrefslogtreecommitdiff
path: root/home/delay.asm
diff options
context:
space:
mode:
Diffstat (limited to 'home/delay.asm')
-rw-r--r--home/delay.asm23
1 files changed, 13 insertions, 10 deletions
diff --git a/home/delay.asm b/home/delay.asm
index b9b7ac1f..4ad25ef2 100644
--- a/home/delay.asm
+++ b/home/delay.asm
@@ -1,16 +1,19 @@
-DelayFrame:: ; 32e
- ld a, $1
- ld [$ceea], a
-.asm_333
- halt
- ld a, [$ceea]
+DelayFrame::
+; Wait for one frame
+ ld a, 1
+ ld [wVBlankOccurred], a
+
+; Wait for the next VBlank, halting to conserve battery
+.halt
+ halt ; rgbasm adds a nop after this instruction by default
+ ld a, [wVBlankOccurred]
and a
- jr nz, .asm_333
+ jr nz, .halt
ret
-DelayFrames:: ; 33c
-.loop
+DelayFrames::
+; Wait c frames
call DelayFrame
dec c
- jr nz, .loop
+ jr nz, DelayFrames
ret