🍩 Donut NES CHR Codec 🗜️

Donut is a compression codec for the native texture data of a Nintendo Entertainment System (NES). It operates by a fixed decoded block size of 64 bytes.


The software is provided "as is", without warranty of any kind, express or implied, including but not limited to the warranties of merchantability, fitness for a particular purpose and noninfringement. In no event shall the authors be liable for any claim, damages or other liability, whether in an action of contract, tort or otherwise, arising from, out of or in connection with the software or the use or other dealings in the software.

Compressor With NES and Game Boy Decompresion routines (updated 2024-05-22)

Compressor and cc65 Decompresion routines (updated 2023-12-21)

The Donut Codec is included in the standard library of NESFab

Frequently Asked Questions (FAQ)

Is this Y2K-compliant?
Yes. Donut doesn't handle dates. Also I wasn't even programing computers back then.

Lossy or lossless compression?
Lossless, unless you specify bits to lose with the encoder's "don't care bits" option. This may be useful for static images that have sprite overlays.

How does this compare to ZIP/Deflate?
Donut is worst, but good luck getting Deflate implmented and running on a 6502 machine with only 2K of RAM. LZ4 may be better then Donut for general data and has been implmented for the NES. Mabye I'll conduct a more detailed statistical analysis at a later time.

What Copyright License is this?
Public domain.

Where's the GitHub page?
I am not intrested in maintaining an official GitHub repository at this time.

Do I have to include donut.s for my NESDev Compo '2x or Mapper 28 Project?

Will this work with CHR ROM?
No, to upload to PPU adresses $0000~$1fff the cartridge configuration will need to map RAM there.

Does this work for a project with 4 bpp SNES tiles?
The SNES texture data is still a bytewise planner format. While I have not tried it myself, I believe you can get decent results by: