コード例 #1
0
        public static bool IsJumpVariable(this ParsedInstruction instr)
        {
            switch (instr.Instruction)
            {
            case Instruction.JMP0:
                return(true);

            default:
                return(false);
            }
        }
コード例 #2
0
        public static bool IsJumpStatic(this ParsedInstruction instr)
        {
            switch (instr.Instruction)
            {
            case Instruction.JMP:
            case Instruction.CALL:
                return(true);

            default:
                return(false);
            }
        }
コード例 #3
0
        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);
        }
コード例 #4
0
        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);
            }
        }
コード例 #5
0
        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");
            }
        }
コード例 #6
0
        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);
            }
        }
コード例 #7
0
        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);
            }
        }
コード例 #8
0
 public string DisassembleLine(ParsedInstruction inst) =>
 InstructionTable[inst.Instruction](inst);