IBM PC data cassette

From Just Solve the File Format Problem
Jump to: navigation, search
File Format
Name IBM PC data cassette
Released 1981

Yes, the IBM PC did have a cassette port at one point. Actually, only the original IBM Personal Computer model 5150, and the later PCjr (intended as a low-end home computer), had this; other PCs did away with this feature which was rarely used on this platform given that just about everybody got their PC with at least one disk drive. Apparently, though, IBM felt that when they made their entry into the PC field (after years of regarding small computers as "toys" unworthy of their attention) they needed to be sure their machine duplicated all the features present in other brands of personal computers around at the time, and most of them had cassette interfaces then because disk drives had been so expensive in recent history (and those computers were aimed at home/hobby markets with limited budgets). By the time of the IBM PC, disk drives had come down in price, while IBM's computers were aimed at a more upscale business/professional market, so cassettes saw little use there.

The format consists of 1-millisecond-long pulses for each 1 bit, and 0.5-millisecond pulses for each 0 bit. A tape record starts with a leader of 256 bytes of all 1 bits (hex FF), followed by a single synchronization bit (0), and then a synchronization byte (hex 16, the ASCII character from the C0 controls designated as SYN). This is followed by one or more 256-byte data blocks. Each data block is followed by a 2-byte CRC, with the most significant byte first. After the last block, a 4-byte trailer is written of all 1 bits (hex FF).

Tokenised BASIC programs and memory areas saved by IBM Cassette BASIC consist of two records: the first one is a header (always 256 bytes, of which the first 16 are significant), and the second one contains the data.

ASCII listings and data files consist of a sequence of 256-byte records; the first one is a header, as above, and subsequent ones contain the data. If the first byte of the record is 0, this is not the last record, and all 255 following bytes are valid data. Otherwise it gives the number of valid bytes in the last record, plus one.

The header layout is:

Offset Size Description
0x00 Byte Always 0xA5
0x01 8 bytes Filename, ASCII
0x09 Byte Flags:
Bit Meaning if set Example command to create
7 Tokenised BASIC SAVE "file"
6 ASCII listing SAVE "file", A
5 Protected tokenised BASIC SAVE "file", P
0 Memory area BSAVE "file", address, length
No bits set Data OPEN "O",1,"file"
0x0A Word Number of bytes in the following data record (little-endian word)
0x0C Word Segment of load address (little-endian word)
0x0E Word Offset of load address (little-endian word)


Personal tools