Difference between revisions of "Sachen Mappers"

From Tauwasser's Wiki
Jump to: navigation, search
m (Modes of Operation: reword, default map RA7 <= A7 after unlock)
(split pages up)
 
(31 intermediate revisions by the same user not shown)
Line 1: Line 1:
Several Sachen Mappers are thought to exist.
+
__TOC__
 +
 
 +
Sachen manufactured unlicensed Game Boy and Game Boy Color games from ~2000 until 2007.
 +
 
 +
Two Sachen Mappers are thought to exist. Both exist in a stand-alone variant -- just the mapper under glob top -- and an integrated variant -- mapper and ROM are under the same glob top on the PCB.
  
 
{| class="wikitable" style="width: 30%;"
 
{| class="wikitable" style="width: 30%;"
Line 5: Line 9:
 
!style="width: 50%;" | Comment
 
!style="width: 50%;" | Comment
 
|-
 
|-
|Sachen MBC1
+
|[[Sachen MMC1]]
|MBC for mono 1B games.
+
|MMC for mono 4B games.
|-
 
|Sachen MMC1
 
|MMC for mono 4B games
 
|-
 
|Sachen MMC2
 
|MMC for color 4B games
 
 
|-
 
|-
|Sachen MMC3
+
|[[Sachen MMC2]]
|MMC for color 8B games.
+
|MMC for mono/color 1B games.
This might be the same as Sachen MMC2.
 
|-
 
|Sachen MMC4
 
|MMC for Mighty 31 in 1 Mix.
 
|}
 
  
= Sachen MBC1 =
+
MMC for color 4B games.
  
Judging from [[#Sachen  MMC1|MMC1]], this mapper also performs scrambling of the game header.
+
MMC for color 6B games.
  
= Sachen MMC1 =
+
MMC for color 8B games.
  
4B-005 on TG-002 and 4B-007 on SA-111 tested.
+
MMC for color 16B games.
  
Write-Accessible Registers:
+
MMC for color 31B games.
 
+
|}
* 0x0000-0x1FFF: Base ROM bank register
 
* 0x2000-0x3FFF: ROM bank register
 
* 0x4000-0x7FFF: ROM bank mask register
 
 
 
Memory Map:
 
 
 
* 0x0000-0x3FFF: Mapped ROM bank #0
 
* 0x4000-0x7FFF: Mapped Switchable ROM bank
 
* 0x8000-0xFFFF: Unused
 
 
 
Mapped here means adjusted for absolute Base ROM bank.
 
 
 
== 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''
+
= Notes =
  
The only way to ''lock'' the mapper after ''unlocking'' is to reset it.
+
== 0x6000 - 0x7FFF ==
  
== Multi Memory Remap ==
+
Writing to the 0x6000-0x7FFF range did not affect mapping in any way. I did an exhaustive test.
 
 
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: <pre>(rb & ~mask) | (mask & rb_base)</pre>
 
 
 
== 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:
 
  
 
<pre>
 
<pre>
RA0 <= A6
+
for (k= 0x0000; k < 0x2000; k++) {
RA1 <= A4
+
for (l = 0x00; l < 0x100u; l++) {
RA4 <= A1
+
// reset to base RB 0x00 with mask 0x00 here
RA6 <= A0
 
</pre>
 
  
When A8 is low or A15..A9 is not low, RAn lines will track their respective An line.
+
// map RB 0x04 with mask 0xFC
 +
writeb(0x2000u, 0xFFu); // enable map regs
 +
writeb(0x0000u, 0x04u); // base RB
 +
writeb(0x4000u, 0xFCu); // mask
 +
writeb(0x6000 | k, l);  // see if this does anything
 +
writeb(0x2000u, 0x00u); // disable map regs
  
== ROM Bank Register ==
+
//check RB 0x00 - RB 0x04 against known hashes and report error
 
+
}
The ROM bank register is zero-adjusted. Zero-adjustment is done on all 8 input bits D7..D0. However, only D5..D0 are seemingly used. This means, that ROM Bank 0x00 can be mapped to 0x4000-0x7FFF by abusing the overflow in this register.
+
}
 
 
<pre>
 
D5 D4 D3 D2 D1 D0
 
\___/ \_________/
 
  |        \---------- ROM Bank
 
  \------------------- Map Enable
 
 
</pre>
 
</pre>
  
ROM Bank bits switch the bank mapped to 0x4000-0x7FFF.
+
== 0xA000 - 0xBFFF ==
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 only four high address lines on the TB-002 PCB. The Map Enable bits were not observed to have any effect on mapping.
 
 
 
== Base ROM Bank Register ==
 
 
 
This register stores the base ROM bank.
 
 
 
<pre>
 
D3 D2 D1 D0
 
\_________/
 
    \-------- Base ROM Bank
 
</pre>
 
 
 
This register writable without limitation when Map Enable in the [[#ROM Bank Register]] is 0b11.
 
Changes to this register take immediate effect.
 
The width of this register is based off the fact that the [[#ROM Bank Register]] only contains 4 bank bits as well as the fact that there are only four high address lines on the TB-002 PCB.
 
 
 
== ROM bank mask register ==
 
 
 
 
 
This register stores the ROM bank mask.
 
 
 
<pre>
 
D3 D2 D1 D0
 
\_________/
 
    \-------- ROM Bank Mask
 
</pre>
 
 
 
This register writable without limitation when Map Enable in the [[#ROM Bank Register]] is 0b11.
 
Changes to this register take immediate effect.
 
The width of this register is based off the fact that the [[#ROM Bank Register]] only contains 4 bank bits as well as the fact that there are only four high address lines on the TB-002 PCB.
 
 
 
 
 
= Sachen MMC2 =
 
 
 
No info as of now.
 
 
 
= Sachen MMC3 =
 
 
 
No info as of now.
 
 
 
= Sachen MMC4 =
 
  
No info as of now.
+
Reading from this range produced no results.
  
 
= Miscellaneous Information =
 
= Miscellaneous Information =
Line 137: Line 57:
 
Too bad Sachen screwed up (on 4B-007 at least) and actually writes the base RB to the mask register and the mask to the base RB register, thus all games having broken masking. But due to power-of-2 sizes of RBs and masks, it turns out that only a few extra RBs are mappable which shouldn't be instead of the games skipping ROM banks.
 
Too bad Sachen screwed up (on 4B-007 at least) and actually writes the base RB to the mask register and the mask to the base RB register, thus all games having broken masking. But due to power-of-2 sizes of RBs and masks, it turns out that only a few extra RBs are mappable which shouldn't be instead of the games skipping ROM banks.
  
I noticed that the Sachen logo check -- VRAM comparison of Sachen logo starting at 0x8010 -- was disabled in the mapped games. I also noticed that games do write to 0x0000-0x1FFF while being mapped, so this may have some effect (possibly SRAM) either on the original Sachen MBC1 1B mapper or on both the MBC1 (1B) and MMC1 (4B mono) mappers.
+
I noticed that the Sachen logo check -- VRAM comparison of Sachen logo starting at 0x8010 -- was disabled in the mapped games. I also noticed that games do write to 0x0000-0x1FFF while being mapped, so this may have some effect. Technically, since A15..A6, A4, A1, A0 are connected, there might be many registers mapped. Initial tests show this not to be the case.
  
 
[[Category:DMG]]
 
[[Category:DMG]]

Latest revision as of 23:50, 15 February 2018

Sachen manufactured unlicensed Game Boy and Game Boy Color games from ~2000 until 2007.

Two Sachen Mappers are thought to exist. Both exist in a stand-alone variant -- just the mapper under glob top -- and an integrated variant -- mapper and ROM are under the same glob top on the PCB.

Name Comment
Sachen MMC1 MMC for mono 4B games.
Sachen MMC2 MMC for mono/color 1B games.

MMC for color 4B games.

MMC for color 6B games.

MMC for color 8B games.

MMC for color 16B games.

MMC for color 31B games.

Notes

0x6000 - 0x7FFF

Writing to the 0x6000-0x7FFF range did not affect mapping in any way. I did an exhaustive test.

for (k= 0x0000; k < 0x2000; k++) {
	for (l = 0x00; l < 0x100u; l++) {
		// reset to base RB 0x00 with mask 0x00 here

		// map RB 0x04 with mask 0xFC
		writeb(0x2000u, 0xFFu); // enable map regs
		writeb(0x0000u, 0x04u); // base RB
		writeb(0x4000u, 0xFCu); // mask
		writeb(0x6000 | k, l);  // see if this does anything
		writeb(0x2000u, 0x00u); // disable map regs

		//check RB 0x00 - RB 0x04 against known hashes and report error
	}
}

0xA000 - 0xBFFF

Reading from this range produced no results.

Miscellaneous Information

Too bad Sachen screwed up (on 4B-007 at least) and actually writes the base RB to the mask register and the mask to the base RB register, thus all games having broken masking. But due to power-of-2 sizes of RBs and masks, it turns out that only a few extra RBs are mappable which shouldn't be instead of the games skipping ROM banks.

I noticed that the Sachen logo check -- VRAM comparison of Sachen logo starting at 0x8010 -- was disabled in the mapped games. I also noticed that games do write to 0x0000-0x1FFF while being mapped, so this may have some effect. Technically, since A15..A6, A4, A1, A0 are connected, there might be many registers mapped. Initial tests show this not to be the case.