https://github.com/rose-mtz/virtualcomputer
A virtual computer that can run machine code. [C++]
https://github.com/rose-mtz/virtualcomputer
cpp
Last synced: about 2 months ago
JSON representation
A virtual computer that can run machine code. [C++]
- Host: GitHub
- URL: https://github.com/rose-mtz/virtualcomputer
- Owner: rose-mtz
- Created: 2023-01-16T17:47:30.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2025-02-19T03:49:34.000Z (over 1 year ago)
- Last Synced: 2025-12-26T23:23:58.883Z (7 months ago)
- Topics: cpp
- Language: C++
- Homepage:
- Size: 664 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# VirtualComputer
This is a program that simulates a CPU and main memory. As input, it receives a program that is written in machine code (only hexadecimal). It will then run that program. After each instruction execution, the registers of the CPU will be printed to the console.
## Example Program: Adding Two Numbers
The following example program adds two numbers. It has three instructions.
**The Program Represented In:**
Assembly code:
```
LOAD 4; # loads 4 to register
ADD 3; # adds 3 to value in register (4)
STOP ; # program stop instruction
```
Machine code (*hexadecimal*):
```
C0 0004
70 0003
00 0000
```
Machine code (*binary*):
```
11000000 0000000000000100
01110000 0000000000000011
00000000 0000000000000000
```
## Executing/Running The Example Program

