Epic n00b question
Everything is in the title:
How to extract CHR & PRG from a NES/UNiF file.
But without using raphnet's ReadNES.exe
The vast majority* of iNES ROM files are structured like this:
header, PRG ROM, CHR ROM
-or-
header, PRG ROM
Read the first 16 bytes from the file. This is the header.
Byte 0x0004 of the header is the PRG ROM size in 16384-byte units.
Byte 0x0005 of the header is the CHR ROM size in 8192-byte units. This may be 0, in which case the cartridge uses only CHR RAM.
Now read the PRG ROM, and read the CHR ROM if it is present.
* Excluding a few mapper hacks that use an obscure iNES feature to load 512 bytes of code into PRG RAM before execution begins.
tepples wrote:
Byte 0x0005 of the header is the CHR ROM size in 8192-byte units. This may be 0, in which case the cartridge uses only CHR RAM.
How does CHR RAM work?
Are not CHR ROM and CHR RAM the same? I mean, isn"t CHR RAM store into 8192-byte banks placed after PRG ROM into an iNES file?
CHR RAM is the stuff you can write to while the program runs, so there's no predefined data for it.
But, how can a game have a title screen if all its character data is RAM?
Unless, if title screen data is stored into PRG ROM. Which mean that PRG ROM is a melting pot of both PRG and CHR data....
The data is stored in the PRG ROM, and the program copies it to CHR RAM.
Ok, I've understood
A program using CHR RAM is a melting pot, but this has the advantage of opening up several possibilities:
- Fine-grained tile animation (e.g. water in Final Fantasy games)
- Compression of tile data (e.g. Contra, Codemasters games)
- Drawing shapes at pixel precision (e.g. Qix, Hatris, Videomation)
- Displaying video generated by a coprocessor (e.g. Wide Boy)
- Familiarity for people who grew up programming for other platforms (e.g. ColecoVision, Commodore 64)
The NES and Neo Geo AES are the only consoles I can think of that use CHR ROM on the cartridge at all. Everything else has onboard CHR RAM, either dedicated or unified with main RAM.