orange

module
v0.0.0-...-cf91f57 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 8, 2022 License: GPL-3.0

README

orange

A virtual machine with a custom ISA. Named after my favorite color because I can.

About

This repository features an assembler and a virtual machine for assembling and then running programs written in assembly. The instruction set architecture is described in ISA.md.

Why?

While taking an introductory computer architecture class, I became interested in exploring more advanced assemblers and simulators than the ones that we were learning about and creating in class.

The ISA for orange is inspired by "LEGv8", a subset of ARMv8 (hence the name), which we discuss in EECS 370. I plan to expand on the ISA to add more interesting features like built-in stack management.

Usage

To assemble a program, run the package located in ./cmd/orangeasm. To run a program, run the package located in ./cmd/orangevm. To link multiple object files, run the package located in ./cmd/orangelinker.

If you want to assemble a standalone program (e.g. no linking), use ./orangeasm --executable [input file] [output file].

Examples

  • multiplication.orange
    • Multiplies two 32-bit numbers using grade-school multiplication algorithm
  • string.orange
    • Traversal of a null-terminated string
  • stack.orange
    • Simple demonstration of calling functions and saving values to the stack
  • print.orange
    • Example usage of write syscall for printing a string
  • sections.orange
    • Semantics for defining different sections
  • linker example
    • Showcases using multiple files to implement a program
    • The main file calls the strLen function in the second file
  • greet.orange
    • A simple program that greets the user
    • Makes use of the strio part of the "standard library"

Todo

  • Better, more modular parsing of assembly
  • Stack management
  • Proper error management
  • Object files with symbol table, relocation table
  • System calls (for console output)
  • Dynamic memory allocation via syscalls
  • Simple language + compiler

Directories

Path Synopsis
asm
cmd

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL