While working on redoing Solar Wars I decided to take the whole month of February researching nametable compression. I gathered a bunch of raw picture data to develop another nametable compression format. I don't know what to name it so I currently call it "Nametable format D".
Edit: I've changed my format, to accommodate a few more features. The compression ratio is not impacted much.
On average it saves about 710 (69%) bytes per nametable. That's compared to PackBits which saves about 562 (55%) bytes.
A decoder used to be attached, but there's not much sense in attaching a decoder without an encoder. You can find the current encoder plus the data I worked off of at https://jroatch.nfshost.com/2015/nes/na ... ession.zip
Edit: I've changed my format, to accommodate a few more features. The compression ratio is not impacted much.
Code:
000nnnnn ... : 32-N literal bytes.
00111111 : End stream.
00111110 xx yy : * Set PPU_ADDR to yyxx
001nnnnn xx yy : For 32-N times, emit alternately X and Y.
01011111 : * toggle BG transperency. (initially opaque)
010nnnnn xx : 32-N run of X.
01111111 xx : Set BG to X. (initially BG = 0)
011nnnnn xx : 32-N incrementing run starting at X.
1nnnnnnn : 128-N Run of BG.
* = Not present in lite variant.
00111111 : End stream.
00111110 xx yy : * Set PPU_ADDR to yyxx
001nnnnn xx yy : For 32-N times, emit alternately X and Y.
01011111 : * toggle BG transperency. (initially opaque)
010nnnnn xx : 32-N run of X.
01111111 xx : Set BG to X. (initially BG = 0)
011nnnnn xx : 32-N incrementing run starting at X.
1nnnnnnn : 128-N Run of BG.
* = Not present in lite variant.
On average it saves about 710 (69%) bytes per nametable. That's compared to PackBits which saves about 562 (55%) bytes.
A decoder used to be attached, but there's not much sense in attaching a decoder without an encoder. You can find the current encoder plus the data I worked off of at https://jroatch.nfshost.com/2015/nes/na ... ession.zip