Git Product home page Git Product logo

simple-vm's Introduction

Simple VM

A simple virtual machine written in C++ using it's own low level language with high level features from host machine like Sleep, etc.

Language

I have written a simple assembly like language called Simple Virtual Emulation and file extension is .svm which contains a few high level instructions.

Instruction Description
MOV Moves data from one register to another
MOVI Moves a static integer into register
JMP Jumps to a specific instruction index aka address
OUT Prints register encoded to HEX on host console
OUTI Prints register on host console
ADD Adds 1 to a register
NOP No operation
JE Jumps to next instruction if 2 registers are equal
JNE Jumps to next instruction if 2 register aren't equal
HALT Halts code execution
INT Interrupts code execution for (static integer) milliseconds
PAUSE Pause's console on host machine requiring enter to be pressed

Host

This is made for Windows systems but can easily be ported to UNIX. The only host functionality I use that is Windows only is the Kernel32::Sleep function.

Uses

There is really no practical uses for this other than for fun unless you do a few upgrades to it. Have fun and good day.

simple-vm's People

Contributors

justvmexit avatar

Stargazers

 avatar

simple-vm's Issues

This code is just flat out bad.

Most of the code is redundant and bad, switch cases for instructions / mnemonics is fine but there's a way better way of doing this, it's called indirect threading and it's a popular for efficiency where you use goto statements and functions for specific mnemonics. Also it's not even turing complete, you're not even allowing for access of conditional branching, this is not going to be used for any programming language you think it would, this isn't a "simple VM", it's a bad VM. (Side note, your nop doesn't work, it just breaks out of the loop, no incrementation of the program counter, this is not simply doing "nothing", it's exiting the execution loop.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.