示例#1
0
 // IRQ
 public override void OnPPUScanlineTick()
 {
     // In frame signal
     irq_current_inframe = (NesEmu.IsInRender() && NesEmu.IsRenderingOn()) ? 0x40 : 0x00;
     if (irq_current_inframe == 0)
     {
         irq_current_inframe = 0x40;
         irq_current_counter = 0;
         irq_pending         = 0;
         NesEmu.IRQFlags    &= ~NesEmu.IRQ_BOARD;
     }
     else
     {
         irq_current_counter++;
         if (irq_current_counter == irq_line)
         {
             irq_pending = 0x80;     // IRQ pending flag is raised *regardless* of whether or not IRQs are enabled.
             if (irq_enable == 0x80) // Trigger an IRQ on the 6502 if both this flag *and* the IRQ enable flag is set.
             {
                 NesEmu.IRQFlags |= NesEmu.IRQ_BOARD;
             }
         }
     }
 }