Ejemplo n.º 1
0
        private void addOtherBreakpointButton_Click(object sender, EventArgs e)
        {
            if ((comboBox2.SelectedIndex < 0) || (comboBox2.SelectedIndex < 14 && maskedTextBox2.Text.Length < 1))
            {
                return;
            }

            int addr = -1;
            int val  = -1;

            SPECCY_EVENT speccyEvent = Utilities.GetEnumFromString <SPECCY_EVENT>(comboBox2.Text, SPECCY_EVENT.OPCODE_PC);

            if (comboBox2.SelectedIndex < 14)
            {
                addr = Utilities.ConvertToInt(maskedTextBox2.Text);

                if (addr > 65535)
                {
                    System.Windows.Forms.MessageBox.Show("The address is not within 0 to 65535!", "Invalid input", MessageBoxButtons.OK);
                    return;
                }
            }
            else if (speccyEvent == SPECCY_EVENT.ULA_WRITE || speccyEvent == SPECCY_EVENT.ULA_READ)
            {
                addr = 254; //0xfe
            }
            if (maskedTextBox3.Text.Length > 0)
            {
                val = Utilities.ConvertToInt(maskedTextBox3.Text);

                if (val > 255)
                {
                    System.Windows.Forms.MessageBox.Show("The value is not within 0 to 255!", "Invalid input", MessageBoxButtons.OK);
                    return;
                }
            }
            else
            {
                val = -1;
            }

            string       _str = comboBox2.SelectedItem.ToString();// +"@" + addr.ToString();
            SPECCY_EVENT speccEventFromString = Utilities.GetEnumFromString <SPECCY_EVENT>(_str, SPECCY_EVENT.OPCODE_PC);

            KeyValuePair <SPECCY_EVENT, Monitor.BreakPointCondition> kv = new KeyValuePair <SPECCY_EVENT, Monitor.BreakPointCondition>(speccEventFromString, new Monitor.BreakPointCondition(speccEventFromString, addr, val));

            monitor.AddBreakpoint(kv);
        }