Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Accessing to the save/load game data
(11-17-2018, 04:10 AM)Loïc Wrote: If I get it correctly,
the bios flashwrite can only turn 0 to 1 but it should to write starting from the offset address.

No, sorry. I think I didn't explain well. Erasing flash memory will set all the bits to 1 (all bytes to 0xFF).
Flashwrite can change 1s to 0s.

(11-17-2018, 04:10 AM)Loïc Wrote: The smallest amount of data that can be written is 256bytes (ld brc3,1)

I forgot about that, so my discussion of 12-bytes of savegame doesn't fit quite so well.

This is true, but it's only a limitation of the BIOS call, if I remember right. You can write your own function to do it, but it's a bit complex. The main problem is that the code can not run from flash memory while you are erasing/programming flash memory. Code running from BIOS can do it. Code running from RAM can do it. So, if you want your own erase/flash code, you need to copy the code to RAM and then execute the function from RAM.

Also, I think my discussion of the idea of the signature could be confusing.

If I were to use the BIOS call, then, maybe I would just make every bit of savegame data 0x100 (256) bytes long even if you only needed 10 bytes of savegame data for your game. Then maybe I'd just use 0x00 for a signature.

SAVE would look something like this.
- saveslot=0
- Read from SAVEOFFSET+(saveslot x 0x100)
--If it is 0, saveslot++
--else, write to SAVEOFFSET+(saveslot x 0x100) [include 0x00 at start of array]

RESTORE SAVE would look like
- saveslot=0
- Read from SAVEOFFSET+(saveslot x 0x100)
--If it is 0, read data from SAVEOFFSET+(saveslot x 0x100) into array
--else, return array

I'll try to find my ASM code that erases and writes flash mem. I have it somewhere.
Card Fighters' Clash 2 English Translation ( )
Neo Geo Pocket Flash Cart and Linker Project ( )
Avatar art thanks to Trev-Mun ( )

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, 07:27 AM

Forum Jump:

Users browsing this thread: 1 Guest(s)