Ejemplo n.º 1
0
        private void InitTrainer()
        {
            try
            {
                if (File.Exists(_settingsPath))
                {
                    ET3400Settings = ET3400Settings.Load(_settingsPath);
                }
                else
                {
                    ET3400Settings = new ET3400Settings();
                }
                _trainer                    = new ET3400.Trainer.Trainer(ET3400Settings, SegmentPictureBox);
                _trainer.OnStart           += OnStart;
                _trainer.OnStop            += OnStop;
                _trainer.BreakpointsEnabled = true;

                Resize  += OnResize;
                Closing += OnClosing;
#if DEBUG
                _trainer.Runner.OnTimer += RunnerOnTimer;
#endif

                Shown += OnShown;

                // Delay drawing to the form before has loaded as it causes graphical glitches
                //timer = new Timer(StartDelay, null, TimeSpan.FromMilliseconds(500), Timeout.InfiniteTimeSpan);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error initializing the emulator");
            }
        }
Ejemplo n.º 2
0
        public DebuggerView(ET3400.Trainer.Trainer trainer)
        {
            InitializeComponent();
            //Application.AddMessageFilter(this);
            this.Closing += OnClosing;
            DasmViewPictureBox.MouseWheel += DasmViewPictureBoxOnMouseWheel;

            _memoryDisplay      = new MemoryDisplay(MemoryViewPictureBox, MemoryViewScrollBar, trainer);
            _disassemberDisplay = new DisassemberDisplay(DasmViewPictureBox, DasmViewScrollBar, trainer);
            _disassemberDisplay.OnSelectLine += OnSelectLine;

            _trainer = trainer;

            _trainer.OnStop  += OnStop;
            _trainer.OnStart += OnStart;
            _trainer.OnStep  += OnStep;
            _trainer.Breakpoints.OnChange += OnChange;

            _trainer.MemoryMapEventBus.Subscribe(MapEventType.Add, AddMapEventAction);
            _trainer.MemoryMapEventBus.Subscribe(MapEventType.Update, UpdateMapEventAction);
            _trainer.MemoryMapEventBus.Subscribe(MapEventType.Remove, RemoveMapEventAction);
            _trainer.MemoryMapEventBus.Subscribe(MapEventType.Clear, ClearMapEventAction);

            var region = trainer.MemoryMapManager.GetRegion("RAM");

            foreach (var memoryMap in region.MemoryMapCollection)
            {
                RangesListView.Items.Add(FromMemoryMap(memoryMap));
            }

            _updateTimer = new Timer(state =>
            {
                UpdateDisplay();
            }, null, 0, Timeout.Infinite);


            UpdateButtonState();

            BreakpointsListView.Sorting            = SortOrder.Ascending;
            BreakpointsListView.ListViewItemSorter = new BreakpointComparer();
            RangesListView.Sorting            = SortOrder.Ascending;
            RangesListView.ListViewItemSorter = new MemoryMapComparer();

            var debuggerSettings = _trainer.Settings.DebuggerSettings;

            memoryToolStripMenuItem.Checked      = debuggerSettings.ShowMemory;
            disassemblyToolStripMenuItem.Checked = debuggerSettings.ShowDisassembly;
            statusToolStripMenuItem.Checked      = debuggerSettings.ShowStatus;

            UpdateFormSize();
        }