Browse Source

Merge branch 'master' of git.homolo.gy:forestbelton/island-story

master
Forest Belton 3 years ago
parent
commit
cd0765a30f
2 changed files with 13 additions and 26 deletions
  1. +1
    -1
      Makefile
  2. +12
    -25
      src/map.s

+ 1
- 1
Makefile View File

@ -20,7 +20,7 @@ OFILES := $(SFILES:%.s=%.o) $(MAP_S:%.s=%.o)
is.gb is.gb.sym: $(OFILES) is.gb is.gb.sym: $(OFILES)
@echo "[LINK] is.gb" @echo "[LINK] is.gb"
@rgblink -o $@ -n $@.sym $(OFILES) @rgblink -o $@ -n $@.sym $(OFILES)
@rgbfix -v $@
@rgbfix -v -p 0 $@
$(OFILES): $(MAP_INC) $(OFILES): $(MAP_INC)
$(OFILES): $(SPRITE_2BPP) $(OFILES): $(SPRITE_2BPP)

+ 12
- 25
src/map.s View File

@ -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

Loading…
Cancel
Save