core, fix z80 vcounter value

This commit is contained in:
kub 2023-07-12 22:35:33 +02:00
parent adffea8dae
commit 7021622153
4 changed files with 27 additions and 28 deletions

View file

@ -454,6 +454,8 @@ struct PicoTiming
int timer_a_next_oflow, timer_a_step; // in z80 cycles
int timer_b_next_oflow, timer_b_step;
int vcnt_wrap, vcnt_adj;
};
struct PicoSound
@ -914,6 +916,13 @@ static __inline void VideoWriteVRAM(u32 a, u16 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 u32 PicoVideoRead(u32 a);
unsigned char PicoVideoRead8DataH(int is_from_z80);