https://github.com/safememoryzone/tvm
Simple virtual machine with a minimal instruction set.
https://github.com/safememoryzone/tvm
Last synced: about 2 months ago
JSON representation
Simple virtual machine with a minimal instruction set.
- Host: GitHub
- URL: https://github.com/safememoryzone/tvm
- Owner: SafeMemoryZone
- License: mit
- Created: 2024-08-22T18:24:03.000Z (9 months ago)
- Default Branch: master
- Last Pushed: 2024-09-30T12:26:36.000Z (8 months ago)
- Last Synced: 2025-02-10T21:36:48.322Z (3 months ago)
- Language: C
- Size: 88.9 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# tvm
A tiny minimalistic virtual machine.
## Quickstart
```console
$ make
$ ./tvm -c
$ ./tvm out.tvm
```## Note
This project was abandoned and may conatain bugs. As of now, it is only a few steps away from being turing complete. Some instructions even invoke UB if used incorrectly.
## Fibonacci Example
```
; This program calcuates the nth fib specifed by #r7
; For the default value of '10' it should output '55'mov #r0, 0
mov #r1, 1mov #r7, 10 ; nth fib to calculate
%loop
cmp #r7, #r7
jz %done
dec #r7mov #r3, #r1
add #r1, #r0, #r1
mov #r0, #r3jmp %loop
%done
exit 0
```## License
Copyright (c) 2024 Viliam Holly.
This project is licensed under the MIT license.