Introduction
CSW (Compressed Square Wave) is a format of Ramsoft, a ZX Spectrum demogroup, for square-wave sample data such as computer tapes. It is far smaller than the same recording in an audio format such as VOC. The CSW.EXE utility converts VOC, WAV, IFF and OUT files to CSW and back.
Structure
A binary file with little-endian numbers. It starts with the 22-byte text
Compressed Square Wave and the byte 0x1A, followed by a major and a minor revision
number, the sample rate, the compression type and flags. The data is a list of pulse lengths, one byte each,
with a zero byte introducing a four-byte length for long pulses.
The two known revisions are 1.01 and 2.00. Version 2.00 has a 32-bit sample rate, a pulse count, the name of the writing program and an optional header extension, and adds Z-RLE, which compresses the pulse data further with deflate.
Not described
Known, not yet covered
- Reference: the layout of the format is not yet described here: the header offsets of both revisions and the compression schemes are in Ramsoft’s specification.
- Viewer: the site has no viewer for this format.
Links
Software
- CSW.EXE – Ramsoft’s converter between CSW and audio files (MS-DOS)
- MakeTZX – tape converter on whose engine CSW is strongly based
Developers
- libspectrum – ZX Spectrum file library that reads CSW version 1 (C)
Reference
- CSW technical specifications – Ramsoft’s description, mirror copy