Skip to content
This repository has been archived by the owner on Dec 10, 2023. It is now read-only.
/ oldcustomasm Public archive
forked from hlorenzi/customasm

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

License

Notifications You must be signed in to change notification settings

Emmett81/oldcustomasm

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

70 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

customasm

This is an assembler that takes custom instruction set definitions and uses them to assemble source files.
This can be useful if you'd like to test out a new virtual machine's bytecode, or even if you're eager to write programs for that new processor architecture you just implemented in FPGA!

Check out the Releases section for pre-built binaries.

Check out the documentation for usage instructions:

Usage: customasm [options] <file>

Options:
    -h, --help          Display this information.
    -v, --version       Display version information.
    -q, --quiet         Suppress progress reports.
    -f, --format FORMAT The format of the output file. Possible formats:
                        binary, binstr, hexstr, bindump, hexdump
    -o, --out-data FILE The name of the output file. (Default: a.out)
        --stdout        Write output to stdout instead of a file.

The idea is that, given the following file:

#cpudef
{
   #align 8
   
   load r1, {value} -> 8'0x11 @ value[7:0]
   load r2, {value} -> 8'0x12 @ value[7:0]
   load r3, {value} -> 8'0x13 @ value[7:0]
   add  r1, r2      -> 8'0x21
   sub  r3, {value} -> 8'0x33 @ value[7:0]
   jnz  {address}   -> 8'0x40 @ address[15:0]
   ret              -> 8'0x50
}

#addr 0x8000

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

...the assembler would use the #cpudef rules to convert the instructions into binary code:

8000: 11 00
8002: 12 03
8004: 13 04
8006: 21
8007: 33 01
8009: 40 80 06
800c: 50

About

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

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Rust 81.5%
  • Assembly 17.8%
  • Other 0.7%