+static __inline void check_cd_dma(void)
+{
+ int ddx;
+
+ if (!(Pico_mcd->scd.Status_CDC & 0x08)) return;
+
+ ddx = Pico_mcd->s68k_regs[4] & 7;
+ if (ddx < 2) return; // invalid
+ if (ddx < 4) {
+ Pico_mcd->s68k_regs[4] |= 0x40; // Data set ready in host port
+ return;
+ }
+ if (ddx == 6) return; // invalid
+
+ Update_CDC_TRansfer(ddx); // now go and do the actual transfer
+}
+
+// to be called on 224 or line_sample scanlines only
+static __inline void getSamples(int y)
+{
+ if(y == 224) {
+ //dprintf("sta%i: %i [%i]", (emustatus & 2), emustatus, y);
+ if(emustatus & 2)
+ sound_render(PsndLen/2, PsndLen-PsndLen/2);
+ else sound_render(0, PsndLen);
+ if (emustatus&1) emustatus|=2; else emustatus&=~2;
+ if (PicoWriteSound) PicoWriteSound();
+ // clear sound buffer
+ memset(PsndOut, 0, (PicoOpt & 8) ? (PsndLen<<2) : (PsndLen<<1));
+ }
+ else if(emustatus & 3) {
+ emustatus|= 2;
+ emustatus&=~1;
+ sound_render(0, PsndLen/2);
+ }
+}
+
+