# tonkobali Rust project for the [Programming with Rust](https://2024.fmi.rust-lang.bg/) elective at FMI. This is a small [SUBLEQ](https://en.wikipedia.org/wiki/One-instruction_set_computer#Subtract_and_branch_if_less_than_or_equal_to_zero)-based virtual machine and assembler for it. More information can be found in the READMEs of the appropriate crates. Some example programs are provided in `examples`. ## Detailed demo ![](detailed_demo.mp4) ## Usage Install `cargo` on your system. For Nix-capable machines you may get an environment with everything you need with: ```sh nix develop ``` To assemble and then execute the `math.s` program just execute: ```sh cargo run --bin assembler -- ./examples/math.s cargo run --bin vm -- ./program.bin ``` Wait until you see a prompt with `HALTED` with red background to the left of your cursor. You're now in the interface of the virtual machine. Then enter `1000.1001`, you should get the following output: ``` 1000: 55 1 ``` To exit the vm enter `quit`. ## Resources - [Wikipedia on SUBLEQ](https://en.wikipedia.org/wiki/One-instruction_set_computer#Subtract_and_branch_if_less_than_or_equal_to_zero) - [masswerk's 6502 instruction set](https://www.masswerk.at/6502/6502_instruction_set.html#AND) - [rmac's source format](https://rmac.is-slick.com/manual/manual/#source-format) - [sbprojects on wozmon](https://www.sbprojects.net/projects/apple1/wozmon.php) ## Name The name of this project has some logic behind it. "SUBLEQ" can be shortened to "SL". "SL" also stands for [Sierra Leone](https://en.wikipedia.org/wiki/Sierra_Leone), a small african country. Sierra Leone is divided into [16 districts](https://en.wikipedia.org/wiki/Districts_of_Sierra_Leone), the two center-most being "Tonkolili" and "Bombali". Therefore, "tonkobali" represents the composition of the two central components inside SL. Before, the vm crate was called "tonkolili" and assembler - "bombali". These names were dropped because they were confusing.