INES Mapper 006: Difference between revisions

From NESdev Wiki
Jump to navigationJump to search
(Move mode-specific notes to mode sections and identify mode 1 as UN1ROM after lidnariq compared this mapper to the Action 53 mapper in https://forums.nesdev.com/viewtopic.php?p=228394#p228394)
(Shorten. Don't say "copier" since they don't copy anything. Remove bit descriptions irrelevant for iNES use.)
Line 1: Line 1:
[[Category:INES Mappers|006]][[Category:Mappers with cycle IRQs]]
[[Category:INES Mappers|006]][[Category:Mappers with cycle IRQs]]
iNES Mappers 006/008 are used for ROM images that have been converted from disk images for the ''Bung Game Doctor'' copiers. They are also supported by the ''Front FarEast Super Magic Card'' copiers. All of these ROM images have been extensively modified to use the copier's idiosyncratic bankswitch registers.
iNES Mapper 006 is used for ROM images that have been extracted from disk images for the ''Bung (Super) Game Doctor'' or ''Front Fareast Magicard'' RAM cartridges and that use [[#Mode 1: Custom|Game Doctor Mode 1]] or [[#8 KiB Banking Mode|8 KiB Banking Mode]] (exclusively or non-exclusively). Extracted games that exclusively use the other banking modes can be run using their normal [[iNES]] mapper equivalents. iNES Mapper 008 specifies [[#Mode 4: GNROM|Game Doctor Mode 4]], which makes it a duplicate of [[INES Mapper 066]].


There are 32 KiB of CHR-RAM, enough to run games with less than or equal to that amount of CHR data with little modification. For games with more than 32 KiB of CHR-ROM, additional bankswitching code keeps track of the game's CHR-ROM bank usage and caches the most recently-used 32 KiB in CHR-RAM, copying data from PRG address space into CHR-RAM as needed. This necessarily involves screen flicker. The amount of extra code needed to accomplish this requires a "trainer" that is always loaded into PRG-RAM at $7000. According to the [[iNES]] format, this Trainer is supposedly always 512 bytes in size. A few ROM images however actually have 640- or 768-byte trainers, whose size must be detected as the modulus 8192 of the file size minus the 16 byte iNES header, detecting and ignoring any footer.
=Banks=
* CPU $6000-$7FFF: 8 KiB of PRG-RAM. If the [[iNES]] header specifies a 512-byte "trainer", it must be loaded to $7000-$71FF, be writable, and (on a hard reset) initialized by JSRing to $7003 before JMPing to the game's reset vector.
* CPU $8000-$FFFF: 32 KiB of PRG-"ROM", banked in various amounts from 256 KiB total depending on the banking mode.
* PPU $0000-$1FFF: 8 KiB of CHR-RAM, banked in 8 KiB amounts from 32 KiB total.


=Banking Modes=
=Game Doctor Banking Modes=
The banking mode is changed via registers $42FE/$42FF. The initial banking mode upon startup would be directly available in the original disk image format that these copiers used, but can only be roughly deduced from the iNES header:
Write-only register at $42FC-$42FF:
* Mapper 002: Either actual [[INES Mapper 002]] (UNROM/UOROM) or Copier Modes 0 (128 KiB PRG) or 2 (256 KiB PRG). Since actual UNROM/UOROM boards do not have PRG-RAM, any Mapper 002 iNES-format ROM image that has the Battery bit set, the Trainer bit set, or writes to $4024-$43FF is actually a Copier Mode 0/2 game.
A~FEDC BA98 7654 3210  D~7654 3210
* Mapper 003: Either actual [[INES Mapper 003]] (CNROM) or Copier Modes 5 (32 KiB CHR) or 7 (16 KiB CHR). Since actual CNROM boards do not have PRG-RAM, any Mapper 003 iNES-format ROM image that has the Battery bit set, the Trainer bit set, or writes to $4024-$43FF is actually a Copier Mode 5 game.
  -------------------    ---------
* Mapper 006: Unspecified, but almost always Copier Mode 1.
  0100 0010 1111 11bM    BBBM ....
* Mapper 008: Copier Mode 4.
                    |+----|||+------ Set nametable mirroring type
The initial nametable mirroring type can be deduced from the iNES header. Games that require one-screen mirroring, which could not be conveyed by the iNES header, always enable it by writing to $42FE themselves.
                    |    |||        0: One-screen, page 0
 
                    |    |||        1: One-screen, page 1
==Mode 0: UNROM==
                    |    |||        2: Vertical
                    |    |||        3: Horizontal
                    +-----|||------- 0: PRG-ROM is writeable, latch is disabled
                          |||        1: PRG-ROM is write-protected, latch is enabled
                          +++------- Select Game Doctor Banking mode
* Because the RAM cartridge has no other means of masking PRG-/CHR-ROM addresses, UNROM vs. UOROM and CNROM-128 vs. CNROM-256 are explicitly differentiated.
* When changing from a mode that allows changing CHR-RAM banks to one that does not, the previously-chosen CHR-RAM bank remains active.
* The latch at $8000-$FFFF is only active when PRG-"ROM" is [[#Game Doctor Mode ($42FC-$42FF)|write-protected]]. A few games temporarily write-enable PRG-"ROM" to change the reset handler after initialization.
==Mode 0: [[INES Mapper 002|UNROM]]==
* 16 KiB PRG-ROM bank at CPU $8000-$BFFF, switched by D0..D2 of data latch at CPU $8000-$FFFF
* 16 KiB PRG-ROM bank at CPU $8000-$BFFF, switched by D0..D2 of data latch at CPU $8000-$FFFF
* 16 KiB PRG-ROM bank at CPU $C000-$FFFF, fixed to bank #7
* 16 KiB PRG-ROM bank at CPU $C000-$FFFF, fixed to bank #7
* 8 KiB of write-enabled CHR-RAM
* 8 KiB of write-enabled CHR-RAM
 
==Mode 1: Custom==
==Mode 1: UN1ROM==
A hybrid of [[UNROM]] (fixed bank 7), [[UOROM]] (256 KiB total PRG-ROM size), and [[iNES Mapper 094|UN1ROM]] (left shift by 2) with 32 KiB of CHR-RAM.
This combines the left shift by 2 of the ''Senjou no Ookami'' mapper ([[iNES Mapper 094]]) with CHR bank switching.
* 16 KiB PRG-ROM bank at CPU $8000-$BFFF, switched by D2..D6 of data latch at CPU $8000-$FFFE (not $FFFF!)
* 16 KiB PRG-ROM bank at CPU $8000-$BFFF, switched by D2..D6 of data latch at CPU $8000-$FFFE (not $FFFF!)
* 16 KiB PRG-ROM bank at CPU $C000-$FFFF, fixed to bank #7
* 16 KiB PRG-ROM bank at CPU $C000-$FFFF, fixed to bank #7
* 8 KiB write-enabled CHR-RAM bank at PPU $0000-$1FFF, switched by D0..D1 of data latch at CPU $8000-$FFFE (not $FFFF!)
* 8 KiB write-enabled CHR-RAM bank at PPU $0000-$1FFF, switched by D0..D1 of data latch at CPU $8000-$FFFE (not $FFFF!)
 
==Mode 2: [[INES Mapper 002|UOROM]]==
==Mode 2: UOROM==
Unlike [[INES Mapper 002]], the copier needs to differentiate between UNROM and UOROM because it has no other way of masking the PRG-ROM address to know which bank is the last bank.
* 16 KiB PRG-ROM bank at CPU $8000-$BFFF, switched by D0..D3 of data latch at CPU $8000-$FFFF
* 16 KiB PRG-ROM bank at CPU $8000-$BFFF, switched by D0..D3 of data latch at CPU $8000-$FFFF
* 16 KiB PRG-ROM bank at CPU $C000-$FFFF, fixed to bank #15
* 16 KiB PRG-ROM bank at CPU $C000-$FFFF, fixed to bank #15
* 8 KiB of write-enabled CHR-RAM
* 8 KiB of write-enabled CHR-RAM
 
==Mode 3: [[INES Mapper 097|Reverse UOROM]]==
==Mode 3: Reverse UOROM==
* 16 KiB PRG-ROM bank at CPU $8000-$BFFF, fixed to bank #15
* 16 KiB PRG-ROM bank at CPU $8000-$BFFF, fixed to bank #15
* 16 KiB PRG-ROM bank at CPU $C000-$FFFF, switched by D0..D3 of data latch at CPU $8000-$FFFF
* 16 KiB PRG-ROM bank at CPU $C000-$FFFF, switched by D0..D3 of data latch at CPU $8000-$FFFF
* 8 KiB of write-enabled CHR-RAM
* 8 KiB of write-enabled CHR-RAM
* Seems to used by only one game (''Kaiketsu Yanchamaru''), which normally uses [[iNES Mapper 097]]. Could theoretically be used for [[iNES Mapper 180|UNROM (mapper 180)]] games if bank 15 duplicates bank 0.
==Mode 4: [[INES Mapper 066|GNROM]]==
 
==Mode 4: GNROM==
* 32 KiB PRG-ROM bank at CPU $8000-$FFFF, switched by D4..D5 of data latch at CPU $8000-$FFFF
* 32 KiB PRG-ROM bank at CPU $8000-$FFFF, switched by D4..D5 of data latch at CPU $8000-$FFFF
* 8 KiB write-protected CHR-RAM bank at PPU $0000-$1FFF, switched by D0..D1 of data latch at CPU $8000-$FFFF
* 8 KiB write-protected CHR-RAM bank at PPU $0000-$1FFF, switched by D0..D1 of data latch at CPU $8000-$FFFF
 
==Mode 5: [[INES Mapper 003|CNROM-256]]==
==Mode 5: CNROM-256==
* 32 KiB PRG-ROM bank at CPU $8000-$FFFF, fixed to bank #7
* 32 KiB PRG-ROM bank at CPU $8000-$FFFF, fixed to bank #7
* 8 KiB write-protected CHR-RAM bank at PPU $0000-$1FFF, switched by D0..D1 of data latch at CPU $8000-$FFFF
* 8 KiB write-protected CHR-RAM bank at PPU $0000-$1FFF, switched by D0..D1 of data latch at CPU $8000-$FFFF
 
==Mode 6: [[INES Mapper 003|CNROM-128]]==
==Mode 6: CNROM-128==
* 32 KiB PRG-ROM bank at CPU $8000-$FFFF, fixed to bank #3
* 32 KiB PRG-ROM bank at CPU $8000-$FFFF, fixed to bank #3
* 8 KiB of write-protected CHR-RAM bank at PPU $0000-$1FFF, switched by D0 of data latch at CPU $8000-$FFFF
* 8 KiB of write-protected CHR-RAM bank at PPU $0000-$1FFF, switched by D0 of data latch at CPU $8000-$FFFF
 
==Mode 7: [[INES Mapper 000|NROM-256]]==
==Mode 7: NROM-256==
* 32 KiB PRG-ROM bank at CPU $8000-$FFFF, fixed to bank #3
* 32 KiB PRG-ROM bank at CPU $8000-$FFFF, fixed to bank #3
* 8 KiB write-protected CHR-RAM bank at PPU $0000-$1FFF, switched by D0 of data latch at CPU $8000-$FFFF
* 8 KiB write-protected CHR-RAM bank at PPU $0000-$1FFF
 
=8 KiB Banking Mode=
==Notes==
  Write-only register at $43FE-$43FF:
* Unlike [[INES Mapper 002]], the copier needs to differentiate between UNROM and UOROM because it has no other way of masking the PRG-ROM address to know which bank is the last bank.
  A~FEDC BA98 7654 3210
* CHR-RAM is write-protected in modes 4-7 and write-enabled in modes 0-3.
   -------------------
* When changing from a mode that allows changing CHR-RAM banks to one that does not, the previously-chosen CHR-RAM bank remains active. The current CHR-RAM bank can be accessed directly, regardless of the selected 2M Mode, via register $43FF.
   0100 0011 1111 111M
* The latch at $8000-$FFFF is only active when PRG-ROM is write-protected.
                     |
 
==4M PRG Mode==
* 8 KiB PRG-ROM bank at CPU $8000-$9FFF, switched by D2..D7 of data latch at CPU $8000-$9FFF
* 8 KiB PRG-ROM bank at CPU $A000-$BFFF, switched by D2..D7 of data latch at CPU $A000-$BFFF
* 8 KiB PRG-ROM bank at CPU $C000-$DFFF, switched by D2..D7 of data latch at CPU $C000-$DFFF
* 8 KiB PRG-ROM bank at CPU $E000-$FFFF, switched by D2..D7 of data latch at CPU $E000-$FFFF
* 8 KiB CHR-RAM bank at PPU $0000-$1FFF, switched by D0..D1 of data latch at CPU $8000-$FFFF
* 4M mode is enabled by writing any value to $43FE and disabled by writing any value to $43FF. If enabled, it has precedence over the eight banking modes set via $42FE-$42FF. They still apply in one aspect only: whether CHR-RAM is write-enabled or not. This is used for effect by a few releases of games that originally wrote to CHR-ROM.
* The four PRG bank registers are latched, even if not applied, when the 4M Mode is not active, and will take effect once $43FE is written to afterwards.
 
=Global registers=
==Mirroring and 1M/2M Banking Mode ($42FC-$42FF)==
  A~FEDC BA98 7654 3210  D~7654 3210
  -------------------    ---------
  0100 0010 1111 11bM    BBBM ....
                    |+----|||+------ Set nametable mirroring type
                    |    |||        0: One-screen, page 0
                    |    |||        1: One-screen, page 1
                    |    |||        2: Vertical
                    |    |||        3: Horizontal
                    +-----|||------- 0: PRG-ROM is writeable, latch is disabled
                          |||        1: PRG-ROM is write-protected, latch is enabled
                          +++------- Banking mode (see above)
 
==4M PRG Banking Mode Enable/Disable ($43FE-$43FF)==
  A~FEDC BA98 7654 3210  D~7654 3210
   -------------------    ---------
   0100 0011 1111 111M   ..PP p.CC
                    |      || | ++- Select 8 KiB CHR-RAM bank at PPU $0000-$1FFF
                    |      || +----*Select PRG A17 (128 KiB bank)
                    |      ++------*Select PRG A16/A15 (32/64 KiB bank)
                    |              *Ignored during gameplay, only used by BIOS
                     |               when loading a game from disk
                     +- Enable/Disable 4M PRG Banking Mode
                     +- Enable/Disable 4M PRG Banking Mode
                         0: Enable
                         0: Enable
                         1: Disable
                         1: Disable
*Banks:
** 8 KiB PRG-ROM bank at CPU $8000-$9FFF, switched by D2..D7 of data latch at CPU $8000-$9FFF
** 8 KiB PRG-ROM bank at CPU $A000-$BFFF, switched by D2..D7 of data latch at CPU $A000-$BFFF
** 8 KiB PRG-ROM bank at CPU $C000-$DFFF, switched by D2..D7 of data latch at CPU $C000-$DFFF
** 8 KiB PRG-ROM bank at CPU $E000-$FFFF, switched by D2..D7 of data latch at CPU $E000-$FFFF
** 8 KiB CHR-RAM bank at PPU $0000-$1FFF, switched by D0..D1 of data latch at CPU $8000-$FFFF
* If enabled, it has precedence over the Game Doctor banking modes in everything but CHR-RAM write-protection.
* The four data latches accept values written even when 8 KiB Banking Mode is not active, and will take effect once $43FE is written to afterwards.


==FDS Write Data ($4024)==
==FDS Write Data ($4024)==
This register is not part of the copier, but part of the FDS RAM adapter that attaches to it. A few games abusing the FDS Disk Data IRQ for frame timing write any value to this register to acknowledge a pending IRQ.
This register is not part of the RAM cartridge, but part of the FDS RAM adapter that originally attached to it. A few games abusing the FDS Disk Data IRQ for frame timing write any value to this register to acknowledge a pending IRQ.


==FDS Control ($4025)==
==FDS Control ($4025)==
This register is not part of the copier, but part of the FDS RAM adapter that attaches to it. A few games abuse the FDS Disk Data IRQ for frame timing. If bit 7
This register is not part of the RAM cartridge, but part of the FDS RAM adapter that originally attached to it. A few games abuse the FDS Disk Data IRQ for frame timing. If bit 7 is set, the FDS RAM adapter will generate IRQs every 1,792 cycles of the 21.4772 MHz master clock, or after every 149+1/3 CPU cycles.
is set, the FDS RAM adapter will generate IRQs every 1,792 cycles of the 21.4772 MHz master clock, or after every 149+1/3 CPU cycles.


==Cycle IRQ Counter Low Byte ($4100)==
==Cycle IRQ Counter Low Byte ($4100)==
This is the low byte of a '''16-bit''' counter that, if nonzero, is increased on every M2 cycle and raises an IRQ when the counter flips from $FFFF to $0000. Writing
This is the low byte of a '''16-bit''' counter that, if nonzero, is increased on every M2 cycle and raises an IRQ when the counter flips from $FFFF to $0000. Writing to this register also acknowledges the IRQ.
to this register also acknowledges the IRQ.


==Cycle IRQ Counter High Byte ($4101)==
==Cycle IRQ Counter High Byte ($4101)==
Line 108: Line 83:


=Notes=
=Notes=
* Before control is transferred to the game's Reset handler vectored at $FFFC, the copier BIOS issues a JSR to $7003 if it finds a valid trainer there. This call is necessary to properly set up initial CHR-RAM content and bankswitching registers.
* [//nesdev.org/mapper6.txt Mapper 6]  Info on the FFE mapper. By FanWen Yang (outdated).
 
* [http://www.famicomdisksystem.com/game-doctor-copiers/ Info on various Famicom "copiers"]
=More Information=
* [//nesdev.org/mapper6.txt Mapper 6]  Info on the FFE mapper. By FanWen Yang.
* [//forums.nesdev.org/viewtopic.php?p=5111 SMC Header] in nesdev forum.
* [http://www.famicomdisksystem.com/game-doctor-copiers/ Info on various famicom copiers]

Revision as of 21:34, 31 January 2019

iNES Mapper 006 is used for ROM images that have been extracted from disk images for the Bung (Super) Game Doctor or Front Fareast Magicard RAM cartridges and that use Game Doctor Mode 1 or 8 KiB Banking Mode (exclusively or non-exclusively). Extracted games that exclusively use the other banking modes can be run using their normal iNES mapper equivalents. iNES Mapper 008 specifies Game Doctor Mode 4, which makes it a duplicate of INES Mapper 066.

Banks

  • CPU $6000-$7FFF: 8 KiB of PRG-RAM. If the iNES header specifies a 512-byte "trainer", it must be loaded to $7000-$71FF, be writable, and (on a hard reset) initialized by JSRing to $7003 before JMPing to the game's reset vector.
  • CPU $8000-$FFFF: 32 KiB of PRG-"ROM", banked in various amounts from 256 KiB total depending on the banking mode.
  • PPU $0000-$1FFF: 8 KiB of CHR-RAM, banked in 8 KiB amounts from 32 KiB total.

Game Doctor Banking Modes

Write-only register at $42FC-$42FF:
A~FEDC BA98 7654 3210  D~7654 3210
  -------------------    ---------
  0100 0010 1111 11bM    BBBM ....
                   |+----|||+------ Set nametable mirroring type
                   |     |||         0: One-screen, page 0
                   |     |||         1: One-screen, page 1
                   |     |||         2: Vertical
                   |     |||         3: Horizontal
                   +-----|||------- 0: PRG-ROM is writeable, latch is disabled
                         |||        1: PRG-ROM is write-protected, latch is enabled
                         +++------- Select Game Doctor Banking mode
  • Because the RAM cartridge has no other means of masking PRG-/CHR-ROM addresses, UNROM vs. UOROM and CNROM-128 vs. CNROM-256 are explicitly differentiated.
  • When changing from a mode that allows changing CHR-RAM banks to one that does not, the previously-chosen CHR-RAM bank remains active.
  • The latch at $8000-$FFFF is only active when PRG-"ROM" is write-protected. A few games temporarily write-enable PRG-"ROM" to change the reset handler after initialization.

Mode 0: UNROM

  • 16 KiB PRG-ROM bank at CPU $8000-$BFFF, switched by D0..D2 of data latch at CPU $8000-$FFFF
  • 16 KiB PRG-ROM bank at CPU $C000-$FFFF, fixed to bank #7
  • 8 KiB of write-enabled CHR-RAM

Mode 1: Custom

A hybrid of UNROM (fixed bank 7), UOROM (256 KiB total PRG-ROM size), and UN1ROM (left shift by 2) with 32 KiB of CHR-RAM.

  • 16 KiB PRG-ROM bank at CPU $8000-$BFFF, switched by D2..D6 of data latch at CPU $8000-$FFFE (not $FFFF!)
  • 16 KiB PRG-ROM bank at CPU $C000-$FFFF, fixed to bank #7
  • 8 KiB write-enabled CHR-RAM bank at PPU $0000-$1FFF, switched by D0..D1 of data latch at CPU $8000-$FFFE (not $FFFF!)

Mode 2: UOROM

  • 16 KiB PRG-ROM bank at CPU $8000-$BFFF, switched by D0..D3 of data latch at CPU $8000-$FFFF
  • 16 KiB PRG-ROM bank at CPU $C000-$FFFF, fixed to bank #15
  • 8 KiB of write-enabled CHR-RAM

Mode 3: Reverse UOROM

  • 16 KiB PRG-ROM bank at CPU $8000-$BFFF, fixed to bank #15
  • 16 KiB PRG-ROM bank at CPU $C000-$FFFF, switched by D0..D3 of data latch at CPU $8000-$FFFF
  • 8 KiB of write-enabled CHR-RAM

Mode 4: GNROM

  • 32 KiB PRG-ROM bank at CPU $8000-$FFFF, switched by D4..D5 of data latch at CPU $8000-$FFFF
  • 8 KiB write-protected CHR-RAM bank at PPU $0000-$1FFF, switched by D0..D1 of data latch at CPU $8000-$FFFF

Mode 5: CNROM-256

  • 32 KiB PRG-ROM bank at CPU $8000-$FFFF, fixed to bank #7
  • 8 KiB write-protected CHR-RAM bank at PPU $0000-$1FFF, switched by D0..D1 of data latch at CPU $8000-$FFFF

Mode 6: CNROM-128

  • 32 KiB PRG-ROM bank at CPU $8000-$FFFF, fixed to bank #3
  • 8 KiB of write-protected CHR-RAM bank at PPU $0000-$1FFF, switched by D0 of data latch at CPU $8000-$FFFF

Mode 7: NROM-256

  • 32 KiB PRG-ROM bank at CPU $8000-$FFFF, fixed to bank #3
  • 8 KiB write-protected CHR-RAM bank at PPU $0000-$1FFF

8 KiB Banking Mode

Write-only register at $43FE-$43FF:
A~FEDC BA98 7654 3210
  -------------------
  0100 0011 1111 111M
                    |
                    +- Enable/Disable 4M PRG Banking Mode
                        0: Enable
                        1: Disable
  • Banks:
    • 8 KiB PRG-ROM bank at CPU $8000-$9FFF, switched by D2..D7 of data latch at CPU $8000-$9FFF
    • 8 KiB PRG-ROM bank at CPU $A000-$BFFF, switched by D2..D7 of data latch at CPU $A000-$BFFF
    • 8 KiB PRG-ROM bank at CPU $C000-$DFFF, switched by D2..D7 of data latch at CPU $C000-$DFFF
    • 8 KiB PRG-ROM bank at CPU $E000-$FFFF, switched by D2..D7 of data latch at CPU $E000-$FFFF
    • 8 KiB CHR-RAM bank at PPU $0000-$1FFF, switched by D0..D1 of data latch at CPU $8000-$FFFF
  • If enabled, it has precedence over the Game Doctor banking modes in everything but CHR-RAM write-protection.
  • The four data latches accept values written even when 8 KiB Banking Mode is not active, and will take effect once $43FE is written to afterwards.

FDS Write Data ($4024)

This register is not part of the RAM cartridge, but part of the FDS RAM adapter that originally attached to it. A few games abusing the FDS Disk Data IRQ for frame timing write any value to this register to acknowledge a pending IRQ.

FDS Control ($4025)

This register is not part of the RAM cartridge, but part of the FDS RAM adapter that originally attached to it. A few games abuse the FDS Disk Data IRQ for frame timing. If bit 7 is set, the FDS RAM adapter will generate IRQs every 1,792 cycles of the 21.4772 MHz master clock, or after every 149+1/3 CPU cycles.

Cycle IRQ Counter Low Byte ($4100)

This is the low byte of a 16-bit counter that, if nonzero, is increased on every M2 cycle and raises an IRQ when the counter flips from $FFFF to $0000. Writing to this register also acknowledges the IRQ.

Cycle IRQ Counter High Byte ($4101)

This is the high byte of a 16-bit counter that, if nonzero, is increased on every M2 cycle and raises an IRQ when the counter flips from $FFFF to $0000.

Notes