From Data Crystal
Jump to: navigation, search

(Blatantly copied from Brian Provinciano's nice doc on the format - google it!)

The NES-UNROM board is built to support games with up to 256K of PRG ROM and 8K of CHR RAM. It is one of the simplest mappers next to CNROM.

The PRG ROM loaded into memory is broken up into two separate 16K banks. The low 16K bank from $8000-BFFF is bankswitchable, while the high bank at $C000-FFFF is locked to the last 16K bank of the ROM. The low 16K bank can be selected using a four bit value, thus allowing for up to 16 banks, making the maximum PRG ROM size 256K.

The mapper consists of two standard logic ICs, a 74hc161 counter and 74hc32 OR-gate. The '161 is used to latch/store the bank value (A14-A17), while the OR-gate locks the high bank to be the last.

The operation is quite simple. When a value is written to the PRG ROM memory space ($8000-FFFF), the low four bits (D0-D3) are latched to the '161. The D0-D3 bits control the ROM's A14-A17 address lines. These outputs are not connected directly to the ROM though, as they pass though the OR-gate. These four bits are all ORed with the cart edge's PRG A14. As a result, when accessing the high 16K bank, PRG A14 is 1, so the last bank is activated. When accessing the low bank, PRG A14 is 0, so the latched bank value goes through as it is.

The UNROM board contains busconflicts. The ROM is enabled on all accesses to PRG memory $8000-FFFF, read or write. As a result, when writing a bank value to the mapper, the ROM as the location written to must contain the same value, or wacky results can and do occur. Since writing to anywhere $8000-FFFF can switch banks, and there are a maximum of 16 banks, one could simply use an array of 16 bytes, values 00 to 0F. Then, to switch to bank 15 for example, just write to the location in the ROM containing the 0F byte.