
Security News
Meet Socket at Black Hat and DEF CON 2025 in Las Vegas
Meet Socket at Black Hat & DEF CON 2025 for 1:1s, insider security talks at Allegiant Stadium, and a private dinner with top minds in software supply chain security.
thumbulator.ts
Advanced tools
This is a customized version of David Welch's thumbulator, an emulator targetting the thumb subset of the ARM instruction set.
The thumbulator itself has been transpiled from C using emscripten, the glue code around it is written in Typescript. As such, the module can be directly used with TS, no external typings required (of course, it works in plain JS, too).
The package is available on NPM
$ npm install thumbulator.ts
The package has a single default export: the Thumbulator
class. In order to
instantiate, you need to pass a bus
object that implements reading and writing
from the bus.
import Thumbulator from 'thumbulator.ts';
const thumbulator = new Thumbulator({
read16: (address: number): number => {
// read a 16 bit word at the given address
},
read32: (address: number): number => {
// optional; read a 32 bit word (will use read16 instead if not defined)
},
write16: (address: number, value: number) => {
// write a 16 bit word to the given address
},
write32: (address: number, value: number) => {
// optional; write a 32 bit word (will use write16 if not defined)
}
}, {
printer: (line: string): void => {
// optional; override logging (uses console.log and console.error by default)
},
stopAddress: number, // optional; the emulation stops with TrapReason.stop when
// execution reaches this address
trapOnInstructionFetch: (address: number): number => {
// optional; return a nonzero trap code to trap and stop the emulation on
// instruction fetch. This is evaluated only if stopAddress is not set.
},
trapOnBx32: (instructionAddress: number, targetAddress: number): number => {
// optional; handle BX out of thumb mode.
}
});
The second options object is optional
After instantiation, call init and wait for the promise to resolve in order to make sure that the emscripten runtime has initialized.
await thumbulator.init();
const trapReason: Thumbulator.TrapReason = thumbulator.run(cycles);
Run the emulation for cycles
instructions or until a trap occurs. See the
source
for trap codes.
thumbulator.abort();
This will cause run
to return immediatelly with TrapReason.abort
(10).
thumbulator.reset();
const value = thumbulator.readRegister(r);
thumbulator.writeRegister(r, value);
These will read and write registers.
thumbulator.enableDebug(true);
This will cause the emulator to enter verbose mode and dump disassembly
This module is used in the 6502.ts VCS emulator for emulating the ARM SOC in the Harmony cartridge.
Both David Welch's original code and the glue around it are licensed under the MIT license.
FAQs
The Thumbulator ARM emulator by David Welch, compiled to JavaScript
The npm package thumbulator.ts receives a total of 2 weekly downloads. As such, thumbulator.ts popularity was classified as not popular.
We found that thumbulator.ts demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Meet Socket at Black Hat & DEF CON 2025 for 1:1s, insider security talks at Allegiant Stadium, and a private dinner with top minds in software supply chain security.
Security News
CAI is a new open source AI framework that automates penetration testing tasks like scanning and exploitation up to 3,600× faster than humans.
Security News
Deno 2.4 brings back bundling, improves dependency updates and telemetry, and makes the runtime more practical for real-world JavaScript projects.