Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/hildjj/lc3asm.js
Assembler for Little Computer 3 in javascript
https://github.com/hildjj/lc3asm.js
Last synced: 28 days ago
JSON representation
Assembler for Little Computer 3 in javascript
- Host: GitHub
- URL: https://github.com/hildjj/lc3asm.js
- Owner: hildjj
- License: mit
- Created: 2021-06-26T19:07:41.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2021-06-27T18:49:33.000Z (over 3 years ago)
- Last Synced: 2024-10-13T06:20:57.091Z (about 1 month ago)
- Language: JavaScript
- Size: 326 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# lc3asm.js
An assembler for Little Computer 3
([LC-3](https://en.wikipedia.org/wiki/Little_Computer_3)).## Installation
```sh
$ npm install lc3asm
```## Running
```sh
$ lc3asm .asm
```This will generate `inputfile.obj` and `inputfile.sym` with the resulting
object code and symbols respectively.## API
```js
import Assembler from "lc3asm";const asm = new Assembler(`
.orig 0
.fill 0
.end`, "filename"); // May throw a Peggy syntax errorasm.symbols(); // Returns a string
asm.object(); // Returns a Uint8Array
```Syntax errors have a `format()` function that will generate nice output:
```js
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](https://github.com/hildjj/lc3asm.js/actions/workflows/node.js.yml/badge.svg)](https://github.com/hildjj/lc3asm.js/actions/workflows/node.js.yml)
[![codecov](https://codecov.io/gh/hildjj/lc3asm.js/branch/main/graph/badge.svg?token=684YVFGCPI)](https://codecov.io/gh/hildjj/lc3asm.js)