CARD

From NeoGeo Development Wiki
Revision as of 03:49, 21 October 2012 by ElBarto (talk | contribs) (→‎Variables)
Jump to navigation Jump to search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

CARD ($C00468)

The CARD routine is used to perform action on the memory card.

Warning: register contents aren't preserved !

Variables

The following variables are used when using the CARD routine :

Address DEF name Size Set by Description
$10FDC4 BIOS_CARD_COMMAND byte BIOS or Game Command to execute,
$10FDC6 BIOS_CARD_ANSWER byte BIOS Answer code for the command
$10FDC8 BIOS_CARD_START longword BIOS or Game Pointer to data
$10FDCC BIOS_CARD_SIZE word BIOS or Game Size of data
$10FDCE BIOS_CARD_FCB word BIOS or Game Game NGH number
$10FDD0 BIOS_CARD_SUB byte or word BIOS or Game Game Subnumber

The following temporary variable are used when calling CARD :

Address DEF name Size Description
$10FD04 BIOS_CARD_DIRECTORY_START long word Start of Directory
$10FD08 BIOS_CARD_BLOCK_NUMBER word Number of blocks
$10FD0A BIOS_CARD_FAT_START long word Start of FAT
$10FD0E BIOS_CARD_FAT_SIZE word Size of FAT
$10FD10 BIOS_CARD_DATA_START long word Start of Data
$10FD14 BIOS_CARD_TYPE word $0 : 8 bits wide card

$01 : 16 bits wide card

$80 : 16 bits wide weird card (more to come on them)

$10FD16 BIOS_CARD_SIZE word Size of the card

BIOS_CARD_ANSWER

This variable contain the result of the operation.

$00: Normal completion

$80: No card inserted

$81: Card isn't formated

$82: Data doesn't exist

$83: FAT error

$84: Memory card is full

$85: Write disable or ROM card

Commands

$0 - Format memory card

Format the memory card.

$1 - Data Search

Find the number of save files for the specified game.

Inputs :

BIOS_CARD_FCB must contain the NGH number of the game to search.

Outputs :

BIOS_CARD_SUB contain a 16 bits mask for all 16 available blocks for the game. If bit n is set to 1, then the n save exist for this game.

$2 - Data load

Load the specified save file in RAM.

Inputs:

BIOS_CARD_FCB must contain the game NGH number.

BIOS_CARD_SUB must contain the game save number (16 max per game).

BIOS_CARD_START must contain an address where the save will be loaded.

BIOS_CARD_SIZE must contain the size of the save (normally 64 bytes).

$3 - Data save

Save from RAM to the specified save file.

Inputs:

BIOS_CARD_FCB must contain the game NGH number.

BIOS_CARD_SUB must contain the game save number (16 max per game).

BIOS_CARD_START must contain an address from where the save will be saved.

BIOS_CARD_SIZE must contain the size of the save (normally 64 bytes).

$4 - Data delete

Delete the specified file.

Inputs:

BIOS_CARD_FCB must contain the game NGH number.

BIOS_CARD_SUB must contain the game save number (16 max per game).

$5 - Read Data title

Read the Data Title of the BIOS_CARD_SIZE save file.

Inputs:

BIOS_CARD_START must contain an address to put the Data Title

BIOS_CARD_SIZE contain the save file to read from.

$6 - User name save

Set the user name of the memory card.

Inputs:

BIOS_CARD_START address to the username (max 16 bytes).

$7 - User name load

Load the user name of the memory card.

Inputs:

BIOS_CARD_START address where to put the data.

CARD_ERROR ($C0046E)

The CARD_ERROR routine can handle automatically some errors depending on the command and the error code.

Most of the time it will display a message on screen (using MESS_OUT) but the routine can also automatically format the memory card if it's needed. (On AES, a user confirmation is asked before formating, on MVS it is done automatically).

List of command/error combination that CARD_ERROR handle (based on the sp-s2 bios) :

Command Error Result
$2 (Data load) $81 (card not formated) Display "NO DATA FOR THIS GAME."
$2 (Data load) $83 (FAT error) Display "ERROR ON MEMORY CARD."
$2 (Data load) $85 (Write disable) Display "NO DATA FOR THIS GAME."
$3 (Data save) $81 (card not formated) Format the card
$3 (Data save) $83 (FAT error) Format the card
$3 (Data save) $84 (Card is full) Bring up a menu to delete some saves
$3 (Data save) $85 (Write protected) Display "MEMORY CARD WRITE PROTECTED."
$4 (Data delete) $85 (Write protected) Display "MEMORY CARD WRITE PROTECTED."
$6 (Username save) $81 (card nor formated) Format the card
$6 (Username save) $85 (Write protected) Display "MEMORY CARD WRITE PROTECTED."
$7 (Username load) $81 (card nor formated) Display "NO DATA FOR THIS GAME."
$7 (Username load) $85 (Write protected) Display "NO DATA FOR THIS GAME."