| Name | Size | |
|---|---|---|
| .. | ||
| Cargo.toml | 126 B | log stats plain blame |
| README.md | 2.2 KiB | log stats plain blame |
| src | 94 B | log stats plain |
tonkobali virtual machine
This is a virtual machine which executes SUBLEQ instructions. The idea is we have a vector of words (i64) which represents our entire memory. We use a certain amount of addresses in the beginning of this memory for our purposes.
Since we have only one instruction we only store data, no opcodes. When the virtual machine program counter is at a certain location, the next three values from memory are read and SUBLEQ is executed with those values as arguments. This continues until the program jumps to address 0, when we reach a "HALTED" state.
TUI
Once started, you may enter commands for the VM, and to the left of your cursor you'll see vertical bars. If the contents of these bars is empty, it means the machine is executing instructions. If the contents are "HALTED", the machine has stopped executing. If the contents are "STEP", the VM is in single-step mode.
All commands and their meaning can be found by issuing help:
<ADDRESS> is a usize constant
<VALUE> is a Word (i64) constant
Multiple 'Memory IO' commands may be put on a single line, when
separated by spaces
General commands:
h, ?, help This menu
q, e, quit, exit Stop and exit the virtual machine
Normal execution:
r, run <ADDRESS> Start normal execution at ADDRESS
Only applicable when 'HALTED'
Single-step execution:
s, single <ADDRESS> Start single-step execution at ADDRESS
c, continue Resume normal execution
Only applicable when in 'STEP' mode
n, next Execute next instruction
Only applicable when in 'STEP' mode
Memory IO:
<ADDRESS> Print the value at the location
<ADDRESS>.<ADDRESS> Print the values between the locations
(inclusive range)
<ADDRESS>:<VALUE> Set value at ADDRESS to VALUE
Single-step mode allows you to execute only a single instruction at a time.
After each execution the arguments to SUBLEQ are printed.
At any point you may manipulate the memory.
Then you can execute the next single instruction (with next) or resume normal execution (with continue).
The memory io commands are inspired from Steve Wozniak's wozmon.
