Skip to content

streamich/ass-js

Folders and files

NameName
Last commit message
Last commit date
Nov 19, 2019
Jan 3, 2018
Jan 3, 2018
Jul 28, 2021
Aug 20, 2017
Dec 29, 2017
Jul 28, 2021
Dec 26, 2017
Jan 1, 2018
Jan 1, 2018
Nov 17, 2017
Oct 20, 2018
Jan 1, 2018
May 8, 2025
Jan 14, 2018
Dec 26, 2017
Dec 26, 2017

Repository files navigation

(‿*‿)
Assembler.js

Assembler implemented in JavaScript:

Install

npm i ass-js

Getting Started

Store 0xBABE in RAX register

import {X64} from 'ass-js';

const asm = X64();
asm._('mov', ['rax', 0xBABE]);

Compile to machine code

console.log(code.compile()); // <Buffer 48 c7 c0 be ba 00 00>

Show text representation

console.log(String(code));
// 000 main:
// 001   movq rax, 0x0000BABE ; 000000|000000 0x48, 0xC7, 0xC0, 0xBE, 0xBA, 0x00, 0x00 7 bytes

Use templates

const template = _ => {
    _('mov', ['rdx', 0xC001]);
    _('mov', ['rax', 0xBABE]);
};

asm.code(template);

Docs

License

Unlicense — public domain.