A86: Erasing Old Sprites
[Prev][Next][Index][Thread]
A86: Erasing Old Sprites
I am trying to learn asm, and I am working on a sprite demo. This code
should draw a sprite and then when I press a directional key it should
delete the old sprite position and then draw it in the new sprite position
(deleting the old one). I did not include the PutSprite routine because I
think everyone that could answer this question knows what the answer is.
The problem is it does not do this (what I explained above) so I was
wondering if anyone could help.
Anyway in case you dont know the variables:
cd = x,y coordinates
ix = the sprite to display
Also this is and 8x8 sprite rotuine that i got off of ticalc.org.
If anyone could help me I would be greaty appreciated. Oh yeah and I
removed the comments for space concerns
#include "asm86.h"
#include "ti86asm.inc"
.org _asm_exec_ram
call _clrLCD
call BUSY_OFF
jr Setup
Setup:
ld b,0
ld c,0
ld ix,0
ld ix,Dude
call PutSprite
jr Test
Test:
jp ClearOld
Move:
call GET_KEY
cp K_EXIT
jr z,Exit
cp K_UP
jr z,Up
cp K_DOWN
jr z,Down
cp K_LEFT
jr z,Left
cp K_RIGHT
jr z,Right
jr Move
Up:
ld a,c
sub 8
ld c,a
jp DrawNew
Down:
ld a,c
add a,8
ld c,a
jp DrawNew
Left:
ld a,b
sub 8
ld b,a
jp DrawNew
Right:
ld a,b
add a,8
ld b,a
jp DrawNew
Exit:
call _clrLCD
ret
ClearOld:
ld b,b
ld c,c
ld ix,0
ld ix,Clear
call PutSprite
jp Move
DrawNew:
ld ix,0
ld ix,Dude
call PutSprite
jp Move
Dude:
.db %01110000
.db %01110000
.db %00100000
.db %00100100
.db %01111110
.db %00110100
.db %00111000
.db %01101100
Clear:
.db %00000000
.db %00000000
.db %00000000
.db %00000000
.db %00000000
.db %00000000
.db %00000000
.db %00000000
.db %00000000
.end
.end