ST-V: Hand-tuned pixel-clock to match measured fps from the pcb [Angelo Salese, Corrado Tomaselli]

Improved hblank duration behaviour [Angelo Salese]
This commit is contained in:
Angelo Salese 2009-07-25 13:38:47 +00:00
parent 5334207183
commit 80bb7c8943
2 changed files with 24 additions and 12 deletions

View File

@ -180,7 +180,7 @@ ToDo / Notes:
#define MASTER_CLOCK_352 57272800 #define MASTER_CLOCK_352 57272800
#define MASTER_CLOCK_320 53748200 #define MASTER_CLOCK_320 53748200
#define PIXEL_CLOCK MASTER_CLOCK_352/4 #define PIXEL_CLOCK 50160000/2/4 /*hand-tuned to match fps ~59.82*/
/**************************************************************************************/ /**************************************************************************************/
/*to be added into a stv Header file,remember to remove all the static...*/ /*to be added into a stv Header file,remember to remove all the static...*/
@ -2754,7 +2754,7 @@ static MACHINE_DRIVER_START( stv )
MDRV_SCREEN_ADD("screen", RASTER) MDRV_SCREEN_ADD("screen", RASTER)
MDRV_SCREEN_FORMAT(BITMAP_FORMAT_RGB15) MDRV_SCREEN_FORMAT(BITMAP_FORMAT_RGB15)
MDRV_SCREEN_RAW_PARAMS(PIXEL_CLOCK, 704, 0, 703, 512, 0, 511) // we need to use a resolution as high as the max size it can change to MDRV_SCREEN_RAW_PARAMS(PIXEL_CLOCK, 400, 0, 320, 262, 0, 224)
MDRV_PALETTE_LENGTH(2048+(2048*2))//standard palette + extra memory for rgb brightness. MDRV_PALETTE_LENGTH(2048+(2048*2))//standard palette + extra memory for rgb brightness.
MDRV_GFXDECODE(stv) MDRV_GFXDECODE(stv)

View File

@ -120,8 +120,8 @@ UINT32* stv_vdp2_cram;
static void stv_vdp2_dynamic_res_change(running_machine *machine); static void stv_vdp2_dynamic_res_change(running_machine *machine);
static UINT8 get_hblank(running_machine *machine); static UINT8 get_hblank(running_machine *machine);
static int get_vblank_duration(running_machine *machine); static int get_vblank_duration(running_machine *machine);
//int get_hblank_duration(running_machine *machine); //<- when we know that... static int get_hblank_duration(running_machine *machine);
static UINT8 get_odd_bit(running_machine *machine); static UINT8 get_odd_bit(running_machine *machine);
static void refresh_palette_data(running_machine *machine); static void refresh_palette_data(running_machine *machine);
@ -5277,8 +5277,19 @@ static UINT8 get_hblank(running_machine *machine)
return 0; return 0;
} }
//int get_hblank_duration(running_machine *machine) /* the following is a complete guess-work */
//... static int get_hblank_duration(running_machine *machine)
{
switch( STV_VDP2_HRES & 3 )
{
case 0: return 80; //400-320
case 1: return 104; break; //456-352
case 2: return 160; break; //(400-320)*2
case 3: return 208; break; //(456-352)*2
}
return 0;
}
UINT8 stv_get_vblank(running_machine *machine) UINT8 stv_get_vblank(running_machine *machine)
{ {
@ -5306,10 +5317,10 @@ static int get_vblank_duration(running_machine *machine)
switch(STV_VDP2_VRES & 3) switch(STV_VDP2_VRES & 3)
{ {
case 0: return 39; //263-224 case 0: return 40; //264-224
case 1: return 23; //263-240 case 1: return 24; //264-240
case 2: return 7; //263-256 case 2: return 8; //264-256
case 3: return 7; //263-256 case 3: return 8; //264-256
} }
return 0; return 0;
@ -5430,7 +5441,7 @@ VIDEO_START( stv_vdp2 )
/* & height / width not yet understood (docs-wise MUST be bigger than normal visible area)*/ /* & height / width not yet understood (docs-wise MUST be bigger than normal visible area)*/
static TIMER_CALLBACK( dyn_res_change ) static TIMER_CALLBACK( dyn_res_change )
{ {
UINT8 vblank_period; int vblank_period,hblank_period;
rectangle visarea = *video_screen_get_visible_area(machine->primary_screen); rectangle visarea = *video_screen_get_visible_area(machine->primary_screen);
visarea.min_x = 0; visarea.min_x = 0;
visarea.max_x = horz_res-1; visarea.max_x = horz_res-1;
@ -5438,9 +5449,10 @@ static TIMER_CALLBACK( dyn_res_change )
visarea.max_y = vert_res-1; visarea.max_y = vert_res-1;
vblank_period = get_vblank_duration(machine); vblank_period = get_vblank_duration(machine);
hblank_period = get_hblank_duration(machine);
// popmessage("%d",vblank_period); // popmessage("%d",vblank_period);
// hblank_period = get_hblank_duration(machine->primary_screen); // hblank_period = get_hblank_duration(machine->primary_screen);
video_screen_configure(machine->primary_screen, horz_res*2, (vert_res+vblank_period), &visarea, video_screen_get_frame_period(machine->primary_screen).attoseconds ); video_screen_configure(machine->primary_screen, (horz_res+hblank_period), (vert_res+vblank_period), &visarea, video_screen_get_frame_period(machine->primary_screen).attoseconds );
} }
static void stv_vdp2_dynamic_res_change(running_machine *machine) static void stv_vdp2_dynamic_res_change(running_machine *machine)