// Used to map which control line we turn on to output to a register UInt32 MapRegisterToControlLineOut(GeneralPurposeRegisterId reg) { switch (reg) { case GeneralPurposeRegisterId.A: return((UInt32)ControlLineId.A_REG_OUT); case GeneralPurposeRegisterId.B: return((UInt32)ControlLineId.B_REG_OUT); default: throw new Exception("Unknown register value"); } }
public void OutputState(ValueFormat format) { Console.ForegroundColor = RuntimeInformation.IsOSPlatform(OSPlatform.OSX) ? ConsoleColor.Black : ConsoleColor.White; if (Bus.Driver == this) { Console.ForegroundColor = ConsoleColor.Red; } if (busInputLine != null && busInputLine.State) { Console.ForegroundColor = ConsoleColor.Blue; } Console.SetCursorPosition(ConsoleXY.X, ConsoleXY.Y); Console.Write("|-----------------------|"); Console.SetCursorPosition(ConsoleXY.X, ConsoleXY.Y + 1); Console.Write("| |"); Console.SetCursorPosition(ConsoleXY.X, ConsoleXY.Y + 1); switch (format) { case ValueFormat.Hex: Console.Write(String.Format("|{0}: 0x{1:X2}", id.ToString(), Value)); break; case ValueFormat.Decimal: Console.Write(String.Format("|{0}: {1}", id.ToString(), Value)); break; case ValueFormat.Binary: Console.Write(String.Format("|{0}: {1}", id.ToString(), BinaryValue)); break; } // Yes this should be done with inheritence... if (id == SystemRegister.IR) { OpCode opCode = (OpCode)(Value >> 3); GeneralPurposeRegisterId reg = (GeneralPurposeRegisterId)(Value & 0x07); Console.Write(String.Format(" {0}", opCode.ToString())); if (Enum.IsDefined(reg.GetType(), reg)) { Console.Write(String.Format(" {0}", reg.ToString())); } } Console.SetCursorPosition(ConsoleXY.X, ConsoleXY.Y + 2); Console.Write("|-----------------------|"); }
public void OutputState(ValueFormat format) { Console.ForegroundColor = RuntimeInformation.IsOSPlatform(OSPlatform.OSX) ? ConsoleColor.Black : ConsoleColor.White; Console.SetCursorPosition(ConsoleXY.X, ConsoleXY.Y); Console.Write("|-----------------------|"); Console.SetCursorPosition(ConsoleXY.X, ConsoleXY.Y + 1); Console.Write("| |"); Console.SetCursorPosition(ConsoleXY.X, ConsoleXY.Y + 1); Console.Write(String.Format("|{0} - 0x{1:X2}", id.ToString(), Value)); // Yes this should be done with inheritence... if (id == SystemRegister.IR) { OpCode opCode = (OpCode)(Value >> 3); GeneralPurposeRegisterId reg = (GeneralPurposeRegisterId)(Value & 0x07); Console.Write(String.Format(" {0} {1}", opCode.ToString(), reg.ToString())); } Console.SetCursorPosition(ConsoleXY.X, ConsoleXY.Y + 2); Console.Write("|-----------------------|"); }