Hacking ROP to use SRAM instead of Serial EEPROM

For anything related to cart (SRAM, SF2 mapper, audio, CD mode 1, ...)

Moderator: BigEvilCorporation

Whipon
Interested
Posts: 14
Joined: Thu Jul 07, 2011 3:09 am

Post by Whipon » Thu Jul 14, 2011 6:01 pm

HardWareMan wrote:
Whipon wrote:What about the data pointer issues I described?.
I wanted to debug it a bit to see what it writes, etc.
I don't use MESS, so I don't know what it does or what it don't. In addition, the game can perform some tests of equipment before use. Just do write/read byte to/from (a) and see what you get on real hardware. I think it will be much quicker. And don't forget implement address pointer, wich must increment after every read.
I see. Well, thanks again. I'll take your advice and I'll test the rom directly on real hardware. Afterall, there's no windows emulators with Serial Eeprom support.

Eke
Very interested
Posts: 884
Joined: Wed Feb 28, 2007 2:57 pm
Contact:

Post by Eke » Thu Jul 14, 2011 6:29 pm

Regen does... and it has some kind of debugger version too.

Whipon
Interested
Posts: 14
Joined: Thu Jul 07, 2011 3:09 am

Post by Whipon » Thu Jul 14, 2011 6:36 pm

Eke wrote:Regen does... and it has some kind of debugger version too.
I tried a clean rom with its latest version, normal and debugger one. It doesn't let me save. The game outputs the same message as in most emulators and pirate cartridges:
"I cannot save the game because of a media error. Consult your manual".

Eke
Very interested
Posts: 884
Joined: Wed Feb 28, 2007 2:57 pm
Contact:

Post by Eke » Fri Jul 15, 2011 9:10 am

Weird, i thought it does but apparently not for all EEPROM games. You could also try mednafen, it uses my code for EEPROM emulation, and Rings of Power is supported. I don't know if it has a debugger though.

Whipon
Interested
Posts: 14
Joined: Thu Jul 07, 2011 3:09 am

Post by Whipon » Sat Jul 16, 2011 2:37 am

Eke wrote:Weird, i thought it does but apparently not for all EEPROM games. You could also try mednafen, it uses my code for EEPROM emulation, and Rings of Power is supported. I don't know if it has a debugger though.
u_u.
I downloaded latest WIP (0.9.17) but it also doesn't let me save. A pity, because it seems Mednafen does have a debugger. The same goes with 0.9.0.
I don't know why this game is so hard to emulate. I'm playing it in a Genesis Plus port on my android phone and it saves perfectly.
Maybe you used a different version?.

HardWareMan
Very interested
Posts: 745
Joined: Sat Dec 15, 2007 7:49 am
Location: Kazakhstan, Pavlodar

Post by HardWareMan » Sat Jul 16, 2011 4:15 am

Eke wrote:Weird, i thought it does but apparently not for all EEPROM games. You could also try mednafen, it uses my code for EEPROM emulation, and Rings of Power is supported. I don't know if it has a debugger though.
Again. All your EMUs able to save at new generation I2C EEPROM 24cxx. And ROP save to early version of I2C EEPROM - simplier x24C01 (notice: "x"!). Feel the difference of protocols: x24C01 and regular 24C01.
Nobody listen to me. Shame.

Whipon
Interested
Posts: 14
Joined: Thu Jul 07, 2011 3:09 am

Post by Whipon » Sat Jul 16, 2011 4:30 am

HardWareMan wrote:
Eke wrote:Weird, i thought it does but apparently not for all EEPROM games. You could also try mednafen, it uses my code for EEPROM emulation, and Rings of Power is supported. I don't know if it has a debugger though.
Again. All your EMUs able to save at new generation I2C EEPROM 24cxx. And ROP save to early version of I2C EEPROM - simplier x24C01 (notice: "x"!). Feel the difference of protocols: x24C01 and regular 24C01.
Nobody listen to me. Shame.
Sorry, but, do you know of any emulator with a debugger for any platform that supports saving with this game?. I want to debug its save routine to do some checks.

HardWareMan
Very interested
Posts: 745
Joined: Sat Dec 15, 2007 7:49 am
Location: Kazakhstan, Pavlodar

Post by HardWareMan » Sat Jul 16, 2011 6:34 am

Whipon wrote:...do you know of any emulator with a debugger...
With powerfull debugger - yes, with x24c01 support - no.

Eke
Very interested
Posts: 884
Joined: Wed Feb 28, 2007 2:57 pm
Contact:

Post by Eke » Sat Jul 16, 2011 9:56 am

HardWareMan wrote:
Eke wrote:Weird, i thought it does but apparently not for all EEPROM games. You could also try mednafen, it uses my code for EEPROM emulation, and Rings of Power is supported. I don't know if it has a debugger though.
Again. All your EMUs able to save at new generation I2C EEPROM 24cxx. And ROP save to early version of I2C EEPROM - simplier x24C01 (notice: "x"!). Feel the difference of protocols: x24C01 and regular 24C01.
Nobody listen to me. Shame.
I know the difference, and it's emulated perfectly fine by Genesis Plus GX (see the code) ... and the recent android ports made out of it :roll:
I thought that Mednafen was using this code because I've been told so but apparently I was wrong. Another possibility is that your ROM is not properly identified in its database and that Mednafen's specific EEPROM detection routine is faulty.
EDIT: by looking at Mednafen's implementation, it looks like it is using an old version of my code and the address for SDA/SCL lines are incorrect, which is why it doesn't work. EA games are traditionally using 16-bit access to read/write backup memory and this one does the same for EEPROM lines, which is why I initially wrote that $200000 was the good address but it should be $200001 and word access to eeprom need to be treated specifically.

For the record, ROP and all other EA games use the same kind of 128-byte EEPROM as Sega one (WB5,Rockman Megaworld, etc) which is already emulated by a few emulators (Kega and Regen at least), it's just the mapper which is different (notice how SCL/SDA lines are not mapped to the same bits) and need to be supported, X24C01 eeprom type already is.

Whipon
Interested
Posts: 14
Joined: Thu Jul 07, 2011 3:09 am

Post by Whipon » Sat Jul 16, 2011 12:16 pm

How difficult would it be adding your EEPROM code to the source and recompile it?.
I'm at my job, so I can't do it right now.
If its just a copy paste, I'll give it a try.
Meanwhile, while I'm at my job, if you feel like doing it, feel free to recompile it ;).

Eke
Very interested
Posts: 884
Joined: Wed Feb 28, 2007 2:57 pm
Contact:

Post by Eke » Sat Jul 16, 2011 12:23 pm

I think the problem occurs when using Mednafen on little-endian platform.
I'm not sure how the data input in MD_Cart_Type_EEPROM::Write16 and output by MD_Cart_Type_EEPROM::Read16 is handled but you might want to try the following modification:
/* EA mapper (24C01 only) */
{ EEP_EA_24C01, {7, 0x7F, 0x7F, 0x200000, 0x200000, 0x200000, 7, 7, 6}},
to
/* EA mapper (24C01 only) */
{ EEP_EA_24C01, {7, 0x7F, 0x7F, 0x200000, 0x200000, 0x200000, 15, 15, 14}},
Last edited by Eke on Sat Jul 16, 2011 12:28 pm, edited 1 time in total.

Whipon
Interested
Posts: 14
Joined: Thu Jul 07, 2011 3:09 am

Post by Whipon » Sat Jul 16, 2011 12:26 pm

Eke wrote:I think the problem occurs when using Mednafen on little-endian platform.
I'm not sure how the data input in MD_Cart_Type_EEPROM::Write16 and output by MD_Cart_Type_EEPROM::Read16 is handled but you might want to try the following modification:

Change
/* EA mapper (24C01 only) */
{ EEP_EA_24C01, {7, 0x7F, 0x7F, 0x200000, 0x200000, 0x200000, 7, 7, 6}},
to
/* EA mapper (24C01 only) */
{ EEP_EA_24C01, {7, 0x7F, 0x7F, 0x200000, 0x200000, 0x200000, 15, 15, 14}},
Great. Thanks a lot. I'll recompile it with this modification this afternoon.

Eke
Very interested
Posts: 884
Joined: Wed Feb 28, 2007 2:57 pm
Contact:

Post by Eke » Sat Jul 16, 2011 12:29 pm

There is no guarantee that this will work though

Whipon
Interested
Posts: 14
Joined: Thu Jul 07, 2011 3:09 am

Post by Whipon » Sat Jul 16, 2011 12:31 pm

Eke wrote:There is no guarantee that this will work though
But then, why it works in Geneis Plus and its ports?. Isn't the same code?.

Eke
Very interested
Posts: 884
Joined: Wed Feb 28, 2007 2:57 pm
Contact:

Post by Eke » Sat Jul 16, 2011 12:50 pm

As I said previously, it's not exactly the same code and it was apparently modified for Mednafen's interface. My current version handles 8-bit and 16-bit access properly and was tested on little-endian platform with success.

I'm only giving you a hack here that could eventually fix it if the problem is what I think (i.e endian issue). Normally, it's up to to the rest of emulator to handle endianness properly but I have no idea how this is handled in Mednafen.

Post Reply