private int ExecuteNextOperation() { State.Opcode = Memory[State.ProgramCounter++]; IOpcode handler = OpcodeFactory.GetOpcode(State.Opcode); if (handler == null) { throw new Exception(string.Format("Opcode {0} not implemented!", State.Opcode)); } var operand = GetOperandSafe(handler); return(handler.Execute(this, operand)); }
public void InstructionList_Completion() { int missingCount = 0; for (int i = 0; i < OpcodeList.Length; i++) { IOpcode opcode = OpcodeFactory.GetOpcode(OpcodeList[i]); if (opcode == null) { missingCount++; Debug.WriteLine("Opcode {0:X2} is missing!", OpcodeList[i]); } } if (missingCount > 0) { Debug.WriteLine("Opcode completion {0:###.00}%", 100D - (100D * missingCount) / OpcodeList.Length); } Assert.AreEqual(missingCount, 0, String.Format("{0} opcode(s) are missing", missingCount)); }