Changes

AMSDOS Header

145 bytes added, 11 July
{| class="wikitable"
|-
! Offset !! Size Bytes !! 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 ..11 || Extension || Unused characters are filled with space
|-
| C || DWORD 12..15 || Zero || Contains all zeroes
|-
| 10 || BYTE 16 || Block number || Tape only
|-
| 11 || BYTE 17 || Last block || Tape only
|-
| 12 || BYTE 18 || 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")
|-
| 13 || WORD 19..20 || Data location || Address of the 2KB buffer
|-
| 15 || WORD 21..22 ||Load address ||
|-
| 17 || BYTE 23 || First block || Set to #FF, only used for output files
|-
| 18 || WORD 24..25 ||style="white-space: nowrap;"| Logical length || Actual file length is here
|-
| 1A || WORD 26..27 || Entry address ||
|-
| 1C || 36 BYTES 28..63 || Unused ||
|-
| 40 || 3 BYTES 64..66 || Real length || Length of the file in bytes, excluding the header record. 24-bit number, least significant byte first. Just a copy, not used!
|-
| 43 || WORD 67..68 || Checksum || Unsigned sum of all bytes until this field
|-
| 45 || 59 BYTES 69..127 || Unused || Free to use
|}
 
These headers are detected by checksumming the first 67 bytes of the record. If the checksum is as expected then a header is present, if not then there is no header.
To calculate the checksum just add all bytes from 00 up to and including byte 66 together.
8,323
edits