From 0c8ed9c424d2f2081b54c85d79c5b387d6975465 Mon Sep 17 00:00:00 2001 From: villadelfia Date: Wed, 18 Oct 2023 01:32:25 +0000 Subject: [PATCH] Update 'src/field.asm' --- src/field.asm | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) 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