Real time save - how hard is it to implement?

Discussion in 'Mega Everdrive / Everdrive MD' started by Bboydocument, Nov 4, 2010.

  1. Bboydocument

    Bboydocument Spirited Member

    Joined:
    Oct 22, 2010
    Messages:
    119
    Likes Received:
    0
    I read on the neoflash forums that the latest snes core release 2.3 has real time save support.

    So what makes it so hard to implement real time save on flash carts? Is it because it requires ram to temporarily dump the state of all the registers?

    Will everdrive have this feature in future?
     
  2. MottZilla

    MottZilla Champion of the Forum

    Joined:
    Feb 1, 2006
    Messages:
    5,066
    Likes Received:
    102
    Even on SNES, "real time save" is not 100% perect. Some games work fine with it, others have some issues where saving and restoring only works in certain places, and then there are games were it totally fails completely. EverDrive doesn't have enough RAM for doing a real time save. I'm not sure it would even be possible to use FlashROM space to do it but other than that maybe if you could save directly onto the SD card.
     
    Last edited: Nov 4, 2010
  3. Bboydocument

    Bboydocument Spirited Member

    Joined:
    Oct 22, 2010
    Messages:
    119
    Likes Received:
    0
    Yeah, see I can see ram being an issue. To be able to load/save a state directly from/to the sd card would be incredible. No flash cart seems to have pioneered this properly though, due to the limit of ram.

    Even in the same fashion as the old console copiers would suffice
     
  4. DC_Lov

    DC_Lov Rising Member

    Joined:
    Sep 23, 2010
    Messages:
    64
    Likes Received:
    0
    I have 3 copiers , I can guaranty that a the real time save function is crap. It doesn't work correctly most of the time , the loaded save has no BGM , boss fail to show up , game glitches all over the place ect.
     
  5. Bboydocument

    Bboydocument Spirited Member

    Joined:
    Oct 22, 2010
    Messages:
    119
    Likes Received:
    0
    Yeah I see what u mean... Although real time save works okay on my swc and super ufo. Anyway, it just must be hard to take an accurate snapshot of the actual hardware in action. Emulators seem to pull it off fine, but i guess that's cause the environment they run in already supports it
     
  6. KRIKzz

    KRIKzz Well Known Member

    Joined:
    Apr 5, 2010
    Messages:
    1,672
    Likes Received:
    2
    i never try to implement realtime save. it will be possible on everdrive if snas register and ppu ram have read access. i never try to read them so i dont know. if they have not read acces, then need large ram buffer for ppu ram and registers
     
  7. Calpis

    Calpis Champion of the Forum

    Joined:
    Mar 13, 2004
    Messages:
    5,906
    Likes Received:
    21
    For both SNES/GEN you need 2M of RAM.
     
  8. Eke

    Eke Spirited Member

    Joined:
    Apr 6, 2010
    Messages:
    117
    Likes Received:
    2
    I don't know for SNES but 2M seems a lot.

    I did the calculation some time ago for Genesis, out of curiosity.

    For internal RAM, you would need 64KB (68k RAM) + 8KB (Z80 RAM) + 64KB (VRAM) + 128 bytes (CRAM) + 128 bytes (VSRAM) = 139776 bytes

    For 68k registers, you need 20 x 4 = 80 bytes

    For Z80 registers, you need 18x1 + 4x2 = 26 bytes

    For I/O registers, you need 16 bytes.

    These are directly accessible through software and could be dumped by OS program (I can't imagine the difficulty of dumping CPU registers without altering them though).

    VDP, PSG & FM registers however, are write-only so you would need to sniff all writes to the concerned addresses, decode register writes and store the data.

    For VDP + PSG registers, you need 24 + 8 = 32 bytes.
    For FM, you need 2 bytes to store the latched address and 510 byte should be enough for YM2612 registers, 512 bytes total

    For better compatibility, you might want to decode Z80 bank register, Z80 reset & bus request writes (2 bytes required) as well.

    Total is less than 140 Kbytes of data to save, the complexity being more in the logic used to decode write-only registers access.

    Off course, the saved state will never be as compatible as an emulator savestate since you are obviously missing a lot of chip internal data that are never accessible.
     
    Last edited: Nov 5, 2010
  9. Calpis

    Calpis Champion of the Forum

    Joined:
    Mar 13, 2004
    Messages:
    5,906
    Likes Received:
    21
    Yeah, 2M isn't exact, but it's rounding up. Should he use a 1M & 2x64K RAMs to fit it most efficiently? lol. What about 256K of cart backup RAM? Can't allow that to be corrupted.

    SNES is basically the same, but there is 1M of WRAM.
     
  10. Trenton_net

    Trenton_net AKA SUPERCOM32

    Joined:
    Apr 13, 2007
    Messages:
    2,378
    Likes Received:
    58
    I would assume taking a perfect RTS snapshot would be impossible on consoles because just trying to save the state of the machine will ultimately modify the state of the machine your trying to save.
     
  11. Calpis

    Calpis Champion of the Forum

    Joined:
    Mar 13, 2004
    Messages:
    5,906
    Likes Received:
    21
    It depends on the method in which the RTS gets control. Usually it's done by hijacking the NMI vector so the state is preserved. Using a normally unused interrupt wouldn't preserve 100% of the stack, but a game shouldn't be that close to allowing the stack to overflow. Another trickier method is to sync to the CPU by watching the bus then feed it a JMP.
     
  12. WaverBoy

    WaverBoy Active Member

    Joined:
    Aug 16, 2010
    Messages:
    38
    Likes Received:
    0
  13. KRIKzz

    KRIKzz Well Known Member

    Joined:
    Apr 5, 2010
    Messages:
    1,672
    Likes Received:
    2
    not possible
     
sonicdude10
Draft saved Draft deleted
Insert every image as a...
  1.  0%

Share This Page