Esempio n. 1
0
        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("|-----------------------|");
        }
Esempio n. 2
0
        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("|-----------------------|");
        }