would someone be willing to help me debug the first step of my tile displaying routine for stratcon? for some reason it only seems to display the first column of tiles.....
Code:
Code:
Code:
tilemapdisp:
ld a,0 ;y coord
tilemapiloop:
ld e,0 ;x coord
tilemapiloop2:
push af
push de
push af ;we want 2 copies on the stack, 1 is for later use.
push de
call getMapPixel ;get the pixel mask for e,a
and (hl) ;get the state of the pixel
jr nz,tilemapiloopdland ;if the pixel is land, don't bother with a sprite
pop de
ld h,8
call h_times_e
pop af
push hl
ld e,a
ld h,8
call h_times_e ;l now has y coordinate
pop de
ld a,e ;a now has x coord.
ld b,8
ld ix,spr_water
call iPutSprite ;draw the water sprite
jr endtilemapiloop2
tilemapiloopdland:
pop de
ld h,8
call h_times_e
pop af
push hl
ld e,a
ld h,8
call h_times_e ;l now has y coordinate
pop de
ld a,e ;a now has x coord.
ld b,8
ld ix,spr_land
call iPutSprite ;draw the water sprite
endtilemapiloop2:
pop de
inc e
ld a,e
cp 12
jr nz,endtilemapiloop
ld e,0
endtilemapiloop:
pop af
inc a
cp 8
jr nz,tilemapiloop
ret
Code:
getMapPixel:
ld d,$00
ld h,d
ld l,e
add hl,de
add hl,de
add hl,hl
add hl,hl
ld de,savesscreen
add hl,de
ld b,$00
ld c,a
and %00000111
srl c
srl c
srl c
add hl,bc
ld b,a
inc b
ld a,%00000001
getPixelLoop:
rrca
djnz getPixelLoop
ret