Omnimaga

Calculator Community => TI Calculators => Axe => Topic started by: Camdenmil on September 02, 2011, 06:17:30 pm

Title: 4x4 sprites
Post by: Camdenmil on September 02, 2011, 06:17:30 pm
I'm making a game that uses 4x4 sprites. Does anyone have a fast way for drawing 4x4 sprites? Right now I'm using nib{ to copy to the buffers.
Title: Re: 4x4 sprites
Post by: Deep Toaster on September 03, 2011, 06:29:20 pm
Just treat it like an 8x8 sprite. That's the fastest way because nib{ is basically a combination of 8-bit storing and masking anyway.
Title: Re: 4x4 sprites
Post by: Camdenmil on September 03, 2011, 09:17:49 pm
So I just draw it the same way as an 8x8 tilemap except with twice as many pt- commands.
Title: Re: 4x4 sprites
Post by: Builderboy on September 03, 2011, 09:57:33 pm
If you are drawing a tilemap, it actually might be better to do something clever by adding values and only storing once to each byte, that way you are using 768 byte store commands instead of twice as many nibble storing commands.  You could do something like:

A*256 + B -> {L6+L}

where A is the nibble of the first sprite, B is the nibble of the second sprite, and L is your offset.  Does that make kinda sense?
Title: Re: 4x4 sprites
Post by: ralphdspam on September 03, 2011, 10:14:36 pm
If anyone wants to make an Axiom, Xeda, Runer, and I made a couple of ASM routines.  
http://ourl.ca/10793

Builderboy's idea is probably the best solution for pure Axe, though.
Title: Re: 4x4 sprites
Post by: Camdenmil on September 04, 2011, 03:31:41 pm
If you are drawing a tilemap, it actually might be better to do something clever by adding values and only storing once to each byte, that way you are using 768 byte store commands instead of twice as many nibble storing commands.  You could do something like:

A*256 + B -> {L6+L}

where A is the nibble of the first sprite, B is the nibble of the second sprite, and L is your offset.  Does that make kinda sense?
I thought about that way but I couldn't figure out how because I forgot about multiplying to shift. Don't you multiply by 16 to shift it 4 bits though?
Title: Re: 4x4 sprites
Post by: Builderboy on September 04, 2011, 04:19:12 pm
Oh right, I was thinking bytes, but yeah multiply by 16 would do it :)