Memory card: Difference between revisions

From NeoGeo Development Wiki
Jump to navigation Jump to search
 
(15 intermediate revisions by 4 users not shown)
Line 1: Line 1:
JEIDA V3 memory cards used in AES and some [[MVS hardware|MVS systems]] to store game saves and/or high scores. The original SNK card could only hold 2KiB of data. The Neogeo can use up to 8MiB (24 address lines but A23 never used) ?
[[File:snkmemcard.jpg|thumb|SRAM memory card, showing the SRAM chip and voltage detection circuit. Picture by [[User:HPMAN|HPMAN]]]]


[[File:snkmemcard.jpg|thumb|Picture by [[User:HPMAN|HPMAN]]]]
[[File:NEO-IC8_front.jpg|thumb|NEO-IC8, original SNK card. Picture by [[User:ArcadeTV|ArcadeTV]]]]
[[File:NEO-IC8_back.jpg|thumb|NEO-IC8, back of original SNK card. Picture by [[User:ArcadeTV|ArcadeTV]]]]


The official SNK memory card was a battery-based 2KiB card using a LH5116 CMOS SRAM chip and voltage switching circuitry. Data retention voltage: 2V.
The NeoGeo home console and some [[MVS hardware|MVS]] cabs can use [[JEIDA V3]] memory cards to store game saves and/or high scores, allowing players to save their progress and continue on any system running the same game.


The SP-S2 [[BIOS]] can only handle 8bit memory cards up to 16KiB ? (bank checking while format up to $8000/2).
Even if the memory card [[68k memory map|address space]] can be freely used, games should only perform memory card operations through the [[CARD]] system ROM call to avoid data corruption.
Seems the file checking can only go up to 256 so 16 files * 16 games * 64 bytes = 16KiB too.


Replaced by a 8KiB fixed battery-backed RAM chip in the [[CD systems]].
=Supported card types=


See the [[CARD]] BIOS call description for memory card operations.
The SP-S2 [[system ROM]] (and probably all the others) can handle 8 memory card sizes from 2KiB up to 16KiB, in 2KiB steps:
*2KiB
*4KiB
*6KiB
*8KiB
*10KiB
*14KiB
*16KiB


[[http://www.neogeoprotos.com/memcardfaq.htm (from neogeoprotos.com)]]
And 4 different card types:
*8 bits wide
*16 bits wide
*16 bits wide "doubled"
*"SNK ROM" cards


[[http://www.raregame.ru/file/15/NEO-GEO_Memcard_Data_Format.GIF Data format (from Raregame.ru)]]
For 8-bit cards (all official SNK cards ?) only the lower byte is used, but accesses must '''always''' be done in words. This is because memory card accesses are only enabled for word or upper byte operations (/UDS 68k signal).
 
=Original SNK card=
 
The original SNK-branded memory card was a [[:File:CR2016_battery.jpg|battery-backed]] 8-bit wide 2KiB card using a [[LH5116|LH5116 SRAM chip]] and voltage switching circuitry.
 
Since it uses a battery, it may be prone to data loss if the voltage drops below 2V. Unlike the MVS [[backup RAM]] battery, the memory card one isn't rechargeable.
 
There are at least 2 known versions of the original SNK Memory Card, each with its individual design and circuit-board:<br>
[[Image:NEO-IC8_versions.png|640px]]
 
The first version has the [[C10075-X2-2]] while the later one hase the [[EZ866]] board.
 
=CD systems=
 
A "virtual" memory card is embedded in [[CD systems]] as a 8KiB battery-backed SRAM chip.


=Data format=
=Data format=


BIOS can handle 8 different card size (2K, 4K, 6K, 8K, 10K, 14K and 16K) and different card type (8 bits wide, 16 bits wide, 16 bits doubled wide and SNK ROM card).
All cards use the same format regardless of capacity, only regions sizes differ. Since the JEIDA data bus is 16-bits wide, make sure to double the address for 8-bit cards if you choose to access their memory directly.


All the data here are for all the card, it's just a matter on how to read the data between different type of card.
The data is referred to as "blocks", one block being 64 bytes. The header always occupies the first block. Eg. A 2KiB card can hold (2048/64)-1 = 31 blocks.


The internal card data are splitted into 5 regions.
The data is split into 5 regions:


==Header==
==Header==


Always $80 bytes.
Always 64 bytes.


{| class="regdef"
{|class="wikitable"
| '''Address'''
| '''Address'''
| '''Name'''
| '''Name'''
Line 37: Line 63:
|
|
|10 bytes
|10 bytes
|Zero or "SNK ROM " (Development unit I think)
|Zeros or "SNK ROM " (development unit ?)


For 16bits doubled card, $6 is set to $0001
For 16 bits "doubled" cards, $6 is set to $0001
|-
|-
|$A
|$A
|CARD_SIZE
|CARD_SIZE
|word
|word
|Size of the memcard
|Address space used by the memory card. Eg. A 2KiB 8-bit card is $1000.
|-
|-
|$C
|$C
Line 54: Line 80:
|CARD_FAT_1_CHKSUM
|CARD_FAT_1_CHKSUM
|byte
|byte
|Checksum of the FAT 1
|Checksum of FAT 1
|-
|-
|$E
|$E
|CARD_FAT_2_CHKSUM
|CARD_FAT_2_CHKSUM
|byte
|byte
|Checksum of the FAT 2
|Checksum of FAT 2
|-
|-
|$F
|$F
|CARD_USERNAME_AVAILABLE
|CARD_USERNAME_AVAILABLE
|byte
|byte
|0 : Username available, !0 : Username unavailable
|0 : Username unavailable, !0 : Username available
|-
|-
|$10
|$10
|CARD_USERNAME
|CARD_USERNAME
|16 bytes
|16 bytes
|Card holder username
|Card holder's username
|-
|-
|$20
|$20
|CARD_MAGIC
|CARD_MAGIC
|16 bytes
|16 bytes
|$4e $XX $45 $XX $4f $XX $2d $XX $47 $XX $45 $XX $4f $XX 80 $XX "NEO-GEO" + $80
|$4E $XX $45 $XX $4F $XX $2D $XX $47 $XX $45 $XX $4F $XX $80 $XX ("NEO-GEO", $80)
|-
|-
|$30
|$30
|CARD_REGION
|CARD_REGION
|byte
|byte
|Region of slot that formated the card, 0 = Japan, 1 = USA, 2 = Europe
|Region of the system that formated the card, 0 = Japan, 1 = USA, 2 = Europe
|}
|}


==Directory==
==Directory==


List of saves. Size depends on card size, it can hold 32, 64, 96, 128, 160, 192, 224 or 256 entries.
List of saves of 32, 64, 96, 128, 160, 192, 224 or 256 entries. The size depends on the card's capacity.


Each entry have this format :
Note that since the header occupies the first block, there will always be at least one unused directory entry.
 
Each entry is 4 bytes, with the following format:


{| class="regdef"
{| class="regdef"
Line 95: Line 123:
|$0
|$0
|byte
|byte
|Game Sub number (CARD_SUB), 0 to 15. $FF if entry is free
|Save sub-number (CARD_SUB), 0 to 15. $FF if entry is free.
|-
|-
|$1
|$1
|word
|word
|Game NGH number
|Game's [[NGH number]]
|-
|-
|$3
|$3
|byte
|byte
|FAT entry number (see below)
|FAT entry index (see below)
|}
|}


==FAT 1==
==FAT 1==


List of used blocks. Size depends on card size, it can hold 64, 128 192 or 256 entries.
List of used blocks of 64, 128, 192, or 256 entries. The size depends on the card's capacity.
$02 is a BIOS reserved block
* $02 is a block reserved by the system ROM
$01 is a game used block
* $01 is a block used by a game
$00 is a free block
* $00 is a free block


==FAT 2==
==FAT 2==


FAT 2 is simply a mirror of FAT 1.
FAT 2 is simply a mirror of FAT 1.
If any of the FAT tables checksum is bad, the correct table is written over the other one. If both checksums are bad, the system ROM displays an error.


==Game Data==
==Game Data==


Normally 64 bytes but maybe some games use more that one block ?
Many games use only one block, but some may use more.


The first 20 bytes are the data title (generally the game name + the stage name).
The first 20 bytes contain the data title (usually the game and stage name).


=Card pinout=
=Registers=


[[File:Lh5116_pinout.png|right|frame|LH5116 pinout]]
* Write is enabled if {{Reg|REG_CRDUNLOCK1}} and {{Reg|REG_CRDUNLOCK2}} are written to
* The WP (Write Protect) pin is read through bit 6 of {{Reg|REG_STATUS_B}}
* CD1 (Card Detect 1) is read through bit 4 of {{Reg|REG_STATUS_B}}
* CD2 (Card Detect 2) is read through bit 5 of {{Reg|REG_STATUS_B}}
** Both must be 0 if the card is inserted correctly
* Attribute memory is selected if {{Reg|REG_CRDREGSEL}} is written to, never used ?


{|class="wikitable"
=Pinout=
|Pin||Goes to||Signal name||PC Card name
|-
|1||colspan="3"|GND
|-
|2||9 G0||MCD3||D3
|-
|3||11 G0||MCD4||D4
|-
|4||12 G0||MCD5||D5
|-
|5||13 G0||MCD6||D6
|-
|6||14 G0||MCD7||D7
|-
|7||42, 27 C1||CRDC||/CE1
|-
|8||23 E0||Y10||A10
|-
|9||30 C1||CRDO||/OE
|-
|10||24 E0||Y11||A11
|-
|11||22 E0||Y9||A9
|-
|12||14 E0||Y8||A8
|-
|13||28 E0||Y13||A13
|-
|14||29 E0||Y14||A14
|-
|15||6 HC32||(31 C1 (CRDW) OR {{Reg|REG_CRDUNLOCK1}} OR /{{Reg|REG_CRDUNLOCK2}})||/WE
|-
|16||colspan="2"|NC||READY
|-
|17||colspan="3"|VCC
|-
|18||colspan="3"|VCC
|-
|19||39 E0||Y16||A16
|-
|20||30 E0||Y15||A15
|-
|21||27 E0||Y12||A12
|-
|22||13 E0||Y7||A7
|-
|23||12 E0||Y6||A6
|-
|24||11 E0||Y5||A5
|-
|25||9 E0||Y4||A4
|-
|26||8 E0||Y3||A3
|-
|27||7 E0||Y2||A2
|-
|28||6 E0||Y1||A1
|-
|29||5 E0||Y0||A0
|-
|30||6 G0||MCD0||D0
|-
|31||7 G0||MCD1||D1
|-
|32||8 G0||MCD2||D2
|-
|33||88 C1||IN26 ({{Reg|REG_STATUS_B}} bit 6)||WP (Write Protect)
|-
|34||colspan="3"|GND
|}


{|class="wikitable"
See [[Memory card pinout]].
|Pin||Goes to||Signal name||PC Card name
|-
|35||colspan="3"|GND
|-
|36||73 C1||IN24 ({{Reg|REG_STATUS_B}} bit 4)||/CD1 (Card Detect 1)
|-
|37||30 G0||MCD11||D11
|-
|38||43 G0||MCD12||D12
|-
|39||44 G0||MCD13||D13
|-
|40||45 G0||MCD14||D14
|-
|41||46 G0||MCD15||D15
|-
|42||7|| ||/CE2
|-
|43||colspan="2"|NC||/VS1
|-
|44||colspan="2"|NC||/IORD
|-
|45||colspan="2"|NC||/IOWR
|-
|46||40 E0||Y17||A17
|-
|47||41 E0||Y18||A18
|-
|48||43 E0||Y19||A19
|-
|49||44 E0||Y20||A20
|-
|50||45 E0||Y21||A21
|-
|51||colspan="3"|VCC
|-
|52||colspan="3"|VCC
|-
|53||46 E0||Y22||A22
|-
|54||47 E0||Y23||A23
|-
|55||colspan="2"|NC||A24
|-
|56||colspan="2"|NC||A25
|-
|57||colspan="2"|NC||/VS2
|-
|58||colspan="2"|NC||RESET
|-
|59||colspan="2"|NC||/WAIT
|-
|60||colspan="2"|NC||Reserved
|-
|61||8 HC32||({{Reg|REG_CRDREGSEL}} OR CRDO)||/REG
|-
|62||colspan="2"|NC||BVD2
|-
|63||colspan="2"|NC||BVD1
|-
|64||27 G0||MCD8||D8
|-
|65||28 G0||MCD9||D9
|-
|66||29 G0||MCD10||D10
|-
|67||87 C1||IN25 ({{Reg|REG_STATUS_B}} bit 5)||/CD2 (Card Detect 2)
|-
|68||colspan="3"|GND
|}


[[Category:Cartridge systems]]
[[Category:Cartridge systems]]

Latest revision as of 01:25, 17 January 2023

SRAM memory card, showing the SRAM chip and voltage detection circuit. Picture by HPMAN
NEO-IC8, original SNK card. Picture by ArcadeTV
NEO-IC8, back of original SNK card. Picture by ArcadeTV

The NeoGeo home console and some MVS cabs can use JEIDA V3 memory cards to store game saves and/or high scores, allowing players to save their progress and continue on any system running the same game.

Even if the memory card address space can be freely used, games should only perform memory card operations through the CARD system ROM call to avoid data corruption.

Supported card types

The SP-S2 system ROM (and probably all the others) can handle 8 memory card sizes from 2KiB up to 16KiB, in 2KiB steps:

  • 2KiB
  • 4KiB
  • 6KiB
  • 8KiB
  • 10KiB
  • 14KiB
  • 16KiB

And 4 different card types:

  • 8 bits wide
  • 16 bits wide
  • 16 bits wide "doubled"
  • "SNK ROM" cards

For 8-bit cards (all official SNK cards ?) only the lower byte is used, but accesses must always be done in words. This is because memory card accesses are only enabled for word or upper byte operations (/UDS 68k signal).

Original SNK card

The original SNK-branded memory card was a battery-backed 8-bit wide 2KiB card using a LH5116 SRAM chip and voltage switching circuitry.

Since it uses a battery, it may be prone to data loss if the voltage drops below 2V. Unlike the MVS backup RAM battery, the memory card one isn't rechargeable.

There are at least 2 known versions of the original SNK Memory Card, each with its individual design and circuit-board:

The first version has the C10075-X2-2 while the later one hase the EZ866 board.

CD systems

A "virtual" memory card is embedded in CD systems as a 8KiB battery-backed SRAM chip.

Data format

All cards use the same format regardless of capacity, only regions sizes differ. Since the JEIDA data bus is 16-bits wide, make sure to double the address for 8-bit cards if you choose to access their memory directly.

The data is referred to as "blocks", one block being 64 bytes. The header always occupies the first block. Eg. A 2KiB card can hold (2048/64)-1 = 31 blocks.

The data is split into 5 regions:

Header

Always 64 bytes.

Address Name Size Description
$0~$9 10 bytes Zeros or "SNK ROM " (development unit ?)

For 16 bits "doubled" cards, $6 is set to $0001

$A CARD_SIZE word Address space used by the memory card. Eg. A 2KiB 8-bit card is $1000.
$C byte 0
$D CARD_FAT_1_CHKSUM byte Checksum of FAT 1
$E CARD_FAT_2_CHKSUM byte Checksum of FAT 2
$F CARD_USERNAME_AVAILABLE byte 0 : Username unavailable, !0 : Username available
$10 CARD_USERNAME 16 bytes Card holder's username
$20 CARD_MAGIC 16 bytes $4E $XX $45 $XX $4F $XX $2D $XX $47 $XX $45 $XX $4F $XX $80 $XX ("NEO-GEO", $80)
$30 CARD_REGION byte Region of the system that formated the card, 0 = Japan, 1 = USA, 2 = Europe

Directory

List of saves of 32, 64, 96, 128, 160, 192, 224 or 256 entries. The size depends on the card's capacity.

Note that since the header occupies the first block, there will always be at least one unused directory entry.

Each entry is 4 bytes, with the following format:

Address Size Description
$0 byte Save sub-number (CARD_SUB), 0 to 15. $FF if entry is free.
$1 word Game's NGH number
$3 byte FAT entry index (see below)

FAT 1

List of used blocks of 64, 128, 192, or 256 entries. The size depends on the card's capacity.

  • $02 is a block reserved by the system ROM
  • $01 is a block used by a game
  • $00 is a free block

FAT 2

FAT 2 is simply a mirror of FAT 1.

If any of the FAT tables checksum is bad, the correct table is written over the other one. If both checksums are bad, the system ROM displays an error.

Game Data

Many games use only one block, but some may use more.

The first 20 bytes contain the data title (usually the game and stage name).

Registers

Pinout

See Memory card pinout.