Format of executable image files
Last modified 1997-09-20

Executable image files hold programs to be executed; the same format is used
for both IMG and APP files. The file contains control information, an
executable (in DOS format), and up to 4 additional included files (for
example, an icon or a resource file).

The format is:

  Offset  0 (cstr): "ImageFileType**"
  Offset 16 (word): image format version ($200F)
  Offset 18 (word): offset of the start of the executable within the file
  Offset 20 (word): size of the code segment, in units of 16 bytes
  Offset 22 (word): location in the code segment to start execution
  Offset 24 (word): stack size         ) each in units of 16 bytes;
  Offset 26 (word): static data size   ) the initial data segment size is
  Offset 28 (word): initial heap size  ) the sum of these three
  Offset 30 (word): amount of initialized static data, in bytes
  Offset 32 (word): checksum of the code
  Offset 34 (word): checksum of the initialized static data
  Offset 36 (word): version number of the program
  Offset 38 (word): initial priority of the program, usually 128
  Offset 40 (word): offset of the start, within the file, of included file 1
  Offset 42 (word): length of included file 1, in bytes
  Offset 44 (word): offset of the start, within the file, of included file 2
  Offset 46 (word): length of included file 2, in bytes
  Offset 48 (word): offset of the start, within the file, of included file 3
  Offset 50 (word): length of included file 3, in bytes
  Offset 52 (word): offset of the start, within the file, of included file 4
  Offset 54 (word): length of included file 4, in bytes
  Offset 56 (word): the number of DYLs within the file
  Offset 58 (long): offset within the file of the DYL information table
  Offset 62 (word): unused

The stack size includes the reserved statics and space for the floating
point emulator (see Psionics File PROCESS). The first part of the static
data is initialized from the data in the IMG file (stored immediately after
the executable), and the remainder is filled with zeros.

The version number of the program is for internal documentation; it does
not affect the execution of the program. Most development tools set this
to $100F (meaning "1.00 final release").

The resource handling facilities in the system expect the second included
file to be a resource (RSC or RZC) file. The system screen requires the
third included file to be a shell data (SHD) file. Any of the four included
files can be a PIC file holding the icon.

If any of the included files has a zero offset, further entries might be
ignored. Thus if there is no second file but a third file, a zero-length
second file should be provided.

An APP file must include a PIC file holding one of:
- a 24x24 bitmap (Series 3t icon);
- two 48x48 bitmaps (Series 3a icon, black plane then grey plane);
- a 24x24 bitmap followed by two 48x48 bitmaps (both forms).

@@@ SHD files

I have no information about the format of DOS executables. @@@