public void disasm(DebuggerCore debugger, FarPointer addr, ushort length = 16) { var dis = new Disassembler(debugger.CPU); dis.cs = addr.Segment; dis.ip = addr.Offset; while (dis.ip < addr.Offset + length) { debugger.WriteLine("{0:X4}:{1:X4} {2}", dis.cs, dis.ip, dis.Read()); } }
public static object sub_fp(FarPointer a, object b) { return(new FarPointer(a.Segment, (ushort)Convert.ChangeType(subtract(a.Offset, b), typeof(ushort)))); }
public void bp(DebuggerCore debugger, FarPointer addr) { debugger.AddBreakPoint(new CodeBreakPoint(addr.Segment, addr.Offset)); }
public void dump_mem(DebuggerCore debugger, FarPointer addr, ushort length = 16, string format = "b") { try { ushort seg = addr.Segment; ushort ofs = addr.Offset; switch (format) { case "b": { char[] chBuf = new char[16]; for (int i = 0; i < length; i++) { if ((i % 16 == 0)) { if (i > 0) { debugger.Write("|"); debugger.Write(new string(chBuf)); debugger.WriteLine("|"); } debugger.Write(string.Format("{0:X4}:{1:X4} ", seg, ofs + i)); } byte b = debugger.CPU.MemoryBus.ReadByte(seg, (ushort)(ofs + i)); chBuf[i % 16] = (b >= 32 && b < 128) ? (char)b : ' '; debugger.Write(string.Format("{0:X2} ", b)); } if ((length % 16) != 0) { debugger.Write(new string(' ', (16 - length % 16) * 3)); } debugger.Write("|"); debugger.Write(new string(chBuf, 0, (length % 16) == 0 ? 16 : length % 16)); debugger.WriteLine("|"); break; } case "w": for (int i = 0; i < length; i++) { if ((i % 8 == 0)) { if (i > 0) { debugger.WriteLine(); } debugger.Write(string.Format("{0:X4}:{1:X4} ", seg, ofs + i * 2)); } var val = debugger.CPU.MemoryBus.ReadWord(seg, (ushort)(ofs + i * 2)); debugger.Write(string.Format("{0:X4} ", val)); } debugger.WriteLine(); break; case "dw": for (int i = 0; i < length; i++) { if ((i % 4 == 0)) { if (i > 0) { debugger.WriteLine(); } debugger.Write(string.Format("{0:X4}:{1:X4} ", seg, ofs + i * 4)); } var val = debugger.CPU.MemoryBus.ReadDWord(seg, (ushort)(ofs + i * 4)); debugger.Write(string.Format("{0:X8} ", val)); } debugger.WriteLine(); break; case "i": for (int i = 0; i < length; i++) { if ((i % 8 == 0)) { if (i > 0) { debugger.WriteLine(); } debugger.Write(string.Format("{0:X4}:{1:X4} ", seg, ofs + i * 2)); } var val = debugger.CPU.MemoryBus.ReadWord(seg, (ushort)(ofs + i * 2)); debugger.Write(string.Format("{0,6} ", unchecked ((short)val))); } debugger.WriteLine(); break; case "l": for (int i = 0; i < length; i++) { if ((i % 4 == 0)) { if (i > 0) { debugger.WriteLine(); } debugger.Write(string.Format("{0:X4}:{1:X4} ", seg, ofs + i * 4)); } var val = debugger.CPU.MemoryBus.ReadDWord(seg, (ushort)(ofs + i * 4)); debugger.Write(string.Format("{0,11} ", unchecked ((int)val))); } debugger.WriteLine(); break; } } catch (CPUException) { debugger.WriteLine("#err"); } }
public void r_to(DebuggerCore debugger, FarPointer addr) { debugger.BreakAt(addr.Segment, addr.Offset); debugger.Continue(); }
public void bp_memr(DebuggerCore debugger, FarPointer addr, ushort length) { debugger.AddBreakPoint(new MemoryReadBreakPoint(addr.Segment, addr.Offset, length)); }
public void view_mem(FarPointer addr) { _debugger.MemoryWindow.MoveTo(addr.Segment, addr.Offset); _debugger.MemoryWindow.Activate(); }
public void view_code(FarPointer addr) { _debugger.CodeWindow.MoveTo(addr.Segment, addr.Offset, 0); _debugger.CodeWindow.Activate(); }