# D.I.Y. "Codemasters CD"

## Introduction

In 1990 Codemasters sold a audio CD which contained a selection of their games. A CD was made for each of the popular platforms: Spectrum, Amstrad and C64.

The total package comprised:

- The Audio CD containing 30 games,
- a "loader" cassette.
- a lead to connect the computer to a Audio CD player

To play a game, the following tasks had to be done:

- Connect the computer and audio CD player using the lead,
- Load the loader program from the "loader" cassette
- Select the audio track corresponding to the game that you wanted to play,
- Begin play back of the audio track
- Wait for the game to load

Each of the games on the CD was stored using a high-speed loader, so a game on the CD loaded much faster (e.g. approx 30 seconds) compared to the corresponding game on cassette (e.g. 5 minutes).

Until recently it was thought that the Amstrad version of this package didn't exist. However, after talking to the developer (The Oliver Twins), I discovered that it was complete and did exist. (The Spectrum version of this package was also developed by The Oliver Twins).

Disclaimer: This document describes my own implementation of this package. My project was developed independantly from the original Codemaster's CD. I do not have the Codemaster's CD and I do not have the exact technical details of it's operation. This design was created from information I have derived from the details of the original Codemaster's CD.

## "Codemaster's CD stunner"

> "Codemasters has rocked the gaming industry with its new CD Games Pack. What's amazing is not just that the Games Pack costs a meere 19.95 UK pounds (67p per game) but that with it you get both a lead to connect any domestic CD player to your CPC and the special loading software to load the games in.

> On the massive compilation will be such past hits as BMX Simulator, Pinball Sim, Ninja Massacre, Fast Food, Treasure Island Dizzy, Four Soccer Sims and Fruit Machine. And although the quoted number of games is 30, it seems more probable that there will be more like 33 or 34 when the Games pack goes on sale.

> But just as significant as the huge number of games on the compilation is Codemasters' decision to release them all on CD. CD-ROM drives are expensive and rare, and certainly not available for 8-bit home micros like the CPC. So Codemasters has instead saved the games on the CD as an audio signal - a far less efficient format than true CD-ROM, but one that nevertheless offers a huge 3MB of storage capacity on a single disc.

> The Taiwanese-made cables provided with the Games Pack connect between a standard domestic CD player's ear socket and the joystick port on the CPC (Codemasters chose to use the the joystick port so that the leads could be the same for all three major 8-bit micros - thus keeping the cost down). Special curcuitry inside the D-connector at the joystick end converts the CD's audio signal into a binary form for loading into the machine.

> Although the CD will be working effectively just like a tape loader, the much 'cleaner' CD signal and the built-in error checking incorporated in CD players, allows games to load far far quicker - as quickly as 20 seconds for some games, in fact. This, plus the fact that any CD player will let you go straight to a selected 'track' at will, puts the Games Pack's performance more in line with Disk drive's.

> Selling games on compact disc has been tried before. Rainbow Arts sold a 6-game compilation on CD for the c64 not so long back, but at 30 UK pounds and being for the c64 only it was of minority interest and offered nothing like the value of the Codemasters product.

> But how many compilations can Codemasters bring out now that the technology is there? The company has a huge back-catalogue, but at 30 games a time, it can't last long.

> No, the point is that Codemasters will first of all establish a huge potential user-base with the first - astonishing - bargain. Not only will the Darlings be able to release new compilations at a lower price, they will also be able to develop whole new styles of games that use the enormous storage capacity of a CD. So can we expect to see a 3,000-screen Dizzy? Or film tie-ins with screen after screen of Digitised graphics and full-length soundtracks?

> The Games Pack may be astonishing value at 19.95 UK pounds but even more astonishing is the potential offered by the sudden accessibility of CD storage."

(c) Future Publishing Ltd. Reproduced with permission.

This article comes from "Amscene" in Amstrad Action magazine, January 1990.

## My implementation

The structure of a generic cassette loading system is described and then compared to the loading system implemented with the CD.

### A generic cassette loading system

A generic cassette loading system has the following form:

- a loader program stored using the operating system's cassette loading system
- one or more data block's using a custom loading system

A generic cassette data signal is normally composed of the following elements:

- a leader
- sync
- data

The leader is a repeated wave. The loading system uses the leader to detect the start of the data for a data block.

The sync is constructed from a wave which is different to the leader. The sync signals the end of the leader and the start of the data.

The data is constructed from multiple waves.

A single bit of data is encoded as a wave. Each wave is composed of a approximatly equal duration of high and then low level. The duration of the high level of the wave defines the value of the data-bit. Normally, a 1-bit has a wave which has a duration twice that of a 0 data-bit.

### Fast-loader data

The fast loader uses two audio signals to define the fast-loader data. A clock signal and a data signal. The clock signal is a repeated, the state of the data signal defines the

The change in clock signal signals that the data signal now represents the state of a new data bit.

## The loader cassette

A cassette is used to store the loader program. The loader program must be started before the games on the CD can be accessed. Once the loader program is active, the game can be fast loaded through the special cable into the computer's memory where it will then be executed.

A loader cassette is used for the following reasons:

- The package will be compatible with the CPC464 and CPC464+ which have a built in cassette recorder,
- The package will be compatible with a CPC664,CPC6128 or KC Compact which are connected to a external cassette player using a cassette lead,
- The loader program doesn't need to be stored on the audio CD. The space that it would have occupied, if it was stored on the audio CD, can be used to store more fast-load data.

It would be possible to store the loader on the audio CD, but this would cause compatibility problems with the CPC464 and CPC464+. The operating system can only load from cassette (or from disc if a disc interface is connected), therefore the loader program must be loaded from cassette (or disc if a disc interface is connected).

With the CPC664, CPC6128 and KC Compact systems, which have a cassette connector, then it would be possible to load the loader from the audio cd, as a cassette lead (or dual purpose fast-loader and cassette lead) could be used. The program data would then be loaded through the fast-loader lead.

## The fast-loader lead

The lead will connect the joystick connector of the Amstrad CPC to the audio output ("line out" or "phones") from the audio cd player.

The parts required:

Description | Maplins Reference | Quantity
--- | --- | ---
3.5mm stereo plug | HF98G | 1
9-pin D-type socket | RK61R | 1
wire | - | 3 equal lengths

The connections required:

Joystick connector | 3.5mm stereo plug
--- | ---
1 (Up) | Left audio
2 (Down) | Right audio
8 (Common 1) | GND

The signals:

Joystick connector | Lead function | Keyboard Map
--- | --- | ---
1 (Up) | Clock | Line 9 bit 0
2 (Down) | Data | Line 9 bit 1

Why use the joystick connector?

1. We require two simultaneous inputs for clock and data,
2. The joystick connector is always available on all models of the CPC,
3. A lead which uses the joystick connector will be much simpler compared to a lead which uses the Expansion connector, because we do not require the I/O port decoding hardware and edge connector.
4. If we used I/O port decoding then there is a possibility that the selected I/O port addressess could conflict with existing hardware which is connected to the computer, this would cause compatiblility problems. The joystick port doesn't need I/O port decoding and therefore this problem is eliminated.
5. The joystick port is easy to access and can handle the required data throughput.

Why use Up for clock and Down for Data?
  The time required to test the clock signal and receive the data is quicker with this choice. Up corresponds to Bit 0 of keyboard line 9, and Down corresponds to bit 1 of keyboard line 9. The state of the clock can be easily be tested by using the "RRA" instruction which transfers bit 0 of the data into the Z80's carry flag. If the clock has changed state, then the state of the data can be acquired by one additional "RRA" instruction.

  Other bits could be used but to access the data in these bits would require more instructions or instructions which take longer to execute. It is not possible to use bit 7 and bit 6 of keyboard line 9, which would be equally as quick to access as bit 0 and bit 1 if the "RLA" instruction was used, because bit 7 corresponds to the DEL key and bit 6 is unused. To access the bits used by the joystick would require longer and as a result the maximum data throughput would be less than using bit 0 and bit 1.

## Sample code

# Reference

## Stereo 3.5mm plug connections

## Digital Joystick Connector (CPC)

Connector type: 9-pin D-Type male.

Pin | Function | Input/Output
--- | --- | ---
1 | Up | Input
2 | Down | Input
3 | Left | Input
4 | Right | Input
5 | Fire 3 | Input
6 | Fire 2 | Input
7 | Fire 1 | Input
8 | Common 1 | -
9 | Common 2 | -