misim.microchip
Class InstructionSet14
java.lang.Object
|
+--misim.microchip.InstructionSet14
- All Implemented Interfaces:
- InstructionSet
- public class InstructionSet14
- extends java.lang.Object
- implements InstructionSet
The InstructionSet interface provides a means to describe a particular
architecture's instruction set.
Constructor Summary |
InstructionSet14()
This creates an array of instances of the Instruction
classes, ready for decoding loaded software. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
InstructionSet14
public InstructionSet14()
- This creates an array of instances of the Instruction
classes, ready for decoding loaded software.
getNewInstruction
public Instruction getNewInstruction(int opcode,
MachineState machineState)
throws MiSimException
- Return an initialised instruction for the given opcode
- Specified by:
getNewInstruction
in interface InstructionSet
- Parameters:
opcode
- The opcode to encode- Returns:
- Instruction An initialised instance of the required instruction
- Throws:
MiSimException
- If any errors occur during decode
assemble
public int assemble(Token lastToken,
Instruction instr,
AsmLine line,
int[] params,
int paramCount)
throws EditorException
- Assemble a single instruction, returning the correct binary representation
of the given instruction and parameters that follow it in the listing. At
this point, the instruction mnemonic has been identified, but the parameters
have not been parsed.
- Specified by:
assemble
in interface InstructionSet
- Parameters:
token
- The last parsed token for this instructioninstr
- The instruction to assembleline
- The current line being assembledparams
- An array that contains all of the parameters for this instructionparamCount
- The number of parameters discovered for this instruction- Returns:
- The binary representation of the given instruction
- Throws:
EditorException
- if the instruction cannot be assembled.
disassemble
public java.lang.String disassemble(Instruction instr,
MachineState machineState)
- Return a String representation of the given instruction
- Specified by:
disassemble
in interface InstructionSet
- Returns:
- The String representation of the given instruction
getClassCount
public int getClassCount()
- Return the number of classes used to represent this instruction set
- Specified by:
getClassCount
in interface InstructionSet
- Returns:
- The number of instruction classes
getInstructionInstance
public Instruction getInstructionInstance(int index)
- Return an instance of the given instruction class object
- Specified by:
getInstructionInstance
in interface InstructionSet
- Parameters:
index
- The index of the instruction class required- Returns:
- An instance of the Instruction class