3.0.0 • Published 3 years ago

mips-inst v3.0.0

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

mips-inst

npm version

Convert between text and hex representation of MIPS instructions. Used as the basis for the mips-assembler package.

Supports the MIPS IV instruction set.

Usage

import { parse } from "mips-inst";

parse("jr ra");
// 0x03E00008

parse(`
  ADDIU SP SP 0xFFE0
  SW RA 0x18(SP)
  LW RA 0x18(SP)
  JR RA
`);
// [0x27BDFFE0, 0xAFBF0018, 0x8FBF0018, 0x03E00008]
import { print } from "mips-inst";

print(0x03E00008);
// "JR RA"

print([0x27BDFFE0,
  0xAFBF0018,
  0x8FBF0018,
  0x03E00008
]);
// ["ADDIU SP SP -0x20", "SW RA 0x18(SP)", "LW RA 0x18(SP)", "JR RA"]

print(0x27BDFFE0, {
  commas: true,
  include$: true,
  casing: "toLowerCase",
  numBase: 10
});
// "addiu $sp, $sp, -32"

// print also accepts an ArrayBuffer or DataView.

The distributed dist/umd/mipsinst.umd.js exports a MIPSInst global.

Development

To build:

npm install
npm run build

To run tests:

npm test

License

MIT

3.0.0

3 years ago

2.2.7

4 years ago

2.2.6

4 years ago

2.2.5

5 years ago

2.2.4

5 years ago

2.2.3

5 years ago

2.2.2

5 years ago

2.2.1

6 years ago

2.2.0

6 years ago

2.1.0

6 years ago

2.0.0

6 years ago

1.4.2

6 years ago

1.4.1

6 years ago

1.4.0

6 years ago

1.3.0

6 years ago

1.2.1

7 years ago

1.2.0

7 years ago

1.1.0

7 years ago

1.0.0

7 years ago