コード例 #1
0
        /// <summary>
        /// Executes a single frame
        /// </summary>
        public virtual void ExecuteFrame(bool render, bool renderSound)
        {
            ULADevice.FrameEnd        = false;
            ULADevice.ULACycleCounter = CurrentFrameCycle;

            InputRead    = false;
            _render      = render;
            _renderSound = renderSound;

            FrameCompleted = false;

            if (UPDDiskDevice == null || !UPDDiskDevice.FDD_IsDiskLoaded)
            {
                TapeDevice.StartFrame();
            }

            if (_renderSound)
            {
                if (AYDevice != null)
                {
                    AYDevice.StartFrame();
                }
            }

            PollInput();

            for (;;)
            {
                // run the CPU Monitor cycle
                CPUMon.ExecuteCycle();

                // cycle the tape device
                if (UPDDiskDevice == null || !UPDDiskDevice.FDD_IsDiskLoaded)
                {
                    TapeDevice.TapeCycle();
                }

                // has frame end been reached?
                if (ULADevice.FrameEnd)
                {
                    break;
                }
            }

            OverFlow = (int)CurrentFrameCycle - ULADevice.FrameLength;

            // we have reached the end of a frame
            LastFrameStartCPUTick = CPU.TotalExecutedCycles - OverFlow;

            ULADevice.LastTState = 0;

            if (AYDevice != null)
            {
                AYDevice.EndFrame();
            }

            FrameCount++;

            if (UPDDiskDevice == null || !UPDDiskDevice.FDD_IsDiskLoaded)
            {
                TapeDevice.EndFrame();
            }

            FrameCompleted = true;

            // is this a lag frame?
            Spectrum.IsLagFrame = !InputRead;

            // FDC debug
            if (UPDDiskDevice != null && UPDDiskDevice.writeDebug)
            {
                // only write UPD log every second
                if (FrameCount % 10 == 0)
                {
                    System.IO.File.AppendAllLines(UPDDiskDevice.outputfile, UPDDiskDevice.dLog);
                    UPDDiskDevice.dLog = new System.Collections.Generic.List <string>();
                    //System.IO.File.WriteAllText(UPDDiskDevice.outputfile, UPDDiskDevice.outputString);
                }
            }
        }
コード例 #2
0
        /// <summary>
        /// Executes a single frame
        /// </summary>
        public virtual void ExecuteFrame(bool render, bool renderSound)
        {
            InputRead    = false;
            _render      = render;
            _renderSound = renderSound;

            FrameCompleted = false;

            TapeDevice.StartFrame();

            if (_renderSound)
            {
                BuzzerDevice.StartFrame();
                TapeBuzzer.StartFrame();
                if (AYDevice != null)
                {
                    AYDevice.StartFrame();
                }
            }

            PollInput();

            while (CurrentFrameCycle < ULADevice.FrameLength)
            {
                // check for interrupt
                ULADevice.CheckForInterrupt(CurrentFrameCycle);

                // run a single CPU instruction
                CPU.ExecuteOne();

                // cycle the tape device
                TapeDevice.TapeCycle();
            }

            // we have reached the end of a frame
            LastFrameStartCPUTick = CPU.TotalExecutedCycles - OverFlow;

            // paint the buffer if needed
            if (ULADevice.needsPaint && _render)
            {
                ULADevice.UpdateScreenBuffer(ULADevice.FrameLength);
            }

            if (_renderSound)
            {
                BuzzerDevice.EndFrame();
                TapeBuzzer.EndFrame();
            }

            if (AYDevice != null)
            {
                AYDevice.EndFrame();
            }

            FrameCount++;

            // setup for next frame
            ULADevice.ResetInterrupt();

            TapeDevice.EndFrame();

            FrameCompleted = true;

            // is this a lag frame?
            Spectrum.IsLagFrame = !InputRead;
        }
コード例 #3
0
ファイル: CPCBase.cs プロジェクト: Asnivor/BizHawk
        /// <summary>
        /// Executes a single frame
        /// </summary>
        public virtual void ExecuteFrame(bool render, bool renderSound)
        {
            GateArray.FrameEnd = false;
            CRCT.lineCounter   = 0;

            InputRead    = false;
            _render      = render;
            _renderSound = renderSound;

            FrameCompleted = false;

            if (UPDDiskDevice == null || !UPDDiskDevice.FDD_IsDiskLoaded)
            {
                TapeDevice.StartFrame();
            }

            if (_renderSound)
            {
                AYDevice.StartFrame();
            }

            PollInput();

            //CRT.SetupVideo();
            //CRT.ScanlineCounter = 0;

            while (!GateArray.FrameEnd)
            {
                GateArray.ClockCycle();

                // cycle the tape device
                if (UPDDiskDevice == null || !UPDDiskDevice.FDD_IsDiskLoaded)
                {
                    TapeDevice.TapeCycle();
                }
            }
            // we have reached the end of a frame
            LastFrameStartCPUTick = CPU.TotalExecutedCycles; // - OverFlow;

            if (AYDevice != null)
            {
                AYDevice.EndFrame();
            }

            FrameCount++;

            if (UPDDiskDevice == null || !UPDDiskDevice.FDD_IsDiskLoaded)
            {
                TapeDevice.EndFrame();
            }

            FrameCompleted = true;

            // is this a lag frame?
            CPC.IsLagFrame = !InputRead;

            // FDC debug
            if (UPDDiskDevice != null && UPDDiskDevice.writeDebug)
            {
                // only write UPD log every second
                if (FrameCount % 10 == 0)
                {
                    System.IO.File.AppendAllLines(UPDDiskDevice.outputfile, UPDDiskDevice.dLog);
                    UPDDiskDevice.dLog = new System.Collections.Generic.List <string>();
                    //System.IO.File.WriteAllText(UPDDiskDevice.outputfile, UPDDiskDevice.outputString);
                }
            }

            GateArray.FrameClock = 0;
        }
コード例 #4
0
        /// <summary>
        /// Executes a single frame
        /// </summary>
        public virtual void ExecuteFrame(bool render, bool renderSound)
        {
            InputRead    = false;
            _render      = render;
            _renderSound = renderSound;

            FrameCompleted = false;

            if (UPDDiskDevice == null || !UPDDiskDevice.FDD_IsDiskLoaded)
            {
                TapeDevice.StartFrame();
            }

            if (_renderSound)
            {
                //BuzzerDevice.StartFrame();
                //TapeBuzzer.StartFrame();

                if (AYDevice != null)
                {
                    AYDevice.StartFrame();
                }
            }

            PollInput();

            while (CurrentFrameCycle < ULADevice.FrameLength)
            {
                // check for interrupt
                ULADevice.CheckForInterrupt(CurrentFrameCycle);

                // run a single CPU instruction
                CPU.ExecuteOne();

                // cycle the tape device
                if (UPDDiskDevice == null || !UPDDiskDevice.FDD_IsDiskLoaded)
                {
                    TapeDevice.TapeCycle();
                }
            }

            // we have reached the end of a frame
            LastFrameStartCPUTick = CPU.TotalExecutedCycles - OverFlow;

            // paint the buffer if needed
            if (ULADevice.needsPaint && _render)
            {
                ULADevice.UpdateScreenBuffer(ULADevice.FrameLength);
            }

            if (_renderSound)
            {
                //BuzzerDevice.EndFrame();
                //TapeBuzzer.EndFrame();
            }

            if (AYDevice != null)
            {
                AYDevice.EndFrame();
            }

            FrameCount++;

            // setup for next frame
            ULADevice.ResetInterrupt();

            if (UPDDiskDevice == null || !UPDDiskDevice.FDD_IsDiskLoaded)
            {
                TapeDevice.EndFrame();
            }

            FrameCompleted = true;

            // is this a lag frame?
            Spectrum.IsLagFrame = !InputRead;

            // FDC debug

            if (UPDDiskDevice != null && UPDDiskDevice.writeDebug)
            {
                // only write UPD log every second
                if (FrameCount % 10 == 0)
                {
                    System.IO.File.WriteAllText(UPDDiskDevice.outputfile, UPDDiskDevice.outputString);
                }
            }
        }