CNROM: Difference between revisions

From NESdev Wiki
Jump to navigationJump to search
m (iNES Mapper naming conventions)
(Don't link to old information. Don't have page link to itself.)
(34 intermediate revisions by 11 users not shown)
Line 1: Line 1:
[[Category:Discrete_logic_mappers]]
[[Category:CNROM-like mappers]][[Category:Nintendo licensed mappers]][[Category:Expansion audio]]
NES-[[CNROM]] (and its [[Famicom|HVC]] counterpart) is a particular Nintendo cartridge board which uses uses discrete logic to provide up to four 8 KB banks of CHR ROM.
{{Infobox iNES mapper
The [[iNES]] format assigns [[iNES Mapper 003|mapper 3]] to this board.
|name=CNROM
|company=Nintendo, others
|mapper=3
|othermappers=[[iNES Mapper 185|185]]
|boards=CNROM
|prgmax=32K
|prgpage=n/a
|chrmax=32K
|chrpage=8K
|busconflicts=Yes
|audio=No
}}
{{nesdbbox
|ines|3|iNES 003
|ines|185|iNES 185
|unif_wild|CNROM|CNROM
}}
'''[[CNROM]]''' is a discrete-logic circuit board providing up to four 8 KB banks of CHR-ROM. Two iNES mapper numbers denote its two configurations:
* '''iNES Mapper 3''' denotes the common usage mounting 16-32 KiB of CHR-ROM.
** Submapper 0: Bus conflict behavior unknown
** Submapper 1: No bus conflicts
** Submapper 2: AND-type bus conflicts
* '''iNES Mapper 185''' denotes a special usage mounting only 8 KiB of CHR-ROM. CHR-ROM is disabled unless the correct bank number has been selected.
** Submapper 0: CHR-ROM-enabling CS1/CS2 values unknown
** Submapper 4: CS1/CS2=0 enables CHR-ROM, all other values disable CHR-ROM
** Submapper 5: CS1/CS2=1 enables CHR-ROM, all other values disable CHR-ROM
** Submapper 6: CS1/CS2=2 enables CHR-ROM, all other values disable CHR-ROM
** Submapper 7: CS1/CS2=3 enables CHR-ROM, all other values disable CHR-ROM
Two Bandai boards extend the functionality of CNROM:
* [https://nescartdb.com/profile/view/4090/family-trainer-4-jogging-race|''Family Trainer: Jogging Race''] is a simple [[#Oversize mapper 3 with up to 128 KiB|oversized]] version of CNROM and therefore is assigned to mapper 3 as well;
* [https://nescartdb.com/profile/view/3953/family-trainer-3-aerobics-studio|''Family Trainer: Aerobics Studio''] adds a [https://forums.nesdev.org/viewtopic.php?p=102300#p102300|Mitsubishi M50805 speech chip] using an [[#M5085 Speech: responds to writes to CPU $6000-$7FFF|extra register]]. The chip is currently unemulated, but once it is, the speech ROM data will be included as NES 2.0 Misc. ROM data.
The Namco game [https://nescartdb.com/profile/view/3844/hayauchi-super-igo|''Hayauchi Super Igo''] adds 2 KiB of PRG-RAM, denoted using mapper 3 and the appropriate value in the header's PRG-RAM size field.


Many CNROM games such as ''Milon's Secret Castle'' store data tables in otherwise unused portions of CHR ROM and access them through <code>[[NES PPU#PPUDATA ($2007)|$2007]]</code> reads. If an emulator can show the title screen of the [[NROM]] game ''Super Mario Bros.'', but CNROM games don't work, the emulator's <code>$2007</code> readback is likely failing to consider CHR ROM bankswitching.
=Banks=
* CPU $6000-$7FFF: 2 KiB of PRG-RAM, mirrored three times (''Hayauchi Super Igo'' only)
* CPU $8000-$FFFF: 32 KB unbanked PRG-ROM
* PPU $0000-$1FFF: 8 KB switchable window into 32 KiB CHR-ROM
* Nametable arrangement: Fixed; solder pad selects between Horizontal and Vertical


== Overview ==
=Registers=
* PRG ROM size: 16 KB or 32 KB (DIP-28 standard pinout)
==Bank Select: responds to writes to CPU $8000-$FFFF==
* PRG ROM bank size: Not bankswitched
===Regular mapper 3 with up to 32 KiB===
* PRG RAM: None
D~[..DC ..BA] A~[1... .... .... ....]
* CHR capacity: 32 KB ROM (DIP-28 standard pinout)
      ||  ||
* CHR bank size: 8 KB
      ||  ++- CHR A14..A13 (8 KiB bank)
* Nametable [[mirroring]]: Solder pads select vertical or horizontal mirroring
      |+------ Output to Diode 2 (D2)
* Subject to [[bus conflict]]s: Yes [[Category:Mappers with bus conflicts]]
      +------- Output to Diode 1 (D1)


== Solder Pad Config ==
The original CNROM board is always subject to AND-type bus conflicts: the effective value is the value being written bitwise-AND'd with the PRG-ROM content at the address being written to. iNES Mapper 3's submapper indicates whether bus conflicts should actually be emulated. So far, the only .NES files requiring the absence of bus conflicts have been mapper hacks to mapper 3 from other mappers.
* Horizontal mirroring : 'H' disconnected, 'V' connected.
* Vertical mirroring : 'H' connected, 'V' disconnected.


* 16 KB PRG ROM : 'SL' connected, 'CL' disconnected.
===Oversize mapper 3 with up to 128 KiB===
* 32 KB PRG ROM : 'SL' disconnected, 'CL' connected.
D~[.... DCBA] A~[1... .... .... ....]
        ||||
        ++++- CHR A16..A13 (8 KiB bank)


* Bit 4 security implemented to '0' : D2 cathode set to '3' (CHR A12) and D2 anode set to '4' (latch).
Among the licensed NES/Famicom library, this configuration is only used by Bandai's ''Family Trainer: Jogging Race''. Several unlicensed cartridges mount 64 KiB of CHR-ROM; although they work as oversize mapper 3 as well, they are canonically assigned to [[INES Mapper 148]] instead.
* Bit 4 security implemented to '1' : D2 cathode set to '4' (latch) and D2 anode set to '3' (CHR A12).
* Bit 5 security implemented to '0' : D1 cathode set to '1' (CHR A10) and D1 anode set to '2' (latch).
* Bit 5 security implemented to '1' : D1 cathode set to '2' (latch) and D1 anode set to '1' (CHR A10).
* Security unimplemented : D1 and D2 not present.


== Banks ==
===Mapper 185===
* PPU $0000-$1FFF: 8 KB switchable CHR ROM bank
D~[..DC ..BA] A~[1... .... .... ....]
      ||  ||
      ||  |+- Chip Select 2 (CS2)
      ||  +-- Chip Select 1 (CS1)     
      |+------ Output to Diode 2 (D2)
      +------- Output to Diode 1 (D1)


== Registers ==
Mapper 185 always has AND-type bus conflicts. The submapper number denotes the correct Chip Select value that enables CHR-ROM; if another value is active, CHR-ROM is disabled, meaning that reading from the pattern tables returns [[Open_bus_behavior#PPU_open_bus|open bus]]. Theoretically, this should return the LSB of the address read, but real-world behavior varies, and the earlier revision of Mighty Bomb Jack in fact relies on open bus at PPU address $0000 being something other than $00. If the correct Chip Select value is not known -- denoted by submapper 0, which applies to all .NES files without a [[NES 2.0]] header, the simple heuristic "Disable CHR-ROM for the first two reads $2007 after a reset and then enable it" will work with all known games.
=== Bank select ($8000-$FFFF) ===
7  bit  0
---- ----
xxDD xxCC
  ||  ||
  ||  ++- Select 8 KB CHR ROM bank for PPU $0000-$1FFF
  ++------ Security diodes config


== Hardware ==
{| class="datatable sortable"
The CNROM board contains a [[74161|74HC161]] binary counter used as a quad D latch (4-bit register) to select the current CHR bank.
! || bank || PPU addr || test || bank || PPU addr || test
|-
! Game !! colspan=3|Incorrect bank !! colspan=3|Must work <!-- specific test -->
|-
| [//nescartdb.com/profile/view/1262 Bird Week] || $F0 || $1FF0 || ≠ $0C || $0F || $1FF0 || = $0C
|-
| [//nescartdb.com/profile/view/1264 B-Wings] || $00 || $0000 || ≠ $3C || $33 || $0000 || = $3C
|-
| [//nescartdb.com/profile/view/1261 Mighty Bomb Jack (J, PRG0)] || $00 || $0000 || ≠ $00 || $11 || colspan=2|untested
|-
| Mighty Bomb Jack (J, PRG1) || $00 || $0001 || ≠ $3C || $11 || colspan=2|untested
|-
| Sansuu 1 Nen || $20 || $000C || ≠ $BC || $22 || $000C || = $BC
|-
| [//nescartdb.com/profile/view/1263 Sansuu 2 Nen] || $20 || $0003 || ≠ $42 || $22 || $0003 || = $42
|-
| [//nescartdb.com/profile/view/4061 Othello] || $20 || $0006 || ≠ $3F || $22 || $0006 || = $3F
|-
| [//nescartdb.com/profile/view/3791 Sansuu 3 Nen] || $00 || $0006 || ≠ $34 || $2A || $0006 || = $34
|-
| [//nescartdb.com/profile/view/3592 Spy vs Spy] || $13 || $1F20 || ≠ $55 || $21 || colspan=2|untested
|-
| [//nescartdb.com/profile/view/2332 Seicross] || $21 || $0700…$0707 || ≠ $20,$60,$70,$70,$70,$40,$08,$38 || $20 || colspan=2|untested
|}
The North American and PAL versions of ''Mighty Bomb Jack'' mount 32 KiB of CHR-ROM instead and so use normal [[INES Mapper 003|mapper 3]].


Early CNROM boards allow security diodes to be placed. If the latched bits 4 and 5 do not correspond to the configuration of the 2 diodes placed on the board while the PPU is rendering, the latched signal will conflict with some of the PPU's adresses bus and create bus conflicts. This system was probably created to make dumping cartridges harder, because the dumping device would have to write the correct value into the 74HC161 latch to dump the CHR ROM proprely, or else bus conflicts will appear and possibly damage the dumping device.
==Speech Start/Message Select: responds to writes to CPU $6000-$7FFF==
This anti-dump precaution wasn't very effective, and Nintendo quickly gave up on this. Only Japanese games released in 1986 are known to have these diodes present.
D~[.D.. .CBA] A~[011. .... .... ....]
    |    +++- Message number (0-7)
    +-------- M5085 /SYNC signal
A falling edge of the D bit starts the selected speech line. This register only exists on the PCB of ''Family Trainer: Aerobics Studio''.


Some Japanese CNROM games combine the diode security with special CHR ROM where higher addresses are actually additional chip enable signals. This will cause the game's CHR ROM to be disabled at all if the wrong CHR bank is selected, making only one actual 8K CHR bank available (the games could in theory run in a [[NROM]] board without being affected).
=Hardware=
Those games typically turn the PPU off, switch in the wrong CHR bank (that return open bus) with wrong diode configuration, read a CHR byte in a specific place where the bus conflicts with the mapper will not appear even with the wrong diode config, then read the same byte with the correct bank and diode config latched, and enter in an infinite loop if the two reads matches. Those games have been assigned to [[iNES Mapper 185]]. Trying to dump them as regular NROM games will create bus conflicts with the dumping device, and even if this is bypassed the game will not run because the CHR ROM will be mirrored for all 8K bank select values.
The 4-bit latch register is implemented using a [[74161|74HC161]] binary counter. On iNES Mapper 3, the latch's A and B outputs directly connect to the CHR-ROM chip's A14 and A13 inputs. On iNES Mapper 185, the particular ROM chip model (Sharp LH2367 or equivalent) changes the functionality of pins 26 (normally A13) and 27 (normally A14) into two programmable (during manufacturing) Chip Select inputs, effectively disabling CHR-ROM and tri-stating its data outputs when the one correct bank of four possible CHR-ROM banks is not selected, as a copy-protection mechanism.  


== Variants ==
==Security diodes==
CNROM operates identically to a [[GNROM]] with one PRG bank.
As another copy protection mechanism, the CNROM circuit board has a spot for two diodes that produce additional bus conflicts to hinder cartridge dumping attempts. Diode 1 connects latch bit 'D' to CHR-ROM A10; Diode 2 connects latch bit 'C' to CHR-ROM A12. Each latch bit must be set such that the diode does ''not'' allow current to flow, because if it does, AND-type bus conflicts occur that may cause the wrong CHR-ROM A10 and A12 signals to be applied, depending on the relative output resistances of latch chip and console or dumping device. Both the NES PPU and modern Kazzo-like dumping devices have strong enough output drivers to always win these bus conflicts, but 1980s' dumping equipment will lose these bus conflicts and produce an unusable readout. Each diode can be mounted either with the anode or the cathode facing the latch output. As a diode will allow current to flow if the anode-side voltage is significantly higher than the cathode-side voltage, the latch bit must be 0 if it faces the anode, and 1 if it faces the cathode. The security diodes were mounted by most Nintendo-manufactured Japanese CNROM games manufactured in 1986 as well as Bandai-manufactured CNROM games from 1986 and 1987. They were never used on North American or PAL CNROM games, even as the NES-CNROM board has an unpopulated spot for them until at least revision -02. Emulators need not emulate the functionality of security diodes to run games correctly.


The upper 2 bank select bits on the [[74161|74HC161]] were connected to security diodes.
==Solder Pad Configuration==
If they were connected to CHR ROM address lines instead, this board could have theoretically supported up to 128 KB of CHR ROM.
* Horizontal nametable arrangement ("vertical mirroring"): 'H' connected, 'V' disconnected.
In fact, [[iNES Mapper 003]] encompasses both CNROM and a functionally similar board used in Panesian games that used this much CHR ROM.
* Vertical nametable arrangement ("horizontal mirroring"): 'H' disconnected, 'V' connected.
* 16 KB PRG-ROM: 'SL' connected, 'CL' disconnected.
* 32 KB PRG-ROM: 'SL' disconnected, 'CL' connected.


In theory, it would be possible to implement the bank select register with a [[74377|74HC377]] octal D latch, allowing up to 2 megabytes of CHR ROM, but due to mask ROM cost in the NES era, no non-pirate NES cart used this much memory.
[https://nescartdb.com/profile/view/3844/hayauchi-super-igo ''Hayauchi Super Igo''] is a CNROM-like board with a 2KB SRAM mapped at $6000, using a [[7410|74HC10]] as the address decoder.
 
Theoretically the bank select register could be implemented with a [[74377|74HC377]] octal D latch, allowing up to 2 megabytes of CHR ROM.

Revision as of 08:34, 8 February 2025

CNROM
Company Nintendo, others
Boards CNROM
PRG ROM capacity 32K
PRG ROM window n/a
PRG RAM capacity None
CHR capacity 32K
CHR window 8K
Nametable mirroring Fixed H or V, controlled by solder pads
Bus conflicts Yes
IRQ No
Audio No
iNES mappers 003, 185
NESCartDB
iNES 003
iNES 185
CNROM

CNROM is a discrete-logic circuit board providing up to four 8 KB banks of CHR-ROM. Two iNES mapper numbers denote its two configurations:

  • iNES Mapper 3 denotes the common usage mounting 16-32 KiB of CHR-ROM.
    • Submapper 0: Bus conflict behavior unknown
    • Submapper 1: No bus conflicts
    • Submapper 2: AND-type bus conflicts
  • iNES Mapper 185 denotes a special usage mounting only 8 KiB of CHR-ROM. CHR-ROM is disabled unless the correct bank number has been selected.
    • Submapper 0: CHR-ROM-enabling CS1/CS2 values unknown
    • Submapper 4: CS1/CS2=0 enables CHR-ROM, all other values disable CHR-ROM
    • Submapper 5: CS1/CS2=1 enables CHR-ROM, all other values disable CHR-ROM
    • Submapper 6: CS1/CS2=2 enables CHR-ROM, all other values disable CHR-ROM
    • Submapper 7: CS1/CS2=3 enables CHR-ROM, all other values disable CHR-ROM

Two Bandai boards extend the functionality of CNROM:

The Namco game Hayauchi Super Igo adds 2 KiB of PRG-RAM, denoted using mapper 3 and the appropriate value in the header's PRG-RAM size field.

Banks

  • CPU $6000-$7FFF: 2 KiB of PRG-RAM, mirrored three times (Hayauchi Super Igo only)
  • CPU $8000-$FFFF: 32 KB unbanked PRG-ROM
  • PPU $0000-$1FFF: 8 KB switchable window into 32 KiB CHR-ROM
  • Nametable arrangement: Fixed; solder pad selects between Horizontal and Vertical

Registers

Bank Select: responds to writes to CPU $8000-$FFFF

Regular mapper 3 with up to 32 KiB

D~[..DC ..BA] A~[1... .... .... ....]
     ||   ||
     ||   ++- CHR A14..A13 (8 KiB bank)
     |+------ Output to Diode 2 (D2)
     +------- Output to Diode 1 (D1)

The original CNROM board is always subject to AND-type bus conflicts: the effective value is the value being written bitwise-AND'd with the PRG-ROM content at the address being written to. iNES Mapper 3's submapper indicates whether bus conflicts should actually be emulated. So far, the only .NES files requiring the absence of bus conflicts have been mapper hacks to mapper 3 from other mappers.

Oversize mapper 3 with up to 128 KiB

D~[.... DCBA] A~[1... .... .... ....]
        ||||
        ++++- CHR A16..A13 (8 KiB bank)

Among the licensed NES/Famicom library, this configuration is only used by Bandai's Family Trainer: Jogging Race. Several unlicensed cartridges mount 64 KiB of CHR-ROM; although they work as oversize mapper 3 as well, they are canonically assigned to INES Mapper 148 instead.

Mapper 185

D~[..DC ..BA] A~[1... .... .... ....]
     ||   ||
     ||   |+- Chip Select 2 (CS2)
     ||   +-- Chip Select 1 (CS1)      
     |+------ Output to Diode 2 (D2)
     +------- Output to Diode 1 (D1)

Mapper 185 always has AND-type bus conflicts. The submapper number denotes the correct Chip Select value that enables CHR-ROM; if another value is active, CHR-ROM is disabled, meaning that reading from the pattern tables returns open bus. Theoretically, this should return the LSB of the address read, but real-world behavior varies, and the earlier revision of Mighty Bomb Jack in fact relies on open bus at PPU address $0000 being something other than $00. If the correct Chip Select value is not known -- denoted by submapper 0, which applies to all .NES files without a NES 2.0 header, the simple heuristic "Disable CHR-ROM for the first two reads $2007 after a reset and then enable it" will work with all known games.

bank PPU addr test bank PPU addr test
Game Incorrect bank Must work
Bird Week $F0 $1FF0 ≠ $0C $0F $1FF0 = $0C
B-Wings $00 $0000 ≠ $3C $33 $0000 = $3C
Mighty Bomb Jack (J, PRG0) $00 $0000 ≠ $00 $11 untested
Mighty Bomb Jack (J, PRG1) $00 $0001 ≠ $3C $11 untested
Sansuu 1 Nen $20 $000C ≠ $BC $22 $000C = $BC
Sansuu 2 Nen $20 $0003 ≠ $42 $22 $0003 = $42
Othello $20 $0006 ≠ $3F $22 $0006 = $3F
Sansuu 3 Nen $00 $0006 ≠ $34 $2A $0006 = $34
Spy vs Spy $13 $1F20 ≠ $55 $21 untested
Seicross $21 $0700…$0707 ≠ $20,$60,$70,$70,$70,$40,$08,$38 $20 untested

The North American and PAL versions of Mighty Bomb Jack mount 32 KiB of CHR-ROM instead and so use normal mapper 3.

Speech Start/Message Select: responds to writes to CPU $6000-$7FFF

D~[.D.. .CBA] A~[011. .... .... ....]
    |    +++- Message number (0-7)
    +-------- M5085 /SYNC signal

A falling edge of the D bit starts the selected speech line. This register only exists on the PCB of Family Trainer: Aerobics Studio.

Hardware

The 4-bit latch register is implemented using a 74HC161 binary counter. On iNES Mapper 3, the latch's A and B outputs directly connect to the CHR-ROM chip's A14 and A13 inputs. On iNES Mapper 185, the particular ROM chip model (Sharp LH2367 or equivalent) changes the functionality of pins 26 (normally A13) and 27 (normally A14) into two programmable (during manufacturing) Chip Select inputs, effectively disabling CHR-ROM and tri-stating its data outputs when the one correct bank of four possible CHR-ROM banks is not selected, as a copy-protection mechanism.

Security diodes

As another copy protection mechanism, the CNROM circuit board has a spot for two diodes that produce additional bus conflicts to hinder cartridge dumping attempts. Diode 1 connects latch bit 'D' to CHR-ROM A10; Diode 2 connects latch bit 'C' to CHR-ROM A12. Each latch bit must be set such that the diode does not allow current to flow, because if it does, AND-type bus conflicts occur that may cause the wrong CHR-ROM A10 and A12 signals to be applied, depending on the relative output resistances of latch chip and console or dumping device. Both the NES PPU and modern Kazzo-like dumping devices have strong enough output drivers to always win these bus conflicts, but 1980s' dumping equipment will lose these bus conflicts and produce an unusable readout. Each diode can be mounted either with the anode or the cathode facing the latch output. As a diode will allow current to flow if the anode-side voltage is significantly higher than the cathode-side voltage, the latch bit must be 0 if it faces the anode, and 1 if it faces the cathode. The security diodes were mounted by most Nintendo-manufactured Japanese CNROM games manufactured in 1986 as well as Bandai-manufactured CNROM games from 1986 and 1987. They were never used on North American or PAL CNROM games, even as the NES-CNROM board has an unpopulated spot for them until at least revision -02. Emulators need not emulate the functionality of security diodes to run games correctly.

Solder Pad Configuration

  • Horizontal nametable arrangement ("vertical mirroring"): 'H' connected, 'V' disconnected.
  • Vertical nametable arrangement ("horizontal mirroring"): 'H' disconnected, 'V' connected.
  • 16 KB PRG-ROM: 'SL' connected, 'CL' disconnected.
  • 32 KB PRG-ROM: 'SL' disconnected, 'CL' connected.

Hayauchi Super Igo is a CNROM-like board with a 2KB SRAM mapped at $6000, using a 74HC10 as the address decoder.

Theoretically the bank select register could be implemented with a 74HC377 octal D latch, allowing up to 2 megabytes of CHR ROM.