}
else skip=PicoSkipFrame;
- Pico.t.m68c_frame_start = SekCyclesDone();
+ Pico.t.m68c_frame_start = Pico.t.m68c_aim;
pv->v_counter = Pico.m.scanline = 0;
z80_resetCycles();
PsndStartFrame();
}
// Run scanline:
- Pico.t.m68c_line_start = SekCyclesDone();
+ Pico.t.m68c_line_start = Pico.t.m68c_aim;
do_timing_hacks_as(pv, vdp_slots);
CPUS_RUN(CYCLES_M68K_LINE);
do_hint(pv);
}
- pv->status |= SR_VB; // go into vblank
+ pv->status |= SR_VB | PVS_VB2; // go into vblank
// the following SekRun is there for several reasons:
// there must be a delay after vblank bit is set and irq is asserted (Mazin Saga)
// also delay between F bit (bit 7) is set in SR and IRQ happens (Ex-Mutants)
// also delay between last H-int and V-int (Golden Axe 3)
- Pico.t.m68c_line_start = SekCyclesDone();
+ Pico.t.m68c_line_start = Pico.t.m68c_aim;
do_timing_hacks_vb();
CPUS_RUN(CYCLES_M68K_VINT_LAG);
+ pv->status |= SR_F;
pv->pending_ints |= 0x20;
if (pv->reg[1] & 0x20) {
Pico.t.m68c_aim = Pico.t.m68c_cnt + 11; // HACK
}
// Run scanline:
- Pico.t.m68c_line_start = SekCyclesDone();
+ Pico.t.m68c_line_start = Pico.t.m68c_aim;
do_timing_hacks_vb();
CPUS_RUN(CYCLES_M68K_LINE);
pevt_log_m68k_o(EVT_NEXT_LINE);
}
- pv->status &= ~SR_VB;
+ pv->status &= ~(SR_VB | PVS_VB2);
+ pv->status |= ((pv->reg[1] >> 3) ^ SR_VB) & SR_VB; // forced blanking
// last scanline
Pico.m.scanline = y;
}
// Run scanline:
- Pico.t.m68c_line_start = SekCyclesDone();
+ Pico.t.m68c_line_start = Pico.t.m68c_aim;
do_timing_hacks_as(pv, vdp_slots);
CPUS_RUN(CYCLES_M68K_LINE);
pvid->pending=0;\r
}\r
\r
- // preliminary FIFO emulation for Chaos Engine, The (E)\r
- if (!(pvid->status & SR_VB) && (pvid->reg[1] & 0x40) && !(PicoOpt&POPT_DIS_VDP_FIFO)) // active display?\r
+ if (!(pvid->status & SR_VB) && !(PicoOpt&POPT_DIS_VDP_FIFO))\r
{\r
int use = pvid->type == 1 ? 2 : 1;\r
pvid->lwrite_cnt -= use;\r
case 0x01:\r
elprintf(EL_INTSW, "vint_onoff: %i->%i [%u] pend=%i @ %06x", (dold&0x20)>>5,\r
(d&0x20)>>5, SekCyclesDone(), (pvid->pending_ints&0x20)>>5, SekPc);\r
+ if (!(pvid->status & PVS_VB2))\r
+ pvid->status &= ~SR_VB;\r
+ pvid->status |= ((d >> 3) ^ SR_VB) & SR_VB; // forced blanking\r
goto update_irq;\r
case 0x05:\r
//elprintf(EL_STATUS, "spritep moved to %04x", (unsigned)(Pico.video.reg[5]&0x7f) << 9);\r
}\r
}\r
\r
-PICO_INTERNAL_ASM unsigned int PicoVideoRead(unsigned int a)\r
+static u32 SrLow(const struct PicoVideo *pv)\r
{\r
- a&=0x1c;\r
+ unsigned int c, d = pv->status;\r
\r
- if (a==0x04) // control port\r
- {\r
- struct PicoVideo *pv=&Pico.video;\r
- unsigned int d;\r
- d=pv->status;\r
- //if (PicoOpt&POPT_ALT_RENDERER) d|=0x0020; // sprite collision (Shadow of the Beast)\r
- if (SekCyclesDone() - Pico.t.m68c_line_start >= 488-88)\r
- d|=0x0004; // H-Blank (Sonic3 vs)\r
-\r
- d |= ((pv->reg[1]&0x40)^0x40) >> 3; // set V-Blank if display is disabled\r
- d |= (pv->pending_ints&0x20)<<2; // V-int pending?\r
- if (d&0x100) pv->status&=~0x100; // FIFO no longer full\r
+ c = SekCyclesDone() - Pico.t.m68c_line_start - 39;\r
+ if (c < 92)\r
+ d |= SR_HB;\r
+ return d;\r
+}\r
\r
- pv->pending = 0; // ctrl port reads clear write-pending flag (Charles MacDonald)\r
+PICO_INTERNAL_ASM unsigned int PicoVideoRead(unsigned int a)\r
+{\r
+ a &= 0x1c;\r
\r
+ if (a == 0x04) // control port\r
+ {\r
+ struct PicoVideo *pv = &Pico.video;\r
+ unsigned int d = SrLow(pv);\r
+ pv->pending = 0;\r
elprintf(EL_SR, "SR read: %04x [%u] @ %06x", d, SekCyclesDone(), SekPc);\r
return d;\r
}\r
return VideoRead();\r
}\r
\r
-// FIXME: broken mess\r
unsigned char PicoVideoRead8CtlH(void)\r
{\r
u8 d = (u8)(Pico.video.status >> 8);\r
- if (d & 1)\r
- Pico.video.status &= ~0x100; // FIFO no longer full\r
Pico.video.pending = 0;\r
elprintf(EL_SR, "SR read (h): %02x @ %06x", d, SekPc);\r
return d;\r
\r
unsigned char PicoVideoRead8CtlL(void)\r
{\r
- u8 d = (u8)Pico.video.status;\r
- //if (PicoOpt&POPT_ALT_RENDERER) d|=0x0020; // sprite collision (Shadow of the Beast)\r
- d |= ((Pico.video.reg[1]&0x40)^0x40) >> 3; // set V-Blank if display is disabled\r
- d |= (Pico.video.pending_ints&0x20)<<2; // V-int pending?\r
- if (SekCyclesDone() - Pico.t.m68c_line_start >= 488-88) d |= 4; // H-Blank\r
+ u8 d = SrLow(&Pico.video);\r
Pico.video.pending = 0;\r
elprintf(EL_SR, "SR read (l): %02x @ %06x", d, SekPc);\r
return d;\r