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.
A CD Image consists of sectors. Each sector is exactly 2352 bytes in size. The format of a sector is:
Name | Size | Description | |
Sector | 2352 Bytes | ||
Synch | 12 Bytes | 0x00 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0x00 | |
MSF | 3 Bytes | Contains the minute, second, and frame of the current sector. Each is 1 byte. | |
Mode | 1 Byte | This tells what mode the sector is in. Desribed in more detail below. | |
Mode Data | 2336 Bytes | Contains the actual data for the current sector. The format of these bytes depends on the current mode for the sector. |
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.
Name | Size | Description | |
Mode Data | 2336 Bytes | ||
User Data | 2048 Bytes | ||
EDC | 4 Bytes | Error Detection Code | |
Blank | 8 Bytes | 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 | |
ECC | 276 Bytes | Error Correction Code |
There is no structure for this mode. The Mode Data IS the User Data. There is no checksums, sh, or os.
Name | Size | Description | |
Mode Data | 2336 Bytes | ||
SH | 8 Bytes | Shell | |
User Data | 2048 Bytes | ||
EDC | 4 Bytes | Error Detection Code | |
ECC | 276 Bytes | Error Correction Code |
Name | Size | Description | |
Mode Data | 2336 Bytes | ||
SH | 8 Bytes | Shell | |
User Data | 2324 Bytes | ||
EDC | 4 Bytes | Error Detection Code |
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.
Coming soon...
Coming soon...