Example #1
0
 internal void AddBreakpoint(ushort Address, bool Read, bool Write, bool Execute)
 {
     Breakpoints.Add(Address, new Breakpoint()
     {
         Address = Address, OnRead = Read, OnWrite = Write, OnExecute = Execute
     });
 }
Example #2
0
        public ParseMessage AddError(int Line, Types.ErrorCode Code, string Text)
        {
            ParseMessage errorMessage = new ParseMessage(ParseMessage.LineType.ERROR, Code, Text, -1, 0);

            Messages.Add(Line, errorMessage);
            ++m_ErrorMessages;
            return(errorMessage);
        }
Example #3
0
        private void RefreshNodes()
        {
            treeProject.BeginUpdate();
            NodeRoot.Nodes.Clear();

            IList <Types.SymbolInfo> sortedTokens = null;

            // sort by line number
            if (Core.Settings.OutlineSortByIndex)
            {
                GR.Collections.MultiMap <int, Types.SymbolInfo> sortedTokensInner = new GR.Collections.MultiMap <int, C64Studio.Types.SymbolInfo>();
                foreach (KeyValuePair <string, Types.SymbolInfo> token in OutlineTokens)
                {
                    if (!string.IsNullOrEmpty(Core.Settings.OutlineFilter))
                    {
                        if (token.Key.ToUpper().Contains(Core.Settings.OutlineFilter.ToUpper()))
                        {
                            sortedTokensInner.Add(token.Value.LineIndex, token.Value);
                        }
                    }
                    else
                    {
                        sortedTokensInner.Add(token.Value.LineIndex, token.Value);
                    }
                }
                sortedTokens = sortedTokensInner.Values;
            }
            else
            {
                GR.Collections.MultiMap <string, Types.SymbolInfo> sortedTokensInner = new GR.Collections.MultiMap <string, C64Studio.Types.SymbolInfo>();
                foreach (KeyValuePair <string, Types.SymbolInfo> token in OutlineTokens)
                {
                    if (!string.IsNullOrEmpty(Core.Settings.OutlineFilter))
                    {
                        if (token.Key.ToUpper().Contains(Core.Settings.OutlineFilter.ToUpper()))
                        {
                            sortedTokensInner.Add(token.Key.ToUpper(), token.Value);
                        }
                    }
                    else
                    {
                        sortedTokensInner.Add(token.Key.ToUpper(), token.Value);
                    }
                }
                sortedTokens = sortedTokensInner.Values;
            }

            string curZone = "";

            System.Windows.Forms.TreeNode parentNode = new System.Windows.Forms.TreeNode();
            parentNode            = new System.Windows.Forms.TreeNode();
            parentNode.Text       = "Global Zone";
            parentNode.ImageIndex = parentNode.SelectedImageIndex = 0;
            NodeRoot.Nodes.Add(parentNode);
            System.Windows.Forms.TreeNode globalZone = parentNode;

            Dictionary <string, TreeNode> zoneNodes = new Dictionary <string, TreeNode>();

            zoneNodes.Add(parentNode.Text, globalZone);

            // add zone nodes first
            foreach (var token in sortedTokens)
            {
                if (token.Type == C64Studio.Types.SymbolInfo.Types.ZONE)
                {
                    System.Windows.Forms.TreeNode node = new System.Windows.Forms.TreeNode();

                    node.Text = token.Name;
                    node.Tag  = token;

                    parentNode            = new System.Windows.Forms.TreeNode();
                    parentNode.Text       = token.Zone;
                    parentNode.ImageIndex = parentNode.SelectedImageIndex = 0;
                    NodeRoot.Nodes.Add(parentNode);
                    parentNode.Tag = token;

                    zoneNodes.Add(parentNode.Text, parentNode);
                }
            }

            // now add child nodes
            parentNode = globalZone;
            foreach (var token in sortedTokens)
            {
                if (token.Type == C64Studio.Types.SymbolInfo.Types.ZONE)
                {
                    curZone    = token.Zone;
                    parentNode = zoneNodes[token.Zone];
                    continue;
                }

                System.Windows.Forms.TreeNode node = new System.Windows.Forms.TreeNode();
                bool addNode = true;

                node.Text = token.Name;
                node.Tag  = token;

                switch (token.Type)
                {
                case C64Studio.Types.SymbolInfo.Types.CONSTANT_1:
                case C64Studio.Types.SymbolInfo.Types.CONSTANT_2:
                    node.ImageIndex = node.SelectedImageIndex = 2;
                    node.Text      += " = $" + token.AddressOrValue.ToString("X4");
                    break;

                case C64Studio.Types.SymbolInfo.Types.LABEL:
                    if ((token.Name.Contains(".")) &&
                        (!Core.Settings.OutlineShowLocalLabels))
                    {
                        addNode = false;
                    }
                    if ((token.Name.StartsWith(C64Studio.Parser.ASMFileParser.InternalLabelPrefix)) &&
                        (!Core.Settings.OutlineShowShortCutLabels))
                    {
                        addNode = false;
                    }
                    node.ImageIndex = node.SelectedImageIndex = 1;
                    node.Text      += " = $" + token.AddressOrValue.ToString("X4");
                    break;

                case C64Studio.Types.SymbolInfo.Types.PREPROCESSOR_LABEL:
                case C64Studio.Types.SymbolInfo.Types.PREPROCESSOR_CONSTANT_1:
                case C64Studio.Types.SymbolInfo.Types.PREPROCESSOR_CONSTANT_2:
                    node.ImageIndex = node.SelectedImageIndex = 3;
                    node.Text      += " = $" + token.AddressOrValue.ToString("X4");
                    break;

                case C64Studio.Types.SymbolInfo.Types.UNKNOWN:
                    break;
                }

                if (!addNode)
                {
                    continue;
                }

                // cut off zone
                try
                {
                    // find parent node
                    if ((string.IsNullOrEmpty(token.Zone)) ||
                        (!zoneNodes.ContainsKey(token.Zone)))
                    {
                        globalZone.Nodes.Add(node);
                    }
                    else
                    //if ( curZone.Length > 0 )
                    {
                        var parentZoneNode = zoneNodes[token.Zone];

                        int    dotPos         = node.Text.IndexOf('.');
                        string nodeParentText = parentZoneNode.Text;
                        if (dotPos != -1)
                        {
                            node.Text = node.Text.Substring(dotPos);
                        }
                        parentZoneNode.Nodes.Add(node);

                        if ((_ExpandedNodes.ContainsKey(nodeParentText)) &&
                            (_ExpandedNodes[nodeParentText]))
                        {
                            parentZoneNode.Expand();
                        }
                    }
                }
                catch (Exception ex)
                {
                    Debug.Log(ex.Message);
                }
            }
            NodeRoot.Expand();
            treeProject.EndUpdate();
        }
Example #4
0
 public void AddAccelerator(AcceleratorKey Accelerator)
 {
     Accelerators.Add(Accelerator.Key, Accelerator);
 }