/* tslint:disable */
/* eslint-disable */

/**
 * Assemble source text into a ROM image.
 */
export function chip8_assemble(src: string): Uint8Array;

/**
 * Disassembly of `count` instructions from `addr`: "addr\topcode\ttext" per line.
 */
export function chip8_disasm(addr: number, count: number): string;

/**
 * 64×32 pixels, 1 byte each (0 or 1).
 */
export function chip8_display(): Uint8Array;

/**
 * One 60 Hz frame: run up to `cycles` instructions, then tick the timers.
 * Returns the number of instructions executed.
 */
export function chip8_frame(cycles: number): number;

export function chip8_key(key: number, down: boolean): void;

/**
 * Load a ROM image (reset, keeping the quirks setting).
 */
export function chip8_load(rom: Uint8Array): void;

/**
 * Assembly source of a built-in program.
 */
export function chip8_program_source(index: number): string;

/**
 * Built-in programs: "id\tname" per line.
 */
export function chip8_programs(): string;

/**
 * [pc, I, DT, ST, stack depth, status (0 run / 1 key wait / 2 bad opcode / 3 stack error),
 *  bad opcode, V0 … VF]
 */
export function chip8_regs(): Uint16Array;

/**
 * Restart the current ROM.
 */
export function chip8_reset(): void;

/**
 * Quirk bit set (see `vm::QUIRK_*`); applies immediately.
 */
export function chip8_set_quirks(quirks: number): void;

/**
 * True while the sound timer is running (the page plays a tone).
 */
export function chip8_sound(): boolean;

/**
 * Execute a single instruction (debugger). Returns the status code.
 */
export function chip8_step(): number;

export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;

export interface InitOutput {
    readonly memory: WebAssembly.Memory;
    readonly chip8_assemble: (a: number, b: number) => [number, number, number, number];
    readonly chip8_disasm: (a: number, b: number) => [number, number];
    readonly chip8_display: () => [number, number];
    readonly chip8_frame: (a: number) => number;
    readonly chip8_key: (a: number, b: number) => void;
    readonly chip8_load: (a: number, b: number) => [number, number];
    readonly chip8_program_source: (a: number) => [number, number];
    readonly chip8_programs: () => [number, number];
    readonly chip8_regs: () => [number, number];
    readonly chip8_reset: () => void;
    readonly chip8_set_quirks: (a: number) => void;
    readonly chip8_sound: () => number;
    readonly chip8_step: () => number;
    readonly __wbindgen_externrefs: WebAssembly.Table;
    readonly __wbindgen_malloc: (a: number, b: number) => number;
    readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
    readonly __externref_table_dealloc: (a: number) => void;
    readonly __wbindgen_free: (a: number, b: number, c: number) => void;
    readonly __wbindgen_start: () => void;
}

export type SyncInitInput = BufferSource | WebAssembly.Module;

/**
 * Instantiates the given `module`, which can either be bytes or
 * a precompiled `WebAssembly.Module`.
 *
 * @param {{ module: SyncInitInput }} module - Passing `SyncInitInput` directly is deprecated.
 *
 * @returns {InitOutput}
 */
export function initSync(module: { module: SyncInitInput } | SyncInitInput): InitOutput;

/**
 * If `module_or_path` is {RequestInfo} or {URL}, makes a request and
 * for everything else, calls `WebAssembly.instantiate` directly.
 *
 * @param {{ module_or_path: InitInput | Promise<InitInput> }} module_or_path - Passing `InitInput` directly is deprecated.
 *
 * @returns {Promise<InitOutput>}
 */
export default function __wbg_init (module_or_path?: { module_or_path: InitInput | Promise<InitInput> } | InitInput | Promise<InitInput>): Promise<InitOutput>;
