private static string ProcessArrayDisplaySyntax(bool useHex, ref bool forceHasChanged, Match match) { string newValue; int address; if (match.Groups[2].Value.Length > 0) { address = int.Parse(match.Groups[2].Value.Substring(1), System.Globalization.NumberStyles.HexNumber); } else if (match.Groups[3].Value.Length > 0) { address = int.Parse(match.Groups[3].Value); } else { CodeLabel label = LabelManager.GetLabel(match.Groups[4].Value); if (label == null) { forceHasChanged = true; return("<invalid label>"); } address = label.GetRelativeAddress(); } int elemCount = int.Parse(match.Groups[5].Value); if (address >= 0) { List <string> values = new List <string>(elemCount); for (int j = address, end = address + elemCount; j < end; j++) { int memValue = InteropEmu.DebugGetMemoryValue(DebugMemoryType.CpuMemory, (uint)j); values.Add(useHex ? memValue.ToString("X2") : memValue.ToString()); } newValue = string.Join(" ", values); } else { newValue = "<label out of scope>"; forceHasChanged = true; } return(newValue); }
private void mnuViewInDisassembly_Click(object sender, EventArgs e) { if (lstWatch.SelectedItems.Count != 1) { return; } if (_selectedAddress >= 0) { DebugWindowManager.GetDebugger().ScrollToAddress(_selectedAddress); } else if (_selectedLabel != null) { int relAddress = _selectedLabel.GetRelativeAddress(); if (relAddress >= 0) { DebugWindowManager.GetDebugger().ScrollToAddress(relAddress); } } }
private void mnuViewInDisassembly_Click(object sender, EventArgs e) { if (lstWatch.SelectedItems.Count != 1) { return; } if (_selectedAddress >= 0) { DebugWindowManager.OpenDebugger(_cpuType).GoToAddress(_selectedAddress); } else if (_selectedLabel != null) { AddressInfo relAddress = _selectedLabel.GetRelativeAddress(_cpuType); if (relAddress.Address >= 0) { DebugWindowManager.OpenDebugger(_cpuType).GoToAddress(relAddress.Address); } } }
public void Prepare(long firstByteIndex, long lastByteIndex) { int visibleByteCount = (int)(lastByteIndex - firstByteIndex + 1); if (_highlightBreakpoints) { Breakpoint[] breakpoints = BreakpointManager.Breakpoints.ToArray(); _breakpointTypes = new BreakpointType[visibleByteCount]; for (int i = 0; i < visibleByteCount; i++) { int byteIndex = i + (int)firstByteIndex; foreach (Breakpoint bp in breakpoints) { if (bp.Enabled && bp.IsCpuBreakpoint && bp.Matches(byteIndex, _memoryType)) { _breakpointTypes[i] = bp.BreakOnExec ? BreakpointType.Execute : (bp.BreakOnWrite ? BreakpointType.WriteRam : BreakpointType.ReadRam); break; } } } } else { _breakpointTypes = null; } _counts = InteropEmu.DebugGetMemoryAccessCounts((UInt32)firstByteIndex, (UInt32)visibleByteCount, _memoryType); if (_memoryType == DebugMemoryType.CpuMemory) { _freezeState = InteropEmu.DebugGetFreezeState((UInt16)firstByteIndex, (UInt16)visibleByteCount); } _cdlData = null; if (_highlightDmcDataBytes || _highlightDataBytes || _highlightCodeBytes) { switch (_memoryType) { case DebugMemoryType.ChrRom: case DebugMemoryType.PpuMemory: case DebugMemoryType.CpuMemory: case DebugMemoryType.PrgRom: _cdlData = InteropEmu.DebugGetCdlData((UInt32)firstByteIndex, (UInt32)visibleByteCount, _memoryType); break; } } _hasLabel = new ByteLabelState[visibleByteCount]; if (_highlightLabelledBytes) { if (_memoryType == DebugMemoryType.CpuMemory) { for (long i = 0; i < _hasLabel.Length; i++) { UInt16 addr = (UInt16)(i + firstByteIndex); CodeLabel label = LabelManager.GetLabel(addr); if (label == null) { label = LabelManager.GetLabel(addr, AddressType.Register); } if (label != null && !string.IsNullOrWhiteSpace(label.Label)) { if (label.Length > 1) { int relAddress = label.GetRelativeAddress(); _hasLabel[i] = relAddress == addr ? ByteLabelState.LabelFirstByte : ByteLabelState.LabelExtraByte; } else { _hasLabel[i] = ByteLabelState.LabelFirstByte; } } } } else if (_memoryType == DebugMemoryType.PrgRom || _memoryType == DebugMemoryType.WorkRam || _memoryType == DebugMemoryType.SaveRam) { for (long i = 0; i < _hasLabel.Length; i++) { UInt32 addr = (UInt32)(i + firstByteIndex); CodeLabel label = LabelManager.GetLabel(addr, _memoryType.ToAddressType()); if (label != null && !string.IsNullOrWhiteSpace(label.Label)) { _hasLabel[i] = label.Length == 1 || label.Address == addr ? ByteLabelState.LabelFirstByte : ByteLabelState.LabelExtraByte; } } } } InteropEmu.DebugGetState(ref _state); }