/// <summary> /// Initializes a new instance of the <see cref="VGAConsole"/> class. /// </summary> public VGAConsole(SimCPU simCPU, ISimDisplay dislayForm) : base(simCPU) { this.dislayForm = dislayForm; this.IsMemoryMonitor = true; ioBase = StandardIOBase; baseAddress = StandardAddressBase; width = 80; height = 27; cursorPosition = 0; lastCommand = 0; font = new Font("Lucida Console", 9, FontStyle.Regular); //font = new Font("Consolas", 8, FontStyle.Regular); fontWidth = (int)font.SizeInPoints; fontHeight = (int)font.SizeInPoints + 5; bitmap = new System.Drawing.Bitmap(fontWidth * width, fontHeight * height, System.Drawing.Imaging.PixelFormat.Format24bppRgb); graphic = Graphics.FromImage(bitmap); dislayForm.SetBitMap(bitmap); }
protected void AddBreakpointByLabel(int lineNbr, string data) { var symbol = SimCPU.GetSymbol(data); AddOutput(lineNbr, "STATUS: Add breakpoint " + symbol.Name + " at " + MainForm.Format(symbol.Address, MainForm.Display32)); MainForm.AddBreakpoint(symbol.Name, symbol.Address); }
protected void AddWatchByLabel(int lineNbr, string data) { var symbol = SimCPU.GetSymbol(data); AddOutput(lineNbr, "STATUS: Add watach " + symbol.Name + " at " + MainForm.Format(symbol.Address, MainForm.Display32)); MainForm.AddWatch(symbol.Name, symbol.Address, (int)symbol.Size); }
private void Compile() { var simAdapter = GetSimAdaptor("x86"); compileStartTime = DateTime.Now; Compiler.CompilerOptions.EnableSSA = false; Compiler.CompilerOptions.EnableOptimizations = false; Compiler.CompilerOptions.EnableVariablePromotion = false; Compiler.CompilerOptions.EnableSparseConditionalConstantPropagation = false; Compiler.CompilerOptions.EnableInlinedMethods = false; Compiler.CompilerOptions.LinkerFactory = delegate { return(new SimLinker(simAdapter)); }; Compiler.CompilerFactory = delegate { return(new SimCompiler(simAdapter)); }; Compiler.Execute(Environment.ProcessorCount); SimCPU = simAdapter.SimCPU; SimCPU.Monitor.BreakAtTick = 1; SimCPU.Monitor.BreakOnException = true; SimCPU.Monitor.OnStateUpdate = UpdateSimState; SimCPU.Reset(); Display32 = SimCPU.GetState().NativeRegisterSize == 32; }
public override BaseSimDevice Clone(SimCPU simCPU) { var device = new CMOS(simCPU); device.index = index; return(device); }
public override void ExtendState(SimCPU simCPU) { var x86 = simCPU as CPUx86; AddStack(x86); AddStackFrame(x86); AddCallStack(x86); }
public override void Execute(SimCPU cpu, SimInstruction instruction) { var x86 = cpu as CPUx86; x86.EIP.Value = x86.EIP.Value + instruction.OpcodeSize; Execute(x86, instruction); }
public override BaseSimDevice Clone(SimCPU simCPU) { var device = new MosaDebug(simCPU, debug); device.value32 = value32; device.bytes32 = bytes32; device.sb = new StringBuilder(sb.ToString()); return(device); }
public override BaseSimDevice Clone(SimCPU simCPU) { var device = new MosaDebug(simCPU, debug); device.value32 = value32; device.bytes32 = bytes32; device.sb = new StringBuilder(sb.ToString()); return device; }
private void AddSymbol(ulong ip) { SimSymbol symbol = SimCPU.FindSymbol(ip); if (symbol != null) { treeView1.Nodes.Add(new CallStackEntry(symbol, ip, true)); } else { treeView1.Nodes.Add(new CallStackEntry(ip, true)); } }
private void UpdateDisplay() { int lines = lbMemory.Height / (lbMemory.Font.Height + 2); try { string nbr = tbMemory.Text.ToUpper().Trim(); int digits = 10; int where = nbr.IndexOf('X'); if (where >= 0) { digits = 16; nbr = nbr.Substring(where + 1); } uint at = Convert.ToUInt32(nbr, digits); string[] newlines = new string[lines]; for (int line = 0; line < lines; line++) { string l = at.ToString("X").PadLeft(8, '0') + ':'; string d = string.Empty; for (int x = 0; x < 16; x++) { byte mem = SimCPU.DirectRead8(at); if (x % 4 == 0) { l = l + ' '; } l = l + mem.ToString("X").PadLeft(2, '0'); char b = (char)mem; d = d + (char.IsLetterOrDigit(b) ? b : '.'); at++; } newlines[line] = l + ' ' + d; } lbMemory.Lines = newlines; Status = string.Empty; } catch (Exception e) { Status = "Error: " + e.ToString(); } }
public void AddHistory(BaseSimState simState) { if (!MainForm.Record) { return; } if (simState.IP == 0xFFFFFFF0) { return; } string methodName = SimCPU.FindSymbol(simState.IP).Name; pendingHistory.Enqueue(new HistoryEntry(simState, methodName, MainForm.Display32)); }
public override void UpdateDock(BaseSimState simState) { var currentInstruction = simState.Instruction; var nextInstruction = SimCPU.GetOpcode(simState.NextIP); textBox1.Text = simState.Tick.ToString(); textBox2.Text = currentInstruction != null?currentInstruction.ToString() : "-BLANK-"; textBox3.Text = nextInstruction != null?nextInstruction.ToString() : "-BLANK-"; textBox4.Text = "0x" + simState.IP.ToString("X8"); textBox5.Text = "0x" + simState.NextIP.ToString("X8"); textBox6.Text = simState.CPUException != null?simState.CPUException.ToString() : "None"; double speed = simState.Tick / simState.TotalElapsedSeconds; textBox7.Text = speed.ToString("0.00"); Refresh(); }
public override BaseSimDevice Clone(SimCPU simCPU) { var device = new CMOS(simCPU); device.index = index; return device; }
public static readonly uint VirtualPageBitMap = 1024 * 1024 * 21; // 0x1500000 #endregion Fields #region Constructors public MosaKernel(SimCPU simCPU) : base(simCPU) { }
public override BaseSimDevice Clone(SimCPU simCPU) { return new MosaImage(simCPU); }
public static readonly uint VirtualPageBitMap = 1024 * 1024 * 20; // 0x01400000 public MosaKernel(SimCPU simCPU) : base(simCPU) { }
public PowerUp(SimCPU simCPU) : base(simCPU) { }
/// <summary> /// Initializes a new instance of the <see cref="MosaDebug"/> class. /// </summary> /// <param name="simCPU">The sim cpu.</param> public MosaDebug(SimCPU simCPU) : base(simCPU) { debug = null; }
public BaseSimDevice(SimCPU simCPU) { this.simCPU = simCPU; IsMemoryMonitor = false; }
/// <summary> /// Initializes a new instance of the <see cref="CMOS"/> class. /// </summary> /// <param name="ioBase">The io base.</param> public CMOS(SimCPU simCPU) : base(simCPU) { }
/// <summary> /// Initializes a new instance of the <see cref="BochDebug"/> class. /// </summary> /// <param name="simCPU">The sim cpu.</param> public BochDebug(SimCPU simCPU) : base(simCPU) { debug = null; }
public static readonly uint MultibootStructure = 0x10090; // same as QEMU public Multiboot(SimCPU simCPU) : base(simCPU) { }
public override BaseSimDevice Clone(SimCPU simCPU) { return(new Multiboot(simCPU)); }
public SimStream(SimCPU simCPU, ulong offset) { this.simCPU = simCPU; this.internaloffset = offset; }
public MosaImage(SimCPU simCPU) : base(simCPU) { }
public virtual void Execute(SimCPU cpu, SimInstruction instruction) { }
public override BaseSimDevice Clone(SimCPU simCPU) { return(new MosaImage(simCPU)); }
public override BaseSimDevice Clone(SimCPU simCPU) { return(new MosaTestMemory(simCPU)); }
public BaseSimDevice(SimCPU simCPU) { this.simCPU = simCPU; }
public MosaTestMemory(SimCPU simCPU) : base(simCPU) { }
public override BaseSimDevice Clone(SimCPU simCPU) { return new Multiboot(simCPU); }
public override BaseSimDevice Clone(SimCPU simCPU) { return(new MosaKernel(simCPU)); }
public SimLinkerFinalizationStage(SimCPU simCPU) { this.simCPU = simCPU; }
public override BaseSimDevice Clone(SimCPU simCPU) { return new MosaTestMemory(simCPU); }
public override BaseSimDevice Clone(SimCPU simCPU) { return new MosaKernel(simCPU); }
public ulong offset; // hack until next version of SharpDism public SimAssemblyCode(SimCPU simCPU, ulong offset = 0) { this.simCPU = simCPU; this.offset = offset; }
public override BaseSimDevice Clone(SimCPU simCPU) { return(null); // not clonable }
public static readonly uint MultibootStructure = 0x10090; // same as QEMU #endregion Fields #region Constructors public Multiboot(SimCPU simCPU) : base(simCPU) { }
public abstract BaseSimDevice Clone(SimCPU simCPU);
/// <summary> /// Initializes a new instance of the <see cref="VGAConsole"/> class. /// </summary> public VGAConsole(SimCPU simCPU, ISimDisplay dislayForm) : base(simCPU) { this.dislayForm = dislayForm; IsMemoryMonitor = true; ioBase = StandardIOBase; baseAddress = StandardAddressBase; width = 80; height = 27; cursorPosition = 0; lastCommand = 0; font = new Font("Lucida Console", 9, FontStyle.Regular); //font = new Font("Consolas", 8, FontStyle.Regular); fontWidth = (int)font.SizeInPoints; fontHeight = (int)font.SizeInPoints + 5; bitmap = new System.Drawing.Bitmap(fontWidth * width, fontHeight * height, System.Drawing.Imaging.PixelFormat.Format24bppRgb); graphic = Graphics.FromImage(bitmap); dislayForm.SetBitMap(bitmap); }
public static readonly uint ImageSize = 1024 * 1024 * 8; // 8MB public MosaImage(SimCPU simCPU) : base(simCPU) { }
public override BaseSimDevice Clone(SimCPU simCPU) { return null; // not clonable }
/// <summary> /// Initializes a new instance of the <see cref="MosaDebug"/> class. /// </summary> /// <param name="simCPU">The sim cpu.</param> /// <param name="output">The output.</param> public MosaDebug(SimCPU simCPU, TextWriter output) : base(simCPU) { debug = output; }
public override BaseSimDevice Clone(SimCPU simCPU) { return new PowerUp(simCPU); }