mirror of
https://github.com/RaySollium99/picodrive.git
synced 2025-09-05 07:17:45 -04:00
core, fix z80 vcounter value
This commit is contained in:
parent
adffea8dae
commit
7021622153
4 changed files with 27 additions and 28 deletions
|
@ -1367,7 +1367,7 @@ static unsigned char z80_md_vdp_read(unsigned short a)
|
||||||
case 0x04: return PicoVideoRead8CtlH(1);
|
case 0x04: return PicoVideoRead8CtlH(1);
|
||||||
case 0x05: return PicoVideoRead8CtlL(1);
|
case 0x05: return PicoVideoRead8CtlL(1);
|
||||||
case 0x08:
|
case 0x08:
|
||||||
case 0x0c: return get_scanline(1); // FIXME: make it proper
|
case 0x0c: return PicoVideoGetV(get_scanline(1));
|
||||||
case 0x09:
|
case 0x09:
|
||||||
case 0x0d: return Pico.m.rotate++;
|
case 0x0d: return Pico.m.rotate++;
|
||||||
}
|
}
|
||||||
|
|
|
@ -225,6 +225,15 @@ void PicoLoopPrepare(void)
|
||||||
// force setting possibly changed..
|
// force setting possibly changed..
|
||||||
Pico.m.pal = (PicoIn.regionOverride == 2 || PicoIn.regionOverride == 8) ? 1 : 0;
|
Pico.m.pal = (PicoIn.regionOverride == 2 || PicoIn.regionOverride == 8) ? 1 : 0;
|
||||||
|
|
||||||
|
if (Pico.m.pal) {
|
||||||
|
Pico.t.vcnt_wrap = 0x103;
|
||||||
|
Pico.t.vcnt_adj = 57;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
Pico.t.vcnt_wrap = 0xEB;
|
||||||
|
Pico.t.vcnt_adj = 6;
|
||||||
|
}
|
||||||
|
|
||||||
Pico.m.dirtyPal = 1;
|
Pico.m.dirtyPal = 1;
|
||||||
rendstatus_old = -1;
|
rendstatus_old = -1;
|
||||||
|
|
||||||
|
|
|
@ -136,7 +136,6 @@ static int PicoFrameHints(void)
|
||||||
{
|
{
|
||||||
struct PicoVideo *pv = &Pico.video;
|
struct PicoVideo *pv = &Pico.video;
|
||||||
int lines, y, lines_vis, skip;
|
int lines, y, lines_vis, skip;
|
||||||
int vcnt_wrap, vcnt_adj;
|
|
||||||
int hint; // Hint counter
|
int hint; // Hint counter
|
||||||
|
|
||||||
pevt_log_m68k_o(EVT_FRAME_START);
|
pevt_log_m68k_o(EVT_FRAME_START);
|
||||||
|
@ -144,7 +143,6 @@ static int PicoFrameHints(void)
|
||||||
skip = PicoIn.skipFrame;
|
skip = PicoIn.skipFrame;
|
||||||
|
|
||||||
Pico.t.m68c_frame_start = Pico.t.m68c_aim;
|
Pico.t.m68c_frame_start = Pico.t.m68c_aim;
|
||||||
pv->v_counter = Pico.m.scanline = 0;
|
|
||||||
z80_resetCycles();
|
z80_resetCycles();
|
||||||
PsndStartFrame();
|
PsndStartFrame();
|
||||||
|
|
||||||
|
@ -153,16 +151,13 @@ static int PicoFrameHints(void)
|
||||||
// === active display ===
|
// === active display ===
|
||||||
pv->status |= PVS_ACTIVE;
|
pv->status |= PVS_ACTIVE;
|
||||||
|
|
||||||
for (y = 0; ; y++)
|
for (y = 0;; y++)
|
||||||
{
|
{
|
||||||
pv->v_counter = Pico.m.scanline = y;
|
Pico.m.scanline = y;
|
||||||
if ((pv->reg[12]&6) == 6) { // interlace mode 2
|
pv->v_counter = PicoVideoGetV(y);
|
||||||
pv->v_counter <<= 1;
|
|
||||||
pv->v_counter |= pv->v_counter >> 8;
|
|
||||||
pv->v_counter &= 0xff;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((y == 224 && !(pv->reg[1] & 8)) || y == 240)
|
lines_vis = (pv->reg[1] & 8) ? 240 : 224;
|
||||||
|
if (y == lines_vis)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
PAD_DELAY();
|
PAD_DELAY();
|
||||||
|
@ -268,25 +263,11 @@ static int PicoFrameHints(void)
|
||||||
pevt_log_m68k_o(EVT_NEXT_LINE);
|
pevt_log_m68k_o(EVT_NEXT_LINE);
|
||||||
|
|
||||||
// === VBLANK ===
|
// === VBLANK ===
|
||||||
if (Pico.m.pal) {
|
lines = Pico.m.pal ? 313 : 262;
|
||||||
lines = 313;
|
|
||||||
vcnt_wrap = 0x103;
|
|
||||||
vcnt_adj = 57;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
lines = 262;
|
|
||||||
vcnt_wrap = 0xEB;
|
|
||||||
vcnt_adj = 6;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (y++; y < lines - 1; y++)
|
for (y++; y < lines - 1; y++)
|
||||||
{
|
{
|
||||||
pv->v_counter = Pico.m.scanline = y;
|
Pico.m.scanline = y;
|
||||||
if (y >= vcnt_wrap)
|
pv->v_counter = PicoVideoGetV(y);
|
||||||
pv->v_counter -= vcnt_adj;
|
|
||||||
if ((pv->reg[12]&6) == 6)
|
|
||||||
pv->v_counter = (pv->v_counter << 1) | 1;
|
|
||||||
pv->v_counter &= 0xff;
|
|
||||||
|
|
||||||
PAD_DELAY();
|
PAD_DELAY();
|
||||||
|
|
||||||
|
|
|
@ -454,6 +454,8 @@ struct PicoTiming
|
||||||
|
|
||||||
int timer_a_next_oflow, timer_a_step; // in z80 cycles
|
int timer_a_next_oflow, timer_a_step; // in z80 cycles
|
||||||
int timer_b_next_oflow, timer_b_step;
|
int timer_b_next_oflow, timer_b_step;
|
||||||
|
|
||||||
|
int vcnt_wrap, vcnt_adj;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct PicoSound
|
struct PicoSound
|
||||||
|
@ -914,6 +916,13 @@ static __inline void VideoWriteVRAM(u32 a, u16 d)
|
||||||
UpdateSAT(a, d);
|
UpdateSAT(a, d);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static __inline u8 PicoVideoGetV(int scanline)
|
||||||
|
{
|
||||||
|
if (scanline >= Pico.t.vcnt_wrap) scanline -= Pico.t.vcnt_adj;
|
||||||
|
if ((Pico.video.reg[12]&6) == 6) scanline = (scanline<<1) | 1;
|
||||||
|
return scanline;
|
||||||
|
}
|
||||||
|
|
||||||
PICO_INTERNAL_ASM void PicoVideoWrite(u32 a,unsigned short d);
|
PICO_INTERNAL_ASM void PicoVideoWrite(u32 a,unsigned short d);
|
||||||
PICO_INTERNAL_ASM u32 PicoVideoRead(u32 a);
|
PICO_INTERNAL_ASM u32 PicoVideoRead(u32 a);
|
||||||
unsigned char PicoVideoRead8DataH(int is_from_z80);
|
unsigned char PicoVideoRead8DataH(int is_from_z80);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue