The Squeak image is an object memory space that is loaded by the virtual machine (VM), usually from a data file (squeak.image). When activated by the VM, the object memory becomes a live object environment running under the control of the VM.
With ongoing development of VM, and associated changes to the structure of objects in the live object memory, it becomes necessary to identify the format of the image when saved externally (e.g. to a file on disk).
The "image format" is a numeric identifier, stored in the first few bytes of an image file, that identifies the format of the saved image. The VM uses this image format number to determine whether it is able to execute the image file, and possibly it identify characteristics of the image that may require special handling in the VM.
The known image format numbers, along with explanations of the VM capabilities required by that image format, are described in a Smalltalk package ImageFormat that is maintained in the VMMaker repository.
The main class in the ImageFormat package is class ImageFormat:
ImageFormat represents the requirements of the image in terms of capabilities that must be supported by the virtual machine. The image format version is saved as an integer value in the header of an image file. When an image is loaded, the virtual machine checks the image format version to determine whether it is capable of supporting the requirements of that image.
The image format version value is treated as a bit map of size 32, derived from the 32-bit integer value saved in the image header. Bits in the bit map represent image format requirements. For example, if the image sets bit 15 to indicate that it requires some capability from the VM, then the VM can check bit 15 and decide whether it is able to satisfy that requirement.
The base image format numbers (6502, 6504, 68000, and 68002) utilize 10 of the 32 available bits. The high order bit is reserved as an extension bit for future use. The remaining 21 bits are used to represent additional image format requirements. For example, the low order bit is used to indication that the image uses (and requires support for) the platform byte ordering implemented in the StackInterpreter (Cog) VM.
"(ImageFormat fromFile: Smalltalk imageName) description"
The Smalltalk class ImageFormat is also used to generate the source code for the C language ckformat program.
ImageFormat versionDescriptions do: [:e | Transcript cr; show: e]
(ImageFormat fromFile: Smalltalk imageName) description