hlorenzi/customasm

💻 An assembler for custom, user-defined instruction sets! https://hlorenzi.github.io/customasm/web/

Rust

1,065

358 commits

updated Sep 7, 2026

See the code

README

customasm

customasm is an assembler that allows you to provide your own custom instruction sets to assemble your 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 GitHub Sponsor

🖥️ Try it right now on your web browser!

🕹️ Check out an example project which targets the NES!

⌨️ Install the VSCode syntax highlight extension!

❤️ Support the author!

Documentation

📚 Check out the wiki for a changelog, documentation, and a how-to-start guide!

💲 Check out the command-line help! (Better formatted on the command-line itself)

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.

Example

Given the following file:

#ruledef
{
    load r1, {value: i8} => 0x11 @ value
    load r2, {value: i8} => 0x12 @ value
    load r3, {value: i8} => 0x13 @ value
    add  r1, r2          => 0x21
    sub  r3, {value: i8} => 0x33 @ value
    jnz  {address: u16}  => 0x40 @ address
    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 (base 16)

  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
asm
assembler
assembly
assembly-language
bytecode
bytecode-compiler
compiler
custom
customizable
instruction-set
instruction-set-architecture
machine-code
microprocessor
processor-architecture
rust
rust-lang
user-defined
virtual-machine
vm
webassembly

Project health

Overall

2.9/10

Maintained

3/10

Code review

1/10
OpenSSF Scorecard

crates.io

Latest release

0.14.2 · Sep 7, 2026

Releases this year

4

Significant stargazers

(top 24 of 43)

bjorn3

751 followers · starred May 2020

Max Desiatov

1,054 followers · starred Jan 2025

Eliza Weisman

2,272 followers · starred Jan 2025

Josh Junon

1,859 followers · starred Jan 2025

hlorenzi/customasm

💻 An assembler for custom, user-defined instruction sets! https://hlorenzi.github.io/customasm/web/

Rust

1,065

358 commits

updated Sep 7, 2026

See the code

README

customasm

customasm is an assembler that allows you to provide your own custom instruction sets to assemble your 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 GitHub Sponsor

🖥️ Try it right now on your web browser!

🕹️ Check out an example project which targets the NES!

⌨️ Install the VSCode syntax highlight extension!

❤️ Support the author!

Documentation

📚 Check out the wiki for a changelog, documentation, and a how-to-start guide!

💲 Check out the command-line help! (Better formatted on the command-line itself)

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.

Example

Given the following file:

#ruledef
{
    load r1, {value: i8} => 0x11 @ value
    load r2, {value: i8} => 0x12 @ value
    load r3, {value: i8} => 0x13 @ value
    add  r1, r2          => 0x21
    sub  r3, {value: i8} => 0x33 @ value
    jnz  {address: u16}  => 0x40 @ address
    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 (base 16)

  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
asm
assembler
assembly
assembly-language
bytecode
bytecode-compiler
compiler
custom
customizable
instruction-set
instruction-set-architecture
machine-code
microprocessor
processor-architecture
rust
rust-lang
user-defined
virtual-machine
vm
webassembly

Project health

Overall

2.9/10

Maintained

3/10

Code review

1/10
OpenSSF Scorecard

crates.io

Latest release

0.14.2 · Sep 7, 2026

Releases this year

4

Significant stargazers

(top 24 of 43)

bjorn3

751 followers · starred May 2020

Max Desiatov

1,054 followers · starred Jan 2025

Eliza Weisman

2,272 followers · starred Jan 2025

Josh Junon

1,859 followers · starred Jan 2025