Class Disassembler

  extended byavrora.core.Disassembler

public class Disassembler
extends java.lang.Object

The Disassembler class is (partially) generated from the instruction set description. It consists a public access method disassemble() that given a byte array of machine code, a base address, and an index, will produce an instance of the Instr class that corresponds to that machine code instruction. In the case that the machine code does not represent a valid instruction, the method will

The decision tree(s) for disassembling machine code into Instr instances is derived automatically from the ISDL description of the binary encodings of instructions. This decision tree is then translated into Java code in this class. Therefore, most of the code in this class is generated automatically.

Nested Class Summary
 class Disassembler.InvalidInstruction
          The InvalidInstruction class represents an exception generated by the disassembler when it is given a machine code instruction that does not correspond to a well-formed instruction.
Constructor Summary
Method Summary
 Instr disassemble(int base, byte[] buffer, int index)
          The disassemble() method disassembles a single instruction from binary code.
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructor Detail


public Disassembler()
Method Detail


public Instr disassemble(int base,
                         byte[] buffer,
                         int index)
                  throws Disassembler.InvalidInstruction
The disassemble() method disassembles a single instruction from binary code. It accepts a byte array containing the machine code, an index into the array, and the base PC (which is needed for disassembling PC-relative operands).

base - the base PC address of the beginning of the binary code array
buffer - the binary code
index - an index into the binary code array from which to disassemble an instruction
a new Instr instance representing the instruction at that address, if the machine code is a valid instruction
Disassembler.InvalidInstruction - if the machine code at that address is not a valid instruction