SECTION "Utilities", ROM0
|
|
|
|
; Busy-wait until vertical blank occurs
|
|
waitForVblank::
|
|
ld a, [$ff41]
|
|
and 3
|
|
cp 1
|
|
jr nz, waitForVblank
|
|
ret
|
|
|
|
; Copies data between two regions
|
|
; @param d Size (in bytes) to copy. Must be >0
|
|
; @param bc Pointer to the destination region
|
|
; @param hl Pointer to the source region
|
|
memcpy::
|
|
ld a, [hli]
|
|
ld [bc], a
|
|
inc bc
|
|
dec d
|
|
jr nz, memcpy
|
|
ret
|
|
|
|
; Fills a memory region with a value
|
|
; @param hl Pointer to the destination region
|
|
; @param a Byte to fill with
|
|
; @param c Number of bytes to fill. Must be >0
|
|
memset::
|
|
ld [hli], a
|
|
dec c
|
|
jr nz, memset
|
|
ret
|