Hacker News new | ask | show | jobs
by greggman 4070 days ago
> The NES doesn't support flexible bit depths, but a similar principle allows a simple kind of "compression" when storing compressed graphics data in ROM: for a monochrome font, you wouldn't need to store the upper bitplane, and you'd just zero it out when loading the font.

I don't remember NES having many carts having the ram available load fonts. fonts were in rom and directly read in rom by the hardware. Or am I just forgetting some option on certain carts that allowed fonts in ram?

2 comments

The NES has separate address spaces for the CPU and PPU. Part of each is mapped to internal memory and IO registers, with the rest available for the cartridge to do whatever it wants with. The PPU doesn't care if you map RAM ("CHR-RAM") or ROM ("CHR-ROM") into its address space for holding graphics, it just reads whatever is there, so both are commonly used in games. The IO registers used to update tile and palette indices in the "nametable" can access any part of the PPU's address space, so in a CHR-RAM cart, they would also be used to fill the CHR-RAM with graphics. In this case, you absolutely could use any compression scheme you want (within reason) to compress the graphics stored in PRG-ROM. Of course, with a CHR-ROM cart, you'd be limited to storing uncompressed tiles in the CHR-ROM.

NES games are interesting because there's such a variety of hardware in the cartridges and techniques to make the most of it. There are games with huge PRG (CPU-visible) ROMs that stream data into CHR-RAM. There are games with huge CHR-ROMs and mapping hardware for granting fast, fine-grained access to more tile memory than would fit into the PPU's address space. There are games that store level data in unused CHR-ROM, and even a few (IIRC) that store game variables in unused CHR-RAM! Programmers made the most of whatever hardware was cheaply available to them.

It's not particularly uncommon. Check out the mapper list at http://tuxnes.sourceforge.net/nesmapper.txt. All the 0k chr entries are carts that have chr ram. Just for funsies, I looked up one I had, and cracked it open so we could take a look at it. You can see on this Cobra Triangle cart the MB8464A 8k sram chip wired up to the chr lines. https://drive.google.com/file/d/0B2I5cGIsgvHbN1NFdUdLNTluNHM... It's also kind of cool to see the 74 series chips at work; the 74161 counter being used to select the prg rom bank, and the 7402 used to disable the prg rom during writes.