[TI 84 ASM] How do I use the 4 extra bits in a 12x12 sprite

Got questions? Got answers? Go here for both.

Moderator: MaxCoderz Staff

Post Reply
Nugget
New Member
Posts: 5
Joined: Fri 18 Jan, 2008 9:10 pm

[TI 84 ASM] How do I use the 4 extra bits in a 12x12 sprite

Post by Nugget »

I made a routine to display a 12x12 sprite, but, of course, the sprite is 2 bytes in length, which basically wastes 4 bits per row of sprite data (shown by my attempt to BOLD):

Code: Select all

	.DB	%11111000, %0000[b]0000[/b]
	.DB	%01111100, %0000[b]0000[/b]
	.DB	%00111110, %0000[b]0000[/b]
	.DB	%00011111, %0000[b]0000[/b]
	.DB	%00001111, %1000[b]0000[/b]
	.DB	%00000111, %1100[b]0000[/b]
	.DB	%00000011, %1110[b]0000[/b]
	.DB	%00000001, %1111[b]0000[/b]
	.DB	%00000000, %1111[b]0000[/b]
	.DB	%00000000, %0111[b]0000[/b]
	.DB	%00000000, %0011[b]0000[/b]
	.DB	%00000000, %0001[b]0000[/b]
How can I make use of that space to store more sprites? Would that require a separate 12x12 sprite routine which shifts from the right rather than the left? I know somebody out there has an amazing trick.
User avatar
tr1p1ea
Maxcoderz Staff
Posts: 4141
Joined: Thu 16 Dec, 2004 10:06 pm
Location: I cant seem to get out of this cryogenic chamber!
Contact:

Post by tr1p1ea »

When you draw your sprite, you could just mask out the lower 4 bits of your second sprite byte i guess. To access the data you would just mask out the upper 4 bits of the byte, no shifting required.
"My world is Black & White. But if I blink fast enough, I see it in Grayscale."
Image
Image
User avatar
Art_of_camelot
Regular Member
Posts: 124
Joined: Sun 09 Sep, 2007 8:50 pm
Location: The dark side of the moon
Contact:

Post by Art_of_camelot »

This is an old link, but this may be what you are looking for:
http://void.ticalc.org/archives/misc/sam.zip
It uses the 4 extra bits and stores 3 12x12 sprites using 36 bytes, as opposed to using 48 bytes to store 2 12x12 sprites. Should be same general concept.
User avatar
tr1p1ea
Maxcoderz Staff
Posts: 4141
Joined: Thu 16 Dec, 2004 10:06 pm
Location: I cant seem to get out of this cryogenic chamber!
Contact:

Post by tr1p1ea »

Oh, didnt read the 'to store more sprites' part. Yeah you could just pack them and seperate them at runtime.
"My world is Black & White. But if I blink fast enough, I see it in Grayscale."
Image
Image
Post Reply