Exemple #1
0
        public bool ParseJumpCallToAnAddressValue(FormCpu i_form, bool i_justParse = false)
        {
            try
            {
                UInt16 detectedJumpAddress = ConvertRadix.ConvertNumberWithPrefix(i_form.textBoxJumpToAnAddress.Text);
                if (detectedJumpAddress > 0xFFFF)
                {
                    Locator.Resolve <IUserMessage>().Error("Value for jump to an address is too big...\n\nMaximum is 2 bytes(0xFFFF).");
                    i_form.textBoxJumpToAnAddress.Focus();
                }
                else
                {
                    _detectingJumpToAddress = detectedJumpAddress;
                }
            }
            catch (CommandParseException)
            {
                if (!i_justParse)
                {
                    Locator.Resolve <IUserMessage>().Error("Incorrect number in field for jump to an address..");
                    i_form.textBoxJumpToAnAddress.Focus();
                }
                return(false);
            }

            return(true);
        }
Exemple #2
0
        public bool ParseTracedOpcode(FormCpu i_form, bool i_justParse = false)
        {
            try
            {
                UInt16 opcode = ConvertRadix.ConvertNumberWithPrefix(i_form.textBoxOpcode.Text);
                if (opcode > 0xFF) //ToDo: only one byte for traced opcode
                {
                    SetTracedOpcode((byte)(opcode % 256));
                }
                else
                {
                    SetTracedOpcode((byte)opcode);
                }
            }
            catch (CommandParseException)
            {
                if (!i_justParse)
                {
                    Locator.Resolve <IUserMessage>().Error("Incorrect opcode number...");
                    i_form.textBoxOpcode.Focus();
                }
                return(false);
            }

            return(true);
        }
Exemple #3
0
        public static Dictionary <string, ushort> ParseSymbols(string i_symbols)
        {
            if (i_symbols == null || i_symbols == String.Empty)
            {
                return(null);
            }

            Dictionary <string, ushort> out_ParsedSymbols = new Dictionary <string, ushort>();

            string[] lines = i_symbols.Split('\n');
            foreach (string line in lines)
            {
                string[] lineParsed = Regex.Split(line, @"\s+");
                if (lineParsed.Length == 3)
                {
                    ushort symbolAddr = ConvertRadix.ConvertNumberWithPrefix(lineParsed[2]);
                    out_ParsedSymbols.Add(lineParsed[0], symbolAddr);
                }
            }

            return(out_ParsedSymbols);
        }
Exemple #4
0
        public int Compare(object x, object y)
        {
            //!!! designed for ListView<string, ushort> only for now.... !!!
            //Link: https://msdn.microsoft.com/en-us/library/ms996467.aspx
            int returnVal = -1;
            var column1   = ((ListViewItem)x);
            var column2   = ((ListViewItem)y);

            //get value to compare
            if (col == 1) // second column is ushort
            {
                //set values
                ushort value1 = ConvertRadix.ConvertNumberWithPrefix(column1.Tag.ToString());
                ushort value2 = ConvertRadix.ConvertNumberWithPrefix(column2.Tag.ToString());
                if (value1 == value2)
                {
                    returnVal = 0;
                }
                else
                {
                    returnVal = value1 > value2 ? 1 : -1;
                }
            }
            else
            {
                returnVal = String.Compare(((ListViewItem)x).Text, ((ListViewItem)y).Text);
            }

            // Determine whether the sort order is descending.
            if (order == SortOrder.Descending)
            {
                // Invert the value returned by String.Compare.
                returnVal *= -1;
            }
            return(returnVal);
        }