@marioslab/ulang-vm
Version:
Virtual machine & assembler for recreational programming like it's 1992.
68 lines (67 loc) • 1.98 kB
TypeScript
import * as ulang from "./wrapper";
export { compile, printMemory } from "./wrapper";
export declare enum VirtualMachineState {
Stopped = 0,
Running = 1,
Paused = 2
}
export declare enum LogLevel {
None = 0,
Info = 1
}
export declare class VirtualMachine {
private canvas;
private vm;
private state;
private compilerResult;
private vmStart;
private executedInstructions;
private vsyncHit;
private debugSyscallHit;
private breakpoints;
private bpPtr;
private numBps;
private syscallHandlerPtr;
private lastStepHitBreakpoint;
private stateChangeListener;
private logLevel;
private mouseX;
private mouseY;
private mouseButtonDown;
private keys;
private listeners;
private rgbaFramePtr;
constructor(canvasElement: HTMLCanvasElement | string);
private addEventListener;
dipose(): void;
setLogLevel(logLevel: LogLevel): void;
setStateChangeListener(listener: (vm: VirtualMachine, state: VirtualMachineState) => void): void;
setBreakpoints(breakpoints: number[]): void;
private calculateBreakpoints;
run(source: string): void;
stop(): void;
pause(): void;
continue(): void;
step(): void;
getCurrentLine(): number;
getState(): VirtualMachineState;
getRegisters(): ulang.UlangValue[];
getProgram(): ulang.UlangProgram;
getInt(addr: any): number;
getFloat(addr: any): number;
printVmTime(): void;
printVmState(): void;
getCanvas(): HTMLCanvasElement;
private frame;
}
export declare function loadUlang(): Promise<void>;
export declare function createPlayerFromGist(canvas: HTMLCanvasElement | string, gistId: string): Promise<UlangPlayer>;
export declare class UlangPlayer {
vm: VirtualMachine;
source: string;
constructor(canvas: HTMLCanvasElement | string, source: string);
play(): void;
getVirtualMachine(): VirtualMachine;
getSource(): string;
dispose(): void;
}