Esempio n. 1
0
        private void PrintState()
        {
            Console.SetCursorPosition(0, 0);
            string[] dumpLines = _ram.HexDump(0, 0x0800, 32).Split('\n', '\r');

            dumpLines[0] += "  Status Flags:";
            dumpLines[1] += "  N  V  U  B  D  I  Z  C";
            dumpLines[2] += String.Format("  {0}  {1}  {2}  {3}  {4}  {5}  {6}  {7}",
                                          _cpu.GetFlag(Flags.N) ? 1 : 0,
                                          _cpu.GetFlag(Flags.V) ? 1 : 0,
                                          _cpu.GetFlag(Flags.U) ? 1 : 0,
                                          _cpu.GetFlag(Flags.B) ? 1 : 0,
                                          _cpu.GetFlag(Flags.D) ? 1 : 0,
                                          _cpu.GetFlag(Flags.I) ? 1 : 0,
                                          _cpu.GetFlag(Flags.Z) ? 1 : 0,
                                          _cpu.GetFlag(Flags.C) ? 1 : 0);

            dumpLines[4] += String.Format("  A:       ${0:X2}", _cpu.A);
            dumpLines[5] += String.Format("  X:       ${0:X2}", _cpu.X);
            dumpLines[6] += String.Format("  Y:       ${0:X2}", _cpu.Y);
            dumpLines[7] += String.Format("  Stack P: ${0:X2}", _cpu.StackPointer);
            dumpLines[8] += String.Format("  PC:      ${0:X4}", _cpu.ProgramCounter);

            //dumpLines[12] += String.Format("  Master Freq: {0}", _masterFps);
            dumpLines[13] += String.Format("  Dots:        {0}", _ppu.RemainingDotsInFrame);

            Console.WriteLine();
            Console.WriteLine(" Zeropage:");

            foreach (string dumpLine in dumpLines)
            {
                Console.WriteLine(dumpLine);
            }
        }