public frmOpCodeTooltip(Form parent, string opcode, int relativeAddress) { _parentForm = parent; InitializeComponent(); OpCodeDesc desc = _descriptions[opcode.ToLowerInvariant()]; if (relativeAddress >= 0) { byte opCode = InteropEmu.DebugGetMemoryValue(DebugMemoryType.CpuMemory, (UInt32)relativeAddress); int opSize = GetOpSize(opCode); string byteCode = ""; for (int i = 0; i < opSize; i++) { byte value = InteropEmu.DebugGetMemoryValue(DebugMemoryType.CpuMemory, (UInt32)(relativeAddress + i)); byteCode += "$" + value.ToString("X2") + " "; } lblByteCode.Text = byteCode; lblAddressingMode.Text = ResourceHelper.GetEnumText(AddressingModes[opCode]); lblCycleCount.Text = OpCycles[opCode].ToString(); if (OpCycles[opCode] != OpCyclesCrossed[opCode]) { lblCycleCount.Text += $" ({OpCyclesCrossed[opCode]} if page crossed)"; } } else { tlpOpCodeInfo.Visible = false; } ctrlFlagCarry.Letter = "C"; ctrlFlagDecimal.Letter = "D"; ctrlFlagInterrupt.Letter = "I"; ctrlFlagNegative.Letter = "N"; ctrlFlagOverflow.Letter = "V"; ctrlFlagZero.Letter = "Z"; lblName.Text = desc.Name; lblOpCodeDescription.Text = desc.Description; ctrlFlagCarry.Active = desc.Flags.HasFlag(CpuFlag.Carry); ctrlFlagDecimal.Active = desc.Flags.HasFlag(CpuFlag.Decimal); ctrlFlagInterrupt.Active = desc.Flags.HasFlag(CpuFlag.Interrupt); ctrlFlagNegative.Active = desc.Flags.HasFlag(CpuFlag.Negative); ctrlFlagOverflow.Active = desc.Flags.HasFlag(CpuFlag.Overflow); ctrlFlagZero.Active = desc.Flags.HasFlag(CpuFlag.Zero); this.TopLevel = false; this.Parent = _parentForm; _parentForm.Controls.Add(this); }
public frmOpCodeTooltip(string opcode) { InitializeComponent(); OpCodeDesc desc = _descriptions[opcode.ToLowerInvariant()]; ctrlFlagCarry.Letter = "C"; ctrlFlagDecimal.Letter = "D"; ctrlFlagInterrupt.Letter = "I"; ctrlFlagNegative.Letter = "N"; ctrlFlagOverflow.Letter = "O"; ctrlFlagZero.Letter = "Z"; lblName.Text = desc.Name; lblOpCodeDescription.Text = desc.Description; ctrlFlagCarry.Active = desc.Flags.HasFlag(CpuFlag.Carry); ctrlFlagDecimal.Active = desc.Flags.HasFlag(CpuFlag.Decimal); ctrlFlagInterrupt.Active = desc.Flags.HasFlag(CpuFlag.Interrupt); ctrlFlagNegative.Active = desc.Flags.HasFlag(CpuFlag.Negative); ctrlFlagOverflow.Active = desc.Flags.HasFlag(CpuFlag.Overflow); ctrlFlagZero.Active = desc.Flags.HasFlag(CpuFlag.Zero); }
public frmOpCodeTooltip(string opcode, int relativeAddress) { InitializeComponent(); OpCodeDesc desc = _descriptions[opcode.ToLowerInvariant()]; if (relativeAddress >= 0) { byte opCode = InteropEmu.DebugGetMemoryValue(DebugMemoryType.CpuMemory, (UInt32)relativeAddress); int opSize = 1; switch (AddressingModes[opCode]) { case AddrMode.Abs: case AddrMode.AbsX: case AddrMode.AbsXW: case AddrMode.AbsY: case AddrMode.AbsYW: case AddrMode.Ind: opSize = 3; break; case AddrMode.Imm: case AddrMode.IndX: case AddrMode.IndY: case AddrMode.IndYW: case AddrMode.Rel: case AddrMode.Zero: case AddrMode.ZeroX: case AddrMode.ZeroY: opSize = 2; break; } string byteCode = ""; for (int i = 0; i < opSize; i++) { byte value = InteropEmu.DebugGetMemoryValue(DebugMemoryType.CpuMemory, (UInt32)(relativeAddress + i)); byteCode += "$" + value.ToString("X2") + " "; } lblByteCode.Text = byteCode; lblAddressingMode.Text = ResourceHelper.GetEnumText(AddressingModes[opCode]); lblCycleCount.Text = OpCycles[opCode].ToString(); if (OpCycles[opCode] != OpCyclesCrossed[opCode]) { lblCycleCount.Text += $" ({OpCyclesCrossed[opCode]} if page crossed)"; } } else { tlpOpCodeInfo.Visible = false; } ctrlFlagCarry.Letter = "C"; ctrlFlagDecimal.Letter = "D"; ctrlFlagInterrupt.Letter = "I"; ctrlFlagNegative.Letter = "N"; ctrlFlagOverflow.Letter = "O"; ctrlFlagZero.Letter = "Z"; lblName.Text = desc.Name; lblOpCodeDescription.Text = desc.Description; ctrlFlagCarry.Active = desc.Flags.HasFlag(CpuFlag.Carry); ctrlFlagDecimal.Active = desc.Flags.HasFlag(CpuFlag.Decimal); ctrlFlagInterrupt.Active = desc.Flags.HasFlag(CpuFlag.Interrupt); ctrlFlagNegative.Active = desc.Flags.HasFlag(CpuFlag.Negative); ctrlFlagOverflow.Active = desc.Flags.HasFlag(CpuFlag.Overflow); ctrlFlagZero.Active = desc.Flags.HasFlag(CpuFlag.Zero); }