Programming NROM

From NESdev Wiki
Revision as of 22:12, 24 March 2010 by Tepples (talk | contribs) (might as well include header too)
Jump to navigationJump to search

NROM and the other boards that make up iNES Mapper 000 are the simplest of all NES cartridge boards. All address decoding and chip enable handling are handled by the NES hardware; the only integrated circuits on the board are the PRG ROM, CHR ROM, and (in 72-pin carts) CIC.

NROM has two configurations:

  • NROM-256 with 32 KiB PRG ROM and 8 KiB CHR ROM
  • NROM-128 with 16 KiB PRG ROM and 8 KiB CHR ROM

Your program is mapped into $8000-$FFFF (NROM-256) or both $8000-$BFFF and $C000-$FFFF (NROM-128). Most NROM-128 games actually run in $C000-$FFFF rather than $8000-$BFFF because it makes the program easier to assemble and link. Some kinds of data used by the NES CPU, such as the vectors and sampled sound, have to be in $C000-$FFFF, and it simplifies the linker script if everything is in the same memory region. There are probably a few games that rely on the mirroring, but experiments with a multicart engine show that most can run with garbage in $8000-$BFFF.

iNES header

NROM-128:

.segment "HEADER"
  .byte "NES", $1A
  .byte $01       ;NROM has 1 16k bank
  .byte $01       ;NROM has 1 8k bank
  .byte $00, $00  ;NROM is Mapper 0
  .byte $00       ;NROM has no PRG RAM, except the variant used in Family BASIC

NROM-256:

.segment "HEADER"
  .byte "NES", $1A
  .byte $01       ;NROM has 1 16k bank
  .byte $01       ;NROM has 1 8k bank
  .byte $00, $00  ;NROM is Mapper 0
  .byte $00       ;NROM has no PRG RAM, except the variant used in Family BASIC