psx.wiki
Log in
Main page
Hardware
Hardware tests
System software
SDKs
File formats
Games
Tools
History
All pages
page
view source
history
View source for CD-ROM Disc Format
← CD-ROM Disc Format
You do not have permission to edit this page.
Log in
to edit.
--- title: CD-ROM Disc Format type: format summary: Sector modes, subchannel Q, addressing and the ISO 9660 file system of PlayStation discs. category: Hardware category: File formats --- ## Overview Digital data is recorded on a CD-ROM in a spiral, the same as on a CD audio disc, and is divided into units called sectors. One second of data is 75 sectors, and a sector is an audio sector, an ADPCM sector or a data sector according to its use.[^ovr113] An audio sector holds 44.1 kHz digital stereo audio and can only be played. A data sector normally holds 2048 bytes of user data in the mode 1 layout. An ADPCM sector is a real-time mode 2 form 2 sector that holds compressed audio.[^ovr113] PlayStation discs follow the CD-ROM XA specification. The data tracks must come before any CD-DA tracks. A disc with data in track 1, audio in tracks 2 and 3 and data again in track 4 is therefore incorrect, and the two data tracks must be joined as track 1.[^ovr1119] psx-spx summarizes the format as an ISO 9660 file system on CD-XA mode 2 sectors.[^spxov] ## Addressing For compatibility with CD audio, CD-ROM addressing uses track number, index number, minute, second and sector. There are 75 sectors in one second and 60 seconds in one minute, and the first sector of the data begins at 00 minutes 02 seconds 00 sector.[^ovr114] A position can therefore be read as a track and index, as seen by an audio player, or as a time from the start of the disc.[^ovr114] A track signal is recorded at the start of each track, and a table of the track positions is recorded at the start of the disc as the TOC (Table of Contents).[^ovr114] For data sectors libcd also counts an absolute sector number from 00:02:00, and CdIntToPos() and CdPosToInt() convert between the two forms.[^ovr114] The minute, second and sector are given in BCD, so decimal 60 is written 0x60.[^ovr117] The disc rotates at normal speed or double speed. Normal speed is the speed of an ordinary CD player and transfers 150KB/sec, which is 75 sectors per second. Double speed transfers 300KB/sec, or 150 sectors per second.[^ovr114] Table: Disc limits | Unit | Count | | --- | --- | | Tracks per disc | 99 (01h to 99h) | | Indices per track | 99 (01h to 99h) | | Minutes per disc | 74 (00h to 73h), or more with restrictions | | Seconds per minute | 60 (00h to 59h) | | Sectors per second | 75 (00h to 74h) | | Frames per sector | 98 | | Bytes per frame | 33: 24 data, 1 subchannel, 8 error correction | The numbers are from psx-spx.[^spxstuff] The 98 frames of 24 data bytes give the 2352 (930h) bytes of a sector. The subchannel and the frame error correction lie outside the sector. Most drive controllers give access only to the 930h bytes and to subchannel Q.[^spxstuff][^spx930] ## Sector Layout ECMA-130 defines a sector as 2352 bytes. It begins with a 12-byte sync field (00h, ten FFh, 00h) and a 4-byte header of minute, second, sector and the sector mode byte.[^ecma14] Mode 0 sets bytes 16 to 2351 to zero. Mode 1 holds 2048 bytes of user data, protected by a 4-byte EDC, 8 zero bytes and 276 bytes of P and Q parity. Mode 2 makes all 2336 bytes after the header user data, and only the CIRC of the frames protects them.[^ecma14] CD-ROM XA divides mode 2 into two forms, and the PlayStation stores its data in them.[^spxsect] The layouts, with offsets in hexadecimal, are as follows:[^spxsect] Table: Sector layouts | Offset | Audio | Mode 1 | Mode 2 form 1 | Mode 2 form 2 | | --- | --- | --- | --- | --- | | 000h | Audio data, 930h bytes | Sync, 0Ch bytes | Sync, 0Ch bytes | Sync, 0Ch bytes | | 00Ch | | Header (minute, second, sector, 01h) | Header (minute, second, sector, 02h) | Header (minute, second, sector, 02h) | | 010h | | Data, 800h bytes | Subheader, 4 bytes | Subheader, 4 bytes | | 014h | | | Copy of subheader | Copy of subheader | | 018h | | | Data, 800h bytes | Data, 914h bytes | | 810h | | EDC over 000h to 80Fh | | | | 814h | | 8 zero bytes | | | | 818h | | | EDC over 010h to 817h | | | 81Ch | | ECC, 114h bytes | ECC, 114h bytes | | | 92Ch | | | | EDC over 010h to 92Bh, or 0 | Audio data is stored as left low byte, left high byte, right low byte and right high byte.[^spxsect] Form 1 therefore keeps the error correction of mode 1 for 2048 bytes of data, while form 2 gives 2324 (914h) bytes of data with error detection only.[^spxsect] A mode 0 sector has the sync and header and 920h zero bytes.[^spxsect] ## Subheader The 4-byte subheader of a mode 2 sector holds the file number, channel number, submode and coding information. A normal data sector has the subheader 00h 00h 08h 00h.[^spxsub] Table: Subheader bytes | Byte | Name | Contents | | --- | --- | --- | | 0 | File number (FN) | 00h to FFh, for interleave | | 1 | Channel number (CN) | 00h to 1Fh in bits 0 to 4, for interleave | | 2 | Submode (SM) | Sector type and flags, below | | 3 | Coding information (CI) | 00h for data, the audio format for XA-ADPCM | Table: Submode bits | Bit | Name | Contents | | --- | --- | --- | | 7 | EOF | End of file, directory, path table or volume terminator | | 6 | RT | Real time | | 5 | Form 2 | 0 = form 1 (800h bytes), 1 = form 2 (914h bytes) | | 4 | Trigger | For application use | | 3 | Data | Data sector | | 2 | Audio | Audio sector | | 1 | Video | Video sector | | 0 | EOR | End of record | Normally one of the Video, Audio and Data bits is set. PlayStation STR movie files are marked as data sectors.[^spxsub] Every volume descriptor sector has EOR set, and the last one also EOF. EOR and EOF are both set in the last sector of each path table and directory and of each file.[^spxsub] Table: Coding information for XA-ADPCM | Bits | Contents | | --- | --- | | 0 to 1 | 0 = mono, 1 = stereo | | 2 to 3 | Sample rate. 0 = 37800 Hz, 1 = 18900 Hz. | | 4 to 5 | Bits per sample. 0 = 4 bits, 1 = 8 bits. | | 6 | Emphasis | | 7 | Reserved | The audio sectors are described in [XA Audio](/hardware/cd-rom/xa-audio/). With real-time sectors the drive may skip a read error in place of a retry, since a delay would be more disturbing to a stream than bad data.[^spxrt] ## Subchannel Q Each frame carries 8 subchannel bits, named P to W. A sector of 98 frames therefore holds 98 bits of each subchannel.[^spxsubch] Subchannel P marks pauses between audio tracks and has no checksum.[^spxp] Subchannel Q carries the position of the sector, the TOC in the lead-in and other information, as follows:[^spxq] Table: Subchannel Q | Bits | Contents | | --- | --- | | 2 | Sync | | 8 | ADR and control | | 72 | Data, depending on ADR | | 16 | CRC-16-CCITT, high byte first | Table: ADR and control byte | Bits | Contents | | --- | --- | | 0 to 3 | ADR. 0 = no data, 1 to 3 = mode, 4 to 0Fh = reserved. | | 4 | Audio preemphasis. Must be 0 for data. | | 5 | Digital copy allowed | | 6 | Data (0 = audio, 1 = data) | | 7 | Four-channel audio. Must be 0 for data. | In the data area ADR 1 gives the track number, the index number (00h for the pause), the time within the track and the absolute time. All of them are in BCD. ADR 1 appears in at least 9 of every 10 sectors.[^spxq1][^ecma22] In the lead-out the track number is AAh. In the lead-in the track number is 00h, and the point field names a track (01h to 99h) or one of three entries: A0h for the first track number and disc type, A1h for the last track number and A2h for the start of the lead-out.[^spxq1] The disc type byte is 00h for CD-DA or CD-ROM; it is 10h for CD-I and 20h for CD-ROM XA.[^spxq1] ADR 2 carries the catalogue number of the disc and ADR 3 the ISRC of a track. ADR 5 carries the multisession information in the lead-in and lead-out.[^spxqmore] The PlayStation reads subchannel Q with CdlGetlocP during play. GetlocP also reads the LibCrypt protection data of some discs.[^ovr1111][^spxgetlocp] ## Track Gaps and the Outer Edge The drive finds the start of an audio track from the TOC and the track signals.[^ovr114] When CD-DA is played continuously, the access goes to the point where the index is 1, so the gap is not played. The audio may therefore differ slightly from an access by absolute time from the TOC, because the TOC may lag the real position.[^ovr1119] A track jump within three minutes of the outer edge of the disc can make the head fly off the disc. The outer three minutes should therefore not be accessed, and they are normally recorded with null data.[^ovr1119] Sony allows the area to be used for a long file that is always read from its start, such as an ending movie, or for a last CD-DA track of three minutes or more.[^ovr1121] ## File System The file system of the PlayStation is based on ISO 9660 level 1, and it assumes that the files are on CD-ROM.[^os24] A CD-ROM is read-only, so each file occupies one continuous run of sectors. A file is read from its start position alone, and nothing like a FAT is needed. libcd provides CdSearchFile() to find the start of a file by name.[^ovr114] File names take the MS-DOS form of an 8-character base name and a 3-character extension with a period between them. The characters are 1-byte alphanumerics, and 1-byte katakana and kanji cannot be used.[^os24] On the disc a name carries the version suffix ";1".[^spxiso] The Operating System manual states that subdirectories cannot be created and that all files are in the root directory. It sets no limit on the number of files.[^os24] However, the CD conference FAQ treats a subdirectory as a file in its parent directory.[^faq165] psx-spx also allows 8-character directory names and gives the kernel limit as one sector (800h bytes) per directory.[^spxiso][^spxdir] ## Disc Layout The first 16 sectors of the first track form the disc's system area. psx-spx gives the contents of a PlayStation disc as follows:[^spxsys] Table: System area | Sector | Contents | | --- | --- | | 0 to 3 | Zero (mode 2 form 1) | | 4 | License string | | 5 to 11 | PlayStation logo, 3278h bytes, rest filled with FFh | | 12 to 15 | Zero (mode 2 form 2) | | 16 | Primary Volume Descriptor | | 17 | Volume Descriptor Set Terminator | The license string in sector 4 begins with "Licensed by" and the name of the Sony company of the region. Japan has "Sony Computer Entertainment Inc."; America has "Sony Computer Entertainment Amer ica"; Europe has "Sony Computer Entertainment Euro pe".[^spxsys] The logo sectors hold a TMD model of the PS logo shown at boot. The Japanese BIOS refuses a changed logo, the European BIOS from version 4.0E refuses it, and the American BIOS accepts it.[^spxsys] The Primary Volume Descriptor carries "PLAYSTATION" in both its system identifier and its application identifier. Its logical block size is 800h bytes, and "CD-XA001" is stored at offset 400h.[^spxpvd] The path tables usually follow in sectors 18 to 21 and the root directory in sector 22.[^spxpath][^spxdir] ## Directory Records A directory record holds the start sector and size of a file, both in both byte orders, a recording time, flags and the name.[^spxdir] On a CD-XA disc each record ends with 14 bytes of system use data:[^spxdir] Table: CD-XA system use field | Offset | Size | Contents | | --- | --- | --- | | 00h | 2 | Owner group ID, usually 0 | | 02h | 2 | Owner user ID, usually 0 | | 04h | 2 | Attributes, big endian | | 06h | 2 | Signature "XA" | | 08h | 1 | File number, which must match the subheader | | 09h | 5 | Reserved | Table: XA attribute bits | Bit | Contents | | --- | --- | | 15 | Directory | | 14 | CD-DA track | | 13 | Interleaved | | 12 | Mode 2 form 2 | | 11 | Mode 2 | | 0 to 10 | Owner, group and world read and execute permissions | The common values are 0D55h for a normal file in 800h-byte sectors, 3D55h for a streaming file of ADPCM or MDEC data, 4555h for a CD-DA track and 8D55h for a directory.[^spxdir] Directory entries do not cross a sector boundary, and the names are sorted alphabetically whether they are files or directories. The first two entries, with the names 00h and 01h, are the current and parent directory.[^spxdir] ## Copy Protection Each licensed disc has a four-letter "SCEx" string in the wobble of its groove in the first seconds of the disc, which a normal CD writer cannot reproduce. The last letter gives the region (I for Japan; A for America; E for Europe).[^spxscex] The firmware of the CD-ROM controller checks the string, not the BIOS, so a patched BIOS cannot bypass it. A disc with a missing or wrong-region string does not boot.[^spxscex] The license string, the logo and the region strings in the executable headers can be copied by a CD writer, but their distribution on unlicensed discs may be illegal.[^spxother] The GetID command in [CD-ROM Commands](/hardware/cd-rom/commands/) reports the result of the check. ## References [^os24]: Sony Computer Entertainment Inc. PlayStation Operating System. August 1998. Page 2-4. [^ovr113]: Sony Computer Entertainment Inc. Run-Time Library Overview. January 1999. Page 11-3, Table 11-1. [^ovr114]: Sony Computer Entertainment Inc. Run-Time Library Overview. January 1999. Page 11-4. [^ovr117]: Sony Computer Entertainment Inc. Run-Time Library Overview. January 1999. Page 11-7. [^ovr1111]: Sony Computer Entertainment Inc. Run-Time Library Overview. January 1999. Page 11-11. [^ovr1119]: Sony Computer Entertainment Inc. Run-Time Library Overview. January 1999. Page 11-19. [^ovr1121]: Sony Computer Entertainment Inc. Run-Time Library Overview. January 1999. Page 11-21. [^faq165]: Sony Computer Entertainment. The Un-Official PlayStation Development FAQ, CD Conference. Release v1.3. February 29, 1996. Question 1.6.5. [^ecma14]: Ecma International. ECMA-130, Data interchange on read-only 120 mm optical data disks (CD-ROM). 2nd edition. June 1996. Clause 14, pages 15 and 16. [^ecma22]: Ecma International. ECMA-130, Data interchange on read-only 120 mm optical data disks (CD-ROM). 2nd edition. June 1996. Clause 22.3. [^spxov]: psx-spx. CDROM Format, CDROM Disk Format, Overview. https://psx-spx.consoledev.net/cdromformat/ [^spxstuff]: psx-spx. CDROM Format, CDROM Disk Format, Stuff. https://psx-spx.consoledev.net/cdromformat/ [^spx930]: psx-spx. CDROM Format, CDROM Disk Format, 930h-Byte Sectors. https://psx-spx.consoledev.net/cdromformat/ [^spxsect]: psx-spx. CDROM Format, CDROM Sector Encoding. https://psx-spx.consoledev.net/cdromformat/ [^spxsub]: psx-spx. CDROM Format, CDROM XA Subheader, File, Channel, Interleave. https://psx-spx.consoledev.net/cdromformat/ [^spxrt]: psx-spx. CDROM Format, CDROM XA Subheader, File, Channel, Interleave, Real Time Streaming. https://psx-spx.consoledev.net/cdromformat/ [^spxsubch]: psx-spx. CDROM Format, CDROM Disk Format, Subchannels. https://psx-spx.consoledev.net/cdromformat/ [^spxp]: psx-spx. CDROM Format, CDROM Subchannels, Subchannel P. https://psx-spx.consoledev.net/cdromformat/ [^spxq]: psx-spx. CDROM Format, CDROM Subchannels, Subchannel Q. https://psx-spx.consoledev.net/cdromformat/ [^spxq1]: psx-spx. CDROM Format, CDROM Subchannels, Subchannel Q with ADR=1. https://psx-spx.consoledev.net/cdromformat/ [^spxqmore]: psx-spx. CDROM Format, CDROM Subchannels, Subchannel Q with ADR=2, ADR=3 and ADR=5. https://psx-spx.consoledev.net/cdromformat/ [^spxgetlocp]: psx-spx. CDROM Drive, CDROM - Status Commands, GetlocP. https://psx-spx.consoledev.net/cdromdrive/ [^spxiso]: psx-spx. CDROM Format, CDROM Disk Format, CDROM Filesystem (ISO 9660 aka ECMA-119). https://psx-spx.consoledev.net/cdromformat/ [^spxsys]: psx-spx. CDROM Format, CDROM ISO Volume Descriptors, System Area. https://psx-spx.consoledev.net/cdromformat/ [^spxpvd]: psx-spx. CDROM Format, CDROM ISO Volume Descriptors, Primary Volume Descriptor. https://psx-spx.consoledev.net/cdromformat/ [^spxpath]: psx-spx. CDROM Format, CDROM ISO File and Directory Descriptors, Path Tables. https://psx-spx.consoledev.net/cdromformat/ [^spxdir]: psx-spx. CDROM Format, CDROM ISO File and Directory Descriptors, Format of a Directory Record. https://psx-spx.consoledev.net/cdromformat/ [^spxscex]: psx-spx. CDROM Format, CDROM Protection - SCEx Strings, SCEx String. https://psx-spx.consoledev.net/cdromformat/ [^spxother]: psx-spx. CDROM Format, CDROM Protection - SCEx Strings, Other Protections. https://psx-spx.consoledev.net/cdromformat/