Difference between revisions of "AMSDOS Header"

From CPCWiki - THE Amstrad CPC encyclopedia!
Jump to: navigation, search
(moar info)
(One intermediate revision by one other user not shown)
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 is consists of 128 bytes and contains 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:
  
<pre>
+
Byte 00: User number (value from 0 to 15 or #E5 for deleted entries)
Byte 00: User number (value from 0 to 15 or #E5 for deleted entries)
+
Byte 01 to 08: filename (fill unused char with spaces)
Byte 01 to 08: filename (fill unused char with spaces)
+
Byte 09 to 11: Extension (fill unused char with spaces)
Byte 09 bis 11: Extension (fill unused char with spaces)
+
Byte 16: first block (tape only)
Byte 16: first block (tape only)
+
Byte 17: first block (tape only)
Byte 17: first block (tape only)
+
Byte 18: file type (0:basic 1:protected 2:binary)
Byte 18: type-byte (0: basic 1:protected 2:binary)
+
Byte 21 and 22: loading address LSB first
Byte 21 and 22: loading address LSB first
+
Byte 23: first block (tape only?)
Byte 23: first block (tape only?)
+
Byte 24 and 25: file length LSB first
Byte 24 and 25: file length LSB first
+
Byte 26 and 27: execution address for machine code program LSB first
Byte 26 and 27: execution address for machine code programs LSB first
+
Byte 64 and 66: 24 bits file length LSB first. Just a copy, not used!
Byte 64 and 66: 24 bits file length LSB first
+
Byte 67 and 68: checksum for bytes 00-66 stored LSB first
Byte 67 and 68: checksum for byte 00 to byte 66 LSB first
+
Byte 69 to 127: undefined content, free to use
Byte 69 to 127: undefined content, free to use
+
</pre>
+
  
To calculate the checksum, just add byte 00 to byte 66 to each other.
+
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.
 
This is only a summary. All details are in [[Firmware Guide]] chapter 9, page 4.
  
[[Category:Programming]] [[Category:Disc Operating System]]
+
[[Category:Disc Operating System]]
 +
[[Category:Programming]]

Revision as of 12:56, 20 December 2017

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)
Byte 01 to 08: filename (fill unused char with spaces)
Byte 09 to 11: Extension (fill unused char with spaces)
Byte 16: first block (tape only)
Byte 17: first block (tape only)
Byte 18: file type (0:basic 1:protected 2:binary)
Byte 21 and 22: loading address LSB first
Byte 23: first block (tape only?)
Byte 24 and 25: file length LSB first
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 67 and 68: checksum for bytes 00-66 stored LSB first
Byte 69 to 127: undefined content, 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.