Closed vaguerant closed 2 years ago
Indeed, the correct behavior in this case is to return the last byte of the instruction reading memory, cf. http://www.techno-junk.org/txt/smstech.txt
Fixed by https://github.com/ekeeke/Genesis-Plus-GX/commit/236e783ec258089a500174e1be550041a4e4850b
File this under "who cares?"
Genesis Plus GX doesn't match hardware behavior when responding to reads from an empty cartridge slot in at least Master System mode. This can be observed by using the rare 2.0 BIOS, called
[BIOS] Sega Master System (Europe) (v2.0).sms
in No-Intro's DAT.This weird BIOS, theorized by some to be intended for Chinese model Master Systems, has behavior that's somewhere between U/E BIOS 1.3 and Japan BIOS 2.1. Superficially, it looks like 1.3, but under the hood it acts like Japan 2.1, with no header check, just the standard Japanese 513-byte "is there anything in the cartridge/card slot?" check, which will launch games from any region. There is a full disassembly of this BIOS by segmtfault.
The cartridge check copies the first 513 bytes of ROM (or else of the open slot response) into RAM starting at
0xC9C0
. This is also the location from which the built-in Snail Maze easter egg/game (Up+A+B on the no-cart instructions screen) reads its tilemap, without initializing it all first. On hardware, this results in junk tiles in the upper left and upper right of the Snail Maze screen. The junk tiles are tile0xB0
in the tilemap, which is the bottom left of the S from "MASTER" in the BIOS logo. You can see some photos of the issue occurring on hardware (but not in MEKA) in this SMSPower post by Bock.Genesis Plus GX doesn't show these junk tiles at all, presumably because the open slot values are different to what reads back on real hardware for this situation.
I happened to mention this (non-)issue around Calindro, author of the (closed source, I believe) multi-console emulator Emulicious, which was also incorrectly not exhibiting the issue, and they were able to implement the correct (i.e. buggy) behavior in that emulator:
As far as I'm aware, that build is currently private; it is probably not fixed yet in the latest official build. Before the fix, Emulicious had those junk tiles pointing to
0xFF
, which is blank, explaining why the issue was not visible there. After the fix, they are both0xB0
.I don't expect this to be particularly helpful, but in the process of investigating the issue, I created a bug fix patch for the BIOS which performs the cartridge check at
0xCA00
instead of0xC9C0
, an area which Snail Maze does initialize, preventing the bug from occurring. I confirmed via Emulicious that the junk tiles once again do not appear when using this patch.