Program Structure
A Thru executable consists of three main components:| Component | Size | Description |
|---|---|---|
| Header | 8 bytes | Version and metadata |
| Program | Variable | Executable bytecode |
| Footer | 4 bytes | Zero terminator |
Header Format
The header is exactly 8 bytes long and contains version information.Header Layout
| Offset | Size | Field | Description |
|---|---|---|---|
| 0 | 1 | Version | Program format version (0x01) |
| 1-7 | 7 | Reserved | Reserved for future use |
Version Field
Currently, only version0x01 is supported.
Example Header
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)
Footer Format
The footer is exactly 4 bytes long and serves as a terminator.Footer Layout
| Offset | Size | Field | Description |
|---|---|---|---|
| -4 | 4 | Terminator | Must be zero (0x00000000) |
Example Footer
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
- 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.