Giter VIP home page Giter VIP logo

oldcustomasm's Introduction

WARNING

This is an old unmaintained fork of customasm. It is the result of me needing a very specific asm{} behauviour for the one-instruction-cpu I was designing at the time.

It is here AT IS for MY OWN personal use. Feel free to also USE IT AT YOUR OWN RISK.

customasm

This is an assembler that takes custom, user-defined instruction sets and uses them to assemble source files.
It can be useful, for example, if you're trying to test the bytecode of a new virtual machine, or if you're eager to write programs for that new microprocessor architecture you just implemented in an FPGA chip!

crates.io Latest Release Releases

Discord

๐Ÿ–ฅ๏ธ Try it right now on your browser!

๐Ÿ•น๏ธ Check out an example project which targets the NES!

๐Ÿ“œ Check out the changelog for new features!

โŒจ๏ธ Install the VSCode syntax highlight extension!

โค๏ธ Support me!

Documentation

๐Ÿ“š Check out the Documentation for advanced features and a how-to guide!

Installation

You can install directly from crates.io by running cargo install customasm. Then the customasm application should automatically become available in your command-line environment.

You can also download pre-built executables from the Releases section.

You can compile from source yourself by first cloning the repository and then simply running cargo build. There's also a battery of tests available at cargo test.

Upgrade to v0.11

๐Ÿ“– Check out instructions for migration from older versions to v0.11!

Example

Given the following file:

#ruledef
{
    load r1, {value} => 0x11 @ value`8
    load r2, {value} => 0x12 @ value`8
    load r3, {value} => 0x13 @ value`8
    add  r1, r2      => 0x21
    sub  r3, {value} => 0x33 @ value`8
    jnz  {address}   => 0x40 @ address`16
    ret              => 0x50
}

multiply3x4:
    load r1, 0
    load r2, 3
    load r3, 4
    
    .loop:
        add r1, r2
        sub r3, 1
        jnz .loop
    
    ret

...the assembler will use the #ruledef directive to convert the instructions into binary code:

 outp | addr | data

  0:0 |    0 |          ; multiply3x4:
  0:0 |    0 | 11 00    ; load r1, 0
  2:0 |    2 | 12 03    ; load r2, 3
  4:0 |    4 | 13 04    ; load r3, 4
  6:0 |    6 |          ; .loop:
  6:0 |    6 | 21       ; add r1, r2
  7:0 |    7 | 33 01    ; sub r3, 1
  9:0 |    9 | 40 00 06 ; jnz .loop
  c:0 |    c | 50       ; ret

Command-Line Usage

Usage: customasm [options] <asm-file-1> ... <asm-file-N>

Options:
    -f, --format FORMAT The format of the output file. Possible formats:
                        binary, annotated, annotatedbin, binstr, hexstr,
                        bindump, hexdump, mif, intelhex, deccomma, hexcomma,
                        decc, hexc, logisim8, logisim16
    -o, --output [FILE] The name of the output file.
    -s, --symbol [FILE] The name of the output symbol file.
    -t, --iter [NUM]    The max number of passes the assembler will attempt
                        (default: 10).
    -p, --print         Print output to stdout instead of writing to a file.
    -q, --quiet         Suppress progress reports.
    -v, --version       Display version information.
    -h, --help          Display this information.

oldcustomasm's People

Contributors

hlorenzi avatar emmett81 avatar clubby789 avatar vascofazza avatar artentus 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.