Format:CD-ROM XA
| Platforms | Platform:PlayStation |
|---|---|
| Endianness | mixed |
| On this wiki | Facts · Code · Notes · Topics |
The sector layer under PlayStation discs: 2352-byte raw sectors (12-byte sync, BCD minute/second/frame and mode, then Mode 2 Form 1 with 2048 data bytes or Form 2 with 2324) with a doubled 4-byte subheader (file, channel, submode, coding info) that tells data, video and XA-ADPCM audio sectors apart.
Overview
A PlayStation disc is a CD-ROM XA disc: its data track holds Mode 2 sectors, usually read as 2048 user bytes through the drive's cooked mode, but stored as 2352 raw bytes per sector in BIN images (see Format:CUE and BIN). The file system on top is Format:ISO 9660. Streaming files (STR video, XA audio) are Form 2 sectors of 2324 bytes without error correction.
Raw sector (2352 = 0x930 bytes)
| Offset | Size | Meaning |
|---|---|---|
| 0x000 | 12 | sync: 00 FF FF FF FF FF FF FF FF FF FF 00 |
| 0x00C | 4 | header: minute, second, sector (BCD, absolute time with the 2 second lead-in, so LBA = (mm*60+ss)*75+ff - 150) and mode (02 on PlayStation data) |
| 0x010 | 4 | subheader: file, channel, submode, coding info |
| 0x014 | 4 | copy of the subheader |
| 0x018 | 0x800 | Form 1 data; then 4 bytes EDC, 276 bytes ECC (0x818-0x92F) |
| 0x018 | 0x914 | Form 2 data (2324 bytes); then 4 bytes EDC, or zero (0x92C-0x92F) |
Mode 1 sectors (mode byte 01) have no subheader: data at 0x010 for 0x800 bytes, EDC at 0x810, 8 zero bytes, ECC at 0x81C. An audio sector (CD-DA) has no sync at all: 2352 bytes of 16-bit stereo samples.
Subheader
Plain data sectors usually carry 00 00 08 00 (some 09 = end of something).
- File number: any byte value (PlayStation discs do not restrict it); it must match the file number in the ISO directory record's XA field.
- Channel: bits 0-4 channel 0-31, bits 5-7 should be zero (some games use FF for gaps).
- Submode bits: 0 end of record, 1 video, 2 audio, 3 data, 4 trigger, 5 form (0 = Form 1, 1 = Form 2), 6 real time, 7 end of file. PlayStation .STR files are flagged data, not video.
- Coding info for XA-ADPCM sectors: bits 0-1 mono(0)/stereo(1), bit 2 sample rate (0 = 37800 Hz, 1 = 18900 Hz), bits 4-5 bits per sample (0 = 4 bit, 1 = 8 bit), bit 6 emphasis. Data sectors: 0.
When reading a damaged image, the doubled subheader lets a reader repair a bad byte from its copy.
XA-ADPCM audio sectors
Each Form 2 audio sector holds 18 blocks of 128 bytes (0x900 bytes; the last 20 bytes of the 2324 are zero). A block has a 16-byte header made of the 4 shift/filter bytes twice (04h-07h copied at 00h-03h, 08h-0Bh copied at 0Ch-0Fh) followed by 28 little-endian 32-bit data words whose nibbles belong to 8 sub-blocks (4 stereo pairs). Header byte: bits 0-3 shift, bits 4-5 filter (four filters; the SPU has five). This is the same algorithm as Format:SPU-ADPCM (PlayStation) with a different nibble order and 28 samples per sub-block; the CD controller decodes it, no voice is used. Interleaving of several files and channels (selected by file and channel number) is how games stream audio alongside video.
System area
Sectors 0-15 of the disc are the system area. On a PlayStation disc sector 4 holds the licence text (" Licensed by " followed by the Sony Computer Entertainment Inc./America/Europe line) and sectors 5-11 the 0x3278-byte logo (a TMD model) that the boot ROM shows. Some BIOS versions compare the logo with a copy in ROM; the region behaviour is described in psx-spx. This page does not describe how to defeat that check.
Code & repositories
- https://github.com/stenzek/duckstation @
8a5b99b8b3ec82712292fea6355438eed85dd79e· license: CC-BY-NC-ND-4.0 (declared by the contributor; GitHub's detector did not recognize LICENSE)
PS1 emulator: src/core/mdec.cpp (command word, RLE decoding, zigzag) and src/core/cdrom.cpp (XA subheader, XA-ADPCM sectors). Check the repository licence before reusing code. PS1 emulator (licence CC BY-NC-ND 4.0, so read for facts only, do not copy code): src/core/mdec.cpp (command word, RLE decoding, zigzag) and src/core/cdrom.cpp (XA subheader, XA-ADPCM sectors).
Tested on: source read, not run: source read, not run or built · checked 2026-10-19; last activity 2026-10-18; Note: the latest release ships binaries; the wiki links only the source, never the binaries
Evidence & references
- psx-spx, "CDROM Sector Encoding", "CDROM XA Subheader, File, Channel, Interleave", "CDROM XA Audio ADPCM Compression" (docs/cdromformat.md in the psx-spx mirror).
- jPSXdec, jpsxdec/src/jpsxdec/cdreaders/CdSectorHeader.java and CdSectorXaSubHeader.java (same sync, BCD address and submode bit masks). Its licence is non-commercial, so only the facts are cited.