int y=0,line=0,lines=0,lines_step=0,sects;\r
int cycles_68k_vblock,cycles_68k_block;\r
\r
- if (Pico.m.pal) {\r
- // M68k cycles/frame: 152009.78\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 = (int) ((double) OSC_PAL / 7 / 50 / 312 * 15 + 0.4); // 16 sects, 16*15=240, 7308\r
- cycles_68k_vblock = (int) ((double) OSC_PAL / 7 / 50 / 312 * 24 + 0.4); // 3 sects, 3*24=72, 35163?\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 = (int) ((double) OSC_PAL / 7 / 50 / 312 * 14 + 0.4); // 16*14=224\r
- cycles_68k_vblock = (int) ((double) OSC_PAL / 7 / 50 / 312 * 22 + 0.4); // 4 sects, 4*22=88\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 = (int) ((double) OSC_NTSC / 7 / 60 / 262 * 14 + 0.4); // 16*14=224, 6831\r
- cycles_68k_vblock = (int) ((double) OSC_NTSC / 7 / 60 / 262 * 19 + 0.4); // 2 sects, 2*19=38, 18544\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
}\r
\r
// here we render sound if ym2612 is disabled\r
- if(!(PicoOpt&1) && PsndOut) {\r
+ if (!(PicoOpt&1) && PsndOut) {\r
int len = sound_render(0, PsndLen);\r
- if(PicoWriteSound) PicoWriteSound(len);\r
+ if (PicoWriteSound) PicoWriteSound(len);\r
// clear sound buffer\r
sound_clear();\r
}\r
\r
// render screen\r
- if(!PicoSkipFrame) {\r
- if(!(PicoOpt&0x10))\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
+ 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
else PicoFrameFull();\r
}\r
\r
+ // a gap between flags set and vint\r
+ pv->pending_ints|=0x20;\r
+ pv->status|=8; // go into vblank\r
+ SekRun(68+4);\r
+\r
// ---- V-Blanking period ----\r
// fix line counts\r
if(Pico.m.pal) {\r
lines_step = 19;\r
}\r
\r
- //dprintf("vint: @ %06x [%i]", SekPc, SekCycleCnt);\r
- pv->pending_ints|=0x20;\r
if (pv->reg[1]&0x20) SekInterrupt(6); // Set IRQ\r
- pv->status|=8; // go into vblank\r
- if(Pico.m.z80Run && (PicoOpt&4)) // ?\r
+ if (Pico.m.z80Run && (PicoOpt&4))\r
z80_int();\r
\r
- while(sects) {\r
+ while (sects) {\r
lines += lines_step;\r
\r
SekRun(cycles_68k_vblock);\r
line=lines;\r
\r
sects--;\r
- if(sects && CheckIdle()) break;\r
+ if (sects && CheckIdle()) break;\r
}\r
\r
// run Z80 for remaining sections\r
- if(sects) {\r
+ if (sects) {\r
lines += sects*lines_step;\r
PicoRunZ80Simple(line, lines);\r
}\r