- SekCyclesReset();\r
-\r
- // 6 button pad: let's just say it timed out now\r
- Pico.m.padTHPhase[0]=Pico.m.padTHPhase[1]=0;\r
-\r
- // ---- Active Scan ----\r
- pv->status&=~0x88; // clear V-Int, come out of vblank\r
-\r
- // Run in sections:\r
- for(sects=16; sects; sects--)\r
- {\r
- if (CheckIdle()) break;\r
-\r
- lines += lines_step;\r
- SekRunM68k(cycles_68k_block);\r
-\r
- PicoRunZ80Simple(line, lines);\r
- line=lines;\r
- }\r
-\r
- // run Z80 for remaining sections\r
- if(sects) {\r
- int c = sects*cycles_68k_block;\r
-\r
- // this "run" is for approriate line counter, etc\r
- SekCycleCnt += c;\r
- SekCycleAim += c;\r
-\r
- lines += sects*lines_step;\r
- PicoRunZ80Simple(line, lines);\r
- }\r
-\r
- // render screen\r
- if (!PicoSkipFrame)\r
- {\r
- if (!(PicoOpt&0x10))\r
- // Draw the screen\r
-#if CAN_HANDLE_240_LINES\r
- if (pv->reg[1]&8) {\r
- for (y=0;y<240;y++) PicoLine(y);\r
- } else {\r
- for (y=0;y<224;y++) PicoLine(y);\r
- }\r
-#else\r
- for (y=0;y<224;y++) PicoLine(y);\r
-#endif\r
- else PicoFrameFull();\r
-#ifdef DRAW_FINISH_FUNC\r
- DRAW_FINISH_FUNC();\r
-#endif\r
- }\r
-\r
- // here we render sound if ym2612 is disabled\r
- if (!(PicoOpt&1) && PsndOut) {\r
- int len = PsndRender(0, PsndLen);\r
- if (PicoWriteSound) PicoWriteSound(len);\r
- // clear sound buffer\r
- PsndClear();\r
- }\r
-\r
- // a gap between flags set and vint\r
- pv->pending_ints|=0x20;\r
- pv->status|=8; // go into vblank\r
- SekRunM68k(68+4);\r
-\r
- // ---- V-Blanking period ----\r
- // fix line counts\r
- if(Pico.m.pal) {\r
- if(pv->reg[1]&8) { // 240 lines\r
- lines = line = 240;\r
- sects = 3;\r
- lines_step = 24;\r
- } else {\r
- lines = line = 224;\r
- sects = 4;\r
- lines_step = 22;\r
- }\r
- } else {\r
- lines = line = 224;\r
- sects = 2;\r
- lines_step = 19;\r
- }\r
-\r
- if (pv->reg[1]&0x20) SekInterrupt(6); // Set IRQ\r
- if (Pico.m.z80Run && (PicoOpt&4))\r
- z80_int();\r
-\r
- while (sects) {\r
- lines += lines_step;\r
-\r
- SekRunM68k(cycles_68k_vblock);\r
-\r
- PicoRunZ80Simple(line, lines);\r
- line=lines;\r
-\r
- sects--;\r
- if (sects && CheckIdle()) break;\r
- }\r
-\r
- // run Z80 for remaining sections\r
- if (sects) {\r
- lines += sects*lines_step;\r
- PicoRunZ80Simple(line, lines);\r
- }\r
-\r
- return 0;\r