Sunsoft FME-7

From NESdev Wiki
Revision as of 23:43, 16 April 2011 by Qbradq (talk | contribs) (First draft)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

The Sunsoft FME-7 is a group of two mappers which work identically, except that one contains extra sound hardware. The FME-7 is the base memory mapper with no additional sound hardware. The Sunsoft 5B is an FME-7 with the addition of extra sound hardware (not documented here).

The FME-7 mapper was used in only one game released in the US, Batman: Return of the Joker.

Overview

  • Manufacturer: Sunsoft
  • PRG ROM Size: Up to 2048 KB (A maximum of 256 KB has been observed in production games)
  • PRG ROM Bank Size: 8 KB at $6000, $8000, $A000, and $C000
  • PRG RAM: Up to 512 KB (A maximum of 8 KB has been observed in production games)
  • CHR Bank Size: 1 KB
  • CHR RAM Support: Unknown
  • Nametable mirroring: Controlled by Mapper, H, V, 1scA, 1scB
  • Subject to bus conflicts: No

Banks

  • CPU $6000-$7FFF: 8 KB Bankable PRG ROM or PRG RAM
  • CPU $8000-$9FFF: 8 KB Bankable PRG ROM
  • CPU $A000-$BFFF: 8 KB Bankable PRG ROM
  • CPU $C000-$DFFF: 8 KB Bankable PRG ROM
  • CPU $E000-$FFFF: 8 KB PRG ROM, fixed to the last bank of ROM
  • PPU $0000-$03FF: 1 KB Bankable CHR ROM
  • PPU $0400-$07FF: 1 KB Bankable CHR ROM
  • PPU $0800-$0BFF: 1 KB Bankable CHR ROM
  • PPU $0C00-$0FFF: 1 KB Bankable CHR ROM
  • PPU $1000-$13FF: 1 KB Bankable CHR ROM
  • PPU $1400-$17FF: 1 KB Bankable CHR ROM
  • PPU $1800-$1BFF: 1 KB Bankable CHR ROM
  • PPU $1C00-$1FFF: 1 KB Bankable CHR ROM

Registers

Configuration of the FME-7 is accomplished by first writing the command number to the Command Register, then writing the command's parameter byte to the Parameter Register.

Command Register ($8000)

Bit7...0
----CCCC
    ++++- The command number to invoke when writing to the Parameter Register

Parameter Register ($A000)

Bit7...0
PPPPPPPP
++++++++- The parameter to use for this command. Writing to this register invokes the command in the Command Register.

Commands

In order to invoke a command first write the command's number to the Command Register, then the desired parameter to the Parameter Register.

CHR Bank 0 ($00)

Parameter Byte
Bit7...0
BBBBBBBB
++++++++- The bank number to select at PPU $0000 - $03FFF

CHR Bank 1 ($01)

Parameter Byte
Bit7...0
BBBBBBBB
++++++++- The bank number to select at PPU $0400 - $07FFF

CHR Bank 2 ($02)

Parameter Byte
Bit7...0
BBBBBBBB
++++++++- The bank number to select at PPU $0800 - $0BFFF

CHR Bank 3 ($03)

Parameter Byte
Bit7...0
BBBBBBBB
++++++++- The bank number to select at PPU $0C00 - $0FFFF

CHR Bank 4 ($04)

Parameter Byte
Bit7...0
BBBBBBBB
++++++++- The bank number to select at PPU $1000 - $13FFF

CHR Bank 5 ($05)

Parameter Byte
Bit7...0
BBBBBBBB
++++++++- The bank number to select at PPU $1400 - $17FFF

CHR Bank 6 ($06)

Parameter Byte
Bit7...0
BBBBBBBB
++++++++- The bank number to select at PPU $1800 - $1BFFF

CHR Bank 7 ($07)

Parameter Byte
Bit7...0
BBBBBBBB
++++++++- The bank number to select at PPU $1C00 - $1FFFF

PRG Bank 0 ($08)

Parameter Byte
Bit7...0
ERBBBBBB
||++++++- The bank number to select at CPU $6000 - $7FFF (limited to the first 512 KB of PRG ROM or RAM)
|+------- RAM / ROM Select Bit
|         0 = PRG ROM
|         1 = PRG RAM
+-------- RAM Enable Bit
          0 = PRG RAM Disabled
          1 = PRG RAM Enabled

If the RAM / ROM Select Bit is 1 (RAM selected), but the RAM Enable Bit is 0 (disabled) the data bus will be open. This is a limited form of WRAM write protection on power-up.

PRG Bank 1 ($09)

Parameter Byte
Bit7...0
BBBBBBBB
++++++++- The bank number to select at CPU $8000 - $9FFF

PRG Bank 2 ($0A)

Parameter Byte
Bit7...0
BBBBBBBB
++++++++- The bank number to select at CPU $A000 - $BFFF

PRG Bank 3 ($0B)

Parameter Byte
Bit7...0
BBBBBBBB
++++++++- The bank number to select at CPU $C000 - $DFFF

Name Table Mirroring ($0C)

Parameter Byte
Bit7...0
------MM
      ++- Mirroring Mode
          0 = Vertical
          1 = Horizontal
          2 = One Screen Mirroring from $2000
          3 = One Screen Mirroring from $2400

IRQ Control ($0D)

Parameter Byte
Bit7...0
C------T
|      +- IRQ Enable
|         0 = Do not generate IRQs
|         1 = Do generate IRQs
+-------- IRQ Counter Enable
          0 = Disable Counter Decrement
          1 = Enable Counter Decrement

IRQ Counter Low Byte ($0E)

Parameter Byte
Bit7...0
LLLLLLLL
++++++++- The low eight bits of the IRQ counter. Note that setting this register directly sets the lower eight bits of the counter.

IRQ Counter High Byte ($0F)

Parameter Byte
Bit7...0
HHHHHHHH
++++++++- The high eight bits of the IRQ counter. Note that setting this register directly sets the upper eight bits of the counter.

IRQ Operation

The IRQ feature of FME-7 is a CPU cycle counting IRQ generator. When enabled the 16-bit IRQ counter is decremented once per CPU cycle. When the IRQ counter is decremented from $0000 to $FFFF an IRQ is generated. The IRQ line is held low until it is acknowledged.

How to Use the IRQ Generator

  1. Set the counter to the desired number of cycles minus one.
  2. Enable the IRQ generator by turning on both the IRQ Enable and IRQ Counter Enable flags of the IRQ Control command.
  3. Within the IRQ handler, turn off the IRQ Enable flag of the IRQ Control command.
    1. This acknowledges the IRQ.
  4. Optional: Go back to Step 1 for the next IRQ.