GeorgRottensteiner / C64Studio

C64Studio is a .NET based IDE specializing in game development for the C64 in assembler and BASIC
Other
252 stars 38 forks source link

Exporting x16 sprites needs the extra color byte removed #113

Closed Thraka closed 3 months ago

Thraka commented 3 months ago

It seems that x16 vera chip uses 17-bits for address space, but for sprites, the bottom 5 bits are ignored, so everything is aligned to 32 decimal ($20).

We were using a sprite project with multiple 32x32x4bpp sprites. However, with that extra metadata byte you add at the end of each sprite for the "chosen" color the C64 uses, throws everything out of whack because nothing after the first sprite aligns properly to the vera memory expected.

While you can use the SPRMEM command in BASIC to set the correct location of the sprite in memory, it unfortunately is bound by the vera limitation of aligning things to 32 decimal. For example, If you set sprite 1 to $3000 and sprite 2 to $3001. Sprite 2 will actually align to $3000 and ignore what you told it. The next bit of memory you can align to is $3020.

GeorgRottensteiner commented 3 months ago

Thanks! I did implement the fix in a different way, as there's a huge function collection querying all kind of mode infos (Lookup). Implemented with commit #c54d5622984286fa270fc4deddf0b8e975344c31. Uploaded a new WIP build to https://www.georg-rottensteiner.de/webmisc/C64StudioRelease.zip

Thraka commented 3 months ago

Awesome, thanks @GeorgRottensteiner ! I wanted to take a stab at it obviously not understanding too much about your code structure, so no worries!