Attempt to add proper H/V latch settings

This commit is contained in:
Angelo Salese 2013-02-13 02:19:31 +00:00
parent 1758617657
commit ac39e1dfd5
3 changed files with 54 additions and 4 deletions

View File

@ -5962,11 +5962,10 @@ READ16_MEMBER ( saturn_state::saturn_vdp2_regs_r )
/* latch h/v signals through HV latch*/
if(!STV_VDP2_EXLTEN)
{
/* TODO: handle various h/v settings. */
if(!space.debugger_access())
{
m_vdp2.h_count = space.machine().primary_screen->hpos() & 0x3ff;
m_vdp2.v_count = space.machine().primary_screen->vpos() & (STV_VDP2_LSMD == 3 ? 0x7ff : 0x3ff);
m_vdp2.h_count = get_hcounter();
m_vdp2.v_count = get_vcounter();
/* latch flag */
m_vdp2.exltfg |= 1;
}
@ -6253,6 +6252,55 @@ UINT8 saturn_state::get_odd_bit( void )
return machine().primary_screen->frame_number() & 1;
}
/* TODO: these needs to be checked via HW tests! */
int saturn_state::get_hcounter( void )
{
int hcount;
hcount = machine().primary_screen->hpos();
switch(STV_VDP2_HRES & 6)
{
/* Normal */
case 0:
hcount &= 0x1ff;
hcount <<= 1;
break;
/* Hi-Res */
case 2:
hcount &= 0x3ff;
break;
/* Exclusive Normal*/
case 4:
hcount &= 0x1ff;
break;
/* Exclusive Hi-Res */
case 6:
hcount >>= 1;
hcount &= 0x1ff;
break;
}
return hcount;
}
int saturn_state::get_vcounter( void )
{
int vcount;
vcount = machine().primary_screen->vpos();
/* Exclusive Monitor */
if(STV_VDP2_HRES & 4)
return vcount & 0x3ff;
/* Double Density Interlace */
if((STV_VDP2_LSMD & 3) == 3)
return (vcount & ~1) | (machine().primary_screen->frame_number() & 1);
return (vcount << 1); // Non-interlace
}
void saturn_state::stv_vdp2_state_save_postload( void )
{
UINT8 *gfxdata = m_vdp2.gfx_decode;

View File

@ -1532,7 +1532,7 @@ TIMER_DEVICE_CALLBACK_MEMBER(saturn_state::saturn_scanline)
//popmessage("%08x %d T0 %d T1 %d %08x",m_scu.ism ^ 0xffffffff,max_y,m_scu_regs[36],m_scu_regs[37],m_scu_regs[38]);
if(scanline == (0)*y_step)
if(scanline == (vblank_line)*y_step)
{
video_update_vdp1();

View File

@ -374,6 +374,8 @@ public:
UINT8 get_vblank( void );
UINT8 get_hblank( void );
int get_hcounter( void );
int get_vcounter( void );
int get_vblank_duration( void );
int get_hblank_duration( void );
int get_pixel_clock( void );