User:Zzo38/DotFami: Difference between revisions

From NESdev Wiki
Jump to navigationJump to search
(Created page with "This is a draft for <tt>.fami</tt> format of NES/Famicom ROM image files. This format allows title text, debugging information, custom mapper, and a few more. (N.B. Do not de...")
 
No edit summary
Line 2: Line 2:


(N.B. Do not delete or move this file until the draft is completed.)
(N.B. Do not delete or move this file until the draft is completed.)
Difference of this format with others includes:
* You can specify NTSC and PAL.
* Can include descriptive text.
* There is no fixed set of mapper numbers; instead the components of the cartridge are configured individually.
* Debugging symbols can be included.


==File Order==
==File Order==
Line 21: Line 27:


* The first four bytes of the header must be the ASCII codes for "<tt>FAMI</tt>".
* The first four bytes of the header must be the ASCII codes for "<tt>FAMI</tt>".
* <tt>bnk</tt>: Number of 8K banks. (There is a special meaning if this is zero; see below.)
* <tt>bnk</tt>: Number of 8K banks.
* <tt>cpu</tt>: CPU mode flag:
* <tt>cpu</tt>: CPU mode flag:
** bit0: Set if decimal mode should work.
** bit0: Set if decimal mode should work.
Line 33: Line 39:
* <tt>mapLen</tt>: Length of mapper codes.
* <tt>mapLen</tt>: Length of mapper codes.
* <tt>symLen</tt>: Length of symbol data.
* <tt>symLen</tt>: Length of symbol data.
==Mapper Codes==
==Symbol Data==
Symbol data consists of zero or more blocks consisting of a 16-bit ID followed by a 16-bit address followed by data.
The ID is formed as follows:
* bit0-bit5: Length of data (0 to 63 bytes).
* bit6-bit7: Mode (0=ROM, 1=mapper, 2=CPU memory, 3=extra)
* bit8-bit15: Depend on mode as follows:
** 0: Bank number.
** 1: Component ID.
** 2: bit8=read, bit9=write, bit10=execute, bit11=16-bit data, bit12-bit15=reserved (set to zero).
** 3: ID number of what kind of extra it is.
The extras would be:
* <tt>$00</tt>: Arcade cabinet switch. Bit0-bit2 of address is the switch number, bit8 of address is the default setting (1=on, 0=off). Data is the name of the switch.
* <tt>$01</tt>: Cartridge component name. Address bit0-bit7 = component ID, bit8-bit15 = sub-part. Data is name of component.
* <tt>$02</tt>: ASCII text. Address indicate what the text means: 0=title, 1=author, 2=copyright, 3=mapper name, 4=license, 5=publisher, 6=version, 7=date.
* <tt>$03</tt>: RGB palette. Address is from 0 to 63 indicating which palette index is used at first, data is the RGB triples (one byte per channel) starting from the specified palette index.
* <tt>$04</tt>: Track name. Address is track number (0 to 255 only). Data is the name of the track in ASCII text. Names can be blank, and if higher track number is given name but lower one is not, the lower numbered tracks still exist and have blank name.

Revision as of 21:40, 3 August 2012

This is a draft for .fami format of NES/Famicom ROM image files. This format allows title text, debugging information, custom mapper, and a few more.

(N.B. Do not delete or move this file until the draft is completed.)

Difference of this format with others includes:

  • You can specify NTSC and PAL.
  • Can include descriptive text.
  • There is no fixed set of mapper numbers; instead the components of the cartridge are configured individually.
  • Debugging symbols can be included.

File Order

  • Header
  • ROM banks
  • Mapper codes
  • Symbol data
  • Descriptive text

(Note: Sixteen bit numbers throughout the file are small-endian form.)

Header

  0   1   2   3   4   5   6   7   8   9   A   B   C   D   E   F
+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
|'F'|'A'|'M'|'I'|bnk|cpu| * | * |textLen|mapLen |symLen | * | * |
+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
  • The first four bytes of the header must be the ASCII codes for "FAMI".
  • bnk: Number of 8K banks.
  • cpu: CPU mode flag:
    • bit0: Set if decimal mode should work.
    • bit1: Set if the 2A03 APU noise Mode flag should be ignored.
    • bit2-bit3: CPU clock speed multiplier: 00 = half speed, 01 = normal speed, 10 = double speed, 11 = quadruple speed.
    • bit4-bit5: TV system: 00 = perfect mode (RGB palette, NTSC timing, 32x30 tiles fully visible, no color artifacts), 01 = NTSC, 10 = PAL, 11 = work with NTSC or PAL.
    • bit6: Set if RAM should be initialized with random values instead of zero.
    • bit7: Set if mapper should be initialized with random values instead of zero.
  • *: Reserved bytes; set to zero.
  • textLen: Length of descriptive text.
  • mapLen: Length of mapper codes.
  • symLen: Length of symbol data.

Mapper Codes

Symbol Data

Symbol data consists of zero or more blocks consisting of a 16-bit ID followed by a 16-bit address followed by data.

The ID is formed as follows:

  • bit0-bit5: Length of data (0 to 63 bytes).
  • bit6-bit7: Mode (0=ROM, 1=mapper, 2=CPU memory, 3=extra)
  • bit8-bit15: Depend on mode as follows:
    • 0: Bank number.
    • 1: Component ID.
    • 2: bit8=read, bit9=write, bit10=execute, bit11=16-bit data, bit12-bit15=reserved (set to zero).
    • 3: ID number of what kind of extra it is.

The extras would be:

  • $00: Arcade cabinet switch. Bit0-bit2 of address is the switch number, bit8 of address is the default setting (1=on, 0=off). Data is the name of the switch.
  • $01: Cartridge component name. Address bit0-bit7 = component ID, bit8-bit15 = sub-part. Data is name of component.
  • $02: ASCII text. Address indicate what the text means: 0=title, 1=author, 2=copyright, 3=mapper name, 4=license, 5=publisher, 6=version, 7=date.
  • $03: RGB palette. Address is from 0 to 63 indicating which palette index is used at first, data is the RGB triples (one byte per channel) starting from the specified palette index.
  • $04: Track name. Address is track number (0 to 255 only). Data is the name of the track in ASCII text. Names can be blank, and if higher track number is given name but lower one is not, the lower numbered tracks still exist and have blank name.