Пример #1
0
        public virtual Instruction interpret()
        {
            int         opcode = cpu.fetchOpcode();
            Instruction insn   = Decoder.instruction(opcode);

            if (log.TraceEnabled)
            {
                log.trace(string.Format("Interpreting 0x{0:X8}: [0x{1:X8}] - {2}", cpu.pc - 4, opcode, insn.disasm(cpu.pc - 4, opcode)));
            }
            insn.interpret(this, opcode);

            if (RuntimeContext.debugCodeBlockCalls)
            {
                if (insn == Instructions.JAL)
                {
                    RuntimeContext.debugCodeBlockStart(cpu, cpu.pc);
                }
                else if (insn == Instructions.JR && ((opcode >> 21) & 31) == Common._ra)
                {
                    int         opcodeCaller   = cpu.memory.read32(cpu._ra - 8);
                    Instruction insnCaller     = Decoder.instruction(opcodeCaller);
                    int         codeBlockStart = cpu.pc;
                    if (insnCaller == Instructions.JAL)
                    {
                        codeBlockStart = jumpTarget(cpu.pc, (opcodeCaller) & 0x3FFFFFF);
                    }
                    RuntimeContext.debugCodeBlockEnd(cpu, codeBlockStart, cpu._ra);
                }
            }

            return(insn);
        }
Пример #2
0
        public virtual void interpretDelayslot()
        {
            int         opcode = cpu.nextOpcode();
            Instruction insn   = Decoder.instruction(opcode);

            if (log.TraceEnabled)
            {
                log.trace(string.Format("Interpreting 0x{0:X8}: [0x{1:X8}] - {2}", cpu.pc - 4, opcode, insn.disasm(cpu.pc - 4, opcode)));
            }
            insn.interpret(this, opcode);
            cpu.nextPc();
        }