The cassette handler sends data to the cassette recorder in blocks of
128 bytes each. The blocks are sent in the following format:
Cassette record format
-----------------
|0 1 0 1 0 1 0 1| speed measurement bytes
-----------------
|0 1 0 1 0 1 0 1|
-----------------
| control byte |
-----------------
| 128 |
= data =
| bytes |
-----------------
| checksum | handled by SIO
-----------------
The control byte may have one of the following values.
$FC (252) record is full.
$FA (250) partly full, next record is EOF.
$FE (254) EOF record, data section is all zeroes.
The cassette handler has two modes of operation. The first mode uses
only a short gap between records. It is called the no IRG
(interrecord gaps) mode. The second mode uses longer gaps between
records and is called the IRG mode. In the IRG mode the computer may
stop the cassette recorder between records for processing data.
When a channel is opened to the cassette recorder, bit 7 of ICAUX2 may
be set to 1 (ICAX2 = $80 (128)). This will cause the cassette to use
the no IRG mode.
A cassette file starts with a 20 second mark tone. This tone is
followed by the file records with 128 data bytes each. The final
record is an End-Of-File record.
The cassette is a straight-forward read/write device. There are no
special functions other than those common to other CIO devices.
The cassette motor is controlled by one of the controller port control
registers. If bit 3 of PACTL [$D302 (54018)] is 0 then the cassette
motor is on. The following BASIC commands will turn the cassette
motor on and off.
Cassette motor control.
POKE 54018,PEEK(54018)-8 motor on
POKE 54018,PEEK(54018)+8 motor off
Useful data base variables and OS equates
PACTL $D302 (54018): port A control register, bit 4
controls cassette motor