User:Zzo38/DotFami: Difference between revisions

From NESdev Wiki
Jump to navigationJump to search
No edit summary
No edit summary
Line 40: Line 40:


==Mapper Codes==
==Mapper Codes==
=== ($00) Add non-audio component ===
=== ($01) Add audio component ===
=== ($02) Set CPU/PPU memory mapping ===
When using this code to map the CPU/PPU memory, the addresses are translated as follows:
* <tt>$0000</tt>..<tt>$1FFF</tt> = CHR memory (addresses in PPU memory map)
* <tt>$2000</tt>..<tt>$3FFF</tt> = Nametables (if nametable mirroring is set up to use these)
* <tt>$4000</tt>..<tt>$4017</tt> = Reserved (DO NOT USE)
* <tt>$4018</tt>..<tt>$FFFF</tt> = CPU memory map
=== ($03) Nametable mirroring ===
=== ($04) Initialize component with data of ROM banks ===


==Symbol Data==
==Symbol Data==
Line 60: Line 76:
* <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>$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. If this field is used, the initial value of accumulator is the track number to start at, and the mapper codes can also use the track number (which will not change at runtime unless the mapper code tells it to) to decide which ROM bank to enable and so on.
* <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. If this field is used, the initial value of accumulator is the track number to start at, and the mapper codes can also use the track number (which will not change at runtime unless the mapper code tells it to) to decide which ROM bank to enable and so on.
* <tt>$05</tt>: CIC region code. Data should be empty or ASCII name of region code. Address should be a number identifying the region code (0=unused or Japan).


== Mapper Audio ==
==Mapper Components==
 
=== ($00) Memory ===
 
If there is nothing mapped to this memory for writing, it is ROM; otherwise it is RAM (but which may be auto initialized at reset).
 
=== ($01) Address translation/bank switch ===
 
=== ($02) Logic gates ===
 
=== ($03) Famicom Disk System ===
 
=== ($04) Save data (battery RAM) ===
 
=== ($05) Multiplication ===
 
This is like the MMC5 multiplication registers.
 
=== ($06) IRQ ===
 
=== ($07) Enable/disable components ===
 
=== ($08) Counter ===
 
==Mapper Audio==


Note that you can have multiple instances of each and that their parameters can differ as well as how the address lines are connected by using other mapper codes.
Note that you can have multiple instances of each and that their parameters can differ as well as how the address lines are connected by using other mapper codes.
Line 94: Line 135:
Parameters:
Parameters:
* Register write delay (on/off) (should be on; turn it off if it is necessary to emulate a program that does not properly wait for the register to be ready)
* Register write delay (on/off) (should be on; turn it off if it is necessary to emulate a program that does not properly wait for the register to be ready)
* Internal patch set (8 bytes each for 15 instruments)
* Internal patch set (8 bytes each for 15 instruments) (optional)


=== ($04) MMC5 audio ===
=== ($04) MMC5 audio ===
Line 108: Line 149:


Parameters:
Parameters:
* (none)
* Clock speed (0=half, 1=full) (should be 0 to emulate Sunsoft 5B audio)


=== ($06) Namco audio ===
=== ($06) Namco audio ===

Revision as of 01:28, 7 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 data
  • 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'| * |cpu| banks |textLen|mapLen |symLen | * | * |
+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
  • The first four bytes of the header must be the ASCII codes for "FAMI".
  • banks: Number 8K ROM banks.
  • cpu: CPU mode flag:
    • bit0: Set if decimal mode should work (not used in NES/Famicom, although some Famiclones may have decimal mode).
    • bit1: Set if the 2A03 APU noise Mode flag should be ignored.
    • bit2: Swap PPUCTRL and PPUMASK (used in some Vs. System games).
    • bit3: Treat tint bits as they do on RGB PPU.
    • bit4-bit7: Reserved bits; set to zero.
  • *: Reserved bytes; set to zero.
  • textLen: Length of descriptive text.
  • mapLen: Length of mapper codes.
  • symLen: Length of symbol data.

Mapper Codes

($00) Add non-audio component

($01) Add audio component

($02) Set CPU/PPU memory mapping

When using this code to map the CPU/PPU memory, the addresses are translated as follows:

  • $0000..$1FFF = CHR memory (addresses in PPU memory map)
  • $2000..$3FFF = Nametables (if nametable mirroring is set up to use these)
  • $4000..$4017 = Reserved (DO NOT USE)
  • $4018..$FFFF = CPU memory map

($03) Nametable mirroring

($04) Initialize component with data of ROM banks

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, 8=composer of original, 9=composer of cover, 10=Nintendo four-letter code, 11=arcade cabinet model number.
  • $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. If this field is used, the initial value of accumulator is the track number to start at, and the mapper codes can also use the track number (which will not change at runtime unless the mapper code tells it to) to decide which ROM bank to enable and so on.
  • $05: CIC region code. Data should be empty or ASCII name of region code. Address should be a number identifying the region code (0=unused or Japan).

Mapper Components

($00) Memory

If there is nothing mapped to this memory for writing, it is ROM; otherwise it is RAM (but which may be auto initialized at reset).

($01) Address translation/bank switch

($02) Logic gates

($03) Famicom Disk System

($04) Save data (battery RAM)

($05) Multiplication

This is like the MMC5 multiplication registers.

($06) IRQ

($07) Enable/disable components

($08) Counter

Mapper Audio

Note that you can have multiple instances of each and that their parameters can differ as well as how the address lines are connected by using other mapper codes.

($00) Extra 2A03 audio

(see APU)

This need not be indicated if using only the NES/Famicom internal audio; this is if you need an additional 2A03 audio as well as the internal one.

Parameters:

  • (none)

($01) Famicom Disk System audio

(see FDS audio)

Parameters:

  • (none)

($02) VRC6 audio

(see VRC6 audio)

Parameters:

  • (none)

($03) VRC7 audio

(see VRC7 audio)

Parameters:

  • Register write delay (on/off) (should be on; turn it off if it is necessary to emulate a program that does not properly wait for the register to be ready)
  • Internal patch set (8 bytes each for 15 instruments) (optional)

($04) MMC5 audio

(see MMC5 audio)

Parameters:

  • (none)

($05) Sunsoft audio

(see Sunsoft 5B audio)

Parameters:

  • Clock speed (0=half, 1=full) (should be 0 to emulate Sunsoft 5B audio)

($06) Namco audio

(see Namco 163 audio)

Parameters:

  • (none)