+
+ // Schedule next call, in hsyncs
+ hsync_steps = SpuUpdInterval[Config.PsxType] - spuSyncCount;
+ next_vsync = VBlankStart - hSyncCount; // ok to overflow
+ next_lace = HSyncTotal[Config.PsxType] - hSyncCount;
+ if( next_vsync && next_vsync < hsync_steps )
+ hsync_steps = next_vsync;
+ if( next_lace && next_lace < hsync_steps )
+ hsync_steps = next_lace;
+
+ rcnts[3].cycleStart = cycle - leftover_cycles;
+ if (Config.PsxType)
+ // 20.12 precision, clk / 50 / 313 ~= 2164.14
+ base_cycle += hsync_steps * 8864320;
+ else
+ // clk / 60 / 263 ~= 2146.31
+ base_cycle += hsync_steps * 8791293;
+ rcnts[3].cycle = base_cycle >> 12;
+ base_cycle &= 0xfff;