Improved SMPC timings

This commit is contained in:
Angelo Salese 2013-10-07 22:37:12 +00:00
parent db2be28f99
commit 28454d8e38
3 changed files with 36 additions and 9 deletions

View File

@ -694,23 +694,20 @@ static void smpc_comreg_exec(address_space &space, UINT8 data, UINT8 is_stv)
case 0x02: case 0x02:
case 0x03: case 0x03:
if(LOG_SMPC) printf ("SMPC: Slave %s %d %d\n",(data & 1) ? "off" : "on",space.machine().primary_screen->hpos(),space.machine().primary_screen->vpos()); if(LOG_SMPC) printf ("SMPC: Slave %s %d %d\n",(data & 1) ? "off" : "on",space.machine().primary_screen->hpos(),space.machine().primary_screen->vpos());
if((data & 1) != (state->m_smpc.slave_on & 1)) space.machine().scheduler().timer_set(attotime::from_usec(15), FUNC(smpc_slave_enable),data & 1);
space.machine().scheduler().timer_set(attotime::from_usec(100), FUNC(smpc_slave_enable),data & 1);
else /* guess: if Slave state is equal to the previous one, just execute less code. ask Greatest Nine '97. Unless SMPC is really so fast ... */
space.machine().scheduler().timer_set(attotime::from_usec(5), FUNC(smpc_slave_enable),data & 1);
break; break;
case 0x06: case 0x06:
case 0x07: case 0x07:
if(LOG_SMPC) printf ("SMPC: Sound %s\n",(data & 1) ? "off" : "on"); if(LOG_SMPC) printf ("SMPC: Sound %s\n",(data & 1) ? "off" : "on");
if(!is_stv) if(!is_stv)
space.machine().scheduler().timer_set(attotime::from_usec(100), FUNC(smpc_sound_enable),data & 1); space.machine().scheduler().timer_set(attotime::from_usec(15), FUNC(smpc_sound_enable),data & 1);
break; break;
/*CD (SH-1) ON/OFF */ /*CD (SH-1) ON/OFF */
case 0x08: case 0x08:
case 0x09: case 0x09:
printf ("SMPC: CD %s\n",(data & 1) ? "off" : "on"); printf ("SMPC: CD %s\n",(data & 1) ? "off" : "on");
space.machine().scheduler().timer_set(attotime::from_usec(40), FUNC(smpc_cd_enable),data & 1); space.machine().scheduler().timer_set(attotime::from_usec(20), FUNC(smpc_cd_enable),data & 1);
break; break;
case 0x0d: case 0x0d:
if(LOG_SMPC) printf ("SMPC: System Reset\n"); if(LOG_SMPC) printf ("SMPC: System Reset\n");
@ -742,11 +739,12 @@ static void smpc_comreg_exec(address_space &space, UINT8 data, UINT8 is_stv)
int timing; int timing;
timing = 100; timing = 8;
if(state->m_smpc.IREG[0] != 0) // non-peripheral data if(state->m_smpc.IREG[0] != 0) // non-peripheral data
timing += 100; timing += 8;
/* TODO: At vblank-out actually ... */
if(state->m_smpc.IREG[1] & 8) // peripheral data if(state->m_smpc.IREG[1] & 8) // peripheral data
timing += 700; timing += 700;
@ -784,6 +782,7 @@ static void smpc_comreg_exec(address_space &space, UINT8 data, UINT8 is_stv)
break; break;
case 0x19: case 0x19:
case 0x1a: case 0x1a:
/* TODO: timing */
if(LOG_SMPC) printf ("SMPC: NMI %sable %d %d\n",data & 1 ? "Dis" : "En",space.machine().primary_screen->hpos(),space.machine().primary_screen->vpos()); if(LOG_SMPC) printf ("SMPC: NMI %sable %d %d\n",data & 1 ? "Dis" : "En",space.machine().primary_screen->hpos(),space.machine().primary_screen->vpos());
space.machine().scheduler().timer_set(attotime::from_usec(100), FUNC(smpc_nmi_set),data & 1); space.machine().scheduler().timer_set(attotime::from_usec(100), FUNC(smpc_nmi_set),data & 1);
break; break;

View File

@ -2007,6 +2007,9 @@ bit-> /----15----|----14----|----13----|----12----|----11----|----10----|----09
| -- | -- | -- | -- | -- | -- | -- | -- | | -- | -- | -- | -- | -- | -- | -- | -- |
\----------|----------|----------|----------|----------|----------|----------|---------*/ \----------|----------|----------|----------|----------|----------|----------|---------*/
#define STV_VDP2_CCRLB (m_vdp2_regs[0x10e/2])
/* 180110 - Colour Offset Enable /* 180110 - Colour Offset Enable
bit-> /----15----|----14----|----13----|----12----|----11----|----10----|----09----|----08----\ bit-> /----15----|----14----|----13----|----12----|----11----|----10----|----09----|----08----\
| -- | -- | -- | -- | -- | -- | -- | -- | | -- | -- | -- | -- | -- | -- | -- | -- |
@ -6043,7 +6046,7 @@ int saturn_state::get_vcounter( void )
return (vcount & ~1) | (machine().primary_screen->frame_number() & 1); return (vcount & ~1) | (machine().primary_screen->frame_number() & 1);
/* docs says << 1, but according to HW tests it's a typo. */ /* docs says << 1, but according to HW tests it's a typo. */
return (vcount & 0x1ff); // Non-interlace return (true_vcount[vcount & 0x1ff][STV_VDP2_VRES]); // Non-interlace
} }
void saturn_state::stv_vdp2_state_save_postload( void ) void saturn_state::stv_vdp2_state_save_postload( void )
@ -6115,6 +6118,7 @@ int saturn_state::stv_vdp2_start ( void )
/* maybe we should move this to video/stv.c */ /* maybe we should move this to video/stv.c */
VIDEO_START_MEMBER(saturn_state,stv_vdp2) VIDEO_START_MEMBER(saturn_state,stv_vdp2)
{ {
int i;
machine().primary_screen->register_screen_bitmap(m_tmpbitmap); machine().primary_screen->register_screen_bitmap(m_tmpbitmap);
stv_vdp2_start(); stv_vdp2_start();
stv_vdp1_start(); stv_vdp1_start();
@ -6123,6 +6127,29 @@ VIDEO_START_MEMBER(saturn_state,stv_vdp2)
machine().gfx[1]->set_source(m_vdp2.gfx_decode); machine().gfx[1]->set_source(m_vdp2.gfx_decode);
machine().gfx[2]->set_source(m_vdp2.gfx_decode); machine().gfx[2]->set_source(m_vdp2.gfx_decode);
machine().gfx[3]->set_source(m_vdp2.gfx_decode); machine().gfx[3]->set_source(m_vdp2.gfx_decode);
/* calc V counter offsets */
/* 224 mode */
for(i=0;i<263;i++)
{
true_vcount[i][0] = i;
if(i>0xec)
true_vcount[i][0]+=0xf9;
}
for(i=0;i<263;i++)
{
true_vcount[i][1] = i;
if(i>0xf5)
true_vcount[i][1]+=0xf9;
}
/* 256 mode, todo */
for(i=0;i<263;i++)
{
true_vcount[i][2] = i;
true_vcount[i][3] = i;
}
} }
void saturn_state::stv_vdp2_dynamic_res_change( void ) void saturn_state::stv_vdp2_dynamic_res_change( void )

View File

@ -358,6 +358,7 @@ public:
void stv_vdp2_draw_NBG3(bitmap_rgb32 &bitmap, const rectangle &cliprect); void stv_vdp2_draw_NBG3(bitmap_rgb32 &bitmap, const rectangle &cliprect);
void stv_vdp2_draw_RBG0(bitmap_rgb32 &bitmap, const rectangle &cliprect); void stv_vdp2_draw_RBG0(bitmap_rgb32 &bitmap, const rectangle &cliprect);
void draw_sprites(bitmap_rgb32 &bitmap, const rectangle &cliprect, UINT8 pri); void draw_sprites(bitmap_rgb32 &bitmap, const rectangle &cliprect, UINT8 pri);
int true_vcount[263][4];
void stv_vdp2_state_save_postload( void ); void stv_vdp2_state_save_postload( void );
void stv_vdp2_exit ( void ); void stv_vdp2_exit ( void );