|
@ -141,20 +141,12 @@ Map_Scroll:: |
|
|
ld c, a |
|
|
ld c, a |
|
|
|
|
|
|
|
|
; HL = _SCRN0 + 32 * (SCY/8 - 2) |
|
|
; HL = _SCRN0 + 32 * (SCY/8 - 2) |
|
|
.find_vram_ptr: |
|
|
|
|
|
ld a, [rSCY] |
|
|
ld a, [rSCY] |
|
|
sub 16 |
|
|
sub 16 |
|
|
srl a |
|
|
srl a |
|
|
srl a |
|
|
srl a |
|
|
srl a |
|
|
srl a |
|
|
ld d, a |
|
|
|
|
|
ld e, 32 |
|
|
|
|
|
ld hl, _SCRN0 |
|
|
|
|
|
.0: |
|
|
|
|
|
ld a, d |
|
|
|
|
|
ADD16 hl |
|
|
|
|
|
dec e |
|
|
|
|
|
jr nz, .0 |
|
|
|
|
|
|
|
|
call get_row_ptr |
|
|
|
|
|
|
|
|
call enqueue_row_write |
|
|
call enqueue_row_write |
|
|
|
|
|
|
|
@ -177,8 +169,7 @@ Map_Scroll:: |
|
|
srl a |
|
|
srl a |
|
|
srl a |
|
|
srl a |
|
|
dec a |
|
|
dec a |
|
|
ld e, a |
|
|
|
|
|
call compute_vram_ptr |
|
|
|
|
|
|
|
|
call get_row_ptr |
|
|
|
|
|
|
|
|
LOAD_MAPX |
|
|
LOAD_MAPX |
|
|
|
|
|
|
|
@ -335,22 +326,18 @@ Map_Update:: |
|
|
ret |
|
|
ret |
|
|
|
|
|
|
|
|
; Computes the offset into map RAM |
|
|
; Computes the offset into map RAM |
|
|
; @param e The map RAM y-coordinate |
|
|
|
|
|
|
|
|
; @param a The map RAM y-coordinate |
|
|
; @return hl Pointer into map RAM |
|
|
; @return hl Pointer into map RAM |
|
|
compute_vram_ptr: |
|
|
|
|
|
push bc |
|
|
|
|
|
|
|
|
get_row_ptr: |
|
|
|
|
|
push de |
|
|
|
|
|
ld d, 0 |
|
|
|
|
|
ld e, a |
|
|
|
|
|
REPT 5 |
|
|
|
|
|
SLA16 de |
|
|
|
|
|
ENDR |
|
|
ld hl, _SCRN0 |
|
|
ld hl, _SCRN0 |
|
|
ld b, 0 |
|
|
|
|
|
ld c, SCRN_VX_B |
|
|
|
|
|
ld a, e |
|
|
|
|
|
.loop: |
|
|
|
|
|
or a |
|
|
|
|
|
jr z, .done |
|
|
|
|
|
add hl, bc |
|
|
|
|
|
dec a |
|
|
|
|
|
jr .loop |
|
|
|
|
|
.done: |
|
|
|
|
|
pop bc |
|
|
|
|
|
|
|
|
add hl, de |
|
|
|
|
|
pop de |
|
|
ret |
|
|
ret |
|
|
|
|
|
|
|
|
; Write a row of map data into row buffer |
|
|
; Write a row of map data into row buffer |
|
|