CARD: Difference between revisions

From NeoGeo Development Wiki
Jump to navigation Jump to search
mNo edit summary
m (moved BIOSF CRDACCESS to CARD: rename page according to official SNK doc)
(No difference)

Revision as of 13:58, 26 June 2011

BIOSF_CRDACCESS ($C00468): Perform memory card operation

Warning: register contents aren't preserved !

(Informations provided by User:Smkdan)

Memory locations used:

BIOS_CRDF       (8bit): function to perform when calling BIOSF_CRDACCESS, see below table
BIOS_CRDRESULT  (8bit): 00 on success, else 80+ and encodes the error, see below table
BIOS_CRDPTR     (32bit): pointer to read from/write to
BIOS_CRDSIZE    (16bit): how much data to read/write from/to card
BIOS_CRDNGH     (16bit): usually game [[NGH]].  Unique identifier for the game that 'owns' the save file
BIOS_CRDFILE    (16bit): each NGH has up to 16 save 'files' associated with

To access memory card, the RAM addresses above must be set depending on the function being attempted BIOS_CRDF values:

$00 (Format)
No extra parameters
$01 (Find)
In: BIOS_CRDNGH: NGH to find save files for
Out: BIOS_CRDFILE: 16bit mask containing 1 bits for each one of the 16 save files if present.
0 bits mean the save file is not present. i.e. FFFF = all 16 saves used, 8000 = only save file 15 is used
$02 (Load)
In:
CRDPTR: pointer to store loaded data to
CRDSIZE: the max size of data to load (automatically stops when entire file is loaded)
CRDNGH: NGH of file
CRDFILE: the file # of the given NGH to load from
$03 (Save)
In:
CRDPTR: pointer to read data to store to the card
CRDSIZE: size of data to save
CRDNGH: NGH of file
CRDFILE: the file # of the given NGH to save as
$04 (Delete)
In:
CRDNGH: NGH of file
CRDFILE: the file # of the given NGH to delete
$05 (GETNAME)
Gets name of a save file, forgot how these work...
$06 (SETUSER) (the username of the card)
$07 (GETUSER)


Error handling

Errors may occur and the BIOS will store a value in BIOS_CRDRESULT depending on what went wrong:

Bit 7 6 5 4 3 2 1 0
Def Error occured 0Error code

Error codes:

  • 0: no card inserted
  • 1: card inserted, but not formatted
  • 2: attempted to load a file that doesn't exist on the card
  • 3: checksum error?
  • 4: attempted to save to a full card
  • 5: card write protect switch is active