public string OperandLabel(int addr) { AsmLine line = GetAsmLineByAddress(addr); Debug.Assert(line.Is6502Operation()); return(line.OperandArgument.Label); }
public override object Convert(object value, Type targetType, object parameter, CultureInfo culture) { var lbi = (ListBoxItem)value; AsmListBoxItem item = (AsmListBoxItem)lbi.Content; AddressItem addressItem = item as AddressItem; string operand = addressItem.Operand ?? ""; Console.WriteLine(operand); int padding; operand = int.TryParse(parameter.ToString(), out padding) ? operand.PadRight(padding) : operand; AsmLine asmLine = item.AsmLine; if (asmLine.HasOperandArgument()) { if (asmLine.OperandArgument.HasLabel()) { if (!(asmLine.IsJumpOperation() || asmLine.IsBranchOperation() || asmLine.Opcode == "rts")) { string label = asmLine.OperandArgument.Label; operand = operand.Replace(label, "<Run Foreground=\"DarkOrange\">" + label + "</Run>"); } } } return(operand.Replace("&", "&")); }
public string OpcodeLineKey(int addr) { AsmLine line = GetAsmLineByAddress(addr); Debug.Assert(line.Is6502Operation()); return(line.Offset + " " + line.Address); }
public string Opcode(int addr) { AsmLine line = GetAsmLineByAddress(addr); Debug.Assert(line.Is6502Operation()); return(line.Opcode); }
private AsmLine GetAsmLineByAddress(int addr) { AsmLine line = null; _asmLineByAddress.TryGetValue(addr, out line); return(line); }
string InstructionColor(AsmLine asmLine) { if (asmLine.IsBranchOperation()) { return("Blue"); } if ("jmp jsr rts".Contains(asmLine.Opcode)) { return("Red"); } return("Black"); }
private string ColorOpcodeOperand(AsmLine asmLine, string paddedOperand) { if (asmLine.HasOperandArgument()) { if (asmLine.OperandArgument.HasLabel()) { if (!(asmLine.IsJumpOperation() || asmLine.IsBranchOperation() || asmLine.Opcode == "rts")) { string label = asmLine.OperandArgument.Label; paddedOperand = "<Span>" + paddedOperand.Replace(label, "<Run Foreground=\"DarkOrange\">" + label + "</Run>").Replace("&", "&") + "</Span>"; } } } return(paddedOperand.Replace("&", "&")); }
public AsmReader(string filename) { _inputLines = new List <string>(File.ReadAllLines(filename)); foreach (string line in _inputLines) { AsmLine asmLine = new AsmLine(line, _asmLines.Count); _asmLines.Add(asmLine); } _addressByLabel = AddressByLabelDictionary(); _labelByAddress = LabelByAddressDictionary(); // all JSR have labels as subroutine address ValidateJsrCalls(); }
private void GotoPreviousLabel() { AsmListBoxItem item = listBox.SelectedItem as AsmListBoxItem; AsmLine asmLine = item.AsmLine; int index = asmLine.Index - 1; while (index >= 0) { asmLine = AsmReader._asmLines[index]; if (asmLine.IsMemoryMapped() && asmLine.HasLabel()) { ScrollToAddress(asmLine.DecimalAddress, ScrollMode.Smooth); return; } index--; } }
private void FollowJumpImmediate() { AsmLine asmLine = SelectedAsmLine(); if (!asmLine.IsJumpOperation()) { return; } _addressStack.Push(asmLine.DecimalAddress); string label = asmLine.OperandArgument.Label; int address; if (!AsmReader.AddressByLabelDictionary().TryGetValue(label, out address)) { return; } ScrollToAddress(address, ScrollMode.ScrollToCenterOfView); }
public string GetAsmLineByIndex(int index) { AsmLine line = _reader._asmLines[index]; return(line.Line); }