Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/omrawaley/txt-8
TXT-8 is a simple 8-bit text-based virtual machine with the intent of education on virtualization.
https://github.com/omrawaley/txt-8
c command-line computer computer-architecture cpp emulation emulator instruction-set-architecture instruction-set-emulation interpreter text-based virtual-machine virtualization
Last synced: 9 days ago
JSON representation
TXT-8 is a simple 8-bit text-based virtual machine with the intent of education on virtualization.
- Host: GitHub
- URL: https://github.com/omrawaley/txt-8
- Owner: omrawaley
- License: apache-2.0
- Created: 2024-11-15T01:10:18.000Z (3 months ago)
- Default Branch: main
- Last Pushed: 2024-12-24T15:02:26.000Z (about 1 month ago)
- Last Synced: 2024-12-24T16:19:32.649Z (about 1 month ago)
- Topics: c, command-line, computer, computer-architecture, cpp, emulation, emulator, instruction-set-architecture, instruction-set-emulation, interpreter, text-based, virtual-machine, virtualization
- Language: C++
- Homepage:
- Size: 43 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# TXT-8 Text-Based Virtual Machine
/$$$$$$$$ /$$ /$$ /$$$$$$$$ /$$$$$$
|__ $$__/| $$ / $$|__ $$__/ /$$__ $$
| $$ | $$/ $$/ | $$ | $$ \ $$
| $$ \ $$$$/ | $$ /$$$$$$| $$$$$$/
| $$ >$$ $$ | $$|______/ >$$__ $$
| $$ /$$/\ $$ | $$ | $$ \ $$
| $$ | $$ \ $$ | $$ | $$$$$$/
|__/ |__/ |__/ |__/ \______/The TXT-8 is a simple 8-bit virtual machine based on the command line.
TXT-8 has a minimal instruction set which demonstrates the fundamental aspects of virtualization.
I originally created TXT-8 to provide digestible substance for my lecture on virtualization for the programming club at my school.
## Specs
Components and specifications of TXT-8.### CPU
- 8x 8-bit general-purpose registers.
- 8-level 12-bit address stack.
- 12-bit stack pointer.
- 12-bit program counter.
- 12-bit index register.### Memory
- 4096 bytes of memory (4KB).
- 12-bit addressing.### Special
- 8-bit output buffer.
- 8-bit buffer pointer that points to the end of the buffer.## Instruction Set
X: 8-bit register (4-bit operand).Y: 8-bit register (4-bit operand).
ADDR: 12-bit address (12-bit operand).
| Opcode | Mnemonic | Operands | Description |
| ------ | -------- | -------- | ------------------------------------------------------------------------------ |
| 0 | CALL | ADDR | Call subroutine |
| 1 | RET | NULL | Return from subroutine |
| 2 | JMP | ADDR | Jump to address |
| 3 | ADD | X, Y | Add X and Y (store in X) |
| 4 | SUB | X, Y | Subtract Y from X (store in X) |
| 5 | AND | X, Y | AND X and Y (store in X) |
| 6 | OR | X, Y | OR X and Y (store in X) |
| 7 | XOR | X, Y | XOR X and Y (store in X) |
| 8 | SHR | X, Y | Shift X right by Y (store in X) |
| 9 | SHL | X, Y | Shift X left by Y (store in X) |
| A | LDB | X | Load output buffer with value of register X. Y bit low enables ASCII encoding. |
| B | LDI | X, BYTE | Load immediate value into X |
| C | LDR | X, Y | Load value of Y into X |
| D | LDX | ADRR | Load index register with address |
| E | STR | X | Load value of X into memory[index] |
| F | PRNT | NULL | Print the text buffer and clear its contents |## Authors
- [@omrawaley](https://www.github.com/omrawaley)
## Installation
A Makefile is provided in the root directory that can be used to build/clean the project.
Simply run `make build` to compile the project.
## Usage```
./bin/txt8
```Examples can be found in the `examples` folder.
You can make your own programs by manually typing the instructions into a [hex editor](https://hexed.it/). I plan on making an assembler (so you can use ASM rather than manual hexadecimal) for TXT-8 once I finish fleshing out the instruction set.
The `.t8` extension for programs is not necessary, but I recommend it for clarity.
## LicenseTXT-8 - [Apache 2.9](https://apache.org/licenses/LICENSE-2.0)