Difference between revisions of "AMSDOS Header"

From CPCWiki - THE Amstrad CPC encyclopedia!
Jump to: navigation, search
(Update summary to a table)
Line 1: Line 1:
 
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:
 
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:
  
Byte 00: User number (value from 0 to 15 or #E5 for deleted entries)
+
{| class="wikitable"
Byte 01 to 08: filename (fill unused char with spaces)
+
|-
Byte 09 to 11: Extension (fill unused char with spaces)
+
! Size !! Name !! Notes
Byte 16: first block (tape only)
+
|-
Byte 17: first block (tape only)
+
| BYTE || User number || 0-15, or #E5 for deleted entries
Byte 18: file type (0:basic 1:protected 2:binary)
+
|-
Byte 21 and 22: loading address LSB first
+
| 8 BYTES || Filename || Unused characters are filled with space
Byte 23: first block (tape only?)
+
|-
Byte 24 and 25: file length LSB first
+
| 3 BYTES || Extension || Unused characters are filled with space
Byte 26 and 27: execution address for machine code program LSB first
+
|-
Byte 64 and 66: 24 bits file length LSB first. Just a copy, not used!
+
| BYTE || Block number || Tape only
Byte 67 and 68: checksum for bytes 00-66 stored LSB first
+
|-
Byte 69 to 127: undefined content, free to use
+
| BYTE || Last block || Tape only
 +
|-
 +
| BYTE || File type || 0:BASIC 1:Protected 2:Binary (ASCII files don't have headers)
 +
|-
 +
| WORD || Length || ???
 +
|-
 +
| WORD || Load address ||
 +
|-
 +
| BYTE || First block || Tape only?
 +
|-
 +
| WORD || Logical length || Actual file length is here
 +
|-
 +
| WORD || Entry address ||
 +
|-
 +
| 36 BYTES || Unused ||
 +
|-
 +
| 3 BYTES || Real length || 24-bit number. Just a copy, not used!
 +
|-
 +
| WORD || Checksum || Unsigned sum of all bytes until this field
 +
|-
 +
| 59 BYTES || Unused || Free to use
 +
|}
  
 
To calculate the checksum just add all bytes from 00 up to and including byte 66 together.
 
To calculate the checksum just add all bytes from 00 up to and including byte 66 together.

Revision as of 21:39, 12 January 2021

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:

Size Name Notes
BYTE User number 0-15, or #E5 for deleted entries
8 BYTES Filename Unused characters are filled with space
3 BYTES Extension Unused characters are filled with space
BYTE Block number Tape only
BYTE Last block Tape only
BYTE File type 0:BASIC 1:Protected 2:Binary (ASCII files don't have headers)
WORD Length  ???
WORD Load address
BYTE First block Tape only?
WORD Logical length Actual file length is here
WORD Entry address
36 BYTES Unused
3 BYTES Real length 24-bit number. Just a copy, not used!
WORD Checksum Unsigned sum of all bytes until this field
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.