The Machine
T32 is small enough that we can describe the whole machine on one page. That is a lovely property for learning.
Registers and pointers
T32 has four pieces of execution state you will think about most often:
PC: the program counter, which points at the next instructionA: a single 8-bit general-purpose registerDP: a 16-bit data pointer used to access memorySP: a 16-bit stack pointer used by stack operations and subroutines
Memory
T32 has a 64 KiB memory tape. Programs are loaded at the start of memory,
and execution begins at address $0000.
This means code and data live in the same address space. In practice, many T32
programs place instructions first and data later in the file, often after a
HLT or at the bottom of the source.
Flags
The virtual machine maintains two status flags:
Z: set when the most recent result is zeroN: set when the most recent result is negative in signed 8-bit terms
You mainly use these with conditional jumps such as JEQ and JNG.
The machine model in one sentence
Most T32 programs follow a simple rhythm:
- point
DPat some memory - move bytes between memory and
A - compute in
A - branch using flags
- use the stack when a value must survive across calls or temporary work
That is the whole dance.
Why this design is interesting
T32 is deliberately constrained:
- only one general-purpose register
- only 32 instructions
- 8-bit arithmetic
- explicit memory movement
These constraints make data flow visible. You can often look at a short T32 program and see exactly where every value comes from and where it goes.