RISC World

Creating CDs using RISC OS

Dave Holden introduces a new series on CD writing

Part 1 - Introduction to CD writing

In the last couple of years CD writers have plummeted in price. As is so often the case we have the PC market to thank for this as they are now fitted as standard to all but the lowest spec PCs and, as always, this has driven the cost if the hardware down.

The availability of low cost CD writers has corresponded with the widespread use of digital cameras and scanners, and I assume these facts are not unrelated. Although writable CD is a cumbersome media to use for conventional backup it's ideal for permanent storage of things like photographic images, scans, etc., especially as it's physically small, the media is cheap, and you can make several copies if required. Furthermore, provided you take reasonable care in the preparation of your CD, it can be platform independent, so, unlike many other forms of data storage, you can create it on a RISC OS machine and pass on copies to people with PCs, Macs, or using Linux.

The basics

Before I get down to the practical aspects I'll briefly describe how writable CDs work, and some of the terms that are used. It's a non-technical description and is intended to give people who know nothing about the subject some idea of how the technology works, so I hope the more knowledgeable readers won't take me to task for inaccuracies introduced in the interests of brevity.

As you are no doubt aware a CD is read (and, in the case of writable CDs, written) using a laser. The protective surface coating of the CD is transparent, and behind this layer is a film which contains the data. The surface of the film can be in one of two states which have different reflective properties when the laser beam is shone onto it. These provide the '0' and '1' states required to hold digital information. So, as the disc rotates it is scanned by the laser and a stream of digital data is returned. Note that the system is the same whatever the format of the data. It can be digital music, computer readable data, anything. On the CD it's just a series of 0's and 1's.

In the case of a 'manufactured' CD the film which holds the data is a fixed substrate. With CDR (CD Recordable) it has properties which enable its state to be altered by shining a laser beam onto it. In the case of CDR discs this process is irreversible. With CDR/W (CD Re-Writable) media the change can be reversed by using the laser in a slightly different way, so the CD can be 'blanked' and re-used.

CD structure

Many of the terms used with CDs reflect the fact that the media was originally intended for music. We talk of '74 minute' and '80 minute' capacity CDs rather than '640 Mb' or '700 Mb'. When data is placed on a CD in separate blocks we refer to these as 'tracks'. For the present I shall be describing data CDs, we'll come to music later, so don't be confused by some of the terms used.

There are three basic ways that data can be placed onto a CD. The ideal (and most universally readable) is the single session format. As you might imagine, this means that everything is written in one go on a single 'track'. Next is multi session'. Here the data is written in a series of tracks. This means that, even using CDR discs, you can add data to a part-full CD. Unfortunately the CD may not be readable on another system until you have finally 'closed' it (and sometimes not even then) so it's not ideal. Its main benefit was that, before the availability of cheap CDR/W discs, it was the only way that you could add data to a CD. In view of the compatibility problems I can see little point in using it now, Finally there's packet CD. This is widely used on PCs, but is not available for RISC OS (Unless you are using VirtualA5000 - ED). It's a very crude system whereby the CD is first marked out with a series of blocks, rather like formatting a floppy disc. 'Packets' of data can then be written to these blocks. This provides a simple way of adding data to a CD, whether CDR or CDR/W, but the CD will often only be readable on the platform on which it was created.

Data is always written to a CD starting at the centre and working outward. The part of the CD closest to the centre is actually written last, as it contains the 'catalogue' of what's on the CD. Because the laser must pass over the CD surface, both for reading and writing, at a constant linear speed the rotational speed of the CD must be greater when it's near the centre than when it's close to the outer edge. This is why, when using a data CD with a lot of material on it you hear the drive speed changing. It has to speed up to get the catalogue information near the centre, then slow down again to access the data.

Writing the data

For most purposes it is best if data is written as a single track from an ISO image. This is a file which is created on your hard drive and which is an exact replica of the data to be written to the CD. It is then copied to the CD in a continuous stream, starting at the centre and working outward. Ideally there should be no interruptions in this process. If there is, that is, when the buffer on the CD writer is empty and it asks for more data it's not quickly available, you get the dreaded 'buffer underrun' error. Modern burn-proof CD writers can, theoretically, recover from this and carry on from where the error occurred, but it is bad practice to rely upon this with data CDs as there may sometimes be a minor corruption of the CD. This will be too small to matter on a music CD, but any corruption, no matter how slight, could mean disaster for a data CD.

From this you can see that you really need quite a lot of spare hard drive space to create a CD. First there's the raw data, then you need as much space again for the ISO image. Once you have created your CD you can, of course, delete all this, but you do need it to be there before you begin.

In theory there are three different CD writing packages available for RISC OS. CDBlaze from Cumana, CDScribe from Eesox, and CDburn from Warm Silence. In fact, as far as I am aware only CDBurn is still being actively developed and supported, so I shall not describe the other programs as I assume that anyone who has a copy of either of these will have purchased it some time ago and will be familiar with its use. All the following descriptions will therefore apply to CDBurn.

Setting up CDBurn

A few years ago most CD writers were SCSI. Now IDE (or, more properly, ATAPI) is much more common, primarily because it is almost universally used on PCs and so is very much cheaper. One of the reasons that CDBurn is now the pre-eminent RISC OS program is it supports third-party IDE interfaces like those from APDL and Simtec. As these are much faster than the on-board RiscPC interface they permit much faster CD writing (up to 16x in the case of the APDL Blitz) which was hitherto only possible using much more expensive SCSI equipment.

The first thing you have to do when you install CDBurn is to configure it. It's amazing how often I get calls from people who complain they can't get it to work because they've omitted this rather essential step.

CDBurn's main configuration window is opened by selecting Configure from the iconbar menu, but first you may have to make another change. Inside the !CDBurn application is a text file called Settings. Load this into a text editor and you should find a few lines at the end like this:

These lines define which filing systems CDBurn will scan looking for CD writers. scanAcorn means the motherboard IDE interface, so if your CD writer is connected to this you must alter this to yes. scanCDFS has no relevance to CD writing but is used by CDBurn when it is reading data from a CD, for example, when extracting data to make a copy. This can be done by accessing the CD directly or via CDFS.

Once you have made any necessary changes save the Settings file and run CDBurn or, if you had already run it Quit and re-run it so it will reload the Settings.

If you click on Configure on CDBurn's iconbar menu this window will appear:

If you click on the menu icon in the CD Writer Options section a menu will appear listing all (!) the CD writers found on your system. Note that if your CD writer is connected to an APDL or Simtec IDE card it must be the first CD ROM drive found. So if you have both a CD reader and a CD writer make sure that the writer has the lower drive number, if not you'll have to switch some cables around.

Your CD writer should appear on the menu, for most systems it will be the only drive available. If CDBurn can't find your drive then the message no CD writers found will appear and you'll have to try to find out what's wrong before proceeding.

Select the drive and it will appear in the icon in the main window as shown.

You can now repeat this for the CD Reader Options section. Even if you've only got one CD drive it may appear twice, once as CDFS::<drive> and again as IDEFS::<drive>, SCSIFS::<drive> etc. Normally the 'raw' version rather than the CDFS version would be the one to select.

If you've got a separate CD reader as well as your CD writer you may wish to choose this. Although I don't normally recommend it you can 'direct copy' a CD, but to do this the source and destination drives must obviously be different.

Simulate writing will go through the motions of writing the CD, sending the data to the CD writer, but then just discard each data block instead of sending the command to actually write it. This can be useful when you first start to use CDBurn as it allows you familiarise yourself with how it all works without actually writing the CD.

Once you have chosen the drives you can scroll the pane down to its lower half.

don't fixate' means that the data track(s) are written but not 'fixed' by having the final catalogue information written. This allows you to leave the CD 'open' so that additional tracks can be written later.

You can set the default reading and writing speeds for both Audio and Data CDs. If you have your CD writer attached to the motherboard IDE controller you should be able to write data CDs at 4x but you may find that you can only write audio CDs at 2x.

In the Audio section Track-at-once means that each audio track is written separately with a gap between tracks, just like normal music CDs. Disc-at-once writes the entire CD in one go, merging the tracks together. This produces an effect like that found in live concert CDs where the applause at the end of one track merges with that at the beginning of the next to produce a continuous effect. Unfortunately at present only Track-at-once works with IDE writers, so if you really must have this feature you will have to incur the extra expense of SCSI, but it is being worked on and will probably be available on IDE as well soon.

When you have all the default settings as you want them click on Save to save the configuration file.

Creating a data CD

There are two methods you can use to write a data CD. You can create an ISO image and then write the image to the CD, or you can write 'on the fly'. For most purposes I would strongly advise the former. The exception is when you have a small(ish) number of large files, for example a few large archive files or a number of big picture files like TIFFs or JPEGs. The reason for this is that if you are trying to create a CD of things like applications 'on the fly' then CDBurn has to do a lot of work as well as just sending the files to the CD writer. The fewer (and larger) the files, the less time is used up on this work and so the less chance there is of it not being able to keep up with the CD writer.

Setting out the CD

If you click SELECT on the CDBurn icon the main control window will open.

The functions of the various icons in this window will be described as we proceed.

The first thing you have to do is to tell CDBurn what data you want to put on your CD. There are two ways you can do this. You can place all the files you want to write to the CD into a directory on your hard drive and then tell CDBurn to use this (the third option in the control window) or you can use the Filer-like Data Layout.

Click on Data layout by given Dir. and this window will appear.

Drag the directory in which you have placed all the files you want to put onto the CD to the top writable icon. Now enter a suitable name for the CD in the second writable icon. In the above example I've just used TEST_CD.

Before you can proceed there's one other thing that has to be decided, how the filenames and filetypes will be presented.

The original ISO standard used DOS-like filenames with 8 character filenames and a 3 character extension. Only the upper case characters A to Z, the numbers 0 to 9 and the '_' (underscore) character were permitted. In order to accommodate the '!' character required for Acorn application directories and to enable files to have Acorn filetypes some extensions were included in CDFS. The '!' character is replaced by a '_' and a special table is included on the CD which is ignored by other systems but which CDFS uses to tell is when to replace the '_' with a '!' so Acorn application directories are shown correctly in filer windows and 'work' properly when double-clicked on. A similar system is used to encode Acorn filetypes, but because of the way the data is stored this is mutually exclusive with dot extensions. On an Acorn format CD a file can therefore have an Acorn filetype or a dot extension but not both. So, if you want to put cross-platform files on a CD you have to ensure that dot extensions are enabled. This will suppress those files being given Acorn filetypes, but this shouldn't be a problem on a properly set up RISC OS system as DOSMAP or MIMEMAP should ensure that files with a recognised dot extension are shown in filer windows with the appropriate file icon.

But how is this all done in practice?

If you click on the menu icon to the right of the Filename translation standard icon this menu will appear.

If you are creating a 100% Acorn format CD you can select the first item, Acorn CDFS. If you want a cross platform CD do not select this, ISO level 2 is probably the best choice as it allows long file and directory names and is almost universally understood.

In the bottom left hand corner are three other options. Add CDFS extension will ensure that the information about '!' characters in file and application directory names is tabulated and that, where a file does not have an extension, Acorn filetype data is included.

Force public access should be selected if you want your CD to be able to be used over a network with a Level 2 fileserver.

Joliet extensions is a system that enables certain otherwise 'illegal' characters, including lower case letters, to be used in filenames. CDFS will simply ignore this, so filenames will always appear in upper case, but if you are using something like Warm Silence's CDROMFS, or RISC OS Select then the name will appear exactly as the original. You therefore might as well leave this selected as CDBurn will then put the information on the CD for systems that can make use of it.

Slashes and Dots

It's worth making sure you understand exactly how this works if you want to make your CD usable on other platforms. One of the most common questions I get asked is something like 'I've put all my photos on a CD as JPEGs but my friend can't open them on his PC.' Most systems use the 'dot extension' to identify the content of a file. You will probably be familiar with these and used to seeing .GIF, .JPG, .HTM (or .JPEG and .HTML) to identify types of file. As Acorn filing systems use the '.' character as a directory delimiter they can't display these correctly in filer windows so the forward slash character ,'/', is substituted. This is where some people get confused. Because the '.' is displayed as '/' in an Acorn filer window, when you want to add a (pseudo) dot extension to a file on an Acorn format disc you type '/' instead of '.'. People tend to assume that the slash automagically gets translated somehow to a dot for other systems. That's not quite what happens.

If you have selected Acorn CDFS on the Filename translation menu then the slash remains as a slash. Other systems do not recognise this as a filetype extension so they don't know what the file is. If you choose one of the ISO options then, when CDBurn creates the CD, it changes the slash to a dot, simultaneously suppressing the Acorn filetype information as the two are mutually exclusive (the dot extension takes precedence over the Acorn filetype info). As the files on the CD now have a 'proper' dot extension they will be recognised on other systems.

If you have also selected ADD CDFS extension then, as CDBurn creates the image, it will issue a series of warning messages to tell you that it's suppressing the Acorn filetype info. You can ignore these warnings, they are presented for your information only.

Creating the ISO image

When you have set everything up click on the Generate Image button and a SaveAs window will open. Drag this to a suitable directory viewer on your hard drive (remembering to make sure that there's enough free space to create the image) and CDBurn will start work. When it's finished you will have a file with the filetype &DF6 and an icon like a small CD. This is the ISO image file.

You will also see warnings if you have deeply nested directories. This is because the original ISO standard specifies that directories must not be nested more that eight deep. In practice the data format on the CD can accommodate much larger structures and, as far as I am aware, no filing system on any platform will have problems with this. Although you will be exceeding the ISO standard it is extremely unlikely that it will cause any problems in practice and so these warnings can be ignored.

Filer-like data layout

This is a more convenient way to create a CD if it's a 'one off' rather than something like a commercial CD where you want to prepare everything neatly in a directory first. If you choose to create your CD this way then the window which opens looks like this.

As you can see, most of the items are identical to those in the Data layout by directory window, so I won't bother to repeat the descriptions. The main difference is that instead of specifying the files you want to include using a directory you click on Open ISO filer and a small window will appear. Just drag any files, applications, directories, etc. you want to put on the CD into this window. As you drag them they appear in the window so eventually you might end up with something like this:

Note that the way that filename appear in this window can be set from a menu which will appear if you click MENU over it.

Once you have dragged all the material you want to write to the CD to this window you can click on Generate Image as usual and the ISO image will be created.

Writing the CD

When you have your ISO image you can make to CD. Click on Write Data CD in the control window and this window will appear.

The settings in this window will be the same as those set as the default settings in the Configure window. You can, of course, alter them if you wish.

Drag the ISO image you have created to the icon at the top of the window and its filename will appear. Now all you have to do (after putting a blank CDR or CDR/W disc in the drive) is click on Write.

A small window will appear to tell you that the CD is being written and showing an estimate of how long it is likely to take. Although when creating the ISO image CDBurn multi-tasks when it's actually writing it single-tasks, so there's nothing you can do until the job is finished but wait. When writing is complete the CD drawer will open.

Writing on the fly

For this you proceed exactly as previously described, using either Data layout by directory or the Filer-like data layout but click on Write CD on the fly instead of Generate Image.

A window similar to that shown above for writing an ISO image will appear except that there's no writable icon for you to drag the ISO image file to. The process of actually writing the CD is similar. The main difference is that CDBurn has to create the CD structure as it works, and this obviously means it has a lot more work to do than just copying a previously constructed ISO image to the CD drive. Because of this you will almost certainly find that you have to select a slower writing speed than you can use with an ISO image, and if your CD writer is connected to the motherboard IDE interface then even 2x may be too fast if you have a lot of small files, especially if you do not have a Strong ARM processor.

For this reason this system is not usually recommended unless you are creating a CD with just a few very large files. The slower writing speed might even mean that it takes longer to write a CD on the fly than the two step process of creating an ISO image first. This is especially true if you want more than one copy of the CD as the ISO image only needs to be created once, and the CDs can then be written at the higher speed.

Long filenames without RO4

If you do not have RISC OS 4 then the names you can use on files with an extension will be rather limited. As you can only have 10 characters on an Acorn format drive if you want to add a '.' extension then the slash character and the three character extension means that the actual filename can only have six characters, which is a bit limiting, especially if you already have the files on your drive with longer names but without the extension.

Luckily there's a solution. The freeware program x-files allows large archives to be created where the Acorn limitations of 10 characters in file and directory names and 77 files per directory do not exist. Also, because it does not use compression, unlike more sophisticated archivers like ArcFS and SparkFS it is extremely fast, even with very large archives of several hundred megabytes.

To use x-files for this purpose create a new x-files archive (see its !Help file for instructions) and then, before you put any files into it, create a directory inside the archive. Put all the files you want to include on the CD into this directory. You can now alter the filename or add extensions (there are PD programs that will do this for you with common filetypes) and then select Data layout by directory from the CDBurn control window and drag this directory (not the x-files archive itself) to the window.

x-files is not the best tool for many archiving purposes. It tends to be wasteful of space as it does not 'tidy up' until there's a lot of empty space in the archive and it can sometimes crash and corrupt an archive. However, it is ideal for this purpose as, in my experience, the only time it is likely to corrupt an archive is when you are actually adding files, so if the archive is created without problems it will be perfectly OK. In the unlikely event that something does go wrong, then because you still have the original data files elsewhere you can just delete the archive and start again.

We will go into greater depth next issue.

Dave Holden