miSim

misim
Interface InstructionSet

All Known Implementing Classes:
InstructionSet14

public interface InstructionSet

The InstructionSet interface provides a means to describe a particular architecture's instruction set.


Method Summary
 int assemble(Token lastToken, Instruction instr, AsmLine line, int[] params, int paramCount)
          Assemble a single instruction, returning the correct binary representation of the given instruction and parameters that follow it in the listing.
 java.lang.String disassemble(Instruction instr, MachineState machineState)
          Return a String representation of the given instruction
 int getClassCount()
          Return the number of classes used to represent this instruction set
 Instruction getInstructionInstance(int index)
          Return an instance of the given instruction class object
 Instruction getNewInstruction(int opcode, MachineState machineState)
          Return an initialised instruction for the given opcode
 

Method Detail

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.
Parameters:
token - The last parsed token for this instruction
instr - The instruction to assemble
line - The current line being assembled
params - An array that contains all of the parameters for this instruction
paramCount - 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
Returns:
The String representation of the given instruction

getNewInstruction

public Instruction getNewInstruction(int opcode,
                                     MachineState machineState)
                              throws MiSimException
Return an initialised instruction for the given opcode
Parameters:
opcode - The opcode to encode
Returns:
Instruction An initialised instance of the required instruction
Throws:
MiSimException - If any errors occur during decode

getClassCount

public int getClassCount()
Return the number of classes used to represent this instruction set
Returns:
The number of instruction classes

getInstructionInstance

public Instruction getInstructionInstance(int index)
Return an instance of the given instruction class object
Parameters:
index - The index of the instruction class required
Returns:
An instance of the Instruction class

miSim