{{Infobox iNES mapper |name=VRC2, VRC4 |company=Konami |complexity=ASIC |mapper=21 |othermappers=[[INES Mapper 022|022]], [[INES Mapper 023|023]], [[INES Mapper 025|025]] |boards=VRC2a-c VRC4a-f |pinout=VRC2 pinout |prgmax=256K |prgpage=8K + 8K + 16K fixed |wrammax=8K |wrampage=8K |chrmax=256K (VRC2) 512K (VRC4) |chrpage=1K |mirroring=H, V, switchable (VRC2) H, V, or 1, switchable (VRC4) |busconflicts=No |irq=Only VRC4 }} {{nesdbbox |unif_wild|KONAMI-VRC-2|VRC2 |unif_wild|KONAMI-VRC-4|VRC4 |ines|21|iNES 021 |ines|22|iNES 022 |ines|23|iNES 023 |ines|25|iNES 025 }} [[Category:ASIC mappers]][[Category:Mappers with cycle IRQs]][[Category:NES 2.0 mappers with submappers]][[Category:Mappers with single-screen mirroring]] The '''Konami VRC2''' and '''Konami VRC4''' are two related [[:Category:ASIC mappers|ASIC]] [[mapper]]s in the VRC[http://forums.nesdev.org/viewtopic.php?f=2&t=10611 Forum thread]: Several Famicom Nes Documents in Japanese indicate that VRC stands for "Virtual ROM Controller" family. Because the VRC2 is mostly a subset of the VRC4, relevant games are often emulated as VRC4 only. iNES mappers '''21''', '''22''', '''23''' and '''25''' implement various board permutations, and [[NES 2.0 submappers]] may be used to disambiguate further. Example games: :{|class="wikitable sortable" ! Game !! Variant !! iNES mapper |- | ''Ganbare Pennant Race'' || VRC2a || 22 |- | ''TwinBee 3'' || VRC2a || 22 |- | ''Wai Wai World'' || VRC2b || 23 |- | ''Ganbare Goemon Gaiden'' || VRC2c || 25 |- | ''Wai Wai World 2'' || VRC4a || 21 |- | ''Bio Miracle Bokutte Upa'' || VRC4b || 25 |- | ''Gradius 2 (J)'' || VRC4b || 25 |- | ''Ganbare Goemon Gaiden 2'' || VRC4c || 21 |- | ''Teenage Mutant Ninja Turtles (J)'' || VRC4d || 25 |- | ''Boku Dracula-kun'' || VRC4e || 23 |- | ''Tiny Toon Adventures (J)'' || VRC4e || 23 |- | ''World Hero (Unl)'' || VRC4f || 23 |} __TOC__ == Variations == Variations VRC2a/b/c and VRC4a/b/c/d/e/f are referring to different ''PCB layouts''. Considering the mapper chip itself, all VRC2 behave the same way and all VRC4 behave the same way. This section describes how each variation presents itself to the NES CPU considering the different ''PCBs''. The VRC2 and VRC4 were used with several similar but incompatible boards. The primary difference between them was having the mapper address lines connected in different ways. In particular, two lines chosen from A0-A7 will be used to select registers. {| class="wikitable sortable" !colspan=7|VRC2 |- ! Nickname || PCB || A0 || A1 || Registers || iNES mapper || submapper |- | VRC2a || 351618 || A1 || A0 || $x000, $x002, $x001, $x003 || 22 || 0 |- | VRC2b || many[[#VRC2bPCB|†]] || A0 || A1 || $x000, $x001, $x002, $x003 || 23 || 3 |- | VRC2c || 351948 || A1 || A0 || $x000, $x002, $x001, $x003 || 25 || 3 |} {| class="wikitable sortable" !colspan=7|VRC4 |- ! Nickname || PCB || A0 || A1 || Registers || iNES mapper || submapper |- | VRC4a || 352398 || A1 || A2 || $x000, $x002, $x004, $x006 || 21 || 1 |- | VRC4b || 351406 || A1 || A0 || $x000, $x002, $x001, $x003 || 25 || 1 |- | VRC4c || 352889 || A6 || A7 || $x000, $x040, $x080, $x0C0 || 21 || 2 |- | VRC4d || 352400 || A3 || A2 || $x000, $x008, $x004, $x00C || 25 || 2 |- | VRC4e || 352396 || A2 || A3 || $x000, $x004, $x008, $x00C || 23 || 2 |- | VRC4f || -[[#VRC4fPCB|*]] || A0 || A1 || $x000, $x001, $x002, $x003 || 23 || 1 |} : † {{anchor|VRC2bPCB}} The VRC2b PCBs include: 350603, 350636, 350926, 351179 : * {{anchor|VRC4fPCB}} There're no known official VRC4f boards being commercially produced, and this variant was only glanced at several pirate multicarts and single-game cartridges. As such, VRC4f should be considered as an unofficial variant. === VRC2 vs VRC4 === The VRC2 has: * CHR limit of 256 KiB * 1 bit latch at $6000-$6FFF * Only horizontal or vertical nametable layout. The VRC4 has: * CHR limit of 512 KiB * Additional 8 KiB PRG bank at $C000 * Horizontal, vertical and 1-screen nametables. * IRQ device The VRC2a (mapper 22) additionally wires the CHR banking lines differently (see below). Unlike VRC2's, the RAM decoding circuit that's part of the VRC4 itself only decodes RAM from $6000-$6FFF. For the [https://nescartdb.com/profile/view/1573/ganbare-goemon-gaiden-2-tenka-no-zaihou one game] with 8 KiB of RAM, an external [[PRG RAM circuit|circuit]] was added. === iNES mappers === iNES mappers 21, 23 and 25 each implements ''two'' address mappings at the same time: * '''21:''' VRC4a, VRC4c * '''23:''' VRC2b + VRC4f, VRC4e * '''25:''' VRC2c + VRC4b, VRC4d Because the address pairings do not overlap, and the games appear to use these registers in a well behaved manner, it is presumed sufficient for compatibility in most cases. Additionally, the VRC4 is always presumed for these three mappers. With an [[NES 2.0]] header, a [[NES 2.0 submappers|submapper]] may be used to specify which address mapping to use, and either VRC2 or VRC4. == Banks == === Common === * 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 === VRC2 === * CPU $6000-$6FFF: 1 bit latch, or * CPU $6000-$7FFF: 8 KiB PRG RAM bank (optional) * 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 === VRC4 === * CPU $6000-$6FFF: 2 KiB PRG RAM bank (mirrored once) (optional), or * CPU $6000-$7FFF: 8 KiB PRG RAM bank (via [https://nescartdb.com/profile/view/1573/ganbare-goemon-gaiden-2-tenka-no-zaihou extra circuit]) (optional) * CPU $8000-$9FFF (or $C000-$DFFF): 8 KiB switchable PRG ROM bank * CPU $A000-$BFFF: 8 KiB switchable PRG ROM bank * CPU $C000-$DFFF (or $8000-$9FFF): 8 KiB PRG ROM bank, fixed to the second-to-last bank * CPU $E000-$FFFF: 8 KiB PRG ROM bank, fixed to the last bank == Registers == This page lists registers as they are in the VRC2b and VRC4f variants (iNES mapper 23). === PRG Swap Mode/WRAM control ($9002) VRC4 === 7 bit 0 --------- .... ..MW |+- WRAM Control +-- Swap Mode This register is '''VRC4 only'''. When 'W' is clear: * the 8 KiB page at $6000 is open bus, and WRAM content cannot be read nor written When 'W' is set: * the 8 KiB page at $6000 is WRAM, and WRAM content can be read and written When 'M' is clear: * the 8 KiB page at $8000 is controlled by the $800x register * the 8 KiB page at $C000 is fixed to the second-to-last 8 KiB in the ROM When 'M' is set: * the 8 KiB page at $8000 is fixed to the second-to-last 8 KiB in the ROM * the 8 KiB page at $C000 is controlled by the $800x register === PRG Select 0 ($8000, $8001, $8002, $8003) === 7 bit 0 --------- ...P PPPP | |||| +-++++- Select 8 KiB PRG bank at $8000 or $C000 depending on Swap Mode VRC2 does not have a Swap Mode and the bank this register will switch is always the $8000-$9FFF bank. === PRG Select 1 ($A000, $A001, $A002, $A003) === 7 bit 0 --------- ...P PPPP | |||| +-++++- Select 8 KiB PRG bank at $A000 === Nametable arrangement ($9000, $9001, $9002, $9003) === 7 bit 0 --------- .... ..MM || ++- [[Mirroring]] (0: vertical; 1: horizontal; 2: one-screen, lower bank; 3: one-screen, upper bank) VRC2 supports '''only vertical or horizontal''' nametables. Bit 1 is ignored. VRC4 only has this register at '''$9000 only'''. $9002 is used to select PRG swap mode instead (see above). VRC2-using games are usually well-behaved and only write 0 or 1 to this register, but [https://nescartdb.com/profile/view/2274/konami-wai-wai-world Konami Wai Wai World] in one instance writes $FF instead[http://forums.nesdev.org/viewtopic.php?f=3&t=13473 Forum thread]: incorrect mirroring in Wai Wai World, and VRC2 testing.. === VRC4 External Select ($9003) === The VRC4 decodes writes to $9003 and emits an active low signal. No Konami games made use of this, but some unlicensed games, assigned to other mappers, added extra hardware behind this address. === CHR Select 0 low($B000), high($B001) === $B000 $B001 7 bit 0 7 bit 0 --------- --------- .... LLLL ...H HHHH |||| | |||| |||| +-++++- High 5 bits of 1 KiB CHR bank at PPU $0000 ++++-------------- Low 4 bits VRC2 only has 4 high bits of CHR select. $B001 bit 4 is ignored. On VRC2a (mapper 22), the low bit is ignored (right shift value by 1). === CHR Select 1 low($B002), high($B003) === $B002 $B003 7 bit 0 7 bit 0 --------- --------- .... LLLL ...H HHHH |||| | |||| |||| +-++++- High 5 bits of 1 KiB CHR bank at PPU $0400 ++++-------------- Low 4 bits VRC2 only has 4 high bits of CHR select. $B003 bit 4 is ignored. On VRC2a (mapper 22), 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: {| class="wikitable" ! colspan=2|Write to CPU address ! rowspan=2|1KB CHR bank affected |- ! (low 4 bits) !! (high 5 bits) |- | $C000 || $C001 || $0800-$0BFF |- | $C002 || $C003 || $0C00-$0FFF |- | $D000 || $D001 || $1000-$13FF |- | $D002 || $D003 || $1400-$17FF |- | $E000 || $E001 || $1800-$1BFF |- | $E002 || $E003 || $1C00-$1FFF |} === IRQ Control ($F00x) VRC4 === $F000: IRQ Latch, low 4 bits $F001: IRQ Latch, high 4 bits $F002: IRQ Control $F003: IRQ Acknowledge Many VRC mappers use the same IRQ system. For details on IRQ operation, see [[VRC IRQ]]s. === Microwire interface ($6000-$6FFF) VRC2 === This only exists on VRC2. 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 [[wikipedia:Microwire|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''' ([[iNES Mapper 022|22]]) it's connected to ground. On '''350603''', '''350636''', and '''351179''' it floats. On '''350926''' it's connected to ''Data to EEPROM''. On '''351948''' ([[iNES Mapper 025|25]]) it's connected to ground but extra hardware keeps the VRC2 from 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. == Hardware == The VRC2 and VRC4 exist in a [[VRC2_pinout|40-pin PDIP package]]. == References == *[http://www.romhacking.net/documents/362/ NES Mapper List] by Disch *[http://nesdev.org/konami-e.txt Konami Mapper] by goroh, translated by Sgt. Bowhack *[http://nesdev.org/mappers.zip Comprehensive NES Mapper Document] by \Firebug\, information about mapper's initial state is inaccurate. * The CHR registers really are 9 bits: http://forums.nesdev.org/viewtopic.php?t=8569