Skip to main content
Thru executable programs follow a specific binary format that includes a header, program bytecode, and footer.

Program Structure

A Thru executable consists of three main components:
ComponentSizeDescription
Header8 bytesVersion and metadata
ProgramVariableExecutable bytecode
Footer4 bytesZero terminator

Header Format

The header is exactly 8 bytes long and contains version information.

Header Layout

OffsetSizeFieldDescription
01VersionProgram format version (0x01)
1-77ReservedReserved for future use

Version Field

Currently, only version 0x01 is supported.
Example Header
01 00 00 00 00 00 00 00
^^ Version (0x01)
   ^^^^^^^^^^^^^^^ Reserved (7 bytes, typically zero)

Program Bytecode

The program bytecode section contains the executable instructions:
  • Starts immediately after the 8-byte header
  • Variable length depending on the program size
  • Contains the actual program instructions
  • Minimum size is 0 bytes (empty programs are valid)
The footer is exactly 4 bytes long and serves as a terminator.
OffsetSizeFieldDescription
-44TerminatorMust be zero (0x00000000)
The last 4 bytes of the executable must be set to zero.
Example Footer
00 00 00 00
^^^^^^^^^^^^ All bytes must be zero

Size Constraints

  • Total minimum size: 12 bytes (8-byte header + 4-byte footer)
  • Header size: Exactly 8 bytes
  • Footer size: Exactly 4 bytes
  • Program size: Variable (minimum 0 bytes)

Complete Example

Here’s a minimal valid Thru executable:
Minimal Executable
01 00 00 00 00 00 00 00   // Header: version 0x01 + 7 reserved bytes
95 00 00 00 00 00 00 00   // Program: 8 bytes of instructions
00 00 00 00               // Footer: 4 zero bytes
In this example:
  • Total size: 16 bytes
  • Header size: 8 bytes
  • Program size: 4 bytes
  • Footer size: 4 bytes
The executable format provides extensibility through the version field for future format changes while maintaining a simple structure for current programs.