0.0.1 • Published 3 years ago

lc3asm v0.0.1

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

lc3asm.js

An assembler for Little Computer 3 (LC-3).

Installation

$ npm install lc3asm.js

Running

$ lc3asm <inputfile>.asm

This will generate inputfile.obj and inputfile.sym with the resulting object code and symbols respectively.

API

import Assembler from "lc3asm";

const asm = new Assembler(`
.orig 0
.fill 0
.end`, "filename"); // May throw a Peggy syntax error

asm.symbols(); // Returns a string
asm.object(); // Returns a Uint8Array

Syntax errors have a format() function that will generate nice output:

catch (e) {
  if (typeof e.format === "function") {
    console.error(e.format([{
      source, // must match what was passed to the Assembler constructor
      text,   // The text associated with that file
    }]));

Node.js CI codecov