Update 'src/field.asm'

This commit is contained in:
villadelfia 2023-10-18 01:32:25 +00:00
parent d05febadac
commit 0c8ed9c424
1 changed files with 11 additions and 8 deletions

View File

@ -25,24 +25,27 @@ FieldClear::
call UnsafeMemSet call UnsafeMemSet
ret ret
; This routine will copy wField onto the screen.
BlitField:: BlitField::
; The first 14 rows can be blitted without checking for vram access. ; What to copy
ld de, wField + 10 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 REPT 14
ld hl, FIELD_TOP_LEFT+(32*row)
REPT 10 REPT 10
ld a, [de] ld a, [de]
ld [hl+], a ld [hl+], a
inc de inc de
ENDR ENDR
DEF row += 1 add hl, bc
ENDR ENDR
; The last 6 rows need some care. ; The last 6 rows need some care.
REPT 6 REPT 6
ld hl, FIELD_TOP_LEFT+(32*row)
REPT 2 REPT 2
: ldh a, [rSTAT] : ldh a, [rSTAT]
and STATF_LCD and STATF_LCD
@ -58,11 +61,11 @@ BlitField::
inc de inc de
ENDR ENDR
ENDR ENDR
DEF row += 1 add hl, bc
ENDR ENDR
; This has to finish just before the first LCDC interrupt of the frame or stuff will break in weird ways. ; This has to finish just before the first LCDC interrupt of the frame or stuff will break in weird ways.
ret jp EventLoop
ENDC ENDC