Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Accessing to the save/load game data
#12
If I get it correctly,
the bios flashwrite can only turn 0 to 1 but it should to write starting from the offset address.
The smallest amount of data that can be written is 256bytes (ld brc3,1)

If my savegame is only 1 byte, and I decide that I'll use a full byte to locate where I need to save (let's say 9 saving possibility)

if my signature byte is 0xFF, I call the erase function, and I write 0x00 (signature) 0x??(data) the remaining bytes filled with 0x00
if my signature byte is 0x00, I write 0x01 (signature) 0x00(no data) 0x??(data), the remaining bytes filled with 0x00
if my signature byte is 0x01, I write 0x02 (signature) 0x00 0x00(no data) 0x??(data), the remaining bytes filled with 0x00
if my signature byte is 0x03, I write 0x04 (signature) 0x00 0x00 0x00(no data) 0x??(data), the remaining bytes filled with 0x00
and so on...

So I need to build a ram array of 256bytes (in this case, only 10 bytes relevant) with the first one containing the save position bit and then the data byte placed according it's position...

or use 2 write, one for the control byte/signature, a second for data, but with a different starting offset, keeping in mind that at least 256 bytes are written.
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 Loïc - 11-17-2018, 04:10 AM

Forum Jump:


Users browsing this thread: 1 Guest(s)