diff --git a/src/field.asm b/src/field.asm index ab9529d..20945b4 100644 --- a/src/field.asm +++ b/src/field.asm @@ -25,24 +25,27 @@ FieldClear:: call UnsafeMemSet ret - + ; This routine will copy wField onto the screen. BlitField:: - ; The first 14 rows can be blitted without checking for vram access. + ; What to copy ld de, wField + 10 - DEF row = 0 + ; Where to put it + ld hl, FIELD_TOP_LEFT + ; How much to increment hl after each row + ld bc, 32 + + ; The first 14 rows can be blitted without checking for vram access. REPT 14 - ld hl, FIELD_TOP_LEFT+(32*row) REPT 10 ld a, [de] ld [hl+], a inc de ENDR - DEF row += 1 + add hl, bc ENDR ; The last 6 rows need some care. REPT 6 - ld hl, FIELD_TOP_LEFT+(32*row) REPT 2 : ldh a, [rSTAT] and STATF_LCD @@ -58,11 +61,11 @@ BlitField:: inc de ENDR ENDR - DEF row += 1 + add hl, bc ENDR ; This has to finish just before the first LCDC interrupt of the frame or stuff will break in weird ways. - ret + jp EventLoop ENDC