Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Accessing to the save/load game data
(11-14-2018, 11:38 PM)KeiDash Wrote: Hi everyone,

I'm triying to develop a game for ngpc with the framework 4 and at the moment works fine. I think that it would be good save/load data of the game for give it the possibility of save data and continue in other moment in the same point, somethink like any Memory Card.

I', not find methods in the framework to store or retrive data from this memory address and Chris say to me "maybe Flavor or Loic know something about that"

So, anyone can hel me?


Hi K',
The reading part is the easiest, as it's a direct acces to memory offset where the data are saved.
The writting part is a little trickiest.
If you want to be able to run your program on bung or flashmasta, you need to consider that your game will be 16/32mbits.

The process of data saving requires the use of bios call.
You first need to call an erase function. This function is based on the memory bloc number you want to erase.
The next part is to call the bios write function.

As I've never used C on Neogeo Pocket, I can only give you the assembly way of doing this operation.

You can find some informations in this thread :

here's the way to clear a bloc :

using this definitions :
; rWDCR            equ     6fh      ; Watch Dog Control Register
; WD_CLR            equ     4eh     ;  Value required to be written to rWDT
; VECT_FLASHERS    equ     8        ; Flash memory - erase specified blocks
; VECT_FLASHWRITE    equ     6        ; Flash memory - data write
ld    ra3,0                    : load 0 to ra3 register
ld    rb3,0x21                : load rb3 with the required bloc number (0x21 here)
ld    rw3, VECT_FLASHERS    : load rw3 with the bios bloc erase function number
ld    (rWDCR),WD_CLR        : required so the unit won't shut down
swi    1                    : call bios function

for the wirting part :

ld    ra3,0                            ; load ra3 register with 0
ld    rbc3,1                        ; 1x256 bytes

ld    xhl3, <ram_writing data address>    ; data to write
ld    xde3, 1FA000h                    ; SAVEOFFSET
ld    rw3,VECT_FLASHWRITE            ; load rw3 with the bios write function number
ld    (rWDCR),WD_CLR
swi    1


You only need to read data starting from 0200000h+SAVEOFFSET (ie 3FA000h)
;To read data : acces memory at 0200000h+SAVEOFFSET
ld     bc, 01
ld    xhl, 3FA000h            ; offset where the data are stored
ld    xde, <ram_destination>    ;
ldirw    (xde+),(xhl+)            ;


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-14-2018, 11:58 PM

Forum Jump:

Users browsing this thread: 1 Guest(s)