Closed Bananattack closed 4 years ago
This should be fixed already in the WIP sgbdebug
branch by https://github.com/devinacker/bsnes-plus/commit/59136f907fd16cba659e646daf6fdfcc766ffec9.
Clock speed control is also handled as of https://github.com/devinacker/bsnes-plus/commit/4dafe10cc2d0d42e83b86c442fa7407d188a8fe0, although overclocking doesn't currently produce the same visual glitches as on a real SGB - I suspect it's due to the VRAM buffering stuff that you mentioned in #247, but that's on my todo list as well.
Oh sorry! I didn't know about the sgbdebug
branch. I should have looked at the branches list, feel free to close this if it's fixed already. I'll keep an eye on that!
No worries! All of the SGB stuff I've been doing is pretty recent (and also unfinished), so any related feedback/testing is definitely appreciated.
I'll go ahead and close this one for now but feel free to re-open it if you still notice any issues with how it's being handled in the branch.
If it helps, automated builds from the sgbdebug branch are also available on appveyor: https://ci.appveyor.com/project/devinacker/bsnes-plus/history
Reopening since there seem to be some timing issues here with the test ROMs provided in #247. Probably just a matter of synchronizing the GB and SNES cores better.
I modified the GB core to actually emulate the SGB boot ROM(s) on startup rather than just faking it, which seems to have fixed the timing well enough for your test ROMs to work now.
The MLT_REQ tests in SameSuite are still a bit off, but I'm pretty sure that's always been the case to some degree, probably because of the aforementioned syncing issues. I'll see if there's something more that can be done about that later, but at least stuff that uses MLT_REQ in an actual practical context seems to work a bit better now.
SameSuite test roms work a little better now, though command_mlt_req.gb
still has a few misses, probably due to emulation sync issues involving the multiple MLT_REQ packets in quick succession. Everything else (including @Bananattack's test ROMs and the few games I was testing previously) seem good now, so I'll close this for now unless it's still actually affecting something.
Wow, a lot happened on this weekend. This is great work, thank you for these commits! I'll give it a try soon.
This really opens the doors for homebrew experimentation! And now my weird idea to someday make a GB RPG with enhanced field of view and multiple layers + color blending + mosaic + etc when played on SGB, might be possible ^^
Hi! I'm making a homebrew test program for the Super Game Boy that can upload custom SNES code and then use the Super Game Boy / ICD2 ports to communicate back and forth between the SNES and GB.
There's a small longstanding issue with bsnes with how multiplayer mode is activated, that makes it so that it only works if the Game Boy side first sends a MLT_REQ SGB packet through the joypad port. I've reported the issue for https://github.com/byuu/bsnes/issues/290
This particular issue also exists in bsnes-plus.
Normally the packets sent through the SGB protocol are just data in the ICD2 that can be read out of port $7000..$700F, once port $6008 indicates a full 128-bit SGB packet is ready, and the interpretation of these packets is handled entirely in the Super Game Boy BIOS software. The Super Game Boy BIOS will write to port $6003 in order to toggle the 1P/2P/4P modes.
However, unlike all other packets that get handled by the Super Game Boy BIOS, in bsnes-plus, this one is specifically done as high-level emulation and is hardcoded into the emulator when it receives joypad port writes from the GB-side: https://github.com/devinacker/bsnes-plus/blob/4cae48a58127ace5fc97b632571dc70c39b9b948/supergameboy/interface/interface.cpp#L70-L83
This is probably a mistake, as these joypad packets have no special meaning to the ICD2 itself, they only have meaning to the program running on the SNES that interfaces with the ICD2.
Writes from the SNES program to the bits of ICD2 register $6003 that affect the 1P/2P/4P modes, as well as bits to select the CPU clock speed divider, are presently are ignored: https://github.com/devinacker/bsnes-plus/blob/4cae48a58127ace5fc97b632571dc70c39b9b948/supergameboy/interface/interface.cpp#L241-L251
This document by dforce3000 mentions some information about port $6003: http://www.dforce3000.de/pub/d4s_super_gameboy_notes.pdf
The lack of direct $6003 write support currently makes it impossible for a custom SNES program to enable multi-player mode unless the GB sends a MLT_REQ first. However, on a real SNES running the Super Game Boy hardware, a custom 65816 program uploaded with DATA_TRN/DATA_SND + JUMP can use writes to $6003 to enable multi-joy mode in the ICD2.
[Among one of the possible reasons a custom homebrew might want to write $6003 from the SNES, is that an uploaded program can enable 2P or 4P mode to send custom data in the ICD2 joypad registers $6004 .. $6007, which can then be read out from the Game Boy side. And if the custom SNES program can enable multi-joy mode without the MLT_REQ asking for it, the GB side can use this as a verification that the new program is indeed uploaded and ready to communicate with, and potentially fall back on Super GB clone and emulators systems that don't have a true SNES hosting them.
For example, imagine a Super Game Boy enhanced game that comes with a special driver that can make full use of the SNES PPU and APU to make more powerful capabilities than the Super Game Boy BIOS allows, while still leaving communication open with the ICD2 ports so that the Game Boy can drive things. However, if it detects the host system doesn't actually emulate the full SNES, but still supports other SGB features (such as the case of a lot of GB-only emulators, or if a clone console existed with SGB support), it could fallback on a simplified mode with only borders or screen colorization, based on that information.]
While this probably won't affect any existing commercial games, being able to use this port as it works on a real SNES would open up new possibilities.
Thanks for the help!