Interface CPU

All Superinterfaces:
Plugin
All Known Implementing Classes:
AbstractCPU

public interface CPU extends Plugin
CPU plugin root interface.

Should be implemented by a plugin. There should exist just one implementation.

CPU can define one or more "CPU contexts" (usually just one), which can extend the runtime functionality accessible to plugins.

See Also:
  • Method Details

    • step

      CPU.RunState step() throws Exception
      Executes one instruction synchronously on the host's CPU worker and returns its result.
      Throws:
      Exception
    • execute

      CPU.RunState execute() throws Exception
      Runs the instruction loop synchronously until natural completion or cooperative interruption. The host supplies the worker thread, serializes CPU mutations, and publishes lifecycle events. Return STATE_RUNNING when interrupted without another terminal reason; the host applies the requested pause/stop state. Natural halt, breakpoint, and failures must retain their actual result.
      Throws:
      Exception
    • getStatusPanel

      JPanel getStatusPanel()
      Get CPU status panel.

      Each CPU plugin must have a status panel that shows some important CPU status (e.g. registers, flags, run state, etc.) and allows to manage some settings (e.g. a runtime frequency, etc.).

      This panel is located on the right side in the "emulation" panel of the main module.

      CPU itself should take care about updating the panel when it is appropriate.

      Returns:
      CPU status panel
    • reset

      void reset(int location)
      Resets the CPU synchronously after the host has acknowledged actual execution exit.
      Parameters:
      location - Program location in memory
    • setInstructionLocation

      boolean setInstructionLocation(int location)
      Set memory location of an instruction which will be emulated as next.

      Instruction position is more "abstract" name for "program counter", which is mostly used in 8-bit architectures.

      This method is called by emuStudio application when a user perform "jump to address" operation.

      Parameters:
      location - new address of actual instruction
      Returns:
      true if operation was successful, false otherwise
    • getAddressSpaceSize

      int getAddressSpaceSize()
      Get the number of addressable instruction locations exposed by this CPU.
      Returns:
      positive address-space size; the highest valid location is one less than this value
    • getDecoder

      Decoder getDecoder()
      Get the instruction decoder.

      EmuStudio shares captured instruction facts across listing and flow analysis.

      Returns:
      decoder of CPU instructions
    • getDebuggerColumns

      default List<DebuggerColumn<?>> getDebuggerColumns(Decoder instructions)
      Get custom columns of the debugger table.
      Parameters:
      instructions - host-owned lookup of captured instruction rows; use this for instruction columns
      Returns:
      debugger columns; empty list means default columns (address, mnemo, opcode)
    • isAutomationSupported

      default boolean isAutomationSupported()
      Description copied from interface: Plugin
      Determines if this plugin supports emulation automation.
      Specified by:
      isAutomationSupported in interface Plugin
      Returns:
      true if the plugin supports emulation automation; false otherwise