Re: A82: Sprite routine for ash
[Prev][Next][Index][Thread]
Re: A82: Sprite routine for ash
At 10:11 PM 8/14/97 -0600, you wrote:
>Ok thank you. But I have one more question. How would i store a
>sprite in HL?
>
You do not store the actual sprite into hl, hl just points to the sprite
(remember to add PROGRAM_ADDR.)
Another thing I did not mention, this routine requires that you have 2
bytes containing the dimensions in pixels of the sprite ("x" must be below
8, "y" can be any number) before the actual sprite data starts. So a simple
8x8 box would look something like this:
sprite:
.db 8,8
.db %11111111
.db %10000001
.db %10000001
.db %10000001
.db %10000001
.db %10000001
.db %10000001
.db %11111111
and the following will draw that sprite at 2,2
ld hl,sprite
ld de,(PROGRAM_ADDR)
add hl,de
ld b,2
ld c,2
CALL_(PutSprite)
Also, I have noticed that sometimes a trash line is put in place of the
last line of the last sprite that you have defined, I'm not sure why, but
putting .db 0 at the end of the last sprite in your program corrects this.
-Andrew
References: