- struct PicoVideo *pv=&Pico.video;\r
- int y=0,line=0,lines=0,lines_step=0,sects;\r
- int cycles_68k_vblock,cycles_68k_block;\r
-\r
- // split to 16 run calls for active scan, for vblank split to 2 (ntsc), 3 (pal 240), 4 (pal 224)\r
- if (Pico.m.pal && (pv->reg[1]&8)) {\r
- if(pv->reg[1]&8) { // 240 lines\r
- cycles_68k_block = 7329; // (488*240+148)/16.0, -4\r
- cycles_68k_vblock = 11640; // (72*488-148-68)/3.0, 0\r
- lines_step = 15;\r
- } else {\r
- cycles_68k_block = 6841; // (488*224+148)/16.0, -4\r
- cycles_68k_vblock = 10682; // (88*488-148-68)/4.0, 0\r
- lines_step = 14;\r
- }\r
- } else {\r
- // M68k cycles/frame: 127840.71\r
- cycles_68k_block = 6841; // (488*224+148)/16.0, -4\r
- cycles_68k_vblock = 9164; // (38*488-148-68)/2.0, 0\r
- lines_step = 14;\r
- }\r
-\r
- // we don't emulate DMA timing in this mode\r
- if (Pico.m.dma_xfers) {\r
- Pico.m.dma_xfers=0;\r
- Pico.video.status&=~2;\r
- }\r
-\r
- // VDP FIFO too\r
- pv->lwrite_cnt = 0;\r
- Pico.video.status|=0x200;\r
-\r
- Pico.m.scanline=-1;\r
- z80startCycle=0;\r
-\r
- 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