Tape questions

From: Marko Mäkelä (msmakela_at_cc.hut.fi)
Date: 2001-09-07 08:34:15

Last night I made some measurements with the datassette emulator I've been
working on.  I already had some information of the tape format, thanks to
the book "Commodore 64 Whole Memory Guide" by Tim Arnot.

I became somewhat disappointed at that book, though.  Its information
appears to be based on outdated information.  The frequencies of the
short, medium and long pulses are said to be 2840 Hz (352 µs cycle time),
1953 Hz (512 µs) and 1488 Hz (672 µs).  I composed the following table of
my measurement results:

	PAL VIC-20	CBM 8032SK	PAL C64		PAL C128
short	37..42 (316±20)	41..46 (348±20)	45..50 (380±20)	48..53 (404±20)
medium	55..59 (456±16)	61..65 (504±16)	65..69 (536±16)	68..72 (560±16)
long	75..77 (608±8)	83..86 (676±12)	87..90 (708±12)	90..93 (732±12)
bck/MHz	1.108404	1		.940 (.985248)	.920 (.985248)

The measurement unit was 8 MHz / 64, or 8 microseconds.  The numbers
preceding the parentheses are multiples of 8 microseconds, and the numbers
in parentheses are (average +/- error) values given in microseconds.  The
book's information turns out to coincide with the PET tape format.

I was surprised to see that the PAL C64 (or C128 in C64 mode) uses
different tape frequencies from the PAL C128.  Also the C64 does not use
the same timer values as the VIC-20.  The difference between the C64 and
PET tape frequencies is much bigger than the clock speed difference.

I think that the values for the NTSC VIC-20, C64 and C128 should lie
somewhere within the limits of this table.  I derived the following common
tolerances (in multiples of 8 µs):

short   37..53 (45±8)
medium  55..72 (63½±8½)
long    75..93 (84±9)

In the book, I think it said there would be a 8-bit checksum at every 8
bytes of data.  I didn't find anything like that.  I was surprised to see
that the data is recorded in little-endian format (least significant bit
first).  The book correctly said that there is a parity bit for each byte,
but forgot to state that it is odd parity.

I logged some data for analysis and manually decoded the pulses of an
one-line "hello world" type program I saved from a C64.  It was like this:

first header:
89 88 87 86 85 84 83 82 81
01 01 08 11 08 4b 41 41 4b 4b 49 20*181 33 (*181 means "repeated 181 times")
[01=relocatable program, from 0801 to 0811, name "KAAKKI"+181 spaces]
[checksum=33]

second header:
09 08 07 06 05 04 03 02 01
01 01 08 11 08 4b 41 41 4b 4b 49 20*181 33 (*181 means "repeated 181 times")

first copy of program data:
89 88 87 86 85 84 83 82 81
0f 08 0a 00 99 22 4b 49 49 4b 4b 41 22 00 00 00 9e
[     10     ?  "  K  I  I  K  K  A  "]
[checksum=9e]

second copy of program data:
09 08 07 06 05 04 03 02 01
0f 08 0a 00 99 22 4b 49 49 4b 4b 41 22 00 00 00 9e

Questions: does anyone know the formula for computing the checksum?  And
what about the synchronization sequences 89..81 and 09..01: are they
always like these for all types of tape records (non-relocatable program,
tape I/O data block, ...)?

	Marko


       Message was sent through the cbm-hackers mailing list

Archive generated by hypermail 2.1.1.