Multi-Region NES CIC Clone

From Modding Fridays
Jump to navigation Jump to search

Lockout chip

The NES was released with a crude lockout chip (CIC) that prevents running code across different regions. To do so, the cartridge CIC must match the NES CIC, inside the console, otherwise the software won't be executed. This is a problem if you intend to make a cartridge meant to run on several systems, that is to say on all four NES regions (USA/Canada, UK/Italy/Australia, Europe and Asia). The workaround is to replace the CIC chip with a clone which can pretend to be any CIC chip. There has been several clones produced in the past, but at time of writing, most of these clones are either hard to find, discontinued, or only available for specific newly made PCB for modern NES dev/homebrew.

Krikzz' avrciczz

Good news everyone! Krikzz (from the everdrive fame) has made public the code of his avrciczz, that is used most notably in the EverDrive N8. This CIC clone runs from a small low-power Microchip 8-bit AVR RISC-based microcontroller, the ATtiny13. The DIP version of the chip also fits nicely in the original CIC PCB holes, so it is relatively easy to install in a DIY cartridge made from an existing NES game PCB.

Chip flashing

avrdude -c usbtiny -p t13 -U flash:w:avrciczz.elf:e
avrdude -c usbtiny -p t13 -U lfuse:w:0x70:m -U hfuse:w:0xfb:m

Chip installation

It's possible to replace the original CIC chip with the ATtiny13. However this is not a drop in replacement, but it will help keep things relatively tidy to reuse this part of the PCB. According to avrciczz.asm, the chip must be wired as such:

            ATtiny13A
            ,---_---.
         nc |1     8| VCC 
NES-71) clk |2     7| rst (NES-70)
        led |3     6| din (NES-34)
        GND |4     5| dout(NES-35)
            `-------'
led 0: normal state
led 1: cic trying to change region

And here is the CIC pin layout (source Nesvev):

                ----_----
Data Out 01 <-x|P0.0  Vcc|--- 16 +5V
Data In  02 x->|P0.1 P2.2|x-x 15 Gnd
Seed     03 x->|P0.2 P2.1|x-x 14 Gnd
Lock/Key 04 x->|P0.3 P2.0|x-x 13 Gnd
N/C      05 x- |Xout P1.3|<-x 12 Gnd/Reset speed B
Clk in   06  ->|Xin  P1.2|<-x 11 Gnd/Reset speed A
Reset    07  ->|Rset P1.1|x-> 10 Slave CIC reset
Gnd      08 ---|Gnd  P1.0|x-> 09 /Host reset
                ---------

So not quite the same, but we can reuse the ground, and benefit from a PCB slot with many traces that do not need to be cut as they lead to nowhere.

  • Desolder the original CIC chip

Avrciczz-1.jpg

  • Cut the reset track (CIC pin 7)

Avrciczz-2.jpg

  • Solder a socket or the ATtiny13A. Using a socket is mostly for the situation where you need to test different avrciczz to make sure they all work.

Avrciczz-3.jpg

  • Wire the connections between:
    • avrciczz pin 2 and a solder point for cartridge pin 71
    • avrciczz pin 5 and a solder point for cartridge pin 35
    • avrciczz pin 6 and a solder point for cartridge pin 34
    • avrciczz pin 7 and a solder point for cartridge pin 70
    • avrciczz pin 8 and a solder point for cartridge +5V
    • optionally solder an LED on avrciczz pin 8 and a ground point somewhere to help debug or give visual feedback on chip activity when the cartridge is plugged in a console.

Avrciczz-4-720.jpg

  • DONE! Now, the avrciczz is not going to work out of the box. You need to manually set the region by resetting the console as many times needed until the NES console's internal CIC gets the proper exchange. Every time you reset the console, the avrciczz chip will move to the next region, and once you there is a match, the game will boot. The last selected region is remembered by the chip so you only have to redo this step if you put the cartridge in a console with a different region. Simple.

Avrciczz-5-720.jpg