All Projects → gto76 → Comp Cpp

gto76 / Comp Cpp

Licence: mit
Simple 4-bit virtual computer

Projects that are alternatives of or similar to Comp Cpp

maxc
Programming Language maxc
Stars: ✭ 36 (-89.06%)
Mutual labels:  virtual-machine
Multipass
Multipass orchestrates virtual Ubuntu instances
Stars: ✭ 3,978 (+1109.12%)
Mutual labels:  virtual-machine
Rubinius
The Rubinius Language Platform
Stars: ✭ 3,006 (+813.68%)
Mutual labels:  virtual-machine
ubuntu-vnc-xfce
Headless Ubuntu/Xfce containers with VNC/noVNC (Generation 1)
Stars: ✭ 51 (-84.5%)
Mutual labels:  virtual-machine
plainvm
plainvm allows you to control multiple virtual machines which are distributed among many hosts through your browser.
Stars: ✭ 37 (-88.75%)
Mutual labels:  virtual-machine
Smlvm
Smallrepo Virtual Machine
Stars: ✭ 265 (-19.45%)
Mutual labels:  virtual-machine
Paraphrase
Multi-core suitable Forth-like language
Stars: ✭ 27 (-91.79%)
Mutual labels:  virtual-machine
Ark
ArkScript is a small, fast, functional and scripting language for C++ projects
Stars: ✭ 312 (-5.17%)
Mutual labels:  virtual-machine
Youtube Videos
Documentation for Techno Tim YouTube Videos
Stars: ✭ 250 (-24.01%)
Mutual labels:  virtual-machine
Jikesrvm
Jikes RVM (Research Virtual Machine)
Stars: ✭ 281 (-14.59%)
Mutual labels:  virtual-machine
RISVM
A low overhead, embeddable bytecode virtual machine in C++
Stars: ✭ 21 (-93.62%)
Mutual labels:  virtual-machine
QEMU-Manager
macOS graphical frontend to QEMU
Stars: ✭ 175 (-46.81%)
Mutual labels:  virtual-machine
Tinyvm
TinyVM is a small, fast, lightweight virtual machine written in pure ANSI C.
Stars: ✭ 2,872 (+772.95%)
Mutual labels:  virtual-machine
3bc-lang
Low level language, tiny virtual machine that works on computers and microcontrollers. (Friendly Punched cards)
Stars: ✭ 155 (-52.89%)
Mutual labels:  virtual-machine
Aqemu
Official AQEMU repository - a GUI for virtual machines using QEMU as the backend
Stars: ✭ 301 (-8.51%)
Mutual labels:  virtual-machine
awesome-microvm
🎉 A curated list of awesome things related to Micro-VMs
Stars: ✭ 22 (-93.31%)
Mutual labels:  virtual-machine
Docker To Linux
Make bootable Linux disk image abusing Docker
Stars: ✭ 257 (-21.88%)
Mutual labels:  virtual-machine
V8
The official mirror of the V8 Git repository
Stars: ✭ 18,808 (+5616.72%)
Mutual labels:  virtual-machine
Umka Lang
Umka: a statically typed embeddable scripting language
Stars: ✭ 308 (-6.38%)
Mutual labels:  virtual-machine
Virtualbox Python
Complete implementation of VirtualBox's COM API with a Pythonic interface.
Stars: ✭ 277 (-15.81%)
Mutual labels:  virtual-machine

Comp

Simple 4-bit/1 Hz virtual computer for learning purposes

screenshot

For quick start see HOW TO RUN.

Memory

instructions - 4 bits
  |  +-- addresses - 4 bits
  v  v
----***-  <- 0  ----
--*-**-*  <- 1  ---*
---***--  <- 2  --*-
---*****  <- 3  --**
----***-  <- 4  -*--
---***-*  <- 5  -*-*
----**--  <- 6  -**-
---****-  <- 7  -***
-***---*  <- 8  *---
-*--****  <- 9  *--*
--------  <- 10 *-*-
--------  <- 11 *-**
--------  <- 12 **--
-------*  <- 13 **-*
-------*  <- 14 ***-
<OUTPUT>  <- 15 ****
  • Execution starts at the first address (0).
  • Execution stops when program reaches last address (15).
  • Whatever gets written to the last address is sent to the printer.
  • When reading from the last address (15), we get a random byte value.
  • CPU has one 8 bit register.

Instruction set

  • READ ---- - Copies the value at the specified address into register.
  • WRITE ---* - Copies value of the register to the specified address.
  • ADD --*- - Adds value at the specified address to the value of the register, and writes result to the register. If the result is bigger than the maximum possible value (255 = ********) then 255 gets written.
  • SUBTRACT --** - Subtracts value at the speicfied address from the value of the register, and writes result to the register. If the result is smaller than 0 then 0 gets written.
  • JUMP -*-- - Changes the value of the program counter to the specified address, meaning that in the next cycle execution will continue at that address.
  • IF MAX -*-* - Jumps to the specified address if register has value 255 = ********.
  • IF MIN -**- - Jumps to the specified address if register has value 0 = --------.
  • SHIFT R -*** - Moves every bit of the register one spot to the right. This way rightmost bit gets lost, and a leftmost becomes '-'. This is the only instruction that doesn't use the address part, making the last four bits irrelevant.
  • Any instruction that is not defined above is interpreted as READ ---- instruction.

How to run on…

Windows

  • Install Tiny Core Linux on VirtualBox using this instructions.
  • Run the UNIX commands.

UNIX

$ git clone https://github.com/gto76/comp-cpp.git
$ cd comp-cpp
$ ./run

Other versions

  • Mark II, model with separate address space for code and data, and with more instructions. Programs can be saved and loaded and it can run without the interface (instead of a printer, it then uses stdout). Also input can be piped in.

screenshot

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].