public void UpdateConsole() { m_Curses.Clear(); YCPU cpu = m_Emulator.CPU; // registers - general purpose, then system. ConsoleWrite(0, 0, DateTime.Now.ToString()); int r_y = 2; ConsoleWrite(53, r_y - 1, "Registers"); ConsoleWrite(53, r_y + 1, $"r0: ${cpu.R0:X4}"); ConsoleWrite(53, r_y + 2, $"r1: ${cpu.R1:X4}"); ConsoleWrite(53, r_y + 3, $"r2: ${cpu.R2:X4}"); ConsoleWrite(53, r_y + 4, $"r3: ${cpu.R3:X4}"); ConsoleWrite(53, r_y + 5, $"r4: ${cpu.R4:X4}"); ConsoleWrite(53, r_y + 6, $"r5: ${cpu.R5:X4}"); ConsoleWrite(53, r_y + 7, $"r6: ${cpu.R6:X4}"); ConsoleWrite(53, r_y + 8, $"r7: ${cpu.R7:X4}"); ConsoleWrite(53, r_y + 10, $"fl: ${cpu.FL:X4}"); ConsoleWrite(53, r_y + 11, $"pc: ${cpu.PC:X4}"); ConsoleWrite(53, r_y + 12, $"ps: ${cpu.PS:X4}"); ConsoleWrite(52, r_y + 13, $"usp: ${cpu.USP:X4}"); ConsoleWrite(52, r_y + 14, $"ssp:*${cpu.SSP:X4}"); ConsoleWrite(53, r_y + 16, "ps bits:"); ConsoleWrite(53, r_y + 17, $"{(cpu.PS_S ? "S" : "-")}{(cpu.PS_M ? "M" : "-")}{(cpu.PS_H ? "H" : "-")}{(cpu.PS_I ? "I" : "-")} {(cpu.PS_Q ? "Q" : "-")}{(cpu.PS_U ? "U" : "-")}{(cpu.PS_V ? "V" : "-")}{(cpu.PS_W ? "W" : "-")}"); ConsoleWrite(53, r_y + 18, "fl bits:"); ConsoleWrite(53, r_y + 19, $"{(cpu.FL_N ? "N" : "-")}{(cpu.FL_Z ? "Z" : "-")}{(cpu.FL_C ? "C" : "-")}{(cpu.FL_V ? "V" : "-")}"); ConsoleWrite(53, r_y + 25, "Segments:"); ConsoleWrite(53, r_y + 26, "CS " + ConsoleSegmentRegisterString(cpu.CS)); ConsoleWrite(53, r_y + 27, "DS " + ConsoleSegmentRegisterString(cpu.DS)); ConsoleWrite(53, r_y + 28, "ES " + ConsoleSegmentRegisterString(cpu.ES)); ConsoleWrite(53, r_y + 29, "SS " + ConsoleSegmentRegisterString(cpu.SS)); ConsoleWrite(53, r_y + 30, "IS " + ConsoleSegmentRegisterString(cpu.IS)); // disassembly ConsoleWrite(2, r_y - 1, "Disassembly"); string[] disasm = cpu.Disassemble(cpu.PC, 21, true); for (int i = 0; i < 21; i += 1) { ConsoleWrite(2, r_y + i + 1, disasm[i] + new string(' ', 50 - disasm[i].Length)); } ConsoleWrite(1, 3, ">"); ConsoleWrite(2, 25, $"{cpu.Cycles} Cycles total"); ConsoleWrite(2, 27, "Ctrl-L: Load debug console program"); ConsoleWrite(2, 28, "Ctrl-R: Run at 10 khz"); ConsoleWrite(2, 29, "Ctrl-B: Break"); ConsoleWrite(2, 30, "Ctrl-N: Run one instruction"); ConsoleWrite(2, 31, "Ctrl-M: Run approximately 100 million cycles"); ConsoleWrite(2, 32, "Ctrl-T: Reset interrupt"); if (m_MS != 0) { ConsoleWrite(2, 34, m_MS.ToString()); } }