VRC2

From NESdev Wiki
Revision as of 18:56, 1 April 2016 by Koitsu (talk | contribs) (Term 2s bit is confusing/bizarre)
Jump to navigationJump to search

The Konami VRC2 is an ASIC mapper.

Overview

  • PRG ROM size: Up to 256 KB
  • PRG ROM bank size: 8 KiB
  • PRG RAM: One bit or 8 KiB
  • CHR bank size: 1 KiB
  • Nametable mirroring: Controlled by mapper
  • Subject to bus conflicts: No

The Konami VRC2 is almost identical to the VRC4, but a bit more limited.

See VRC2 pinout for chip pinout.

Banks

  • CPU $6000-$6FFF: 1 bit latch, or
  • CPU $6000-$7FFF: optional 8 KiB RAM
  • CPU $8000-$9FFF: 8 KiB switchable PRG ROM bank
  • CPU $A000-$BFFF: 8 KiB switchable PRG ROM bank
  • CPU $C000-$FFFF: 16 KiB PRG ROM bank, fixed to the last 16 KiB
  • PPU $0000-$03FF: 1 KiB switchable CHR bank
  • PPU $0400-$07FF: 1 KiB switchable CHR bank
  • PPU $0800-$0BFF: 1 KiB switchable CHR bank
  • PPU $0C00-$0FFF: 1 KiB switchable CHR bank
  • PPU $1000-$13FF: 1 KiB switchable CHR bank
  • PPU $1400-$17FF: 1 KiB switchable CHR bank
  • PPU $1800-$1BFF: 1 KiB switchable CHR bank
  • PPU $1C00-$1FFF: 1 KiB switchable CHR bank

Revisions

This mapper had two known revisions: VRC2a and VRC2b. Both revisions uses Address lines A0, A1, and A12-A15 for registers, however VRC2a has A0 and A1 "backwards" from the norm. Address $x001 on VRC2b would be $x002 on VRC2a, and $x002 on VRC2b would be $x001 on VRC2a.

Additionally, VRC2a has 7-bit wide CHR registers, whereas VRC2b has 8-bit wide CHR registers.

The two wiring variants correspond to iNES mappers 22 and 23.

A third variant (similar to VRC2a but with full-width CHR registers and PRG-RAM) is canonically emulated as using the VRC4, and it's assigned to mapper 25.

This page lists registers as they are in the VRC2b variant. For VRC2a registers, reverse A0 and A1 lines.

Registers

PRG Select 0 ($8000, $8001, $8002, $8003)

7  bit  0
---------
...P PPPP
   | ||||
   + ++++- Select 8 KB PRG bank at $8000

PRG Select 1 ($A000, $A001, $A002, $A003)

7  bit  0
---------
...P PPPP
   | ||||
   + ++++- Select 8 KB PRG bank at $A000


Mirroring Control ($9000, $9001, $9002, $9003)

7  bit  0
---------
.... ...M
        |
        +- Mirroring (0: vertical (A10); 1: horizontal (A11))

Note that the VRC4 also uses bit 1. VRC2-using games are usually well-behaved and only write 0 or 1 to this register, but Wai Wai World in once instance writes $FF instead. This would be invisible if not for the historical conflation of the VRC2 and VRC4.

CHR Select 0 ($B000 + $B001)

  $B000        $B001
7  bit  0    7  bit  0
---------    ---------
.... LLLL    .... HHHH
     ||||         ||||
     ||||         ++++- High 4-bits of 1 KB CHR bank at PPU $0000
     ++++-------------- Low 4-bits

Note: On VRC2a, the low bit is ignored (right shift value by 1)


CHR Select 1 ($B002 + $B003)

  $B002        $B003
7  bit  0    7  bit  0
---------    ---------
.... LLLL    .... HHHH
     ||||         ||||
     ||||         ++++- High 4-bits of 1 KB CHR bank at PPU $0400
     ++++-------------- Low 4-bits

Note: On VRC2a, the low bit is ignored (right shift value by 1)

CHR Select 2…7 ($C000 + $EFFF)

The other six CHR bank selects continue the pattern:

Write to CPU address
(low 3 or 4 bits) (high 4 bits) 1KB CHR bank affected
$C000 $C001 $0800-$0BFF
$C002 $C003 $0C00-$0FFF
$D000 $D001 $1000-$13FF
$D002 $D003 $1400-$17FF
$E000 $E001 $1800-$1BFF
$E002 $E003 $1C00-$1FFF

Microwire interface ($6000-$6FFF)

How it was supposed to work:

7  bit  0
---------
.... .SCD
      |||
      ||+- Data to EEPROM (write) or from EEPROM (read)
      |+-- Clock to EEPROM (write only)
      +--- Chip Select (write only)

How it works in practice:

7  bit  0
---------
.... ...L
        |
        +- 1-bit latch value (r/w)

Reads from $6000-6FFF return open bus for the top 7 bits. Reads from $7000-7FFF only ever return open bus.

The VRC2 was supposed to have shipped with a Microwire interface for save games. However, Konami never used it, seemingly due to a defect in the VRC2.

Across all the VRC2-using boards, the Data from EEPROM pin has been connected to many different things. On 351618 (22) it's connected to ground. On 350603, 350636, and 351179 it floats. On 350926 it's connected to Data to EEPROM. On 351948 (25) it's connected to ground but extra hardware keeps the VRC2 some seeing reads from $6000 so as to not conflict with PRG RAM.

Several games, including Contra (J) and Ganbare Goemon 2 (J), rely on the two Data pins being connected to each other, and so expect to be able to read the written value back. In these cases, the LSB agrees with the last value written and the upper seven bits are open bus, e.g. both LDA $6100 and LDA $6000 will return $60|latch. Returning neither open bus nor 0x00 will work, and these games will lock almost immediately after execution begins. Fortunately, no games ever rely on any other behavior.

Emulators that use the same VRC4 core (and its PRG RAM) for VRC2 emulation will have the effect simulated for them. However, only 351948 contains any RAM.

See also