Exemplo n.º 1
0
        private void UpdateDebugInfo()
        {
            for (int row = 0; row < tableLayoutPanel1.RowCount; row++)
            {
                var labelControl   = tableLayoutPanel1.GetControlFromPosition(AddressLabelColumn, row) as Control;
                var textBoxControl = tableLayoutPanel1.GetControlFromPosition(ValueTextBoxColumn, row) as TextBox;
                if (labelControl != null && textBoxControl != null && (!textBoxControl.Focused || textBoxControl.Text.Length == 0))
                {
                    try
                    {
                        var address = MemUtils.StringToUShort(labelControl.Text);
                        var value   = _memUtils.GetWordAtAddress(address);
                        textBoxControl.Text = string.Format("0x{0:X4}", value);
                    }
                    catch (Exception) { /* do nothing */ }
                }
            }

            SetValueText(txtAF, _cpu.Registers.AF);
            SetValueText(txtBC, _cpu.Registers.BC);
            SetValueText(txtDE, _cpu.Registers.DE);
            SetValueText(txtHL, _cpu.Registers.HL);
            SetValueText(txtPC, _cpu.Registers.PC);
            SetValueText(txtSP, _cpu.Registers.SP);
            SetValueText(txtIX, _cpu.Registers.IX);
            SetValueText(txtIY, _cpu.Registers.IY);
            SetValueTextBin(txtFlags, _cpu.Registers.F);
        }
Exemplo n.º 2
0
        internal frmDebug(ICpu cpu, MemUtils memUtils)
        {
            InitializeComponent();
            _cpu      = cpu;
            _memUtils = memUtils;

            SetupMemoryPanelEvents();
            SetupRegisterPanelEvents();
            InitialiseTimer();
        }
Exemplo n.º 3
0
 private void ReadAddrFromTextBox()
 {
     try
     {
         startAddr = MemUtils.StringToUShort(txtStartAddress.Text);
     }
     catch (Exception )
     {
         //do nothing
     }
 }
Exemplo n.º 4
0
        internal void ValueTextBox_Validate(object sender, System.ComponentModel.CancelEventArgs e)
        {
            var ctrl = sender as Control;

            if (ctrl != null)
            {
                try
                {
                    MemUtils.StringToUShort(ctrl.Text);
                }
                catch (Exception)
                {
                    e.Cancel = true;
                }
            }
        }
Exemplo n.º 5
0
 private void btnSearch_Click(object sender, EventArgs e)
 {
     bool addSearch = (SearchResults.Count == 0);
     var searchTerm = MemUtils.StringToByte(txtSearch.Text);
     if (addSearch)
         for (var i=0;i<cpu.Memory.Size;i++)
         {
             if (cpu.Memory[i] == searchTerm)
                 SearchResults.Add(i);
         }
     else
         for (var i = 0; i < cpu.Memory.Size; i++)
         {
             if (cpu.Memory[i] != searchTerm && SearchResults.Contains(i))
                 SearchResults.Remove(i);
         }
 }
Exemplo n.º 6
0
        private void RegisterValueTextBox_Leave(object sender, EventArgs e)
        {
            var ctrl = sender as Control;

            if (ctrl != null)
            {
                var labelControl = tableLayoutPanel3.GetControlFromPosition(RegisterLabelColumn, tableLayoutPanel3.GetPositionFromControl(ctrl).Row) as Control;
                if (labelControl != null)
                {
                    try
                    {
                        var register = labelControl.Text;
                        var value    = MemUtils.StringToShort(ctrl.Text);
                        SetRegisterValue(register, value);
                    }
                    catch (FormatException)
                    {
                        //do nothing
                    }
                }
            }
        }
Exemplo n.º 7
0
        private void ValueTextBox_Leave(object sender, System.EventArgs e)
        {
            var ctrl = sender as Control;

            if (ctrl != null)
            {
                var labelControl = tableLayoutPanel1.GetControlFromPosition(AddressLabelColumn, tableLayoutPanel1.GetPositionFromControl(ctrl).Row) as Control;
                if (labelControl != null)
                {
                    try
                    {
                        var address = MemUtils.StringToUShort(labelControl.Text);
                        var value   = MemUtils.StringToUShort(ctrl.Text);
                        _memUtils.SetWordAtAddress(address, value);
                    }
                    catch (Exception)
                    {
                        //do nothing
                    }
                }
            }
        }