RE: A89: Sprite Question


[Prev][Next][Index][Thread]

RE: A89: Sprite Question




Hi,
Haha, I know how to make a sprite in z80 or just in the normal way, but I
just didn't know how to convert it to hex.  I just don't really understand
what you mean when you say to combine the hex numbers... maybe if I learn to
convert binary to hex I'll figure it out :)  Thanks though that's a really
good start for me :)

-Ahmed

-----Original Message-----
From: owner-assembly-89@lists.ticalc.org
[mailto:owner-assembly-89@lists.ticalc.org]On Behalf Of Nathaniel Gibson
Sent: Tuesday, June 13, 2000 5:18 PM
To: assembly-89@lists.ticalc.org
Subject: Re: A89: Sprite Question



>I know this is a really dumb question probably, but could someone tell me
>how to convert sprites into the format needed for TIGCC, I've never seen
>that format before.  Thanks.
>
>-Ahmed

The best way I can describe it is to do it by hand...


Take a piece of graph paper and make a 16x16 square of blocks. Within
that, draw your sprite. Now, starting at the top line of pixels, take
the first four blocks and pretend that colored in equals 1, and empty
equals 0. Now, put the four numbers together and pretend it's a
binary number. Convert that number to hex. That's the first 'number'.
Do this for the next 3 groups of 4 block in the first row. Put all
four hex digits together, and that's one index.

Example: take this ball below.

0000	1111	1111	0000	0x0ff0
0001	1111	1111	1000	0x1ff8
0011	1111	1111	1100	0x3ffc
0111	1111	1111	1110	0x7ffe
1111	1111	1111	1111	0xffff
1111	1111	1111	1111	0xffff
1111	1111	1111	1111	0xffff
1111	1111	1111	1111	0xffff
1111	1111	1111	1111	0xffff
1111	1111	1111	1111	0xffff
1111	1111	1111	1111	0xffff
1111	1111	1111	1111	0xffff
0111	1111	1111	1110	0x7ffe
0011	1111	1111	1100	0x3ffc
0001	1111	1111	1000	0x1ff8
0000	1111	1111	0000	0x0ff0


Now, put this in the actual declaration...

static unsigned ball [] = {0x0ff0, 0x1ff8, 0x3ffc, 0x7ffe, 0xffff,
0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0x7ffe,
0x3ffc, 0x1ff8, 0x0ff0};

FYI: Sprite16 is buggy, so you'll have to use Sprite32. In this case
your declaration would be...

static unsigned ball [] = {0x0ff00000, 0x1ff80000, 0x3ffc0000,
0x7ffe0000, 0xffff0000, 0xffff0000, 0xffff0000, 0xffff0000,
0xffff0000, 0xffff0000, 0xffff0000, 0xffff0000, 0x7ffe0000,
0x3ffc0000, 0x1ff80000, 0x0ff00000};

Hope this helps,

Nathaniel Gibson
ngibson@ptd.net




Follow-Ups: References: