An open API service indexing awesome lists of open source software.

https://github.com/regular/arm-assembler

nodejs module that turns arm32 assembler code into arm32 machine code
https://github.com/regular/arm-assembler

Last synced: about 2 months ago
JSON representation

nodejs module that turns arm32 assembler code into arm32 machine code

Awesome Lists containing this project

README

          

arm-assembler
===
turn arm32 assembler instructions into binary machine-code

Prerequisistes
---

You need to have the [arm-eabi-toolchain installed](http://blog.y3xz.com/blog/2012/10/07/setting-up-an-arm-eabi-toolchain-on-mac-os-x)

Usage
---
``` javascript
var through = require('through');
var test = require('tape');
var asm = require('.');

test('should assemble single instruction when given a string', function(t) {
t.plan(4);
asm('MOVEQ r0, r1, LSL r2', function(err, i) {
t.equal(err, null);
t.equal(i.toString(16), '1a00211');
});
asm('MOV r0, r1, LSL r2', function(err, i) {
t.equal(err, null);
t.equal(i.toString(16), 'e1a00211');
});
});

test('should return stream when given a stream', function(t) {
var tr = through();
var out = asm(tr);
var i = 0;
t.plan(3);
out.on('data', function(data) {
if (i===0) {
t.equal(data.toString(16), '1a00211');
i++;
} else {
t.equal(data.toString(16), 'e1a00211');
i++;
}
}).on('end', function() {
t.equal(i,2);
});

tr.write('MOVEQ r0, r1, LSL r2');
tr.write('MOV r0, r1, LSL r2');
tr.end();
});
```