Thanks to skaman.
The code does a deeper sanity check of the header data when initializing the cart. It avoids having to constantly press buttons to reinit the cart. Carts can still not initialize the MBC properly but that's normal for the WonderSwan. Clean the pins on the cart and check that the cart and adapter are seated properly. If the cart doesn't unlock immediately, then let the sketch run for a bit. For stubborn carts, a power cycle might be necessary.
The sketch fixes a few typos, removes some trailing spaces, and adds another ROM size (used by Benesse Pocket Challenge V2 carts).
The code change only affects readCHR(). It shortens the check to a single byte but that is enough to identify the four VRC4e carts. The original list of VRC4e carts that I referenced only showed Boku Dracula-kun and Tiny Toon Adventures. I found out that all four of the Mapper 23 VRC4 carts use the VRC4e submapper. Mapper 23 includes VRC4f but there are no known examples (BTW, VRC4f = VRC2b).
IMPROVEMENTS:
Added read/write support for all Serial EEPROM cart types (Acclaim Type 1, Acclaim Type 2, Capcom, Codemasters, EA, and Sega). Capcom EEPROM code is untested but should work the same as Sega EEPROM code.
Fixed SRAM code to handle all SRAM types.
Added identification of SRAM carts that have bad headers.
Added support for Super Street Fighter 2.
WARNINGS:
Serial EEPROM writes take time to complete.
Serial EEPROM support was tested using Serial Output only. Support using the OLED Display might require some timing adjustment as display_Update() on Serial translates to delay(100).
ADDITIONAL NOTES:
I've included a save file for NBA Jam T.E. Rev 0.
NBA Jam T.E. Rev 0 has faulty code that will erase the EEPROM when the cart is played on the console. The solution proposed by the publisher was to play the cart with two different sets of initials (XXX, NBA) to initialize the EEPROM. The included save file was created after doing this special initialization. My tests of the EEPROM show that it will still erase after the special initialization.
I did some additional tests and found a potential solution. Write the included save file to the cart. Play the cart on the console as normal. Create new saves as needed. When done playing, HOLD THE RESET BUTTON DOWN BEFORE TURNING THE CONSOLE OFF. YMMV.
Sometimes the Gameshark will lock itself up, in this case it helps if you put a 6102 game into the Gamesharks slot and then put both into the Cart Reader and just start dumping the rom as if it was a game.
For some reason I can only read or write the first 128KB while the second 128KB remain 0x00.
You might have to re-calculate your homebrew rom's checksum if you had to trim it down to 128KB. In this case you can use chksum64.exe out of the libdragon devkit. Not sure if this is needed though.
And yes by "SST29LE010 N64 Repro" I'm jokingly referring to the Gameshark.
I wanted to turn the Gameshark into an import adapter using Lac's boot emu but the boot emu just restarts itself since the Gameshark isn't switching to the top cart slot.
Sometimes the Gameshark locks up, then you have to plug a 6102 cartridge into the Gamebuster's top slot and then connect both to the cart reader and read the rom. After that it should be accessible again.
Don't use this to update your working Gameshark since you can't read nor write the whole 256KB right now.
But if you have a broken one, have fun. :)
I tested this with a Gameshark V2.0