Re: A85: Mapping Routine
[Prev][Next][Index][Thread]
Re: A85: Mapping Routine
here's what I have in my source code. Take a look at it and see if you know
what's wrong. I don't get any errors when I compile it, only when I run
it...I'm stumped!
Width = 8
Height = 8
Total = 96
NextYAt = 96
ld a,4
out (5),a
ld hl,Map1
push de
ld de,(PROGRAM_ADDR)
add hl,de
pop de
ld (MapPointer),hl
DrawMap:
ROM_CALL(CLEARLCD)
ld a,Total
ld (Current),a
ld a,0
ld (DrawMapX),a
ld a,8
ld (DrawMapY),a
DrawMapLoop:
ld hl,(MapPointer)
ld a,(Current)
ld d,a
ld a,Total
sub d
ld d,0
ld e,a
add hl,de
ld a,(hl)
ld hl,SpriteTable
push de
ld de,(PROGRAM_ADDR)
add hl,de
pop de
add a,a
ld d,0
ld e,a
add hl,de
ROM_CALL(LD_HL_MHL)
ld de,(PROGRAM_ADDR)
add hl,de
ld a,(DrawMapY)
ld c,a
ld a,(DrawMapX)
ld b,a
CALL_(PutSprite)
ld a,(DrawMapX)
add a,Width
cp NextYAt
CALL_Z(UpdateMapY)
ld (DrawMapX),a
ld a,(Current)
ld b,a
dec a
ld (Current),a
djnz DrawMapLoop
ret
UpdateMapY:
ld a,(DrawMapY)
add a,Height
ld (DrawMapY),a
ld a,0
ret