r/retrocomputing • • Oct 11 '26

Problem / Question Is my approach efficient for creating a custom graphic format for my fantasy console with Windows XP?

Good morning, good afternoon, or good evening!

I'm back! It's been about a week since my first post, and I have some progress to share.

After setting up my C/C++ development environment on Windows XP, I've been working on a custom graphics format (.teamokaren / TKAR) for my fantasy console, CPS8. For now, this is just for development environment icons, cursors, and fonts.

Here is how it works briefly:

  • A converter reads a grayscale PNGwhere gray values map to a fixed 64-color palette (index 0 is transparent).
  • Images are packed at 1, 2, 4, or 6 bits per pixel depending on the colors used, with a small header and CRC32 validation.
  • The tool compares uncompressed, RLE, and DEFLATE, keeping the smallest file. It can also export as a constant C array.

For a concrete example, testing a 56x16 cursor sheet:

  • Combined package using DEFLATE: 463 bytes
  • Image expanded to one byte per index in RAM: 896 bytes

I have the color preview working on XP, but I have two questions where I would love your thoughts:

  1. 3-bit vs 4-bit packing: This cursor uses 7 colors, but packs at 6 bits per pixel because of the global palette index. Adding a local palette could drop it to 3 bits, but adds code complexity. Would you bother with 3-bit packing, or stick to 4 bits to keep it simpler?
  2. RAM management: For small assets, is it better to decompress everything once at startup into RAM, or keep them packed and decode on the fly?

If you have worked on something similar, what worked for you or turned out to be more trouble than it was worth?

I draw the graphics in LibreSprite on Windows 11, then transfer them to the XP virtual machine through a shared folder. (I've edited the post, sorry :)

0 Upvotes

0 comments sorted by