|
@ -12,6 +12,9 @@ LAST_SCY:: DB ; Value of SCY last frame |
|
|
PENDING_ROW_PTR:: DW ; Where to write pending row data (0 = no write) |
|
|
PENDING_ROW_PTR:: DW ; Where to write pending row data (0 = no write) |
|
|
PENDING_ROW_DATA:: DS SCRN_VX_B ; Row to be written |
|
|
PENDING_ROW_DATA:: DS SCRN_VX_B ; Row to be written |
|
|
|
|
|
|
|
|
|
|
|
PENDING_COL_PTR:: DW ; Where to write pending column data (0 = no write) |
|
|
|
|
|
PENDING_COL_DATA: DS SCRN_VY_B ; Column to be written |
|
|
|
|
|
|
|
|
CURRENT_DATA_START:: |
|
|
CURRENT_DATA_START:: |
|
|
CURRENT_TILE_PTR:: DW ; Location of tile data |
|
|
CURRENT_TILE_PTR:: DW ; Location of tile data |
|
|
CURRENT_TILE_SIZE:: DB ; Length of tile data (num_tiles * 8) |
|
|
CURRENT_TILE_SIZE:: DB ; Length of tile data (num_tiles * 8) |
|
@ -204,18 +207,39 @@ Map_Scroll:: |
|
|
ret |
|
|
ret |
|
|
|
|
|
|
|
|
Map_Update:: |
|
|
Map_Update:: |
|
|
; Skip update if PENDING_ROW_PTR is 0 |
|
|
|
|
|
|
|
|
; Skip row update if PENDING_ROW_PTR is 0 |
|
|
ld a, [PENDING_ROW_PTR] |
|
|
ld a, [PENDING_ROW_PTR] |
|
|
ld c, a |
|
|
ld c, a |
|
|
ld a, [PENDING_ROW_PTR + 1] |
|
|
ld a, [PENDING_ROW_PTR + 1] |
|
|
ld b, a |
|
|
ld b, a |
|
|
or c |
|
|
or c |
|
|
ret z |
|
|
|
|
|
|
|
|
jr z, .update_col |
|
|
|
|
|
|
|
|
ld hl, PENDING_ROW_DATA |
|
|
ld hl, PENDING_ROW_DATA |
|
|
ld d, SCRN_VX_B |
|
|
ld d, SCRN_VX_B |
|
|
MEMCPY bc, hl, d |
|
|
MEMCPY bc, hl, d |
|
|
|
|
|
|
|
|
|
|
|
.update_col: |
|
|
|
|
|
; Skip update if PENDING_COL_PTR is 0 |
|
|
|
|
|
ld a, [PENDING_COL_PTR] |
|
|
|
|
|
ld c, a |
|
|
|
|
|
ld a, [PENDING_COL_PTR + 1] |
|
|
|
|
|
ld b, a |
|
|
|
|
|
or c |
|
|
|
|
|
ret z |
|
|
|
|
|
|
|
|
|
|
|
ld d, SCRN_VX_B |
|
|
|
|
|
ld hl, PENDING_COL_DATA |
|
|
|
|
|
.update_col_loop: |
|
|
|
|
|
ld a, [hl+] |
|
|
|
|
|
ld [bc], a |
|
|
|
|
|
|
|
|
|
|
|
ld a, SCRN_VX_B |
|
|
|
|
|
ADD16 bc |
|
|
|
|
|
|
|
|
|
|
|
dec d |
|
|
|
|
|
jr nz, .update_col_loop |
|
|
|
|
|
|
|
|
ret |
|
|
ret |
|
|
|
|
|
|
|
|
; Computes the offset into map RAM |
|
|
; Computes the offset into map RAM |
|
|