BBC TAPE FILE FORMATS
BBC->BBC->FileFormat->Tape Search

Tape files contain blocks of the raw bytes of tape or ROM data. All blocks start with a block header byte, followed by a header and data as appropriate.

Header Block

  +--------+---+-----------------------+
  | Offset |Len| Description           |
  +--------+---+-----------------------+
  | 00     | 1 | &2A header sync byte  |
  +--------+---+-----------------------+
  | 01     | n | FILENAME 1-10 chars   |
  +--------+---+-----------------------+                   
  | 1+n    | 1 | &00                   |                   
  +--------+---+-----------------------+                   
  | 2+n    | 4 | LOAD address          |                   
  +--------+---+-----------------------+                   
  | 6+n    | 4 | EXEC address          |                   
  +--------+---+-----------------------+                   
  | 10+n   | 2 | BLOCK number          |                   
  +--------+---+-----------------------+                   
  | 12+n   | 2 | LENGTH = m            |
  +--------+---+-----------------------+ FLAG:b7=last block
  | 14+n   | 1 | FLAG                  |      b6=no data
  +--------+---+-----------------------+      b0=*RUN only
  | 15+n   | 4 | NEXT address          |
  +--------+---+-----------------------+                   
  | 19+n   | 2 | CRC                   |
  +--------+---+-----------------------+
  | 21+n   | m | DATA                  |
  +--------+---+-----------------------+
  | 21+n+m | 2 | CRC                   |
  +--------+---+-----------------------+

Middle Block

  +--------+---+-----------------------+
  | Offset |Len| Description           |
  +--------+---+-----------------------+
  | 00     | 1 | &23 middle block byte |
  +--------+---+-----------------------+
  | 01     | m | DATA                  |
  +--------+---+-----------------------+
  | 01+m   | 2 | CRC                   |
  +--------+---+-----------------------+

End Block

  +--------+---+-----------------------+
  | Offset |Len| Description           |
  +--------+---+-----------------------+
  | 00     | 1 | &2B end block byte    |
  +--------+---+-----------------------+
The NEXT address is only used in ROMs and points to the start of the header of the next file to enable fast scanning past unmatched files. A middle block increments the BLOCK number and LOAD address appropriately.

The tape system only ever saves header blocks. While the combined tape and ROM filing system code will read a middle block, the tape hardware only responds to header blocks starting with an &2A byte.

If you do NEW then SAVE "PROG", the following bytes will be saved:

2A 50 52 4F 47 00 00 19 FF FF 23 80 FF FF 00 00 02 00 80 00 00 00 00 cc cc 0D FF cc cc

^^................ header sync byte
   ^^^^^^^^^^^.... filename
              ^^.. filename terminator
      load addr ..^^^^^^^^^^^
      exec addr ..............^^^^^^^^^^^
      block number .......................^^^^^
      block length .............................^^^^^
      block flag .....................................^^
      address of next file ..............................^^^^^^^^^^^
      header CRC ....................................................^^^^^
      data ................................................................^^^^^
      data CRC ..................................................................^^^^^



This page last updated 11-Aug-2006