Package CPU

Class DisassembledInstruction

java.lang.Object
CPU.DisassembledInstruction

public class DisassembledInstruction extends Object
A disassembled instruction (as a string).
  • Field Details

    • address

      public final int address
    • opcode

      public final int opcode
    • num_operands

      public final int num_operands
    • instruction

      public final String instruction
    • op1

      public final DisassembledOperand op1
    • op2

      public final DisassembledOperand op2
  • Constructor Details

    • DisassembledInstruction

      public DisassembledInstruction(int address, int opcode, String instruction)
      A disassembled instruction with no operands.
      Parameters:
      address - where to start disassembling.
      opcode - the opcode to disassemble.
      instruction - the instruction string corresponding to the opcode.
    • DisassembledInstruction

      public DisassembledInstruction(int address, int opcode, String instruction, DisassembledOperand dop)
      A disassembled instruction with one operand.
      Parameters:
      address - where to start disassembling.
      opcode - the opcode to disassemble.
      instruction - the instruction string corresponding to the opcode.
      dop - the operand.
    • DisassembledInstruction

      public DisassembledInstruction(int address, int opcode, String instruction, DisassembledOperand dop1, DisassembledOperand dop2)
      A disassembled instruction with 2 operands.
      Parameters:
      address - where to start disassembling.
      opcode - the opcode to disassemble.
      instruction - the instruction string corresponding to the opcode.
      dop1 - the 1st operand.
      dop2 - the 2nd operand.
  • Method Details

    • size

      public int size()
      Get the size of the instruction.
      Returns:
      the size of the instruction, in bytes.
    • shortFormat

      public void shortFormat(StringBuilder buffer)
      Formats the instruction in the provided StringBuffer, in short format.
      Parameters:
      buffer - wherein to format the instrcution.
    • formatInstruction

      public void formatInstruction(StringBuilder buffer)
      Formats the instruction in the provided StringBuffer.
      Parameters:
      buffer - wherein to format the instruction.
    • toString

      public String toString()
      Overrides:
      toString in class Object