The code to process .chr files is very messy. Mostly because I was fumbling trying to compute how many pixels I needed to jump for plotting a color and how many bites I needed to jump for reading data.
Kinda makes me wish uxn packed pixels using a simple "4-pixels per byte" scheme instead of a "two-channels per tile" format. Both pack the same information in the same space (2-bits per pixel), but 4-pixels per byte is easier to process, imo.
@capital it's the famicom format, one of the advantage for 2-bit is that you can draw the layers independently when needed.
https://www.nesdev.org/wiki/PPU_pattern_tables