Sachen MMC1

From Tauwasser's Wiki
Jump to: navigation, search

Sachen's MMC1 can be used to address up to 32 Mbit of ROM. It contains provisions for SRAM access.

Pinouts

Pin No. MMC1 Pin No. MMC1+ROM Name Type Comment
1, 36 1 VCC PWR 5V supply
21, 35 17 GND PWR Ground supply
7–8, 26 GND? PWR Ground supply or unused pin.
18–20, 22–26 14–16, 18–22 D0–D7 I Data Bus
25 RD I Low-Active Read Enable
29 32 WR I Low-Active Write Enable
8 2 RESET I Low-Active Asynchronous Reset
2–6, 32, 7, 28, 30, 9, 33–34, 27 13–9, 6–4, 29–28, 24, 27, 3, 30–31, 23 A0–A15 I Address Bus
40–37 RA0, RA1, RA4, RA6 O Scrambled lower ROM Address Lines
31 RA7 O Lower ROM Address Lines
31, 17–10 RA14–RA21 O Upper ROM Address Lines
NC N/A Not connected.

Theory of Operation

Sachen's MMC1 mappers are used for multi-game N-in-1 cartridges. Individual game ROMs can be remapped so their address space logically starts at ROM bank 0x00 although the individual ROMs might be stored starting at another bank. To avoid copyright infringement the game headers are scrambled and the mapper unscrambles them when the header region is read. The mapper also includes a mechanism to switch out the Nintendo logo with a custom logo while still passing the Game Boy Bootstrap logo check. All of these features are also used by various games as a copy-protection mechanism, e.g. ROM mapping, unscrambling and the logo in VRAM are checked to determine if the game is run from an original Sachen cartridge.

Modes of Operation

Sachen MMC1 has two modes of operation locked and unlocked. It defaults to locked after reset.

This is used to display the Sachen logo instead of the Nintendo logo for the DMG bootstrap ROM. While locked, the mapper will keep RA7 set.

The unlock sequence is 0x31 transitions of A15 from high to low. Starting on the last transition, RA7 will follow A7. All control signals are don't cares for this.

Other functionality seems to be unaffected by the lock register: switching banks and remapping work while locked

The only way to lock the mapper after unlocking is to reset it.

Header Scramble

Sachen chose to scramble the header of their games. When A8 is high, while A15..A9 are low, the mapper will perform the following map:

RA0 <= A6
RA1 <= A4
RA4 <= A1
RA6 <= A0

When A8 is low or A15..A9 are not low, RAn lines will track their respective An line.

Multi Memory Remap

Base ROM Bank and ROM Bank Mask Register are used for remapping 0x0000-0x7FFF to be based on a new base ROM bank.

The mapping function is:

(rb & ~mask) | (mask & rb_base)

Memory Map

  • 0x0000-0x3FFF: Mapped ROM bank #0
  • 0x4000-0x7FFF: Mapped Switchable ROM bank
  • 0x8000-0xFFFF: Unmapped

Mapped here means adjusted for absolute Base ROM bank.

The RAn pins depend solely on A14, thus they will alias the 0x0000-0x7FFF region to 0x8000-0xFFFF. ROM is still only enabled when A15 is low, so no output is produced.

Registers

Write-Accessible Registers:

  • 0x0000-0x1FFF: Base ROM bank register
  • 0x2000-0x3FFF: ROM bank register
  • 0x4000-0x5FFF: ROM bank mask register

ROM Bank Register

The ROM bank register is zero-adjusted, i.e. if 0x00 is written, 0x01 will be stored. Zero-adjustment is done on all 8 input bits D7..D0. This means, that ROM Bank 0x00 can only be mapped to 0x4000-0x7FFF when the attached ROM is smaller than 32 Mbit and thus aliases 0x80 to 0x00.

D7 D6 D5 D4 D3 D2 D1 D0    0x01 @ reset
\_____________________/
      \___/      \-------- ROM Bank
        |
        \----------------- Map Enable

ROM Bank bits switch the bank mapped to 0x4000-0x7FFF. Map Enable bits are used to enable write access to the #Base ROM Bank Register and #ROM bank mask register. 0b11 means these registers can be written, other values will not grant write access.

The width of this register is based off the fact that there are six high address lines, two more landing pads (not bonded) visible and I/O lines numbered (15 next to trace with 13 visible traces) on the 1231 PCB.

Base ROM Bank Register

This register stores the base ROM bank.

D7 D6 D5 D4 D3 D2 D1 D0    0x00 @ reset
\_____________________/
                 \-------- Base ROM Bank

This register is writable without limitation when Map Enable in the #ROM Bank Register is 0b11. Changes to this register take immediate effect.

ROM bank mask register

This register stores the ROM bank mask.

D7 D6 D5 D4 D3 D2 D1 D0    0x00 @ reset
\_____________________/
                 \-------- ROM Bank Mask

This register is writable without limitation when Map Enable in the #ROM Bank Register is 0b11. Changes to this register take immediate effect.

Behavior

Integrated ROM

The integrated ROM behaves as a regular ROM chip that's connected to the An resp. RAn address and Dn data lines. Depending on the bonded ROM smaller ROMs may have an additional low-active CE line on RA17 or RA18.