Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Accessing to the save/load game data
#11
(11-17-2018, 02:15 AM)Loïc Wrote:
(11-17-2018, 02:07 AM)Flavor Wrote: ...
BUT, notice that Thor's code erases the block and writes the data.  This will work.  It's probably the easiest way, but it's not the "best" way to do it.
...

Ed, is it possible on neogeo pocket to change only the needed bits ?

All the commercial games I've disassembled uses clear/write process.

Loïc

I think that you can do it.  I don't know if this has been tested, but the chips should support it.  

THEORY of how it should work on the NGPC flash cart chips
For example, if you had a byte that was 0xFF
You could write 0xFE to that byte.  Then it would be 0xFE.
If you tried to write 0xFF to it, it would then be 0xFE
If you tried to write 0xFC to it, it would then be 0xFC
If you tried to write 0x00 to it, it would then be 0x00, and you could never change it again until you erased the block.

But, if you knew that your game only needed 10 bytes of savegame data, you could do something like this.
Put a header on the 10 bytes that's some sort of (non-0xFF) signature with an index, timestamp, etc..  Now the data is maybe 12 bytes.
Erase the block.

When you want to save, first check for your signature.  If it's not there, write your 12 bytes.  If it is there, jump ahead 12 bytes.  Is the signature there?  Keep going until there's an 0xFF (or 12 bytes of 0xFF to be more safe).  If you don't find an unused slot in the block, then erase the block and try again.  Then write your savegame.  

When you want to load, find the last/newest/etc. signature, and load that savegame.

I have also see something like this employed using 2 blocks.  You try to always keep a copy.  If something gets corrupt, you can use the other block as a backup.

In theory, you could also use the earlier "THEORY" bit to do something a bit more interesting.  Instead of a signature, you could have a bitfield that represents the used "slots" and turn a slot to "used" by setting its bit from 1 to 0.  This seems cooler, but it's probably not necessarily better or noticeably faster.
Card Fighters' Clash 2 English Translation ( http://cfc2english.blogspot.com/ )
Neo Geo Pocket Flash Cart and Linker Project ( http://www.flashmasta.com/ )
Avatar art thanks to Trev-Mun ( http://trevmun.deviantart.com/ )
Reply


Messages In This Thread
Accessing to the save/load game data - by KeiDash - 11-14-2018, 11:38 PM
RE: Accessing to the save/load game data - by Flavor - 11-17-2018, 02:28 AM

Forum Jump:


Users browsing this thread: 1 Guest(s)