after the 16th byte

This is an archive of a topic from NESdev BBS, taken in mid-October 2019 before a server upgrade.
View original topic
after the 16th byte
by on (#20644)
after the 16 byte of the .nes file, there is a 512 byte trainer if present, then the 16 or 32kb program code, then the 8kb chr rom. But why are some .nes roms so big like the simspons rom file is 262kb?

by on (#20646)
I've rented at least three NES games based on The Simpsons franchise. Which are you talking about?

If an iNES file is 262,160 bytes, then it's either a 16-byte header followed by 8 banks (131,072 bytes) of PRG ROM and 16 banks (131,072 bytes) of CHR ROM, or it's a 16-byte header (with CHR set for RAM) followed by 16 banks (262,144 bytes) of PRG ROM. The header states how many banks are in each section.
Re: after the 16th byte
by on (#20655)
nesemuguy wrote:
after the 16 byte of the .nes file, there is a 512 byte trainer if present, then the 16 or 32kb program code, then the 8kb chr rom. But why are some .nes roms so big like the simspons rom file is 262kb?

Not all games have only 16KB or 32KB PRG code. In fact most don't! Those sizes are used on boards without memory mapping hardware (i.e. NROM). Most games have more than 32KB of PRG code, and more than 8KB CHR (if it is a CHR-ROM game, CHR-RAM games have their graphics stored with the PRG code).

However, the 6502 (NES CPU) can only see 32KB of PRG and 8KB of CHR at a time, so it's a job for the mapping hardware to show small pieces of the complete ROM into these "windows" that the CPU can see, and that's what memory mapping is.

by on (#20663)
Firstly, you must understand the iNES header. It brings the number of PRG banks, each bank is 4000h bytes long. Same for the CHR banks, but they're 2000h bytes long due to the PPU memory size. Trainers are NOT official data in a cartridge, but hacking using the SRAM space.