tools.processor
Class Opcode

java.lang.Object
  extended by tools.processor.Opcode
Direct Known Subclasses:
DataOpcode

public class Opcode
extends java.lang.Object

An opcode represents a CPU instruction for a given target processor. Fundamentally, the opcode is a sequence of bytes with possible numeric fill-ins. There are also various mnemonic (human readable) representations of the opcode that also contain the numeric fill-ins. Fill-ins are single-lower-case-letters. In the "code" representation these letters are followed by a "m" or "l" for "most significant" and "least significant" where appropriate. For example: The letters are all described in OpcodeParamField. The assembler may create "dynamic" opcodes to represent data strings. In this case the created opcode will have no mnemonics or other attributes ... just code with no fill-ins.


Constructor Summary
Opcode(Processor processor, java.lang.String code, java.lang.String clocks, java.lang.String flags, java.lang.String bus, java.util.Map<java.lang.String,java.lang.String> mnemonicTexts)
          This constructs a new opcode.
 
Method Summary
 java.util.Map<OpcodeParamField,java.lang.String> decodeData(int[] data)
          This method maps the given data bytes into parameter-field values.
 java.lang.String getBus()
           
 java.lang.String getClocks()
           
 java.lang.String getCode()
           
 java.lang.String getFlags()
           
 java.util.Map<java.lang.String,Mnemonic> getMnemonics()
           
 int getOpcodeSize()
          This method returns the number of bytes occupied by the opcode.
 Processor getProcessor()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Opcode

public Opcode(Processor processor,
              java.lang.String code,
              java.lang.String clocks,
              java.lang.String flags,
              java.lang.String bus,
              java.util.Map<java.lang.String,java.lang.String> mnemonicTexts)
This constructs a new opcode.

Parameters:
processor - backwards link to the owning processor
code - the code bytes of the opcode as hex bytes and lower-case-letter fill-ins
clocks - information about the number of clocks the opcode takes
flags - information about the flags this opcode affects
bus - information about the address/data bus access of this opcode
mnemonicTexts - all the various mnemonic representations of this opcode
Method Detail

decodeData

public java.util.Map<OpcodeParamField,java.lang.String> decodeData(int[] data)
This method maps the given data bytes into parameter-field values. This is used by a disassembly process to map existing bytes back into their mnemonic fill-in locations.

Parameters:
data - the data to map into the opcode
Returns:
the map of opcode-field to data-value

getOpcodeSize

public int getOpcodeSize()
This method returns the number of bytes occupied by the opcode.

Returns:
byte-size of the opcode

getProcessor

public Processor getProcessor()

getCode

public java.lang.String getCode()

getClocks

public java.lang.String getClocks()

getFlags

public java.lang.String getFlags()

getBus

public java.lang.String getBus()

getMnemonics

public java.util.Map<java.lang.String,Mnemonic> getMnemonics()