public static bool IsJumpVariable(this ParsedInstruction instr) { switch (instr.Instruction) { case Instruction.JMP0: return(true); default: return(false); } }
public static bool IsJumpStatic(this ParsedInstruction instr) { switch (instr.Instruction) { case Instruction.JMP: case Instruction.CALL: return(true); default: return(false); } }
public bool TryDecode(UInt16 val, out ParsedInstruction inst) { var m = Instructions.Keys.FirstOrDefault(x => x.Matches(val)); if (m == null) { inst = new ParsedInstruction(0, 0, 0, 0); return(false); } inst = m.Parse(val, Instructions[m]); return(true); }
public static bool GeneratesLabel(this ParsedInstruction instr) { switch (instr.Instruction) { case Instruction.JMP: case Instruction.CALL: case Instruction.JMP0: case Instruction.LII: return(true); default: return(false); } }
public static UInt16 GetLabelTarget(this ParsedInstruction instr) { switch (instr.Instruction) { case Instruction.JMP: case Instruction.CALL: case Instruction.JMP0: case Instruction.LII: return(instr.Immediate16); default: throw new Exception("Not a jump instruction"); } }
public static bool IsSkipNext(this ParsedInstruction instr) { switch (instr.Instruction) { case Instruction.SER: case Instruction.SNER: case Instruction.SNEI: case Instruction.SEI: case Instruction.SKP: case Instruction.SKNP: return(true); default: return(false); } }
public static bool IsControlFlow(this ParsedInstruction instr) { switch (instr.Instruction) { case Instruction.JMP: case Instruction.CALL: case Instruction.JMP0: case Instruction.RET: case Instruction.SER: case Instruction.SNER: case Instruction.SNEI: case Instruction.SEI: case Instruction.SKP: case Instruction.SKNP: return(true); default: return(false); } }
public string DisassembleLine(ParsedInstruction inst) => InstructionTable[inst.Instruction](inst);