Ejemplo n.º 1
0
        private void UpdateDeviceList()
        {
            ResetDevicesList();

            devicesInfo_ = PortExtender.GetAvailableDevices();
            if (devicesInfo_ != null)
            {
                var idx = 0;
                foreach (var devInfo in devicesInfo_)
                {
                    var tmp = devicesComboBox.Items.Add("MTPE-" + devInfo.serial + " (" + devInfo.com_id + ")");
                    if (devInfo.com_id == selectedDeviceInfo_.com_id)
                    {
                        idx = tmp;
                    }
                }

                devicesComboBox.SelectedIndex = idx;
            }
            else
            {
                devicesComboBox.SelectedIndex = 0;
            }
        }
Ejemplo n.º 2
0
 public Emulator(PortExtender portExtender)
 {
     portExtender_ = portExtender;
     Reset();
 }
Ejemplo n.º 3
0
        public MainForm()
        {
            InitializeComponent();

            // Current command
            textLabels_ = new Label[] {
                cc0TextLabel,
                cc1TextLabel,
                cc2TextLabel,
                cc3TextLabel,
                cc4TextLabel,
                cc5TextLabel,
                cc6TextLabel,
                cc7TextLabel,
            };
            textBoxes_ = new TextBox[] {
                cc0Text,
                cc1Text,
                cc2Text,
                cc3Text,
                cc4Text,
                cc5Text,
                cc6Text,
                cc7Text,
                cc8Text,
                cc9Text,
            };

            // Common register
            regLabels_ = new Label[] {
                r0Label,
                r1Label,
                r2Label,
                r3Label,
                r4Label,
                r5Label,
                r6Label,
                r7Label,
                r8Label,
                r9Label,
                r10Label,
                r11Label,
                r12Label,
                r13Label,
                r14Label,
                r15Label,
            };
            regTexts_ = new TextBox[] {
                r0Text,
                r1Text,
                r2Text,
                r3Text,
                r4Text,
                r5Text,
                r6Text,
                r7Text,
                r8Text,
                r9Text,
                r10Text,
                r11Text,
                r12Text,
                r13Text,
                r14Text,
                r15Text,
            };
            for (int i = 0; i < Emulator.GetRegSize(); ++i)
            {
                regLabels_[i].Text = $"R{i:d}";
            }

            // Command list
            Helpers.DoubleBuffered(commandList, true);
            commandsListWidths_ = new int[] { 0, 47, 0, 0, 525 };

            // Info lists
            listViewes_ = new Dictionary <WordType, ListView> {
                { WordType.CA, caListView },
                { WordType.I68, i68ListView },
                { WordType.I02, i02ListView },
                { WordType.I35, i35ListView },
                { WordType.PT, ptListView },
                { WordType.PS, psListView },
                { WordType.DEVICE, deviceListView },
            };
            foreach (KeyValuePair <WordType, ListView> listView in listViewes_)
            {
                Helpers.DoubleBuffered(listView.Value, true);
                listView.Value.Items.Clear();
                string[][] lists = Command.GetItems(listView.Key);
                foreach (string[] list in lists)
                {
                    listView.Value.Items.Add(new ListViewItem(list));
                }
            }

            // Leds for fun
            easterEggMask_ = 0;
            leds_          = new PictureBox[] {
                led0,
                led1,
                led2,
                led3,
            };
            ledClicked_ = new bool[] { false, false, false, false };

            // Memory debug form
            stickMemoryForm_ = true;
            memoryForm_      = new MemoryForm(this);
            Helpers.DoubleBuffered(memoryForm_.memoryListView, true);
            for (int i = 0; i < Emulator.GetMemorySize(); ++i)
            {
                memoryForm_.memoryListView.Items.Add(new ListViewItem(new string[] { "", $"0x{i:X2}", "0000 0000", "0x00" }));
            }

            // Stack debug form
            stickStackForm_ = true;
            stackForm_      = new StackForm(this);
            Helpers.DoubleBuffered(stackForm_.stackListView, true);
            for (int i = 0; i < Emulator.GetStackSize(); ++i)
            {
                stackForm_.stackListView.Items.Add(new ListViewItem(new string[] { "", $"0x{i:X}", "0x000" }));
            }

            // Form with program editing
            stickCallsForm_ = false;
            callsForm_      = new CallsForm(this);
            Helpers.DoubleBuffered(callsForm_.callList, true);

            // Form with scheme of ALU
            schemeForm_ = new SchemeForm();

            // Form with extenser device settings
            extenderSettingsForm_ = new ExtenderSettingsForm();

            portExtender_ = new PortExtender(DeviceRemovedHandler);

            // Form with help
            helpForm_ = new HelpForm();
            UpdateEggsCounter_();

            // Reset to initial values
            Reset_();
        }