Nintendo NES-001 User Guide - Page 28

Number of 8 KB CHR-ROM / VROM banks. The names - nes emulator

Page 28 highlights

The software that can be run using an emulator is usually referred to as a ROM image in reference to the original ROM chips used to store it. A simple dump of the contents of the cartridge is unlikely to be sufficient as it leaves no way to identify what each part of the file means. Two different file formats have emerged to provide this information. The iNES file format was originally defined by Marat Fayzullin for use in his iNES emulator. The format has since been used by most emulators and is the most common format for ROM images. INES format files should have the file extension *.nes. The format provides a 16 byte header at the start of the file which contains important information. The format as described in [9] is as shown in table 4-1: Starting Byte 0 3 4 5 6 Length (Bytes) 3 1 1 1 1 Contents Should contain the string 'NES' to identify the file as an iNES file. Should contain the value $1A, also used to identify file format. Number of 16 KB PRG-ROM banks. The PRG-ROM (Program ROM) is the area of ROM used to store the program code. Number of 8 KB CHR-ROM / VROM banks. The names CHR-ROM (Character ROM) and VROM are used synonymously to refer to the area of ROM used to store graphics information, the pattern tables. ROM Control Byte 1: 7 1 • Bit 0 - Indicates the type of mirroring used by the game where 0 indicates horizontal mirroring, 1 indicates vertical mirroring. • Bit 1 - Indicates the presence of battery-backed RAM at memory locations $6000-$7FFF. • Bit 2 - Indicates the presence of a 512-byte trainer at memory locations $7000-$71FF. • Bit 3 - If this bit is set it overrides bit 0 to indicate fourscreen mirroring should be used. • Bits 4-7 - Four lower bits of the mapper number. ROM Control Byte 2: 8 1 9 7 • Bits 0-3 - Reserved for future usage and should all be 0. • Bits 4-7 - Four upper bits of the mapper number. Number of 8 KB RAM banks. For compatibility with previous versions of the iNES format, assume 1 page of RAM when this is 0. Reserved for future usage and should all be 0. Table 4-1. iNES header information. Following the header is the 512-byte trainer, if one is present, otherwise the ROM banks begin here, starting with PRG-ROM then CHR-ROM. The format allows for up to 256 different memory mappers. Each mapper is assigned a specific number and the mapper number can be obtained by shifting bits 4-7 of control byte 2 to the left by 4 bits and then adding the bits 4-7 of control byte 1. A complete list of mappers and their official iNES mapper numbers can be found in Appendix C. 28

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47

28
The software that can be run using an emulator is usually referred to as a ROM image in
reference to the original ROM chips used to store it. A simple dump of the contents of the
cartridge is unlikely to be sufficient as it leaves no way to identify what each part of the file
means. Two different file formats have emerged to provide this information.
The iNES file format was originally defined by Marat Fayzullin for use in his iNES emulator.
The format has since been used by most emulators and is the most common format for ROM
images. INES format files should have the file extension *.nes. The format provides a 16 byte
header at the start of the file which contains important information. The format as described
in [9] is as shown in table 4-1:
Starting Byte
Length (Bytes)
Contents
0
3
Should contain the string ‘NES’ to identify the file as an
iNES file.
3
1
Should contain the value $1A, also used to identify file
format.
4
1
Number of 16 KB PRG-ROM banks. The PRG-ROM
(Program ROM) is the area of ROM used to store the
program code.
5
1
Number of 8 KB CHR-ROM / VROM banks. The names
CHR-ROM
(Character
ROM)
and
VROM
are
used
synonymously to refer to the area of ROM used to store
graphics information, the pattern tables.
6
1
ROM Control Byte 1:
Bit 0 - Indicates the type of mirroring used by the game
where 0 indicates horizontal mirroring, 1 indicates
vertical mirroring.
Bit 1 - Indicates the presence of battery-backed RAM at
memory locations $6000-$7FFF.
Bit 2 - Indicates the presence of a 512-byte trainer at
memory locations $7000-$71FF.
Bit 3 - If this bit is set it overrides bit 0 to indicate four-
screen mirroring should be used.
Bits 4-7 - Four lower bits of the mapper number.
7
1
ROM Control Byte 2:
Bits 0-3 - Reserved for future usage and should all be 0.
Bits 4-7 - Four upper bits of the mapper number.
8
1
Number of 8 KB RAM banks. For compatibility with previous
versions of the iNES format, assume 1 page of RAM when
this is 0.
9
7
Reserved for future usage and should all be 0.
Table 4-1. iNES header information.
Following the header is the 512-byte trainer, if one is present, otherwise the ROM banks
begin here, starting with PRG-ROM then CHR-ROM. The format allows for up to 256
different memory mappers. Each mapper is assigned a specific number and the mapper
number can be obtained by shifting bits 4-7 of control byte 2 to the left by 4 bits and then
adding the bits 4-7 of control byte 1. A complete list of mappers and their official iNES
mapper numbers can be found in Appendix C.