flashid (almost) always contains the hexadecimal representation of two
bytes, which then means it gets compares with strcmp, which in turn need
another string argument. Instead, make it an integer, removing the need to
call strcmp.
Add a separate string representation for printing purposes (maybe this can be
avoided by having the print function format it when needed ?).
The only apparent case where flashid is not an hexadecimal representation
of a pair of bytes is when N64 clears it to "CONF". Set flashid to zero
this case.
This saves about 500 bytes of program space and 200 bytes of ram.
- LoRom (P0) will write up to 8MB starting from file 0x0 to flashrom 0x0.
- HiRom (P0) will write up to 4MB starting from file 0x0 to flashrom 0x0.
- ExLoRom (P1) will write the first 4MB starting from file 0x0 to flashrom 0x400000. And then a second block up to 4MB from file 0x400000 to flashrom 0x0.
- ExHiRom (P1) will write the first 4MB starting from file 0x0 to flashrom 0x400000. And then a second block up to 4MB from file 0x400000 to flashrom 0x0.
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).
If you're still using the old 16bit adapter(the one with the additional pins left and right on the snes cart edge) you can enable the menu again by changing one line in Cart_Reader.ino:
// Enable 16bit flash adapter menu
#define enable_flash16
These two new entries just forward the user to the flashrom functions inside of flash.ino.
I have only tested custom-made 29F033 repros using original SHVC-1J3M-20 and SHVC-1A3M-30 PCBs as shown here: https://github.com/sanni/cartreader/wiki/Reflashing-SNES-Repros
Apparently the step-up converter needs a little delay before it can provide the 12V VPP.
The verify function still does not work though, I have no clue why.
The first 10 words still do not get written though, not sure if I need something like a setup delay or if my eprom is broken.
Too enable the eprom menu for testing 27C322 flashing change the following lines in Flash.ino:
// create menu with title and 3 options to choose from
unsigned char flashSlot;
// Copy menuOptions out of progmem
convertPgm(menuOptionsFlash, 3);
flashSlot = question_box("Select flashrom slot", menuOptions, 3, 0);