+ _rot_comp.Reg_58 |= 0x8000; // Stamp_Size, we start a new GFX operation
+
+ cycles = 5 * w * h;
+ if (cycles > UPDATE_CYCLES)
+ y_step = (UPDATE_CYCLES + 5 * w - 1) / (5 * w);
+ else
+ y_step = h;
+
+ _rot_comp.y_step = y_step;
+ pcd_event_schedule_s68k(PCD_EVENT_GFX, 5 * w * y_step);
+}
+
+void gfx_cd_update(unsigned int cycles)
+{
+ int w = _rot_comp.Reg_62;
+ int h, next;
+
+ if (!(Pico_mcd->rot_comp.Reg_58 & 0x8000))
+ return;
+
+ h = _rot_comp.Reg_64;
+ _rot_comp.Reg_64 -= _rot_comp.y_step;
+
+ if ((int)_rot_comp.Reg_64 <= 0) {
+ Pico_mcd->rot_comp.Reg_58 &= 0x7fff;
+ Pico_mcd->rot_comp.Reg_64 = 0;
+ if (Pico_mcd->s68k_regs[0x33] & PCDS_IEN1) {
+ elprintf(EL_INTS |EL_CD, "s68k: gfx_cd irq 1");
+ SekInterruptS68k(1);
+ }
+ }
+ else {
+ next = _rot_comp.Reg_64;
+ if (next > _rot_comp.y_step)
+ next = _rot_comp.y_step;
+
+ pcd_event_schedule(cycles, PCD_EVENT_GFX, 5 * w * next);
+ h = _rot_comp.y_step;
+ }
+