arc-asm

4.0.1 • Public • Published

$ arc-asm PayPal Version Downloads Get help on Codementor

An ARC assembler written in Node.JS.

Installation

You can install the package globally and use it as command line tool:

$ npm i -g arc-asm

Then, run arc-asm --help and see what the CLI tool can do.

$ arc-asm --help
Usage: arc-asm [options]
 
Options:
  -s, --source <path>  Sets the source file path.   
  -o, --output <path>  Sets the output file path.   
  -h, --help           Displays this help.          
  -v, --version        Displays version information.
 
Examples:
  arc-asm -s my-input.asm # This will generate a.out 
  arc-asm -s my-input.asm -o program # This will generate the `program` file. 
 
Documentation can be found at https://github.com/IonicaBizau/arc-assembler

Example

Here is an example how to use this package as library. To install it locally, as library, you can do that using npm:

$ npm i --save arc-asm
// Dependencies
var ArcAssembler = require("arc-asm");
 
// Compile input
var result = ArcAssembler.compile(
           "! Sum of two numbers"
  + "\n" + "! This is a comment"
  + "\n" + "     .begin"
  + "\n" + "     .org 2048"
  + "\n" + "     ld [x], %r1"
  + "\n" + "     ld [y], %r2"
  + "\n" + "     addcc %r1, %r2, %r3"
  + "\n" + "     jmpl %r15+4, %r0"
  + "\n" + "x:   2"
  + "\n" + "y:   0xa"
);
 
// Show some output
result.raw.forEach(function (c) {
    console.log(c.code.match(/.{1,4}/g).join(" ") + " << Line " + c.line);
});

Documentation

For full API reference, see the DOCUMENTATION.md file.

How to contribute

Have an idea? Found a bug? See how to contribute.

Where is this library used?

If you are using this library in one of your projects, add it in this list. ✨

License

KINDLY © Ionică Bizău

Readme

Keywords

Package Sidebar

Install

npm i arc-asm

Weekly Downloads

2

Version

4.0.1

License

KINDLY

Last publish

Collaborators

  • ionicabizau