Code Monkey home page Code Monkey logo

asmvm's Introduction

A language VM built in Rust.

Based on this tutorial by Fletcher Haynes, and what I'm learning in the TOL304G Programming Language and TOL309G Computer Architecture courses at the University of Iceland.

Assembler

A simple assembler is provided to generate machine code.

Instructions

Instruction  Description
hlt Halts execution
load r i Loads value i into r
add r1 r2 r3 Adds r1 and r2 and outputs to r3
sub r1 r2 r3 Subtracts r2 from r1 and outputs to r3
mul r1 r2 r3 Multiplies r1 by r2 and outputs to r3
div r1 r2 r3 Divides r1 by r2 and outputs to r3
jmp i Jumps to byte i in program
jmpb i Jumps back i bytes in program
jmpf i Jumps forward i bytes in program
jmpc i Jumps to byte i in program if condition is met
eq r1 r2 Checks if r1 is equal to r2
neq r1 r2 Checks if r1 is not equal to r2
gt r1 r2 Checks if r1 > r2
lt r1 r2 Checks if r1 < r2
gtq r1 r2 Checks if r1 >= r2
ltq r1 r2 Checks if r1 <= r2
nop A no-op

An integer value is denoted by a hash symbol and one or more digits (#123).

A register address is denoted by a dollar symbol and a digit from 0 to 31 ($10).

asmvm's People

Contributors

valtyr avatar

Watchers

 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.