Files
pokegold-spaceworld/home/delay.asm
T
Rangi c8e9901947 Code conventions:
- Lowercase hex literals
- Lowercase rgbasm keywords (rept, endr)
- Use decimal literals by default, binary when bits are meaningful; hex indicates that it needs further review, e.g. to define a constant
- Tabs, not spaces
- Newline at end of file (rgbds sometimes complains otherwise)
- Doc comments underneath function names
2018-06-01 13:24:42 -04:00

23 lines
376 B
NASM

INCLUDE "constants.asm"
SECTION "Delay", ROM0[$0317]
DelayFrame::
; Wait for one frame
ld a, 1
ld [wVBlankOccurred], a
.halt
; Wait for the next VBlank, halting to conserve battery
halt ; rgbasm adds a nop after this instruction by default
ld a, [wVBlankOccurred]
and a
jr nz, .halt
ret
DelayFrames::
; Wait c frames
call DelayFrame
dec c
jr nz, DelayFrames
ret