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); } } }
public void CountOpcode(ChipOpCode code) { if (m_Stop) { return; } int count = 0; if (m_Counts.TryGetValue(code, out count)) { m_Counts[code] = ++count; } else { m_Counts.Add(code, 1); } }
public ChipInstruction(ushort instruction, ChipOpCode opCode) { this.m_Instruction = instruction; this.m_Opcode = opCode; }
public OpcodeTag(ChipOpCode opcode) { this.m_Opcode = opcode; }