Changes

AMSDOS Header

1,178 bytes added, 26 April
{| class="wikitable"
|-
! Offset Field !! Size Bytes !! Name !! Notes
|-
| 0 rowspan="10" |System | BYTE | 0 || 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, set to 0
|-
| 11 || BYTE 17 || Last block || Tape only, set to 0
|-
| 12 || BYTE 18 || File type || As per cassette: Bit0 = Protection (set if protected) Bits1..3 = File contents (0:BASIC , 1:Protected Binary, 2:Binary Screen image, 3:ASCII, 4..7 are unallocated) Bits4..7 = Version (ASCII files don't have headers but a fake header is built in memory with the file type #16should be version 1, "Unprotected ASCII v1"all other files should be version 0)
|-
| 13 || WORD 19..20 || Data location length || Address As per cassette: the number of data bytes in the 2KB bufferdata record
|-
| 15 21..22 || WORD ||Load address Data location || As per cassette: where the data was written from originally
|-
| 16 || BYTE 23 || First block || Set to #FF, only used for output files
|-
| 17 rowspan="3" |User | WORD |24..25 |style="white-space: nowrap;"| Logical length || Actual As per cassette: actual file length is here
|-
| 19 || WORD 26..27 || Entry address || As per cassette: the execution address for machine code programs
|-
| 1B || 36 BYTES 28..63 || Unused || As per cassette
|-
| 3F rowspan="3" |AMSDOS | 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!
|-
| 42 || WORD 67..68 || Checksum || Unsigned sum of all bytes until this field
|-
| 44 || 59 BYTES 69..127 || Unused || Free to use
|}
To calculate  These headers are detected by checksumming the checksum just add all first 67 bytes from of the record. If the checksum is as expected then a header is present, if not then there is no header. When a file without a header is opened for input, a fake header is constructed in store as follows: {| class="wikitable"|-! Bytes !! Name !! Notes|-| 0 || User number || User number, #00 up ..#FF|-| 1..8 || Filename || Unused characters are filled with space|-| 9..11 || Extension || Unused characters are filled with space|-| 18 || File type || #16, unprotected ASCII version 1|-| 19..20 || Data location || Address of 2K buffer|-| 23 || First block || Set to #FF|} All other fields are set to and including byte 66 togetherzero.
This is only a summary. All details are in [[Firmware Guide]] chapter 9, page 4.
 
=== Expansion of the AMSDOS Header ===
Some OS and DOS expanded the classic AMSDOS header:
 
1. [[FutureOS Header]]:
* Contains and icon or information text
* File length is 24 Bit
* Defined Loading and Autostart (expansion) RAM configuration
* Additional file types
[[Category:Disc Operating System]]
[[Category:Programming]]
13,147
edits