Interface Registers

interface Registers {
    read(registerName: string): bigint;
    write(registerName: string, value: string | number | bigint): void;
}

Methods

Methods

  • Reads the specified register

    Parameters

    • registerName: string

      The name of the register to be read

    Returns bigint

    The value of the register

    Will throw if an error occurs while reading the register

    // Reads the PC register
    let value = session.registers.read("PC");
  • Write to the specified register

    Parameters

    • registerName: string

      The name of the register to be written to

    • value: string | number | bigint

      The value to be written to the register. Can be a bigint, or an integer represented as a string, or a javascript number.

    Returns void

    Will throw if an error occurs while writing to the register

    // Writes 0x12345 to the PC register
    session.registers.write("PC", 0x12345n);
    // Writes -1 to the R0 register
    session.registers.write("R0", -1n);