org.ow2.asmdex.instruction
Class InstructionFormat12X

java.lang.Object
  extended by org.ow2.asmdex.instruction.Instruction
      extended by org.ow2.asmdex.instruction.InstructionFormat12X
All Implemented Interfaces:
ITwoRegistersInstruction

public class InstructionFormat12X
extends Instruction
implements ITwoRegistersInstruction

Encodes and decodes an instruction built with the Dalvik format 12X.

Author:
Julien Névo

Field Summary
 
Fields inherited from class org.ow2.asmdex.instruction.Instruction
lineNumber, opcodeByte, opcodeHighOrderByte
 
Constructor Summary
InstructionFormat12X(int opcode, int destinationRegister, int var)
          Constructor of the Instruction by providing all the elements it's composed of.
 
Method Summary
 int getRegisterA()
          Gets the index of first register
static int getRegisterA(int opcode)
          Returns the RegisterA encoded in the given 16-bit opcode.
 int getRegisterB()
          Gets the index of second register
static int getRegisterB(int opcode)
          Returns the RegisterB encoded in the given 16-bit opcode.
 int getSize()
          Returns the size of the instruction in bytes.
 void write(ByteVector out, ConstantPool constantPool)
          Encodes the instruction, in the Dalvik format, to an output buffer.
 
Methods inherited from class org.ow2.asmdex.instruction.Instruction
getInstructionSizeInByte, getLineNumber, getOpcodeByte, getOpcodeHighOrderByte, setLineNumber, test4BitsLimit, test4BitsLimit
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

InstructionFormat12X

public InstructionFormat12X(int opcode,
                            int destinationRegister,
                            int var)
Constructor of the Instruction by providing all the elements it's composed of.

Parameters:
opcode - 8 or 16 bits opcode.
destinationRegister - the destination register.
var - the register.
Method Detail

getRegisterA

public int getRegisterA()
Description copied from interface: ITwoRegistersInstruction
Gets the index of first register

Specified by:
getRegisterA in interface ITwoRegistersInstruction
Returns:
index

getRegisterB

public int getRegisterB()
Description copied from interface: ITwoRegistersInstruction
Gets the index of second register

Specified by:
getRegisterB in interface ITwoRegistersInstruction
Returns:
index

getRegisterA

public static int getRegisterA(int opcode)
Returns the RegisterA encoded in the given 16-bit opcode.

Returns:
the RegisterA .

getRegisterB

public static int getRegisterB(int opcode)
Returns the RegisterB encoded in the given 16-bit opcode.

Returns:
the RegisterB .

getSize

public int getSize()
Description copied from class: Instruction
Returns the size of the instruction in bytes.

Specified by:
getSize in class Instruction
Returns:
the size of the instruction in bytes.

write

public void write(ByteVector out,
                  ConstantPool constantPool)
Description copied from class: Instruction
Encodes the instruction, in the Dalvik format, to an output buffer.

Specified by:
write in class Instruction
Parameters:
out - output buffer.
constantPool - the constantPool.