What is it?
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).
Installation
The package is available on NPM
$ npm install thumbulator.ts
How to use it?
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.
; ;
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;
Running the emulation
;
Run the emulation for cycles
instructions or until a trap occurs. See the
source
for trap codes.
Aborting the running emulator (during bus access)
thumbulator.abort;
This will cause run
to return immediatelly with TrapReason.abort
(10).
Reset the emulation
thumbulator.reset;
Read and write registers
;thumbulator.writeRegisterr, value;
These will read and write registers.
Verbose debug output
thumbulator.enableDebugtrue;
This will cause the emulator to enter verbose mode and dump disassembly
Why?
This module is used in the 6502.ts VCS emulator for emulating the ARM SOC in the Harmony cartridge.
License
Both David Welch's original code and the glue around it are licensed under the MIT license.