Пример #1
0
        /// <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();
        }
Пример #2
0
            /// <summary>
            /// Initializes the state from the specified instance
            /// </summary>
            public Spectrum48DeviceState(Spectrum48 spectrum, string modelName = null)
            {
                if (spectrum == null)
                {
                    return;
                }

                ModelName             = modelName;
                LastFrameStartCpuTick = spectrum.LastFrameStartCpuTick;
                LastRenderedUlaTact   = spectrum.LastRenderedUlaTact;
                FrameCount            = spectrum.FrameCount;
                FrameTacts            = spectrum.FrameTacts;
                Overflow = spectrum.Overflow;
                RunsInMaskableInterrupt = spectrum.RunsInMaskableInterrupt;

                Z80CpuState              = spectrum.Cpu?.GetState();
                Z80CpuStateType          = Z80CpuState?.GetType().AssemblyQualifiedName;
                RomDeviceState           = spectrum.RomDevice?.GetState();
                RomDeviceStateType       = RomDeviceState?.GetType().AssemblyQualifiedName;
                MemoryDeviceState        = spectrum.MemoryDevice?.GetState();
                MemoryDeviceStateType    = MemoryDeviceState?.GetType().AssemblyQualifiedName;
                PortDeviceState          = spectrum.PortDevice?.GetState();
                PortDeviceStateType      = PortDeviceState?.GetType().AssemblyQualifiedName;
                ScreenDeviceState        = spectrum.ScreenDevice?.GetState();
                ScreenDeviceStateType    = ScreenDeviceState?.GetType().AssemblyQualifiedName;
                InterruptDeviceState     = spectrum.InterruptDevice?.GetState();
                InterruptDeviceStateType = InterruptDeviceState?.GetType().AssemblyQualifiedName;
                KeyboardDeviceState      = spectrum.KeyboardDevice?.GetState();
                KeyboardDeviceStateType  = KeyboardDeviceState?.GetType().AssemblyQualifiedName;
                BeeperDeviceState        = spectrum.BeeperDevice?.GetState();
                BeeperDeviceStateType    = BeeperDeviceState?.GetType().AssemblyQualifiedName;
                SoundDeviceState         = spectrum.SoundDevice?.GetState();
                SoundDeviceStateType     = SoundDeviceState?.GetType().AssemblyQualifiedName;
                TapeDeviceState          = spectrum.TapeDevice?.GetState();
                TapeDeviceStateType      = TapeDeviceState?.GetType().AssemblyQualifiedName;
            }