ref: b74e63a20dcdb0cf376977426a9dcbe64586273a
parent: d2eeab62eac2213b51371ea7359904f652914db3
author: yenatch <[email protected]>
date: Tue Sep 3 13:36:55 EDT 2013
split out delay functions
--- /dev/null
+++ b/engine/delay.asm
@@ -1,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
+
--- a/main.asm
+++ b/main.asm
@@ -62,28 +62,7 @@
INCLUDE "engine/vblank.asm"
-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
+INCLUDE "engine/delay.asm"
RTC: ; 46f