Browse Source

Implement scrolling left

master
Forest Belton 3 years ago
parent
commit
b7a69f2fb0
1 changed files with 38 additions and 5 deletions
  1. +38
    -5
      src/map.s

+ 38
- 5
src/map.s View File

@ -136,7 +136,7 @@ Map_Scroll::
sub 8
ld [PAGEY], a
jr .done
jp .done
.scroll_down_check:
; Check SCY + (SCRN_Y + 16) = PAGEY
@ -144,7 +144,7 @@ Map_Scroll::
sub SCRN_Y + 16
ld hl, rSCY
cp [hl]
jr nz, .scroll_right_check
jr nz, .scroll_left_check
ld a, [PAGEY]
srl a
@ -177,11 +177,45 @@ Map_Scroll::
jr .done
; If SCX = PAGEX, write map col
.scroll_left_check:
; If SCX = PAGEX, write map col
ld a, [PAGEX]
ld hl, rSCX
cp [hl]
jr nz, .scroll_right_check
; HL = VRAM + PAGEX/8
ld hl, _SCRN0
ld a, [PAGEX]
srl a
srl a
srl a
dec a
ADD16 hl
; B = CAMERA_X - 1
ld a, [CURRENT_CAMERA_X]
dec a
ld b, a
; C = CAMERA_Y - SCY/8
ld a, [rSCY]
ld c, a
ld a, [CURRENT_CAMERA_Y]
srl c
srl c
srl c
sub c
ld c, a
call enqueue_col_write
ld a, [PAGEX]
sub 8
ld [PAGEX], a
; If SCX = SCRN_X - PAGEX, write map col
.scroll_right_check:
; If SCX = SCRN_X - PAGEX, write map col
; Check SCX + (SCRN_X + 16) = PAGEX
ld a, [PAGEX]
sub SCRN_X + 16
@ -211,7 +245,6 @@ Map_Scroll::
srl c
srl c
sub c
; dec a
ld c, a
call enqueue_col_write

Loading…
Cancel
Save