Tiny assembler + cart builder for ECJR

Overview

asmjr

Tiny assembler + cart builder for ECJR

Example usage

To build the example program dvdlogo.asm into a cartridge, with dvdlogo.png as the video rom, run (if you are on Linux I assume you understand how to run a binary with ./):

asmjr.exe -i dvdlogo.png dvdlogo.asm dvdlogo.cart

Help:

asmjr 0.1.0

USAGE:
    asmjr.exe [OPTIONS] <SOURCE> [OUTPUT]

ARGS:
    <SOURCE>    Assembly source file
    <OUTPUT>    Output ECJR cartridge file

OPTIONS:
        --author <AUTHOR>        Author to embed into metadata
        --bare                   Export bare program without .cart container
    -h, --help                   Print help information
    -i, --imagerom <IMAGEROM>    Load image (red channel only) into rom
    -l, --listing                Dump out ops to terminal
    -m, --message <MESSAGE>      Simple message to embed in metadata
    -r, --rawrom <RAWROM>        Load raw bytes into rom
        --readme <README>        Readme file to embed in metadata
    -u, --uncompressed           Leave cart body uncompressed
    -V, --version                Print version information

Assembly Language

The included assembler is extremely minimal. This snippet covers basically all the syntax:

// This file merely demonstrates syntax, the program is nonsense
// and does nothing.

// Comments can be like this,
#  or like this if you want.
;  or like this

// Constants can be declared like this
const SPRITES = 0x200 // comments can be on the same line
const TAU = 6.28318
const can_be_lowercase_or_whatever = 0b1010101
const Ω = "hello!"

// the builtin register names are
// x0 x1 x2 x3 x4 ... x255
// zero (always immutably zero, x0)
// ra (return address, x1)
// sp (stack pointer, x2)
// gp (global pointer, x3)
// tp (thread pointer, x4)
addi sp, sp, 1
jal ra, anything-goes-with-labels-too

// you can create aliases to refer to registers
reg temp = x5
muli temp, temp, 2

// Opcodes look like this (can be uppercase or lowercase)
li x1, 12
LI x2, Ω
addi x3, zero, "a"
nop
add x1, x1, x2
jal zero, LABEL_DECLARED_LATER

// the memory operations (load/store) have an alternate syntax too
store x1, zero, SPRITES
store x1, zero[SPRITES]
load x2, gp[SPRITES]

// Known ECJR memory addresses are builtin constants prefixed with $
li x1, 64
store x1, zero[$VIDEO_SPRITE_COUNT]

// Jump/branch labels are declared like this 
LABEL_DECLARED_LATER:
anything-goes-with-labels-too:

// Unlike constants, labels can be used before declaration

The Eclipse/Snakefield ISA is beyond the scope of this document, see the ECJR emulator documentation.

Building

This builds in the normal way with cargo (e.g., cargo build --release) however you will need to have the Google protocol buffer compiler (protoc) on your path because prost needs it (see: https://grpc.io/docs/protoc-installation/).

You might also like...
ttasm is an assembler for assembling source code to TTVM executable.

ttasm is an assembler for assembling source code to TTVM executable.

Macro assembler for Rust

Macro Assembler This crate implement JSC/SpiderMonkey like macro assembler. Macro assembler purpose is to generate machine code for different platform

Library to write x64 Assembly code from Rust, more properly. Designed for the nasm assembler

x64asm Library to write x64 Assembly code from Rust, more properly. Designed for the nasm assembler How to use let mut f = Formatter::new(false); // f

Hashlink bytecode disassembler, analyzer, decompiler and assembler.
Hashlink bytecode disassembler, analyzer, decompiler and assembler.

Hashlink bytecode This repository contains a collection of Rust crates and cli tools to load, disassemble, decompile and analyze Hashlink bytecode. Re

A safe, extensible ORM and Query Builder for Rust

A safe, extensible ORM and Query Builder for Rust API Documentation: latest release – master branch Homepage Diesel gets rid of the boilerplate for da

A macro-based html builder for rust

Horrorshow A macro-based html templating library, compatible with stable rust (currently requires rust = 1.37). Features This crate will degrade grac

 Archer - a repository builder for ArchLinux
Archer - a repository builder for ArchLinux

Archer - a repository builder for ArchLinux This project is at a very early stage. Current Progress Naive Dependency Resolving Todos dependency resolv

A Rust SQL query builder with a pleasant fluent API closely imitating actual SQL

Scooby An SQL query builder with a pleasant fluent API closely imitating actual SQL. Meant to comfortably build dynamic queries with a little bit of s

A query builder that builds and typechecks queries at compile time

typed-qb: a compile-time typed "query builder" typed-qb is a compile-time, typed, query builder. The goal of this crate is to explore the gap between

Fully typed SQL query builder for Rust [deprecated]

What is Deuterium? Deuterium is a fancy SQL builder for Rust. It's designed to provide a DSL to easily build SQL queries in safe and typed way. Like R

Diesel - A safe, extensible ORM and Query Builder for Rust

A safe, extensible ORM and Query Builder for Rust API Documentation: latest release – master branch Homepage Diesel gets rid of the boilerplate for da

Diesel - ORM and Query Builder for Rust

A safe, extensible ORM and Query Builder for Rust API Documentation: latest release – master branch Homepage Diesel gets rid of the boilerplate for da

Compile-time checked Builder pattern derive macro with zero-memory overhead
Compile-time checked Builder pattern derive macro with zero-memory overhead

Compile-time checked Builder pattern derive macro with zero-memory overhead This is very much a work-in-progress. PRs welcome to bring this to product

AUR external package builder

AUR Build Server Goal This project aims to provide an external package making server based on any PKGBUILD based project. Right now it pulls AUR packa

A container image builder tool for OCI (distrobox/toolbox, also podman/docker)

Distrobox Boost A container image builder tool for Open Container Initiative (distrobox/toolbox, also podman/docker). Distrobox is good enough in runn

The joker_query is a cute query builder, with Joker can implement most complex queries with sugar syntax
The joker_query is a cute query builder, with Joker can implement most complex queries with sugar syntax

joker_query The joker_query is most sugared query builder of Rust, with joker_query can implement most complex queries with sugar syntax Features − (O

A tiny 32 bit kernel written in Rust
A tiny 32 bit kernel written in Rust

rustboot A tiny 32 bit kernel written in Rust. I was inspired to download Rust and try to do this after seeing zero.rs - a stub that lets Rust program

Tiny HTTP client for GET

tinyget a tiny fork of minreq. Simple, minimal-dependency HTTP client. Optional features for https with native-tls TLS implementations. Documentation

A tiny minimal container runtime written in Rust.
A tiny minimal container runtime written in Rust.

vas-quod A tiny minimal container runtime written in Rust. The idea is to support a minimal isolated containers without using existing runtimes, vas-q

Owner
null
Tiny HTTP client for GET

tinyget a tiny fork of minreq. Simple, minimal-dependency HTTP client. Optional features for https with native-tls TLS implementations. Documentation

迷渡 19 Dec 31, 2022
A rust version of "the super tiny compiler"

The (Rust) super tiny compiler This project is a rust version of the super tiny compiler (the original one (JS) was created by Jamie Kyle). The output

Eduardo Stuart 6 Dec 25, 2022
A tiny Rust std-lib for Linux x86_64 and aarch64

Tiny std Like a bad, probably buggy, tiny standard library for Linux. When it's appropriate If you are actually trying to do something solid, checkout

null 4 Dec 17, 2022
A tiny service that downloads files over HTTP links, with resume and restart support.

Http Drogue Http Drogue is a tiny service that downloads files over HTTP from links you provide. It can restart and resume interrupted downloads. Http

Kaan Barmore-Genç 4 Feb 27, 2023
Easy c̵̰͠r̵̛̠ö̴̪s̶̩̒s̵̭̀-t̶̲͝h̶̯̚r̵̺͐e̷̖̽ḁ̴̍d̶̖̔ ȓ̵͙ė̶͎ḟ̴͙e̸̖͛r̶̖͗ë̶̱́ṉ̵̒ĉ̷̥e̷͚̍ s̷̹͌h̷̲̉a̵̭͋r̷̫̊ḭ̵̊n̷̬͂g̵̦̃ f̶̻̊ơ̵̜ṟ̸̈́ R̵̞̋ù̵̺s̷̖̅ţ̸͗!̸̼͋

Rust S̵̓i̸̓n̵̉ I̴n̴f̶e̸r̵n̷a̴l mutability! Howdy, friendly Rust developer! Ever had a value get m̵̯̅ð̶͊v̴̮̾ê̴̼͘d away right under your nose just when

null 294 Dec 23, 2022
mail-builder is a flexible e-mail builder library written in Rust that generates RFC5322 compliant e-mail messages

mail-builder mail-builder is a flexible e-mail builder library written in Rust that generates RFC5322 compliant e-mail messages. The library has full

Stalwart Labs 37 Dec 19, 2022
tidy-builder is a builder generator that is compile-time correct.

The Builder derive macro creates a compile-time correct builder which means that it only allows you to build the given struct if and only if you provi

M.Amin Rayej 7 Dec 18, 2022
Proportional-Integral-Derivative controller simulation to balance a ball on cart

PID Controller Simualation A Proportional-Integral-Derivative controller to self balance a ball on a rolling cart. Use arrow keys to control the cart,

Sparsh Goenka 112 May 6, 2023
Ruxnasm is an assembler for Uxntal — a programming language for the Uxn stack-machine by Hundred Rabbits

Ruxnasm is an assembler for Uxntal — a programming language for the Uxn stack-machine by Hundred Rabbits. Ruxnasm strives to be an alternative to Uxnasm, featuring more user-friendly error reporting, warnings, and helpful hints, reminiscent of those seen in modern compilers for languages such as Rust or Elm.

Karol Belina 44 Oct 4, 2022
MIPS assembler written in Rust

frasm MIPS assembler written in Rust About frasm is an assembler written in Rust speicifally for the MIPs architecture. This is my first time writing

Jacob Mealey 3 Oct 23, 2022