INES The .NES file format (file name suffix .nes) is the de facto standard for distribution of NES binary programs, with use even in licensed emulators such as commercialized PocketNES and Wii Virtual Console. It is often called the iNES format, as it was created by Marat Fayzullin for an emulator called iNES. A "rebooted" version of this file format, NES 2.0, was created to fix many shortcomings and support in emulators is being added. .NESファイル形式(ファイル名接尾辞.nes)は、NESバイナリプログラムを配布するための事実上の標準です, 市販のPocketNESやWii Virtual Consoleなどのライセンスを取得したエミュレータでも使用できます。 これは、Marat Fayzullinによって iNES と呼ばれるエミュレータ用に作成されたので、しばしばiNES形式と呼ばれます。 このファイル形式の「再起動」バージョンである、 NES 2.0は、多くの欠点を修正し、エミュレータのサポートを追加するために作成されました。 Contents 1 iNES emulator 2 Name of file format 3 iNES file format 3.1 Flags 6 3.2 Flags 7 3.3 Flags 9 3.4 Flags 10 3.5 Variant comparison 4 See also 5 References iNES emulator iNES was an early NES emulator developed by Marat Fayzullin. Its most lasting contribution to the NES scene was its popularization of the iNES ROM file format and mapper numbering system. Name of file format This file format is commonly referred to as the iNES file format/iNES header format. The file extension is .nes, so it is sometimes referred to as the .nes file format, and files in it as .nes files. Now that the NES 2.0 file format exists, which uses the same .nes extension, a .nes file/the .nes file format could mean the iNES file format or NES 2.0 format, so the full format names should be used where the differences in the formats are relevant, like specifications or format support. このファイル形式は、一般にiNESファイル形式/ iNESヘッダー形式と呼ばれます。ファイル拡張子は.nesであるため、.nesファイル形式と呼ばれることがあります。似た仕様やフォーマットをサポートする、NES 2.0ファイル形式が同じ.nes拡張子を使用しているので、.nesファイル/ .nesファイル形式は、iNESファイル形式またはNES 2.0形式のいずれかである可能性があります, したがって、形式の違いが関係する場合は、完全な形式名を使用する必要があります。 iNES ファイル形式 An iNES file consists of the following sections, in order: ヘッダー (16 バイト) トレーナー ( 未使用 0 バイト、使用 512 バイト) PRG ROM データ (16384 * x バイト) CHR ROM データ 存在する場合 (8192 * y バイト) PlayChoice INST-ROM, 存在する場合 (0 or 8192 バイト) PlayChoice PROM, 存在する場合 (16 バイト Data, 16 バイト CounterOut) (this is often missing, see PC10 ROM-Images for details) Some ROM-Images additionally contain a 128-byte (or sometimes 127-byte) title at the end of the file. The format of the header is as follows: 0-3: Constant $4E $45 $53 $1A ("NES" followed by MS-DOS end-of-file) 4: Size of PRG ROM in 16 KB units 5: Size of CHR ROM in 8 KB units (Value 0 means the board uses CHR RAM) 6: Flags 6 7: Flags 7 8: Size of PRG RAM in 8 KB units (Value 0 infers 8 KB for compatibility; see PRG RAM circuit) 9: Flags 9 10: Flags 10 (unofficial) 11-15: Zero filled Flags 6 7654 3 2 1 0 ---------------- MapL 4S Tr BB Mr Mr 0: vertical arrangement/horizontal mirroring (CIRAM A10 = PPU A11) 1: horizontal arrangement/vertical mirroring (CIRAM A10 = PPU A10) BB 1: バッテリーバックアップ PRG RAM ($6000-7FFF)か、その他のメモリがカートリッジに載っている Tr 1: 512バイト トレーナーあり $7000-$71FF (PRG dataの前に配置される) 4S 0: V/H arrangementビット有効 1: 4画面 VRAM MapL マッパー番号の下位4ビット In the iNES format, cartridge boards are divided into classes called "mappers" based on similar board hardware and behavior, and each mapper has a number from 0 to 255. iNESフォーマットでは、カートリッジボードは、同様のボードハードウェアと動作に基づいて「マッパー」と呼ばれるクラスに分割され、各マッパーは0〜255の番号を持ちます。 Some mappers, such as MMC1, MMC3, and AxROM, can control nametable mirroring. They ignore bit 0. On the other hand, if bit 3 is true, the cart has 4 KiB of RAM at PPU $2000-$2FFF, and it ignores the mapper's CIRAM A10 output (as in Rad Racer 2). One exception is #218, which uses the four-screen bit to switch between one-screen and V/H mirroring. MMC1、MMC3、AxROMなどの一部のマッパーでは、ネームテーブルのミラーリングを制御できます。 一方、ビット3が真の場合、カートにはPPU $ 2000- $ 2FFFに4 KiBのRAMがあり、 マッパーのCIRAM A10出力を無視します(Rad Racer 2のように)。 1つの例外は#218です。これは4画面ビットを使用して1画面とV / Hミラーリングを切り替えます。 Unlike the PowerPak, Famicom copiers did not implement even the most popular Famicom mappers. Instead, games for the copiers were patched to use the mappers that the copier supported, and some of these patches relied on extra code called a "trainer" that the copier loaded into PRG RAM before starting the game. One of these copiers was made by Front Fareast Industrial; hence the nickname "FFE" for these mapper hacks. It is probably not worth the effort to support FFE hacks in future emulators or copiers because substantially all games available with an FFE hack also have a good dump without a trainer. PowerPakとは異なり、Famicomコピー機は最も人気のあるFamicomマッパーを実装していませんでした。 その代わりに、コピー機のゲームは、コピー機がサポートしているマッパーを使用するようにパッチが当てられました。 これらのパッチの一部では、ゲームを開始する前にコピー機がPRG RAMにロードした「トレーナー」と呼ばれる余分なコードに依存していました。 これらのコピー機の1つはフロントファレストインダストリーによって製造されたものだったので、これらのマッパーハックに「FFE」というニックネームがついています。 将来のエミュレータやコピー機でFFEのハックをサポートする努力をする価値はないでしょう。 実質的にFFEのハックで利用できるすべてのゲームには、トレーナーがいなくても良いダンプを持っているからです。 しかし、一部の改造ROMにおいてもトレーナーを使用している場合があるらしいです。 トレーナーは$7000〜のプログラムを破壊してしまうため、このアドレスを使用するマッパーでは正常に動作しないでしょう。 Flags 7 7654 32 1 0 ------------- MAPH V2 PC VS VS 1: VS Unisystem PC 1: PlayChoice-10 (8KB の ヒント画面データが CHR dataの後に載っている) V2 10: フラグ 8-15 は NES 2.0 形式で使用される MapH xxxx: マッパー番号の上位4ビット The PlayChoice-10 bit is not part of the official specification, and most emulators simply ignore the extra 8KB of data. PlayChoice games are designed to look good with the 2C03 RGB PPU, which handles color emphasis differently from a standard NES PPU. PlayChoice-10ビットは公式仕様の一部ではなく、ほとんどのエミュレータは余分な8KBのデータを無視します。 PlayChoice-10のゲームは、2C03 RGB PPUでよく見えるように設計されています。これは標準のNES PPUとは異なる色の強調を扱います。 Vs. games have a coin slot and different palettes. The detection of which palette a particular game uses is left unspecified. VS Unisystemではコインスロットと異なるパレットがあります。 特定のゲームがどのパレットを使用するかの検出は不特定のままである。 NES 2.0 is a more recent extension to the format that allows more flexibility in ROM and RAM size, among other things. NES 2.0形式は、とりわけROMやRAMサイズの柔軟に指定すること可能にするフォーマットへの新しい拡張です。(といっても、2005年だけど) Flags 9 7654321 0 ---------- RV TV TV 0: TV system NTSC 1: TV system PAL RV 未使用 0をセット Though in the official specification, very few emulators honor this bit as virtually no ROM images in circulation make use of it. 公式の仕様で、ほとんどのエミュレータはこのビットを賞賛していますが、実際にはROMイメージではそれを使用していません。(セットされていない?) Flags 10 76543210 || || || ++- TV system (0: NTSC; 2: PAL; 1/3: dual compatible) |+----- PRG RAM ($6000-$7FFF) (0: present; 1: not present) +------ 0: Board has no bus conflicts 1: Board has bus conflicts This byte is not part of the official specification, and relatively few emulators honor it. このバイトは公式仕様の一部ではなく、比較的少数のエミュレータがそれを尊重しています。 The PRG RAM Size value (stored in byte 8) was recently added to the official specification; as such, virtually no ROM images in circulation make use of it. Older versions of the iNES emulator ignored バイト 7-15, and several ROM management tools wrote messages in there. Commonly, these will be filled with "DiskDude!", which results in 64 being added to the mapper number. A general rule of thumb: if the last 4 バイト are not all zero, and the header is not marked for NES 2.0 format, an emulator should either mask off the upper 4 bits of the mapper number or simply refuse to load the ROM. Variant comparison Over the years, the header of the .NES file format has changed as new features became needed. There are three discernable generations: Archaic iNES Created by Marat and used in very old versions of iNES and in NESticle. ROM image conversion and auditing tools tended to store signature strings at offsets 7-15. iNES 0.7 Created by Marat when the scene discovered the diversity of NES cartridge hardware. Mapper high nibble is supported in emulators since roughly 2000. iNES Later revisions added byte 8 (PRG RAM size) and byte 9 (TV system), though few other emulators supported these fields. NES 2.0 Created by kevtris for the FPGA Kevtendo and maintained by the NESdev community to clarify ambiguous cases that previous headers did not clarify. Became widely adopted starting in the 2010s. Thing Archaic iNES iNES NES 2.0 Byte 7 Unused Mapper high nibble, Vs. Mapper high nibble, NES 2.0 signature, PlayChoice, Vs. Byte 8 Unused Total PRG RAM size (linear) Mapper highest nibble, mapper variant Byte 9 Unused TV system Upper bits of ROM size Byte 10 Unused Unused PRG RAM size (logarithmic; battery and non-battery) Byte 11 Unused Unused VRAM size (logarithmic; battery and non-battery) Byte 12 Unused Unused TV system Byte 13 Unused Unused Vs. PPU variant Mappers supported 0-15 0-255 0-4095 Recommended detection procedure: If byte 7 AND $0C = $08, and the size taking into account byte 9 does not exceed the actual size of the ROM image, then NES 2.0. If byte 7 AND $0C = $00, and バイト 12-15 are all 0, then iNES. Otherwise, archaic iNES. See also INES 1.0 Mapper Grid List of INES mappers References Official iNES specs iNES format by rvu iNES header/format by VmprHntrD iNES emulator