SECTION "functions", ROM0[$2000] ; Wait for vblank without using interrupts. waitVBlank: push af .waitVBlankLoop: ldh a, [$ff44] cp $90 jr nz, .waitVBlankLoop pop af ret ; Writes a value across 16 bytes, starting at HL. Intended to fill a single tile. ; Parameters: ; B - The value to set the bytes to. ; Modifies: ; HL - End result: HL + 16 fillTile: push af push de ld d, 16 ld a, b .fillTileLoop: ld [hli], a dec d jr nz, .fillTileLoop pop de pop af ret