Git Product home page Git Product logo

another-simple-bytecode's Introduction

Another Simple Bytecode

A simple bytecode language I designed with an included assembler and virtual machine interpreter.

Features include:

  • 10 32-bit free use registers (r0-r9)
  • Ability to input/output characters and numbers to the console as well as print a string to the console
  • Most standard operations
  • Ability to access memory to store/load variables

Requirements:

  • Requires python 2 for assembler
  • Any C compiler for virtual machine

Compiling using GCC:

Command: gcc virtual_machine.c

Available opcodes:

  • nop

  • load constant (lc)

  • load constant upper (lcu)

  • load variable (lv)

  • store variable (str)

  • push to stack (push)

  • pop from stack (pop)

  • branch if not equal (bin)

  • branch if less than (bil)

  • branch if equal (bie)

  • branch if greater (big)

  • branch without condition (b)

  • compare (cmp)

  • syscall (sys)

  • increment counter (inc)

  • decrement counter (dec)

  • copy register (copy)

  • swap register (swap)

  • add (add)

  • subtract (sub)

  • multiply (mult)

  • divide (div)

  • modulus (mod)

  • or (or)

  • and (and)

  • xor (xor)

  • not (not)

  • left shift (ls)

  • right shift (rs)

Available registers:

  • r0-r9

  • acc

  • br (branch conditional is stored here, cmp has less than = -1, greater than = 1, equal to = 0)

  • c (counter)

  • ss (stack start)

  • se (stack end)

Available syscalls:

  • 0 - pop value and output it to console

  • 1 - pop char and output it to console

  • 2 - input value from console and push it

  • 3 - input char from console and push it

  • 4 - print string from stack

another-simple-bytecode's People

Contributors

jam1garner 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.