Sprite & lookup table

vbt

Staff member
it seems you can create sprites with colors inside a table and not in CRAM, what is the way to do that ? I manage to setup the sprite "correctly" (well, it uses LUT) but the sprite is not displayed. I guess it's because table addr is wrong or I fill colrs at the wrong place.
 
Make sure the MSB of the CLUT entries is set to mark it as RGB data. Also verify that the CLUT is 32-byte aligned, and that you store the address divided by 8 in the command table (the address should obviously be local to VDP1!)

(Edit: You also have to set the SPCLMD bit in the SPCTL register when initializing VDP2 so it'll read RGB pixels. If you have any VDP2 backgrounds enabled you also have to set up the priorities. My old sprite bend program uses a CLUT sprite to draw the selected vertex marker, you can use it as an example.)
 
Thanks a bunch Antime ! It works perfectly now, SPCLMD wasn't set and I didn't divide by 8 the address.

to set SPCLMD with SBL : SCL_SET_SPCLMD(1);

for lut sprite : smsSprite.drawMode = ( COLOR_1 | ...);

for sprite addr : smsSprite.color = ((int)colAddr)>>3 | (Num<<2);
 
Back
Top