protected override void OnCellValueChanged(DataGridViewCellEventArgs e) { if (e.RowIndex < 0 || e.RowIndex > _cp.MicrocodeRam.Length) { base.OnCellValueChanged(e); return; } switch (e.ColumnIndex) { case 0: // breakpoint { // grab the check value bool cellValue = (bool)this.Rows[e.RowIndex].Cells[e.ColumnIndex].EditedFormattedValue; if (cellValue) { BreakpointManager.SetBreakpoint(new BreakpointEntry(BreakpointProcessor.CP, BreakpointType.Execution, (ushort)e.RowIndex)); } else { BreakpointManager.SetBreakpoint(new BreakpointEntry(BreakpointProcessor.CP, BreakpointType.None, (ushort)e.RowIndex)); } } break; } base.OnCellValueChanged(e); }
protected override void OnCellValueChanged(DataGridViewCellEventArgs e) { if (e.RowIndex < 0 || e.RowIndex > _source.Count) { base.OnCellValueChanged(e); return; } switch (e.ColumnIndex) { case 0: // breakpoint { // grab the check value bool cellValue = (bool)this.Rows[e.RowIndex].Cells[e.ColumnIndex].EditedFormattedValue; ushort address = 0; bool addressAvailable = _sourceMap != null?_sourceMap.GetAddressForSource(new SourceEntry(_currentSourceFile, new string[] { }, 0, e.RowIndex), out address) : false; if (addressAvailable) { if (cellValue) { BreakpointManager.SetBreakpoint(new BreakpointEntry(_iopCode ? BreakpointProcessor.IOP : BreakpointProcessor.CP, BreakpointType.Execution, address)); } else { BreakpointManager.SetBreakpoint(new BreakpointEntry(_iopCode ? BreakpointProcessor.IOP : BreakpointProcessor.CP, BreakpointType.None, address)); } } } break; case 1: // address { string oldCellValue = ((string)this.Rows[e.RowIndex].Cells[e.ColumnIndex].Value).Trim(); string[] symbolTokens = ((string)this.Rows[e.RowIndex].Cells[e.ColumnIndex].EditedFormattedValue).Trim().Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries); if (symbolTokens.Length > 2) { MessageBox.Show("Invalid syntax."); return; } if (oldCellValue.StartsWith("$")) { oldCellValue = oldCellValue.Substring(1); } if (symbolTokens.Length == 0) { // cell is empty, delete the current source map entry if present. // TODO: use source map for this instead? if (_sourceMap != null && !string.IsNullOrEmpty(oldCellValue)) { ushort oldAddress = Convert.ToUInt16(oldCellValue, 16); _sourceMap.RemoveSourceEntry(new SourceEntry(_currentSourceFile, new string[] { }, oldAddress, e.RowIndex)); } return; } // // Valid new cell value. // string cellValue = symbolTokens[0]; string symbolName = symbolTokens.Length == 2 ? symbolTokens[1] : "*none*"; // strip leading $ if any. if (cellValue.StartsWith("$")) { cellValue = cellValue.Substring(1); } try { ushort address = Convert.ToUInt16(cellValue, 16); ushort oldAddress = string.IsNullOrWhiteSpace(oldCellValue) ? (ushort)0 : Convert.ToUInt16(oldCellValue, 16); if (_sourceMap != null && address != oldAddress) { // // Set the new value first. // _sourceMap.AddSourceEntry(new SourceEntry(_currentSourceFile, new string[] { symbolName }, address, e.RowIndex)); // // Remove the old value from the database if there is one. // if (!string.IsNullOrWhiteSpace(oldCellValue)) { _sourceMap.RemoveSourceEntry(new SourceEntry(_currentSourceFile, new string[] { }, oldAddress, e.RowIndex)); } } } catch (Exception ex) { MessageBox.Show(ex.Message, "Hey!"); // Invalid value, clear it. // this.Rows[e.RowIndex].Cells[e.ColumnIndex].Value = String.Empty; } } break; } base.OnCellValueChanged(e); }
private void ClearMesaBreakpoint(int address) { BreakpointManager.SetBreakpoint(new BreakpointEntry(BreakpointProcessor.Mesa, BreakpointType.None, address)); }
private void SetMesaBreakpoint(int address) { BreakpointManager.SetBreakpoint(new BreakpointEntry(BreakpointProcessor.Mesa, BreakpointType.Execution, address)); }