示例#1
0
        public string OperandLabel(int addr)
        {
            AsmLine line = GetAsmLineByAddress(addr);

            Debug.Assert(line.Is6502Operation());
            return(line.OperandArgument.Label);
        }
示例#2
0
        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("&", "&amp;"));
        }
示例#3
0
        public string OpcodeLineKey(int addr)
        {
            AsmLine line = GetAsmLineByAddress(addr);

            Debug.Assert(line.Is6502Operation());
            return(line.Offset + " " + line.Address);
        }
示例#4
0
        public string Opcode(int addr)
        {
            AsmLine line = GetAsmLineByAddress(addr);

            Debug.Assert(line.Is6502Operation());
            return(line.Opcode);
        }
示例#5
0
        private AsmLine GetAsmLineByAddress(int addr)
        {
            AsmLine line = null;

            _asmLineByAddress.TryGetValue(addr, out line);
            return(line);
        }
示例#6
0
 string InstructionColor(AsmLine asmLine)
 {
     if (asmLine.IsBranchOperation())
     {
         return("Blue");
     }
     if ("jmp jsr rts".Contains(asmLine.Opcode))
     {
         return("Red");
     }
     return("Black");
 }
示例#7
0
 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("&", "&amp;") + "</Span>";
             }
         }
     }
     return(paddedOperand.Replace("&", "&amp;"));
 }
示例#8
0
        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();
        }
示例#9
0
        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--;
            }
        }
示例#10
0
        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);
        }
示例#11
0
        public string GetAsmLineByIndex(int index)
        {
            AsmLine line = _reader._asmLines[index];

            return(line.Line);
        }