AMSDOS Header

From CPCWiki - THE Amstrad CPC encyclopedia!
Revision as of 15:44, 7 November 2023 by PulkoMandy (Talk | contribs)

Jump to: navigation, search

In AMSDOS it is possible to store files in two ways: headerless and with a header. Headerless files are often files which were created with OPENOUT and SAVE"filename",a. Programs normally have a file header, which consist of 128 bytes and contain the following data:

Offset Size Name Notes
0 BYTE User number 0-15, or #E5 for deleted entries
1 8 BYTES Filename Unused characters are filled with space
9 3 BYTES Extension Unused characters are filled with space
C DWORD Zero Contains all zeroes
E BYTE Block number Tape only
F BYTE Last block Tape only
10 BYTE File type 0:BASIC 1:Protected 2:Binary (ASCII files don't have headers but a fake header is built in memory with the file type #16, "Unprotected ASCII v1")
11 WORD Data location Address of the 2KB buffer
13 WORD Load address
14 BYTE First block Set to #FF, only used for output files
15 WORD Logical length Actual file length is here
17 WORD Entry address
19 36 BYTES Unused
3D 3 BYTES Real length 24-bit number. Just a copy, not used!
40 WORD Checksum Unsigned sum of all bytes until this field
42 59 BYTES Unused Free to use

To calculate the checksum just add all bytes from 00 up to and including byte 66 together.

This is only a summary. All details are in Firmware Guide chapter 9, page 4.