IRQ() публичный Метод

public IRQ ( long cycle ) : bool
cycle long
Результат bool
Пример #1
0
Файл: YCPU.cs Проект: pabru/YCPU
        /// <summary>
        /// Executes a set number of cycles, or infinite cycles.
        /// </summary>
        /// <param name="cyclecount">How many cycles to run before stopping. Default value of -1 will run until Pause() is called.</param>
        public void Run(int cyclecount = -1)
        {
            // Count Cycles:
            long cyclesTarget = cyclecount == -1 ? long.MaxValue : cyclecount + Cycles;

            // Run the processor for cyclecount Cycles:
            Running = true;
            while (Running)
            {
                try {
                    ushort word = ReadMemInt16(PC, SegmentIndex.CS);
                    PC += 2;

                    // Execute Memory[PC] and increment the cycle counter:
                    YCPUInstruction opcode = m_Opcodes[word & 0x00FF];
                    opcode.Opcode(word);
                    Cycles += opcode.Cycles;

                    // Check for hardware interrupt:
                    if (PS_H && !PS_Q && BUS.IsIRQ)
                    {
                        Interrupt_HWI();
                    }

                    // Check for RTC interrupt:
                    if (m_RTC.IsEnabled && m_RTC.IRQ(Cycles))
                    {
                        Interrupt_Clock();
                    }

                    // Check to see if we've exceeded our cycle target:
                    if (Cycles >= cyclesTarget)
                    {
                        m_Pausing = true;
                    }
                    if (m_Pausing)
                    {
                        Running   = false;
                        m_Pausing = false;
                    }
                }
                catch (SegFaultException e) {
                    Interrupt_SegFault(e.SegmentType, 0xffff, PC);
                }
            }
        }