+ if (!MasterPic.AutoEoi) MasterPic.InServiceRegister |= (1 << 2);
+
+ /* Set the appropriate bit in the IRR and interrupt the CPU */
+ SlavePic.IntRequestRegister |= 1 << Number;
+ EmulatorInterruptSignal();
+ }
+}
+
+BYTE PicGetInterrupt(VOID)
+{
+ INT i, j;
+
+ /* Search interrupts by priority */
+ for (i = 0; i < 8; i++)
+ {
+ /* Check if this line is cascaded to the slave PIC */
+ if ((i == 2)
+ && MasterPic.CascadeRegister & (1 << 2)
+ && SlavePic.Slave
+ && (SlavePic.CascadeRegister == 2))
+ {
+ /* Search the slave PIC interrupts by priority */
+ for (j = 0; j < 8; j++) if ((j != 1) && SlavePic.IntRequestRegister & (1 << j))
+ {
+ /* Clear the IRR flag */
+ SlavePic.IntRequestRegister &= ~(1 << j);
+
+ /* Set the ISR flag, unless AEOI is enabled */
+ if (!SlavePic.AutoEoi) SlavePic.InServiceRegister |= (1 << j);
+
+ /* Return the interrupt number */
+ return SlavePic.IntOffset + j;
+ }
+ }