- // pad delay (for 6 button pads)\r
- if(PicoOpt&0x20) {\r
- if(Pico.m.padDelay[0]++ > 25) Pico.m.padTHPhase[0]=0;\r
- if(Pico.m.padDelay[1]++ > 25) Pico.m.padTHPhase[1]=0;\r
- }\r
-\r
- // H-Interrupts:\r
- if(y <= lines_vis && --hint < 0) // y <= lines_vis: Comix Zone, Golden Axe\r
- {\r
- //dprintf("rhint:old @ %06x", SekPc);\r
- hint=pv->reg[10]; // Reload H-Int counter\r
- pv->pending_ints|=0x10;\r
- if (pv->reg[0]&0x10) SekInterrupt(4);\r
- //dprintf("rhint: %i @ %06x [%i|%i]", hint, SekPc, y, SekCycleCnt);\r
- //dprintf("hint_routine: %x", (*(unsigned short*)(Pico.ram+0x0B84)<<16)|*(unsigned short*)(Pico.ram+0x0B86));\r
- }\r
-\r
- // V-Interrupt:\r
- if (y == lines_vis)\r
- {\r
- dprintf("vint: @ %06x [%i|%i], aim=%i cnt=%i", SekPc, y, SekCycleCnt, SekCycleAim, SekCycleCnt);\r
- pv->status|=0x08; // go into vblank\r
- if(!Pico.m.dma_bytes||(Pico.video.reg[0x17]&0x80)) {\r
- // there must be a gap between H and V ints, also after vblank bit set (Mazin Saga, Bram Stoker's Dracula)\r
- SekRun(128); SekCycleAim-=128; // 128; ?\r
- }\r
- dprintf("[%i|%i], aim=%i cnt=%i @ %x", y, SekCycleCnt, SekCycleAim, SekCycleCnt, SekPc);\r
- pv->status|=0x80; // V-Int happened\r
- pv->pending_ints|=0x20;\r
- if(pv->reg[1]&0x20) SekInterrupt(6);\r
- if(Pico.m.z80Run && (PicoOpt&4)) // ?\r
- z80_int();\r
- //dprintf("zint: [%i|%i] zPC=%04x", Pico.m.scanline, SekCyclesDone(), mz80GetRegisterValue(NULL, 0));\r
- }\r
-\r
- // decide if we draw this line\r
-#if CAN_HANDLE_240_LINES\r
- if(!skip && ((!(pv->reg[1]&8) && y<224) || ((pv->reg[1]&8) && y<240)) )\r
-#else\r
- if(!skip && y<224)\r
-#endif\r
- PicoLine(y);\r
-\r
- if(PicoOpt&1)\r
- sound_timers_and_dac(y);\r
-\r
- // get samples from sound chips\r
- if(y == 32 && PsndOut)\r
- emustatus &= ~1;\r
- else if((y == 224 || y == line_sample) && PsndOut)\r
- getSamples(y);\r
-\r
- // Run scanline:\r
- if (Pico.m.dma_bytes) SekCyclesBurn(CheckDMA());\r
- SekRun(cycles_68k);\r
- if ((PicoOpt&4) && Pico.m.z80Run) {\r
- if (Pico.m.z80Run & 2) z80CycleAim+=cycles_z80;\r
- else {\r
- int cnt = SekCyclesDone() - z80startCycle;\r
- cnt = (cnt>>1)-(cnt>>5);\r
- //if (cnt > cycles_z80) printf("FIXME: z80 cycles: %i\n", cnt);\r
- if (cnt > cycles_z80) cnt = cycles_z80;\r
- Pico.m.z80Run |= 2;\r
- z80CycleAim+=cnt;\r
- }\r
- total_z80+=z80_run(z80CycleAim-total_z80);\r
- }\r
- }\r