psx.wiki

FAT (Memory Card File System)

File system of the Memory Card and the PDA.

FAT (Memory Card File System)
Capacity1 Mbit (128 KB)
Block size8 KB
Sector size128 bytes

This is an old revision of this page, as edited by RemmyLee at 02:46, 23 October 2026. Edit this revision | Latest revision

Overview

A Memory Card holds 1 Mbit (128 KB) of flash memory. The memory is organized in blocks of 8 KB.1

The Memory Card is managed with its own file system. Sony calls it the FAT. PDA application data is also managed in the blocks.1

Writes to flash memory are made in 128-byte units known as sectors. Each block has 64 sectors.1

Block Layout

The blocks of a Memory Card are as follows:1

Table 1: Layout of Memory Card blocks
Block No. Contents
0 FAT block
1 Data block 1
2..14 Data blocks 2 to 14
15 Data block 15

FAT Block

The sectors of the FAT block are as follows:1

Table 2: FAT block memory map
Sector No. Contents
0 Format ID sector
1..15 Block information sectors 1 to 15
16..35 Alternate information sectors 1 to 20
36..55 Alternate sectors 1 to 20
56..62 Reserved sectors 1 to 7
63 Dummy write sector

Format ID Sector

The first 2 bytes of the format ID are 'M' and 'C'. The remaining bytes are 0 up to the checksum in the 128th byte.2

A card whose first 2 bytes are 'MC' is a formatted Memory Card. Any other card is unformatted.2

Block Information Sector

Each data block has one block information sector:2

Table 3: Structure of block information sector
Contents Data type Size (bytes)
Block list information unsigned long 4
File size long 4
Next block unsigned short 2
Filename char x 21 21
Reserved unsigned char 1
Unused 94
PDA application unsigned char 1
Checksum unsigned char 1

The block list information gives the state of the block:2

Table 4: Meaning of block list information
Value Contents
51 Header block
52 Intermediate block
53 End block
A0 Free block
A1 Header block with delete mark
A2 Intermediate block with delete mark
A3 End block with delete mark

Formatting sets every block list information field to A0. A new file gets the values 51 to 53.2

A deleted file keeps its blocks with the values A1 to A3. Restoring the original values restores the file.2

A new file can break the chain from header block to end block.2

The next FAT read then sets every block of the broken chain to A0.2

A 1-block file has only the value 51 (or A1). A 2-block file has 51 and 53 (or A1 and A3) and no 52.2

Block Information Fields

File size is in bytes. It equals 8192 bytes times the number of blocks given when the file is created.3

Next block points to the next block of a file.3

The pointer is 1 less than the block number. Blocks 1 to 15 are stored as 0 to 14.3

Next block is 0xFFFF when there is no next block.3

Filename holds the file name. The string ends with a NULL (0x00).3

McxExecFlag() sets the PDA application flag to 1 for a PDA application. Otherwise the flag is clear.3

libcard and libmcrd do not copy the PDA application flag. A PDA application copied from the PlayStation has the flag set to 0.3

The checksum is the XOR of the first 127 bytes of the sector.3

Alternate Sectors

An alternate information sector holds a substituted sector number and a checksum.3

The alternate sector replaces the sector named in its alternate information sector.3

If alternate information sector 3 holds 123, reads and writes of sector 123 go to alternate sector 3.3

The dummy write sector takes dummy writes that clear unidentified flags.3

FAT Operation

The format operation writes the following values (hex):3

Table 5: State of formatted FAT
Target sector 0 1 2 3 4..7 8 9 10..126 127
0 4D 43 00 00 00 00 00 00 sum
1..15 A0 00 00 00 00 FF FF 00 sum
16..35 FF FF FF FF 00 FF FF 00 sum

The sum in byte 127 is the XOR of bytes 0 to 126.4

Sectors from alternate sector 1 to the dummy write sector need no initial value.5

Delete changes the high 4 bits of the first byte of each block information sector of the file from 5 to A.4

Undelete changes the same bits from A back to 5. Delete and undelete leave all other data unchanged except the checksum.4

PDA Processing

A write to the FAT sector of a block that holds a running PDA application is refused with an error.4

The library takes this state to mean that the Memory Card was swapped.4

The libmcx command "display while transferring file" disables writes to sectors 16 to 55. A write to them gives an error.4

References


  1. ^ a b c d e Sony Computer Entertainment Inc. File Formats. November 1998. Page 5-3, Tables 5-1 and 5-2.

  2. ^ a b c d e f g h i Sony Computer Entertainment Inc. File Formats. November 1998. Page 5-4, Tables 5-3 and 5-4.

  3. ^ a b c d e f g h i j k l m Sony Computer Entertainment Inc. File Formats. November 1998. Page 5-5, Table 5-5.

  4. ^ a b c d e f Sony Computer Entertainment Inc. File Formats. November 1998. Page 5-6.

  5. ^ Sony Computer Entertainment Inc. File Formats. November 1998. Page 5-7.

Categories: File formats