-#else\r
-#include "PicoFrameHints.c"\r
-#endif\r
-\r
-// helper z80 runner\r
-static void PicoRunZ80Simple(int line_from, int line_to)\r
-{\r
- int line_from_r=line_from, line_to_r=line_to, line = line_from;\r
- int line_sample = Pico.m.pal ? 68 : 93;\r
-\r
- if(!(PicoOpt&4) || Pico.m.z80Run == 0) { line_from_r = line_to_r; line_to_r = 0; }\r
-\r
- if(PicoOpt&1) {\r
- // we have ym2612 enabled, so we have to run Z80 in lines, so we could update DAC and timers\r
- for(; line < line_to; line++) {\r
- sound_timers_and_dac(line);\r
- if((line == 224 || line == line_sample) && PsndOut) getSamples(line);\r
- if(line == 32 && PsndOut) emustatus &= ~1;\r
- if(line >= line_from_r && line < line_to_r)\r
- z80_run(228);\r
- }\r
- } else if(line_to_r-line_from_r > 0) {\r
- z80_run(228*(line_to_r-line_from_r));\r
- // samples will be taken by caller\r
- }\r
-}\r
-\r
-// Simple frame without H-Ints\r
-static int PicoFrameSimple(void)\r
-{\r
- 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)) { // 240 lines\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
-\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
- lines += sects*lines_step;\r
- PicoRunZ80Simple(line, lines);\r
- // this is for approriate line counter, etc\r
- SekCycleCnt += c;\r
- SekCycleAim += c;\r
- }\r
-\r
- // here we render sound if ym2612 is disabled\r
- if (!(PicoOpt&1) && PsndOut) {\r
- int len = sound_render(0, PsndLen);\r
- if (PicoWriteSound) PicoWriteSound(len);\r
- // clear sound buffer\r
- sound_clear();\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
- }\r