Classic Computer Magazine Archive COMPUTE! ISSUE 1 / FALL 1979 / PAGE 81

CASSETTE FORMAT REVISITED

Pulse Position modulation is used in the PET (cries of ‘what's that?’). At regular intervals a byte marker pulse is written on the tape, followed by bit pulses, the elapsed time defining the ‘0’ or ‘1’. This method has several advantages. Because the bit pulses are referenced to the byte marker, data is fairly immune to variations in tape speed. If 8 bits do not follow the marker, there has been an error.

Three time periods are defined: Long (L) = 336 ± 5uS (1.49kHz), Medium (M) = 256 ± 5uS (1.49kHz), Short (S) = 176 ± 5uS (2.84kHz), and these are used to define a Word Marker = LLMM, ‘1’ = MMSS and ‘0’ = SSMM, where LLMM means: long ‘1’, long ‘0’, medium ‘1’, med ‘0’. Now to words, ASCII ‘A’ = 01000001 which, when preceded by the word marker and terminated with odd parity gives

LLMMMMSSSSMMSSMMSSMMSSMM

SSMMMMSSSSMMMMSS

• mkr 1 0 0 0 0 0 1 0 1 • gives a character length of 8.96mS. Note 8 bits plus parity to accommodate graphics. Now since it is inefficient to start and stop the tape for each character, they are stored in memory (635-825 or 827-1017 for = 1 or = 2) until sufficient to make up a block of data. I will deal with programs later as they differ from data. Now since data blocks are 191 bytes each a further check is possible (long or short block error). Each block is written twice and if an error is found in the first block, the second is used. Only if the corresponding byte in both blocks is in error can we not recover data.

Now the crunch. The cassette motor takes time to run up to speed and the interblock gap is there to allow for this. If we try to read the tape while the motor is still accelerating, errors are likely to occur. If the first byte or two are not recognized, the block is discarded. Should this contain the mark for end-of-file (EOF) or end-of-tape (EOT) the PET would crash. Owing to a bug in the operating system the inter-block gap is too short … It is relatively simple to turn the cassette motor on before the buffer is full and patches for this have been printed in IPUG circulars but most comprehensively in the TIS Workbooks.

Two more definitions: Block end marker = LL plus leader, Leader = over 50 cycles of shorts.

PROGRAM FILE DATA FILE HEADER & END FORMATS
Header 192 bytes Header 192 bytes Low Starting
Repeated header Repeated header High Address
Program (one long block) Data block 192 bytes Low Ending
Repeated data block High Address
Repeated prog. Data block as reqd. ASCII Up to
Repeated as reqd. Prog 16
End block chars
Data + spaces to end
Repeated end. Repeat above ASCII
End block Sp Spaces
Repeat end. to 191
ALL BLOCK TYPES
Leader First leader 2 secs approx.
Count 9 bytes First pass $89, 88,...81
Down Second pass $09, 08,...08
Type
Data If data or header 191 bytes
area If program, length of program
Check-sum Exclusive-OR checksum of above (hdr type)
Block Block end marker, 1 cycle long
end mkr
Leader Approx 450 cycles of leader (0.16 secs)

Reprinted by permission: Norman Basson, Independent PET Users Group of England