diff --git a/Makefile b/Makefile index 3530a25..3a3ea7f 100644 --- a/Makefile +++ b/Makefile @@ -20,7 +20,7 @@ OFILES := $(SFILES:%.s=%.o) $(MAP_S:%.s=%.o) is.gb is.gb.sym: $(OFILES) @echo "[LINK] is.gb" @rgblink -o $@ -n $@.sym $(OFILES) - @rgbfix -v $@ + @rgbfix -v -p 0 $@ $(OFILES): $(MAP_INC) $(OFILES): $(SPRITE_2BPP) diff --git a/src/map.s b/src/map.s index 68e4b8a..c52f136 100644 --- a/src/map.s +++ b/src/map.s @@ -141,20 +141,12 @@ Map_Scroll:: ld c, a ; HL = _SCRN0 + 32 * (SCY/8 - 2) -.find_vram_ptr: ld a, [rSCY] sub 16 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 @@ -177,8 +169,7 @@ Map_Scroll:: srl a srl a dec a - ld e, a - call compute_vram_ptr + call get_row_ptr LOAD_MAPX @@ -335,22 +326,18 @@ Map_Update:: ret ; 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 -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 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 ; Write a row of map data into row buffer