https://github.com/rosendo-martinez/virtualcomputer
A virtual computer that can run machine code. [C++]
https://github.com/rosendo-martinez/virtualcomputer
cpp
Last synced: 3 months ago
JSON representation
A virtual computer that can run machine code. [C++]
- Host: GitHub
- URL: https://github.com/rosendo-martinez/virtualcomputer
- Owner: Rosendo-Martinez
- Created: 2023-01-16T17:47:30.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2025-02-19T03:49:34.000Z (4 months ago)
- Last Synced: 2025-02-19T04:28:18.638Z (4 months ago)
- Topics: cpp
- Language: C++
- Homepage:
- Size: 663 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

