public void Step(int cycles) { while (cycles > 0) { cycles--; byte a = SystemMemory.ReadByte(m_CodeEngine.PC); byte b = SystemMemory.ReadByte(m_CodeEngine.PC + 1); ushort data = Tools.Create16(a, b); ChipOpCode opcode = Disassembler.DecodeInstruction(data); //Console.WriteLine("Instuction: " + opcode.ToString()); //Console.WriteLine(m_CodeEngine.PC.ToString("X2") + " " + opcode.ToString()); ChipInstruction inst = new ChipInstruction(data, opcode); inst.Address = m_CodeEngine.PC; m_CodeEngine.IncrementPC(); if (m_PatchEngine.PatchAddress(m_CodeEngine, (ushort)(m_CodeEngine.PC - 2))) { continue; } if (opcode == ChipOpCode.Unknown) { if (data != 0) { //Console.WriteLine(m_CodeEngine.PC.ToString("X2")); Console.WriteLine("Syscall: " + inst.NNN.ToString("x")); if (m_UseHybridDynarec) { if (inst.NNN < SystemMemory.Size) { m_HybridDynarec.Execute(inst.NNN, m_CodeEngine); } else { Console.WriteLine("1802 Call is beyond memory bounds! (" + inst.NNN.ToString("X4") + ")"); } } else { Console.WriteLine("Syscall Emitter Disabled!"); } } else { Console.WriteLine("Warning: 0 opcode doing Nop!"); } } else { m_CodeEngine.Call(inst); } } }