- //////////////////////////////////////////////////////
- // special irq handling in the decode buffers (0x0000-0x1000)
- // we know:
- // the decode buffers are located in spu memory in the following way:
- // 0x0000-0x03ff CD audio left
- // 0x0400-0x07ff CD audio right
- // 0x0800-0x0bff Voice 1
- // 0x0c00-0x0fff Voice 3
- // and decoded data is 16 bit for one sample
- // we assume:
- // even if voices 1/3 are off or no cd audio is playing, the internal
- // play positions will move on and wrap after 0x400 bytes.
- // Therefore: we just need a pointer from spumem+0 to spumem+3ff, and
- // increase this pointer on each sample by 2 bytes. If this pointer
- // (or 0x400 offsets of this pointer) hits the spuirq address, we generate
- // an IRQ. Only problem: the "wait for cpu" option is kinda hard to do here
- // in some of Peops timer modes. So: we ignore this option here (for now).
-
- if(unlikely((spuCtrl&CTRL_IRQ) && pSpuIrq && pSpuIrq<spuMemC+0x1000))
- {
- int irq_pos=(pSpuIrq-spuMemC)/2 & 0x1ff;
- if((decode_pos <= irq_pos && irq_pos < decode_pos+NSSIZE)
- || (decode_pos+NSSIZE > 0x200 && irq_pos < ((decode_pos+NSSIZE) & 0x1ff)))
- {
- //printf("decoder irq %x\n", decode_pos);
- do_irq();
- bIRQReturn = 1;
- }
- }
- decode_pos = (decode_pos + NSSIZE) & 0x1ff;