z80:The Application Header

From Learn @ Cemetech
Jump to: navigation, search

Applications need a header, which is essentially data and info about the app that the OS uses to interact with it. The app header is comprised of fields,some of which are required, others of which are not. It is a long-standing myth that the application header needs to be 128 bytes.

Minimal App Header

   .db $80,$0F ,0,0,0,0    ;This field is required. It is supposed to be the size of the app, but it doesn't get used.
   .db $80,$12 ,$01,$04    ;This is the app signing key. 
   .db $80,$4x ,"name"     ;This is the app name, where 'x' is the length of the name, up to 8.
   .db $80,$81 ,#          ;where # is the number of app pages used.
   .db $80,$90             ;Indicate that there is no splash screen
   .db $03,$22,$09,$00     ;Date stamp. Required, but unused.
   .db $02,$00             ;date stamp signature
   <<insert optional fields>>
   .db $80,$70             ;Indicates the start of the application code.


Optional fields

   .db $80,$7F, 0,0,0,0   ;Field: Program Image length, Length=0, N/A. Basically the size of the app, again.
   .db $80,$21, 1         ;Field: App ID, ID=1
   .db $80,$31, 1         ;Field: App Build, Build=1
   .db $80,$21, 1         ;Field: Program Revision, Revision=1
   .db $80,$C2, 1,13      ;Field: Lowest base code (OS version) that the app can run on. in this example, OS v1.13.