summaryrefslogtreecommitdiff
path: root/engine/delay.asm
diff options
context:
space:
mode:
authorBryan Bishop <kanzure@gmail.com>2013-09-05 11:30:12 -0700
committerBryan Bishop <kanzure@gmail.com>2013-09-05 11:30:12 -0700
commit40b4c87db7e9472d99186b67bdec3d48a2132e73 (patch)
treeb0ea0d40187c103dbb9f8bd185ee5f40770b5b53 /engine/delay.asm
parent4e36d85ee966f8f22531183679549061263b2166 (diff)
parent60dde1d03ed43de1e7ef777e4198963620c73958 (diff)
Merge pull request #188 from yenatch/split-common
recomment and split out a ton of common asm (bank 0)
Diffstat (limited to 'engine/delay.asm')
-rw-r--r--engine/delay.asm23
1 files changed, 23 insertions, 0 deletions
diff --git a/engine/delay.asm b/engine/delay.asm
new file mode 100644
index 000000000..4e8b2147c
--- /dev/null
+++ b/engine/delay.asm
@@ -0,0 +1,23 @@
+DelayFrame: ; 45a
+; Wait for one frame
+ ld a, 1
+ ld [VBlankOccurred], a
+
+; Wait for the next VBlank, halting to conserve battery
+.halt
+ halt ; rgbasm adds a nop after this instruction by default
+ ld a, [VBlankOccurred]
+ and a
+ jr nz, .halt
+ ret
+; 468
+
+
+DelayFrames: ; 468
+; Wait c frames
+ call DelayFrame
+ dec c
+ jr nz, DelayFrames
+ ret
+; 46f
+