[Coco] .CAS file format

Ciaran Anscomb cocomalt at 6809.org.uk
Mon Dec 17 03:14:02 EST 2012


Robert Gault wrote:
> Bill Pierce wrote:
> 
> > I thought the "cas" format was just a special wav format, not a "byte by
> > byte" storage format?
> 
> > From: Luis Antoniosi <retrocanada76 at gmail.com>
> > > 
> > is byte-by-byte. Open it in an hex editor and you will see.
> 
> I'm glad this came up as a topic, because you are both right! This may also
> explain some of the problems users of emulators may be having. It won't
> explain the errors many files produce when converted from Coco tapes to sound
> files.
> 
> VCC uses a fake cassette format for CSAVE which has a header of 128 bytes of
> $55, a file name with some special characters, 128 bytes of $55, and then the
> tokenized Basic program. MESS uses a sound file which emulates a cassette
> file. The CSAVE file is a RIFF , Windows PCM, 44.1kHz, 16-bit mono.

Think of each 0 bit as a cycle of 1200Hz and each 1 bit as a cycle
of 2400Hz (kinda - I actually think they get written closer to 1100Hz
and 2100Hz).  Read out bytes lowest bit first.

The various tools (including XRoar in -tape-rewrite mode) will try and
keep the bytes in the CAS file synchronised with bytes in memory (for
readability in hex editors!), but there's no reason they have to be.

The simplicity of the format also means CAS can't represent different
pulse widths (well, you could make your emulator observe BASIC's idea
of expected pulse width and simulate that, but that wouldn't work for
custom loaders).

FWIW I've often thought it would be nice to extend CAS to be able to
represent different pulse widths, raw audio, etc. in the same way as
TZX as used in the Spectrum emulator world.  You could make command
bytes of $55 or $AA indicate "normal CAS data until end of tape", thus
keeping a measure of backwards compatibility...

..ciaran



More information about the Coco mailing list