EXOS 2.1 Cassette Driver Specification

4. Miscellaneous Cassette Features


4.1 The STOP Key

The STOP key is tested whenever the cassette driver is actually accessing the tape, either for reading or for writing. Since the cassette driver disables normal EXOS interrupts while it is accessing the tape, it does not rely on the normal keyboard driver detection of the STOP key. Instead it tests for the STOP key directly itself and simulates the keyboard's action. However it does not test the STOP_IRQ EXOS variable, so the STOP key will always halt cassette operations even if STOP_IRQ is non­zero.

When the STOP key is detected, a .STOP error will be returned to the user, and also a software interrupt will be caused with software interrupt code ?STOP. The channel which was being used will be marked as no longer valid so that the cassette driver will reject further read or write character calls.


4.2 Tape Output Speed and Level

The data rate for tapes being read is determined automatically from the leader signal, and the level has to be set by the user. However the speed and level for writing out of data are controlled by EXOS variables which must be set before opening the channel, unless the defaults are required.

LV_TAPE determines the approximate peak to peak output level of the cassette driver as follows:

        0 or 1  -   20 mV
             2  -   40 mV  (default)
             3  -   80 mV
             4  -  170 mV
             5  -  250 mV
      6 .. 255  -  700 mV

SP_TAPE selects between two tape output speeds, a fast speed and a slow speed as follows:

SP_TAPE == 0 - fast speed (approximately 2400 baud - default)
SP_TAPE <> 0 - slow speed (approximately 1000 baud)

The baud rates are approximate because the actual rate depends on the data since a one and a zero bit take different amounts of time.


4.3 Cassette Loading Level Meter

The cassette loading level meter is displayed whenever the cassette driver is searching for or reading a chunk from the tape. It is derived directly from a hardware level detection circuit, and is displayed on the status line as either a red or a green block next to each other.

If the input level is increased it will become red and if the level is reduced it will become green. The optimum level is when it is just on the verge of changing between red and green, and it may in fact flash between the two as data comes in. Although this is the optimum level, the cassette input is not very sensitive to levels and a wide margin around this optimum is acceptable.

The level meter is removed from the status line when a chunk has been read, to indicate that the tape is no longer being accessed.

The changing of the level meter is done by changing palette colours 2 and 3 of the status line. When the level meter is removed, these colours are restores to their original values. However in the meantime, if there is anything else on the status line it may change colour.


4.4 Remote Control Relays

The Enterprise is equipped with two remote control relays which enable it to control two tape recorders separately. The motor is started when the cassette driver wants to read or write a chunk and stopped as soon as this has been completed, or the STOP key pressed.

When a cassette channel is opened for reading or created for writing, the unit number decides which remote relay will be used for this channel. A unit number of zero or one will use remote­1 and any other value (notably two) will use remote­2. If the user gives no unit number then EXOS will set it to zero by default, so remote­1 will be used.

If two channels are opened then they will each use the remote defined by their unit number. It is generally useful to ensure that these are different so that each channel has exclusive use of one of the remotes, but there is no checking for this. The remote not being used by a cassette channel will not be disturbed at all.

The remote relays can also be controlled by two EXOS variables (called REM1 and REM2), separately from the cassette driver. When one of these is changed then the appropriate relay will be set on or off as appropriate. The cassette driver always updates these variables when it uses the remotes so the variables always represent the current state of the relays. Like all other on/off EXOS variables, zero corresponds to on (motor going) and 0FFh corresponds to off (motor stopped).

The remote relays will always be set off when a reset I/O system occurs (see EXOS kernel specification). This occurs at a warm reset and when a new applications program takes control.


4.5 Use Without Remote Control

Cassette recorders without remote control can be used, provided the PAUSE button on the recorder is used at the correct times. For simply loading and saving programs, no pausing is necessary, assuming that the program doing the loading and saving is fast enough (IS­BASIC is).

For saving, pausing is only necessary to avoid long gaps between chunks, it is not essential. For loading, pausing is necessary to ensure that the data chunks are not missed while the machine is processing the data.

To help with this, when the cassette driver has finished reading a chunk, and there are more data chunks to follow, it displays a "PAUSE" message on the status line in place of the level meter. This message will remain intil the next chunk is required, when it will be overwritten with the level meter again.


4.6 Cassette Sound Feedthrough

The EXOS variable TAPE_SND is used to control feedthrough of the tape input signal to the main sound output. If it is 0FFh then there is no feedthrough. If it is zero then the tape input signal will be fed to the hi­fi sound output and the internal speaker (if MUTE_SND is zero), but not to the headphone/cassette output (to avoid feedback problems). The default setting is on (zero).


4.7 Copying Protection

Since two cassette channels are supported, one for reading and one for writing, it is very easy to open appropriate channels and copy any file at all, regardless of its content, onto another tape. This can be done fairly easily with a BASIC "COPY" command. The cassette driver contains a facility for protecting a file against this very simple type of copying.

When a file is created, and the header written out, the current value of the EXOS variable PROTECT is copied into the header. If this is zero (the default) then the file is not protected. If it is non­zero then the file is marked as a protected file.

When a read channel is opened, and the header is read in, the protect flag from the header is examined. If it is zero then no special action is taken. If it is non­zero then the cassette driver will not permit a write channel to be open at the same time as this read channel. Thus is a write channel is already open then this open channel call will be rejected with a .PROT error. If this open channel is accepted then further create channel calls will be rejected with the same error.


Next Chapter: Hardware.



David Bouman. (dsbouma@cs.vu.nl)