Getting Started
Let us get a working T32 toolchain on your machine first.
What the toolchain does
T32 is a fictitious assembly language. There is no physical T32 processor you can buy or boot, so running a T32 program always involves software that understands the instruction set.
In this repository, that software is the t32 executable. It is an all-in-one
tool that combines the two things you need:
- an assembler, which turns
.s32source code into T32 machine code - a virtual machine, which emulates the T32 processor and runs that code
That means the usual workflow looks like this:
- write a T32 assembly program in a
.s32file - assemble it into a
.o32object file - run that object file in the virtual machine
This is a very friendly setup for learning, because you do not need separate tools, a custom runtime environment, or any real hardware. Everything is bundled into one executable.
Build the project
From the repository root:
mkdir build
cd build
cmake ..
make -j
This builds:
- the
t32executable - the test suite
To run the tests:
make test
The three commands
The t32 executable currently supports three subcommands, though most users
will mainly care about the first two:
assemble: turn a.s32source file into a.o32object filerun: execute a.o32program in the virtual machineparse: inspect the parsed token stream for a.s32file, mainly useful for debugging the assembler or source syntax
In other words:
assembleis how you build a T32 programrunis how you execute itparseis mostly a developer aid
Here is the normal assemble-and-run flow:
APP="hello"
./t32 assemble ../examples/${APP}.s32 ../examples/${APP}.o32
./t32 run ../examples/${APP}.o32
You can think of assemble as producing the bytes that would live in T32
memory, and run as starting the fictional processor inside the emulator.
Where to go next
If you want the big picture first, continue to The Machine. If you would rather see code right away, jump to Your First Program.