0.6.0 • Published 4 years ago

@gct256/mem-tools v0.6.0

Weekly downloads
15
License
MIT
Repository
github
Last release
4 years ago

mem-tools

Tools for simulate retro computer programing with TypeScript.

Memory

  • Utility class of 64KB memory model for TypeScript.
  • Supports read, write, fill and copy.

MemoryListener

  • Listeners can receive events on memory operations.

Address & Offset & utils

  • Useful class & utility for named addresses.
  • Can be used like assembler's labels.
const FOO = new Address('FOO', 0x1234);
const BAR = new Offset('BAR', 0x12);

mem.readInt8(FOO); // read from 0x1234
mem.readInt8(FOO.offset(-0x12)); // read from 0x1234 - 0x12 = 0x1222
mem.readInt8(FOO.offset(BAR)); // read from 0x1234 + 0x12 = 0x1246

const MAP = utils.createAddressMap({
  BAR: 0x2345,
  BAZ: 0x3456,
});

mem.readInt8(MAP.BAR); // read from 0x2345
mem.readInt8(MAP.BAZ); // read from 0x3456

const WORK_MAP = utils.createAddressWorkMap(0xcb00, [
  ['QUX', 2],
  ['QUUX', 1],
  ['QUUUX', 1],
]);

mem.writeInt16(0x1234, WORK_MAP.QUX); // write to 0xcb00
mem.writeInt8(0x56, WORK_MAP.QUUX); // write to 0xcb02
mem.writeInt8(0x78, WORK_MAP.QUUUX); // write to 0xcb03
mem.fill(0, WORK_MAP.__FIRST__, WORK_MAP.__LAST__); // fill 0xcb00 - 0xcb03

formatters

  • Number formatters for 8bit/16bit decimal/dexadecimal.
0.6.0

4 years ago

0.5.0

5 years ago

0.4.0

5 years ago

0.3.0

5 years ago

0.2.0

5 years ago

0.1.0

5 years ago