Difference between revisions of "AMSDOS Header"

From CPCWiki - THE Amstrad CPC encyclopedia!
Jump to: navigation, search
(Update summary to a table)
(Fix errors)
 
(One intermediate revision by the same user not shown)
Line 10: Line 10:
 
|-
 
|-
 
| 3 BYTES || Extension || Unused characters are filled with space
 
| 3 BYTES || Extension || Unused characters are filled with space
 +
|-
 +
| DWORD || Zero || Contains all zeroes
 
|-
 
|-
 
| BYTE || Block number || Tape only
 
| BYTE || Block number || Tape only
Line 15: Line 17:
 
| BYTE || Last block || Tape only
 
| BYTE || Last block || Tape only
 
|-
 
|-
| BYTE || File type || 0:BASIC 1:Protected 2:Binary (ASCII files don't have headers)
+
| 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")
 
|-
 
|-
| WORD || Length || ???
+
| WORD || Data location || Address of the 2KB buffer
 
|-
 
|-
| WORD || Load address ||  
+
| WORD ||Load address ||  
 
|-
 
|-
| BYTE || First block || Tape only?
+
| BYTE || First block || Set to #FF, only used for output files
 
|-
 
|-
| WORD || Logical length || Actual file length is here
+
| WORD ||style="white-space: nowrap;"|  Logical length || Actual file length is here
 
|-
 
|-
 
| WORD || Entry address ||  
 
| WORD || Entry address ||  
Line 33: Line 35:
 
| WORD || Checksum || Unsigned sum of all bytes until this field
 
| WORD || Checksum || Unsigned sum of all bytes until this field
 
|-
 
|-
| 59 BYTES || Unused || Free to use
+
|style="white-space: nowrap;"|59 BYTES || Unused || Free to use
 
|}
 
|}
  

Latest revision as of 21:49, 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
DWORD Zero Contains all zeroes
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 but a fake header is built in memory with the file type #16, "Unprotected ASCII v1")
WORD Data location Address of the 2KB buffer
WORD Load address
BYTE First block Set to #FF, only used for output files
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.