GB & GBC Games Likely to Fail in your Emulator or Flash Cart

Discussion of programming and development for the original Game Boy and Game Boy Color.
lidnariq
Posts: 11429
Joined: Sun Apr 13, 2008 11:12 am

Re: GB & GBC Games Likely to Fail in your Emulator or Flash

Post by lidnariq »

Great Hierophant wrote:One curious thing however is that Rocket Games would display "ROCKET®", not "Nintendo®" on the bootup screen. The GBC checks some of these bytes to ensure that your ROM was displaying the correct name. Rocket Games presumably found a way to bypass the check, but when you replace the logo, the games work but now display Nintendo®.
BennVenn's analysis of Datel's Game Boy Modem indicated that the logo was stored in the MBC itself, and the MBC knows when to switch between the external ROM (for the desired logo) and the internal ROM (for the TMSS circumvention).

Unfortunately, BennVenn's apparently taken down his old analysis pages.
Great Hierophant
Posts: 780
Joined: Tue Nov 23, 2004 9:35 pm

Re: GB & GBC Games Likely to Fail in your Emulator or Flash

Post by Great Hierophant »

lidnariq wrote:
Great Hierophant wrote:One curious thing however is that Rocket Games would display "ROCKET®", not "Nintendo®" on the bootup screen. The GBC checks some of these bytes to ensure that your ROM was displaying the correct name. Rocket Games presumably found a way to bypass the check, but when you replace the logo, the games work but now display Nintendo®.
BennVenn's analysis of Datel's Game Boy Modem indicated that the logo was stored in the MBC itself, and the MBC knows when to switch between the external ROM (for the desired logo) and the internal ROM (for the TMSS circumvention).

Unfortunately, BennVenn's apparently taken down his old analysis pages.
Fortunately the Internet Archive has saved that page : https://web.archive.org/web/20150106134 ... l_MBC1.htm

Unfortunately it looks like someone is going to have to get out the logic analyzer to figure out what the Datel chip does. For the Shark MX, the extra features make sense, but for these simple games, its overkill. Moreover, I think the use of the pure Nintendo logo would have been covered by Sega v. Accolade.
Great Hierophant
Posts: 780
Joined: Tue Nov 23, 2004 9:35 pm

Re: GB & GBC Games Likely to Fail in your Emulator or Flash

Post by Great Hierophant »

Here is an iNES-like mapper scheme which could be useful for unlicensed games and licensed games which cannot be detected by internal header alone : http://hhug.me/gbx/1.0
User avatar
Tauwasser
Posts: 4
Joined: Sun Oct 05, 2014 4:49 pm

Re: GB & GBC Games Likely to Fail in your Emulator or Flash

Post by Tauwasser »

Great Hierophant wrote:I believe one of the first things that all known MMM01 carts do when they are booted up is to write to the multiplexer bit in the Mode Register. This switches control from the first 32KB bank to the last 32KB bank by outputting ROM A19-20 to CPU A13-A14. I think this is why an emulator like bgb needs the multicart menu at the beginning of the ROM, [...].
Actually, not quite. I forgot to highlight a crucial detail on the wiki page... In general the VHDL code should describe the complete behavior and the text is kind of supplementary: in unmapped mode, the high-order ROM address lines are all forced to 1 regardless of the actual register contents. That's why the last two 16kB ROM banks need to contain the menu. And because BGB doesn't know that before it inspected the header, it needs the menu up front.

The multiplex bit part is weird, because the additional #WE bit for the MBC1 mode seems pretty useless, unless the multiplex would be able to switch with the MBC mode somehow :-/
Great Hierophant
Posts: 780
Joined: Tue Nov 23, 2004 9:35 pm

Re: GB & GBC Games Likely to Fail in your Emulator or Flash

Post by Great Hierophant »

I have attached the latest version of the List. I observe that bgb v1.5.7 can run all but three of the licensed mappers, even if it cannot do much with the Camera and the Sonar. I don't know of any emulator that can touch the Mani 74'161, MCB6 or TAMA5.
Attachments
Unusual & Unlicensed GB & GBC.ods
(21.69 KiB) Downloaded 776 times
Shonumi
Posts: 342
Joined: Sun Jan 26, 2014 9:31 am

Re: GB & GBC Games Likely to Fail in your Emulator or Flash

Post by Shonumi »

Great Hierophant wrote: I don't know of any emulator that can touch the Mani 74'161, MCB6 or TAMA5.
KiGB, higan, mGBA, and GBE+ can all emulate the MBC6, at least enough to play the only game that uses it (Net de Get: Minigame @ 100). The Flash chip is only used for downloading games, and only GBE+ currently emulates enough of GB Mobile Adapter + the download servers to get that far. Flash itself isn't emulated, but I can get Flash related error screens as it concerns the downloads. At any rate, the MBC6 is partially (mostly) emulated.

higan and mGBA (and to some extent, even VBA-M) support the TAMA5 as well. I don't believe the RTC is emulated just yet though.
User avatar
Tauwasser
Posts: 4
Joined: Sun Oct 05, 2014 4:49 pm

Re: GB & GBC Games Likely to Fail in your Emulator or Flash

Post by Tauwasser »

Great Hierophant wrote:I'm honestly unclear how exactly the mapper works to wall in a game to its own space within the ROM, but masking bits seems to have something to do with it. That MMM01 page is the only page with hard information about the chip, but while the information on that page seems technically more precise than say on gbdev, it is also a lot more obtuse.
Feel free to ask specific questions. The function of the MMM01 mapper isn't that hard to comprehend. I think what confuses people the most is the way the data is packed into the registers and the multiplex bit.
Great Hierophant wrote:In other interesting things, the Mani 4 in 1 (China) (DMG-601 CHN) has no more data in it after the 160KB mark, although I'm quite sure that there is a 256KB ROM inside the cart with padding. It is structured as 32KB for the menu + 4 x 32GB games.
The DMG-601 CHN multicart is a special cartridge that does not use a regular MBC chip but rather an off-the-shelf counter 74HC161A used as a flip flop. This particular multicart comes in two flavors: regular mask ROM SSOP (DMG-M161-M01 PCB) and COB (DMG-M161-M12 PCB). The SSOP version is a 2 MBit mask rom (256 KiB, marking 23C2001), and dumping confirms that, because if it was just a 1 MBit mask rom, I would have read the lower ROM contents twice.

I only know of one other case involving odd ROM sizes and that's a 3 MBit mask rom that actively outputs 0x00 when reading past the actual ROM (Sachen Street Heroes). Of course I can't rule out that this is somehow a special 1 MBit with 2 MBit addressing ROM chip that outputs 0x00 in a similar manner, but I doubt it. The PCB/mapper itself can address up to 2 MBits as well.
lidnariq
Posts: 11429
Joined: Sun Apr 13, 2008 11:12 am

Re: GB & GBC Games Likely to Fail in your Emulator or Flash

Post by lidnariq »

Tauwasser wrote:rather an off-the-shelf counter 74HC161A used as a flip flop.
Is this the same as Wisdom Tree's mapper? (GB.A14 = 161./LatchEnable ; GB./WR = 161.↑Clock)
User avatar
Tauwasser
Posts: 4
Joined: Sun Oct 05, 2014 4:49 pm

Re: GB & GBC Games Likely to Fail in your Emulator or Flash

Post by Tauwasser »

lidnariq wrote:
Tauwasser wrote:rather an off-the-shelf counter 74HC161A used as a flip flop.
Is this the same as Wisdom Tree's mapper? (GB.A14 = 161./LatchEnable ; GB./WR = 161.↑Clock)
As far as I'm aware the Wisdom Tree games use SN74LS377N, which is an octal flip flop. However, the M161 games can disable the mapping by writing the most significant bit to 1. The Wisdom Tree games all fit within 8 MBit with the exception of the NIV Bible, which is 16 MBit. I don't know what PCB the NIV Bible uses or if other Wisdom Tree games use different PCBs and/or mappers. However, pictures from DAT-o-MATIC show SN74LS377N on all PCBs dumped so far, which isn't a lot.

Spiritual Warfare PCB (1992 Color Dreams Inc.):
Image

DMG-M161-M01 PCB:
Image
lidnariq
Posts: 11429
Joined: Sun Apr 13, 2008 11:12 am

Re: GB & GBC Games Likely to Fail in your Emulator or Flash

Post by lidnariq »

Tauwasser wrote:As far as I'm aware the Wisdom Tree games use SN74LS377N, which is an octal flip flop.
Yes, but the functional differences between the '161 and '377 are: 161 has: 4 bits, asynchronous clear, increment, carry output; '377 has 8 bits, none of the rest.
Spiritual Warfare PCB (1992 Color Dreams Inc.): [schematic]
Are you certain it's A15? There's both a timing hazard with A15's timing relative to /WR, and another (low-quality) source claims that it's A14.

edit: I managed to finally figure out how to navigate Dat-O-Matic to find what is probably the same PCB that was used above, and yes, it's definitely A15.
However, the M161 games can disable the mapping by writing the most significant bit to 1.
Oh, I see, there's a diode OR gate there to let it lock out subsequent bankswitching.
Tyree_Cooper
Posts: 16
Joined: Mon Mar 18, 2019 1:23 am

Re: GB & GBC Games Likely to Fail in your Emulator or Flash Cart

Post by Tyree_Cooper »

Is there any way to make carts like DMG-601-CHN play in an emulator? I dumped all my Chinese 4 in 1 carts and all emulators I tried either fail to load the software, or can only load the game selection screen, and selecting a game just reboots to the same screen.
lidnariq
Posts: 11429
Joined: Sun Apr 13, 2008 11:12 am

Re: GB & GBC Games Likely to Fail in your Emulator or Flash Cart

Post by lidnariq »

Should be able to divide it into separate 32KB games and load those.
zzo38
Posts: 1096
Joined: Mon Feb 07, 2011 12:46 pm

Re: GB & GBC Games Likely to Fail in your Emulator or Flash Cart

Post by zzo38 »

Great Hierophant wrote: Sun Jun 24, 2018 2:14 pmEssentially this list shows that emulation of not just unlicensed but licensed games cannot likely be completely done without a mapper assignment system. The internal header can't always be trusted, I believe it fails with MMM01 games for example.
What I thought of is to use the filename extension (or a parameter of the MIME type) to override the specification of the mapper in the header. If such a filename extension (or MIME type parameter) is not present, then the specification in the header is used. So, instead of .gb you can have .gb_01 to specify the mapper in the filename, if the specification in the header does not work.
(Free Hero Mesh - FOSS puzzle game engine)
Post Reply