Exemple #1
0
        void ISystemBase.run()
        {
            int      iRetraceIntervalMS = 1000 / RETRACE_RATE;
            DateTime dtNextRetrace      = DateTime.UtcNow.AddMilliseconds(iRetraceIntervalMS);

            m_bRun = true;

            bool bRetraceActive = false;

            int ScanLine      = 0;
            int iScanLineFlip = m_VideoInfo.Rows * m_VideoInfo.CharHeight;

            while (m_bRun)
            {
                // screen emulate one scan line
                m_funcDrawScanLine(ScanLine);
                ScanLine++;
                if (ScanLine >= iScanLineFlip)
                {
                    ScanLine = 0;
                }

                if (bRetraceActive)
                {
                    // emulate screen retrace connected to PIA1 CB1 and VIA PB5
                    bRetraceActive = false;
                    m_pia1.CB1     = Signal.Rise;
                    m_via.InputB(5, bRetraceActive);
                }

                if (DateTime.UtcNow >= dtNextRetrace)
                {
                    Application.DoEvents();

                    // emulate screen retrace connected to PIA1 CB1 and VIA PB5
                    bRetraceActive = true;
                    m_pia1.CB1     = Signal.Fall;
                    m_via.InputB(5, bRetraceActive);

                    m_via.emulateCycle();

                    dtNextRetrace = DateTime.UtcNow.AddMilliseconds(iRetraceIntervalMS);
                }

                m_cpu.emulateCycle();
            }
        }
        void ISystemBase.run()
        {
            int      iRetraceIntervalMS = 1000 / RETRACE_RATE;
            DateTime dtNextRetrace      = DateTime.UtcNow.AddMilliseconds(iRetraceIntervalMS);

            m_bRun = true;


            int ScanLine      = 0;
            int iScanLineFlip = m_VideoInfo.Rows * m_VideoInfo.CharHeight;

            while (m_bRun)
            {
                // screen emulate one scan line
                m_funcDrawScanLine(ScanLine);
                ScanLine++;
                if (ScanLine >= iScanLineFlip)
                {
                    ScanLine = 0;
                }

                if (DateTime.UtcNow >= dtNextRetrace)
                {
                    Application.DoEvents();

                    if (m_bNeedRefresh)
                    {
                        m_bNeedRefresh = false;

                        // check queue for characters to display
                        while (m_DisplayQueue.Count > 0)
                        {
                            outputDsp(m_DisplayQueue.Dequeue());
                        }
                    }

                    dtNextRetrace = DateTime.UtcNow.AddMilliseconds(iRetraceIntervalMS);
                }

                m_cpu.emulateCycle();
            }
        }