RISC-V meta assembler that adds quality of life features to assembly

Lox language

TODOs

  • (Partially complete) unreachable code. if a "return" has been found in a local scope and we encounter other code directly following then we error
  • values never read/used

RISCV-Meta-Assembler

RISC-V meta assembler that adds quality of life features to assembly

Memory map (pg 40 of TheReader)

  • sp = 0xbfffffff
  • 0->128K is reserved
  • code starts at 0x00010001
  • static data follows
  • then Dynamic data
  • and finally the Stack which grows downward.

Code example


import {
    "stdio" as std
}

const {
    GPIO_BASE = 0x10012000,  // GPIO base
    GPIO_RED  = 0x400000
}

// Program code section.
// align code to 2^2 bytes = word alignment
// declares "main" symbol as global
// positions code at address 0x00010001
[alignTo word, global, at 0x00010001]
code main {
    use std

    addi sp,sp,-16  // allocate stack frame
    sw   ra,12(sp)    // save return address

    // Setup function parameters    
    lui  a0,%hi(hello)  // compute address of hello upper 20
    addi a0,a0,%lo(hello) // lower 12
    lui  a1,%hi(world)
    addi a1,a1,%lo(world)

    call printf     // call std's printf
    
    lw   ra,12(sp) // restore return address
    addi sp,sp,16  // deallocate stack frame
    
    li   a0,0 // load return value 0
    ret
}

[readOnly, alignTo bytes<4>, at 0x10000000]
data {
    string hello "Hello, %s\n", // null terminated
    string world "world",
    char ['a', 'b', 'c'],
    byte [0x20, 0x0f, 0x40, 0x0a]
    half [0xff01,0xab02]
    word [0xffff001],
}

[readWrite, alignTo bytes(4)]
data {
    global int<4> count,    // 4 byte integer = word
}

Links

https://github.com/gonzispina/golox

Owner
William Cleveland
Currently working on Neuromorphic Engineering to create simple artificial narrow intelligence (ANI).
William Cleveland
Similar Resources

🏃 An x86-64 assembler written in Go.

asm An x86-64 assembler written in Go. It is used by the Q programming language for machine code generation. Architectures Linux x86-64 (ELF binaries)

Nov 7, 2022

Golang RISC-V emulator that can play DOOM

Golang RISC-V emulator that can play DOOM

RISC-V Emulator A toy Golang RISC-V emulator that can play DOOM For now it uses smunaut bootloader and riscv_doom from the ICE40 project. But since th

Dec 12, 2022

The Project Oberon RISC compiler ported to Go.

oberon-compiler This is a port of the Project Oberon compiler for RISC-5 (not to be confused with RISC-V) from Oberon to Go. The compiled binaries can

Dec 6, 2022

🔎🪲 Malleable C2 profiles parser and assembler written in golang

goMalleable 🔎 🪲 Malleable C2 profiles parser and assembler written in golang Table of Contents Introduction Installation Usage Examples Introduction

Oct 24, 2022

Decode embedded EXIF meta data from image files.

goexif Provides decoding of basic exif and tiff encoded data. Still in alpha - no guarantees. Suggestions and pull requests are welcome. Functionality

Dec 17, 2022

A tool to check problems about meta files of Unity

A tool to check problems about meta files of Unity

A tool to check problems about meta files of Unity on Git repositories, and also the tool can do limited autofix for meta files of auto-generated files.

Dec 22, 2022

A CLI tool for get meta infomation, for SEO, Testing , etc

What is meta-curl ? meta-curl is a CLI tool for get meta infomation, for SEO, Testing , etc. This can be used like curl CLI command. How to Use(wip) G

Nov 16, 2021

An API for handling file meta data

dp-files-api An API for handling file meta data Getting started Run make debug Dependencies No further dependencies other than those defined in go.mod

Jan 4, 2022

Lib to extract information of tag html meta

What is this? Is a lib to extract information to mount preview. For Example: When you insert a url on chat how WhatsApp is mounted an preview of websi

May 17, 2022

Code that will query the meta data of an instance within AWS and provide a json formatted output on Go

EC2 meta-data, output JSON Code that will query the meta data of an instance wit

Dec 16, 2021

Torrent-metainfo-parser - Generates a .torrent meta info from a file

torrent-metainfo-parser generates a .torrent meta info from a file required argu

Aug 23, 2022

Go Lang Web Assembly bindings for DOM, HTML etc

WebAPI Go Language Web Assembly bindings for DOM, HTML etc WARNING: The current API is in very early state and should be consider to be expremental. T

Dec 28, 2022

Golang evasion tool, execute-assembly .Net file

🐸 Frog For Automatic Scan 🐶 Doge For Defense Evasion&Offensive Security Doge-Assembly Golang evasion tool, execute-assembly .Net file Intro Are you

Jan 8, 2023

Compiler for a small language into x86-64 Assembly

Compiler This project is a small compiler, that compiles my own little language into X86-64 Assembly. It then uses yasm and ld to assemble and link in

Dec 13, 2022

Generate x86 Assembly with Go

Generate x86 Assembly with Go avo makes high-performance Go assembly easier to write, review and maintain. The avo package presents a familiar assembl

Dec 30, 2022

Compiler for a small language into x86-64 Assembly

Compiler This project is a small compiler, that compiles my own little language into X86-64 Assembly. It then uses yasm and ld to assemble and link in

Dec 13, 2022

Assembly syntax that makes you feel like you're writing code in a high-level language.

shasm Assembly syntax that makes you feel like you're writing code in a high-level language. Shasm is not an Assembler. Shasm simply compiles Shasm sy

Jun 5, 2021

Framework for building distributed services with Web Assembly

Framework for building distributed services with Web Assembly

Tarmac Framework for building distributed services with Web Assembly Tarmac is a unique framework designed for the next generation of distributed syst

Dec 31, 2022

Assembly-optimized MD4 hash algorithm in Go

md4 MD4 hash algorithm in Go. Assembly-optimized for amd64 platforms. MD4 is cryptographically broken and should should only be used where compatibili

Apr 14, 2022
The standard library flag package with its missing features

cmd Package cmd is a minimalistic library that enables easy sub commands with the standard flag library. This library extends the standard library fla

Oct 4, 2022
An open-source GitLab command line tool bringing GitLab's cool features to your command line
An open-source GitLab command line tool bringing GitLab's cool features to your command line

GLab is an open source GitLab CLI tool bringing GitLab to your terminal next to where you are already working with git and your code without switching

Dec 30, 2022
oc CLI plugin to interact with Helm features provided by the OpenShift Console

OpenShift provides support for managing the lifecycle of Helm charts. This capability is limited primarily to the Web Console. This plugin enables the management of Helm charts similar to using the standalone Helm CLI while offloading much of the work to OpenShift.

Aug 20, 2022
CLI program for SEO 301 & 302 url rewrites in fastly with more magento features soon to come

Magento-Fastly Table of Contents Magento-Fastly Development & Testing Install fastly cli Features Installation Usage Development & Testing To test thi

Oct 29, 2021
Template repository for testing CLI features of applications written in Go

Go CLI testing example This repository provides a template on how to create a testable CLI applications in Go language. As an example, this applicatio

Sep 8, 2022
There is a certain amount of work to be done before you can implement the features of your Go powered CLI app

go-project-template-cli There is a certain amount of work to be done before you can implement the features of your Go powered CLI app. A few of those

Jan 23, 2022
A simple RISC-V RV32I assembler

rvasm A simple RISC-V assembler. Supports the RV32i standard plus CSR and other privileged instructions (uret, sret, mret, wfi). Also supports all pse

Nov 17, 2021
Quality of life tool for diablo2r. Automatically counts up and writes the game name into clipboard.
Quality of life tool for diablo2r. Automatically counts up and writes the game name into clipboard.

counterbaal Quality of life tool for people hosting diablo2 baalruns. Automatically counts up and writes the game name into clipboard. Probably only u

Jan 1, 2022
Go package that adds marshal and unmarshal features to nullable sql types.

#Nullable Very simple Go module to handle nullable fields. Basically, it adds to sql package types the JSON marshal and unmarshal features. It has 100

Jan 20, 2022
dropspy is a (POC-quality) reworking of the C-language dropwatch tool in Go, with some extra features.

dropspy is a (POC-quality) reworking of the C-language dropwatch tool in Go, with some extra features.

Dec 12, 2022