The image consists of three different components in this fixed order: imageheader, objectheaders and byte codes.
The imageheader tells something about image version, filesize, no of objectheaders (objects) and no of global variable bytes.
Objectheaders contains different informations depending on the nature of the object:
- The VMTHREAD object (former TBC_TOPVI)
- OffsetToInstructions tells were to find the corresponding byte codes (offset from image start)
- OwnerObjectId must be zero
- TriggerCount is used but must be zero
- LocalBytes describes the number of bytes for local variables
- The SUBCALL object (former TBC_VI and TBC_VI_ALIAS)
- OffsetToInstructions tells were to find the corresponding byte codes (if alias this is equal to mother object)
- OwnerObjectId must be zero
- TriggerCount is used and must be one
- LocalBytes describes the number of bytes for local variables
The BLOCK object (former CLUMP)
- OffsetToInstructions tells were to find the corresponding byte codes (offset from image start)
- OwnerObjectId is equal to object id it belongs to (not equal to zero)
- TriggerCount is used to determine how many triggers needed before the BLOCK object is activated
- LocalBytes must be zero (locals are defined in the owner object)
Byte codes are described in a different section.
Little Endian are used (addresses and data are represented with LSB on lowest address and MSB on highest address).
Offset to instructions is number of bytes from start of image to start of object instructions.
Index to global variables are byte based and counted from start of globals (zero based).
Index to local variables are byte based and counted from start of object locals (zero based).
Object ID's is not zero based - First object (VMTHEAD) is named 1.
FILE layout (aligned)
- IMGHEAD (aligned)
- Sign (4 bytes)
- ImageSize (4 bytes)
- VersionInfo (2 bytes)
- NumberOfObjects (2 bytes)
- GlobalBytes (4 bytes)
- OBJHEAD (aligned)
- OffsetToInstructions (4 bytes)
- OwnerObjectId (2 bytes)
- TriggerCount (2 bytes)
- LocalBytes (4 bytes)