CD Image (BIN/IMG) Format

BIN and IMG are usually the same format, but BIN can be compressed which I haven't run into yet. Usually BIN files have an accompanying CUE file which is the metadata for how the tracks of the BIN are laid out. ISOs appear to just be the raw user data with no sector or error correction information.

For the purpose of this document, we focus more on IMG/BIN.

Sectors

A CD Image consists of sectors. Each sector is exactly 2352 bytes in size. The format of a sector is:

NameSizeDescription
Sector2352 Bytes
 Synch12 Bytes0x00 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0x00
 MSF3 BytesContains the minute, second, and frame of the current sector. Each is 1 byte.
 Mode1 ByteThis tells what mode the sector is in. Desribed in more detail below.
 Mode Data2336 BytesContains the actual data for the current sector. The format of these bytes depends on the current mode for the sector.

Sector Modes

Mode Data varies in format depending on the mode of the sector. There are many different types of Modes but for the PSX use, mainly only 4 are used.
There is a Mode 0, which contains nothing but 0s (no Synch or MSF).
There is a Mode 1, which contains 2048 bytes of data and 288 bytes worth of crc checks.
And there is finally a Mode 2. This mode is unique because it contains 3 different forms: Mode 2, Mode 2 Form 1, and Mode 2 Form 2. Each one also has different structures.

Mode 1

NameSizeDescription
Mode Data2336 Bytes
 User Data2048 Bytes
 EDC4 BytesError Detection Code
 Blank8 Bytes0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00
 ECC276 BytesError Correction Code

Mode 2

There is no structure for this mode. The Mode Data IS the User Data. There is no checksums, sh, or os.

Mode 2 Form 1

NameSizeDescription
Mode Data2336 Bytes
 SH8 BytesShell
 User Data2048 Bytes
 EDC4 BytesError Detection Code
 ECC276 BytesError Correction Code

Mode 2 Form 2

NameSizeDescription
Mode Data2336 Bytes
 SH8 BytesShell
 User Data2324 Bytes
 EDC4 BytesError Detection Code

What Mode is which?

To identify what mode the sector is in, you examine Mode as shown in the Sector Table above. If Mode is equal to 0, then the current mode is 0. If it is equal to 1, then the current Mode is 1. Else if it is equal to 2, it can either be Mode 2 or any of its forms.
To tell the different Mode 2s apart you have to examine bytes 16-23 of the sector (the first 8 bytes of Mode Data). If bytes 16-19 are not the same as 20-23, then it is Mode 2. If they are equal and bit 5 is on (0x20), then it is Mode 2 Form 2. Otherwise it is Mode 2 Form 1.

Sector 16

Coming soon...

Directory Listing

Coming soon...