INTRODUCTION TO CD-ROM
----------------------
In many ways CD-ROMs are similar to floppy disks, the main difference
being that CD-ROMs use optical rather than magnetic storage
methods. Only floppy disks, the data is stored by changes in the
polarity of a magnetic material. The CD-ROM analogs to that are pits
and lands, which vary the intensity of a reflected laser. In both
cases the binary data stored on the medium is not encoded directly,
rather there is a complicated encoding algorithm.
The technology of CD-ROM is too complex to thoroughly detail here, but
there are a few basic concepts that are important to understand. Like
floppy disks, the data on a CD-ROM is organized into tracks and
sectors. But unlike floppy disks, there are two basic types of tracks,
audio and data, with several variants of data tracks. Unlike floppy
disks, CD-ROMs also contain metadata outside of the sectors called
subchannel data. The possibilities for CD-ROM copy protection are
myriad but many rely on subchannel data in addition to invalid sectors,
which are common in floppy protection schemes. Another difference from
floppy disks is that CD-ROMs include powerful methods for error
correction which can also be exploited to prevent copying.
PRESERVING CD-ROMs with cdrdao
------------------------------
For CD-ROMs without copy protection, a valid backup can be made using
simple tools; the Linux tool 'dd' is sufficient to copy a CD-ROM
containing a single data track with an ISO9660 filesystem. But for
multi-track or copy protected CDs, a better tool is needed. A widely
available open source utility that serves our purposes is cdrdao,
available in most Linux distributions.
To make a raw copy of a CD, including subchannel data, the following
cdrdao command suffices:
cdrdao read-cd --read-raw --read-subchan rw_raw --datafile <name.bin>
--device <device name> --driver generic-mmc-raw <name.toc>
This command will produce two files, a .bin containing the CD image
and a .toc containing the table of contents describing the CD
layout. To find the correct <device name> for your system, simply run:
cdrdao scanbus
to see a list of available optical drives. The command to burn a
toc/bin image pair is similar:
cdrdao write --eject --overburn --speed 2 --device <device name>
--driver generic-mmc-raw <.toc file>
CD images created in this way are functional even in the presence of
at least some copy protection methods. So far we have verified that
backups of discs protected with the following methods still work:
SafeDisc v1
SecuROM R1
SecuROM R4
We will update the list as more discs are tested.
Unfortunately, the toc/bin file format is not supported by a lot of
software that can read CD images, so it may be desirable to create
cue/bin files instead. Cdrdao provides a utility, toc2cue, to create a
cue file from a toc file, but there are some caveats. The audio data
byte order for audio tracks written to bin files by cdrdao is reversed
from what tools using cue files expect. The audio tracks in a bin file
created by cdrdao will be corrupted when used with a cue file. The
common symptom for this is static in the audio tracks.
A second problem is that the cue file specification doesn't support
the presence of subchannel data. This means that bin files containing
subchannel data like ours will not be parsed correctly when paired
with a cue file.
To address these problems, we've modified cdrdao's toc2cue utility. We
added a -C option to create a cue-compatible bin file. When specified,
this will create a new bin file that doesn't include subchannel
data. We also added a -s option that when paired with -C will byte
swap the audio data in the resulting bin file. Using these two
options, one can create an emulator-compatible cue/bin pair from
toc/bin files created using our method above like this:
toc2cue -s -C <new .bin file> <.toc file> <new .cue file>
We have issued a pull request including these updates to the official
cdrdao repository, but until they accept the changes you can find the
code at
https://github.com/jjsimpso/cdrdao. For now you will need to
build the code yourself, but we will eventually release a binary
package here if cdrdao's maintainers don't accept our pull request.