Giter Site home page Giter Site logo

rust-simple-vm's Introduction

Simple VM

A simple 16-bit virtual machine, written to learn Rust basics.

Technical Details

This machine has 8 registers:

  • A, B, C and M are general purpose
  • SP is the stack pointer
  • BP is the base pointer for function frames
  • PC is the program counter
  • FLAGS contains 16 status bits, these are currently undefined and always 0

Registers are 16-bits. Memory is accessed with 16-bit addresses, meaning there is are 65536 bytes of addressable memory.

Instructions

Instructions are 16-bits and have the following bit format:

[ O O O O O O O O | A A A A B B B B ]

Here, O is the operation (eg PUSH or ADD). A and B are arguments to that operation, and in some cases are combined into a single 8-bit value.

Operation A B Description
Nop - - Do nothing
Push 8bit literal Join with A Push literal to stack
PopRegister Register - Pop value to register
AddStack - - Pop 2 values, push their sum
AddRegister Register Register A = A + B

rust-simple-vm's People

Contributors

phy1um avatar damonpalovaara avatar

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.