/// <summary> /// Builds the machine that can be started /// </summary> protected virtual void BuildMachine() { if (SpectrumVm == null) { MoveToState(VmState.BuildingMachine); if (StartupConfiguration == null) { throw new InvalidOperationException("You must provide a startup configuration for " + "the virtual machine, it cannot be null"); } // --- Create the machine on first start SpectrumVm = new Spectrum48(StartupConfiguration.DeviceData, this); SpectrumVm.ScreenDevice.FrameCompleted += (s, e) => VmScreenRefreshed?.Invoke(s, new VmScreenRefreshedEventArgs(SpectrumVm.ScreenDevice.GetPixelBuffer())); } // --- We either provider out DebugInfoProvider, or use // --- the default one if (StartupConfiguration.DebugInfoProvider == null) { StartupConfiguration.DebugInfoProvider = SpectrumVm.DebugInfoProvider; } else { SpectrumVm.DebugInfoProvider = StartupConfiguration.DebugInfoProvider; } // --- Set up stack debug support if (StartupConfiguration.StackDebugSupport != null) { SpectrumVm.Cpu.StackDebugSupport = StartupConfiguration.StackDebugSupport; StartupConfiguration.StackDebugSupport.Reset(); } // --- At this point we have a Spectrum VM. // --- Let's reset it SpectrumVm.Reset(); }
/// <summary> /// Forces a screen refresh /// </summary> public void ForceScreenRefresh() { VmScreenRefreshed?.Invoke(this, new VmScreenRefreshedEventArgs(SpectrumVm.ScreenDevice.GetPixelBuffer())); }