- Oiram [TI84+CE]
- 17 Sep 2015 05:03:02 pm Permalink
- Last edited by MateoConLechuga on 05 Jan 2017 06:26:59 pm; edited 8 times in total
DrawMap:
ld hl,(xoffset)
ld de,(yoffset)
; X Cord -> HL
; Y Cord -> DE
DispMapAny:
di
ld a,l
and 7
srl h
rr l
srl h
rr l
srl h
rr l ; x coordinate divided by 8, remainder in A
neg
ld (xoffset_smc),a ; store the amount to shift x by... negatively
ld a,l ; amount to shift the map index down by
ex af,af'
ld a,e
and 7
srl d
rr e
srl d
rr e
srl d
rr e ; X coordinate divided by 8, remainder in A
neg
ld (yoffset_smc),a ; store the amount to shift y by...
ld hl,(mapPtr)
ld a,(hl)
ld (widthoffset_smc),a
ld d,a
mlt de ; width*yoffset
add hl,de ; hl->new starting y location to read from
ex de,hl
or a \ sbc hl,hl
ex af,af'
ld l,a
add hl,de
inc hl
inc hl
yoffset_smc: =$+1
xoffset_smc: =$+2
ld bc,0 ; b=xpos
; hl->mapdata
drawLoop:
push hl
push bc
row:
ld a,(hl)
bit animateTilesFlg,(iy+LCDFlgs)
call nz,animateTiles
inc hl
push bc
push hl
ld l,258/2 ; l = 258/2 bytes
ld h,a
mlt hl ; hl = half the offset we need :: need hl*2
add hl,hl
ld de,tile0_sprite
add hl,de
call drawSprite8bppTile
pop hl
pop bc
ld a,b
add a,8
ld b,a
cp 8*numCols
jr c,row
pop bc
pop hl
widthoffset_smc: =$+1
ld de,0
add hl,de
ld a,c
add a,8
ld c,a
cp 8*numRows ; 72
jr c,drawLoop
res animateTilesFlg,(iy+LCDFlgs)
ret
Advertisement
Advertisement