public LuaTable GetRegisters() { var table = Lua.NewTable(); try { if (DebuggableCore == null) { throw new NotImplementedException(); } foreach (var kvp in DebuggableCore.GetCpuFlagsAndRegisters()) { table[kvp.Key] = kvp.Value.Value; } } catch (NotImplementedException) { Log(string.Format( "Error: {0} does not yet implement getregisters()", Emulator.Attributes().CoreName)); } return(table); }
protected override void TraceFromCallback(uint addr, uint value, uint flags) { var regs = DebuggableCore.GetCpuFlagsAndRegisters(); uint pc = (uint)regs["M68K PC"].Value; var disasm = Disassembler.Disassemble(MemoryDomains.SystemBus, pc & 0xFFFFFF, out _); var sb = new StringBuilder(); foreach (var r in regs) { if (r.Key.StartsWith("M68K")) // drop Z80 regs until it has its own debugger/tracer { if (r.Key != "M68K SP" && r.Key != "M68K ISP" && // copies of a7 r.Key != "M68K PC" && // already present in every line start r.Key != "M68K IR") // copy of last opcode, already shown in raw bytes { sb.Append($"{r.Key.Replace("M68K", "").Trim()}:{r.Value.Value.ToHexString(r.Value.BitSize / 4)} "); } } } var sr = regs["M68K SR"].Value; sb.Append(string.Concat( (sr & 16) > 0 ? "X" : "x", (sr & 8) > 0 ? "N" : "n", (sr & 4) > 0 ? "Z" : "z", (sr & 2) > 0 ? "V" : "v", (sr & 1) > 0 ? "C" : "c")); this.Put(new(disassembly: $"{pc:X6}: {disasm}".PadRight(50), registerInfo: sb.ToString().Trim())); }
protected override void TraceFromCallback() { var regs = DebuggableCore.GetCpuFlagsAndRegisters(); uint pc = (uint)regs["M68K PC"].Value; var length = 0; var disasm = Disassembler.Disassemble(MemoryDomains.SystemBus, pc, out length); var traceInfo = new TraceInfo { Disassembly = string.Format("{0:X6}: {1}", pc, disasm) }; var sb = new StringBuilder(); foreach (var r in regs) { if (r.Key.StartsWith("M68K")) // drop Z80 regs until it has its own debugger/tracer { if (r.Key != "M68K SP" && r.Key != "M68K ISP" && // copies of a7 r.Key != "M68K PC" && // already present in every line start r.Key != "M68K IR") // copy of last opcode, already shown in raw bytes { sb.Append( string.Format("{0}:{1} ", r.Key.Replace("M68K", "").Trim(), r.Value.Value.ToHexString(r.Value.BitSize / 4))); } } } var sr = regs["M68K SR"].Value; sb.Append( string.Format("{0}{1}{2}{3}{4}", (sr & 16) > 0 ? "X" : "x", (sr & 8) > 0 ? "N" : "n", (sr & 4) > 0 ? "Z" : "z", (sr & 2) > 0 ? "V" : "v", (sr & 1) > 0 ? "C" : "c")); traceInfo.RegisterInfo = sb.ToString().Trim(); Put(traceInfo); }
public int GetRegister(string name) { try { if (DebuggableCore == null) { throw new NotImplementedException(); } var registers = DebuggableCore.GetCpuFlagsAndRegisters(); return(registers.ContainsKey(name) ? (int)registers[name].Value : 0); } catch (NotImplementedException) { Log($"Error: {Emulator.Attributes().CoreName} does not yet implement getregister()"); return(0); } }
public Dictionary <string, ulong> GetRegisters() { var table = new Dictionary <string, ulong>(); try { if (DebuggableCore == null) { throw new NotImplementedException(); } foreach (var kvp in DebuggableCore.GetCpuFlagsAndRegisters()) { table[kvp.Key] = kvp.Value.Value; } } catch (NotImplementedException) { Console.WriteLine($"Error: {Emulator.Attributes().CoreName} does not yet implement {nameof(IDebuggable.GetCpuFlagsAndRegisters)}()"); } return(table); }
public ulong?GetRegister(string name) { try { if (DebuggableCore == null) { throw new NotImplementedException(); } var registers = DebuggableCore.GetCpuFlagsAndRegisters(); ulong?value = null; if (registers.ContainsKey(name)) { value = registers[name].Value; } return(value); } catch (NotImplementedException) { Console.WriteLine($"Error: {Emulator.Attributes().CoreName} does not yet implement {nameof(IDebuggable.GetCpuFlagsAndRegisters)}()"); return(null); } }