+3DOS File Header

The +3DOS File Header

Tape files have headers which contain some system information. +3DOS files may, or may not, have headers. All files created by BASIC's SAVE command will have headers.

The +3DOS header mechanism provides a dedicated 8 byte area in each headed file reserved for BASIC's use. The remainder of the header is reserved for +3DOS. This 8 byte header is utilised in files created by BASIC commands (see DOS OPEN description).

+3DOS files may have a single header in the first 128 bytes of the file - the header record. These headers are detected by a 'signature' and checksum. If the signature and checksum are as expected, then a header is present; if not, there is no header. Thus, it is possible, but unlikely, that a file without a header could be mistaken for one with a header.

+3DOS File Header
Bytes Length Content
078+3DOS Signature"PLUS3DOS"
11144Length of file including header
15228+3 BASIC Header
1271ChecksumSum bytes 0…126 AND 0xFF
+3 BASIC Header
Bytes Length Content
01File Type
122File Length
342Param 1
562Param 2
71Unused = 0x00
BASIC File Type
Type File Description Param 1 Param 2
0 BASIC Program Line number to start Start of variable area relative to program start
1 Number Array Variable name, e.g. if DIM a() then this is 0x80 a=0x81, y=0x99
2 Character Array Variable name, e.g. if DIM a$() then this is 0x80 a=0xC1, y=0xD9
3 CODE Start when saved 32768


  • The file header is the first 128 bytes of the file on disk.
  • The Length at bytes 11 is a 32-bit number, the max file size is 8Mb. This includes the 128 byte header.
  • The BASIC header at byte 15 is what IX points to after a call to DOS_READ_HEAD so (IX+0) is the File Type.
  • The length in the BASIC header is the actual length of the file, without the 128 byte header.
  • For File Type 0 - BASIC, Param 1 is either the line number to start execution or 0x8000 for none. Param 2 is the offset of variables. For most purposes this can be the length of the program so no variables.
  • For File Type 3 - CODE, Param 1 is the load address. Param 2 is unused
  • The checksum byte 127 in the header is the sum of the rest of the header, not XOR like tape files.
Last modified November 24, 2021: Start of +3DOS documentation (253d8cc)