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:
Byte 00: User number Byte 01 to 08: filename Byte 09 bis 11: Extension Byte 18: type-byte Byte 21 and 22: loading address Byte 24 and 25: file length Byte 26 and 27: execution address for machine code programs Byte 64 and 65: checksum for byte 00 to byte 66 Byte 67 and 68: (file length)
To calculate the checksum, just add byte 00 to byte 66 to each other.
This is only a summary. All details are in Firmware Guide chapter 9, page 4.