mirror of
https://github.com/holub/mame
synced 2025-04-26 18:23:08 +03:00
PAL porting, nw
This commit is contained in:
parent
4e66031c99
commit
6290c039a7
@ -2223,6 +2223,7 @@ DRIVER_INIT ( stv )
|
||||
state->m_smpc_ram[0x5f] = 0x10;
|
||||
|
||||
state->m_instadma_hack = 0;
|
||||
state->m_vdp2.pal = 0;
|
||||
|
||||
#ifdef MAME_DEBUG
|
||||
/*Uncomment this to enable header info*/
|
||||
@ -2563,17 +2564,22 @@ static TIMER_DEVICE_CALLBACK( saturn_scanline )
|
||||
saturn_state *state = timer.machine().driver_data<saturn_state>();
|
||||
int scanline = param;
|
||||
int max_y = timer.machine().primary_screen->height();
|
||||
int y_step;
|
||||
int y_step,vblank_line;
|
||||
|
||||
y_step = (max_y == 263) ? 1 : 2;
|
||||
y_step = 2;
|
||||
|
||||
if((max_y == 263 && state->m_vdp2.pal == 0) || (max_y == 313 && state->m_vdp2.pal == 1))
|
||||
y_step = 1;
|
||||
|
||||
vblank_line = (state->m_vdp2.pal) ? 288 : 240;
|
||||
|
||||
//popmessage("%08x %d %08x %08x",state->m_scu_regs[40] ^ 0xffffffff,max_y,state->m_scu_regs[36],state->m_scu_regs[38]);
|
||||
|
||||
if(scanline == 0*y_step)
|
||||
device_set_input_line_and_vector(state->m_maincpu, 0xe, (stv_irq.vblank_out) ? HOLD_LINE : CLEAR_LINE , 0x41);
|
||||
else if(scanline == 240*y_step)
|
||||
else if(scanline == vblank_line*y_step)
|
||||
device_set_input_line_and_vector(state->m_maincpu, 0xf, (stv_irq.vblank_in) ? HOLD_LINE : CLEAR_LINE , 0x40);
|
||||
else if((scanline % y_step) == 0 && scanline < 240*y_step)
|
||||
else if((scanline % y_step) == 0 && scanline < vblank_line*y_step)
|
||||
device_set_input_line_and_vector(state->m_maincpu, 0xd, (stv_irq.hblank_in) ? HOLD_LINE : CLEAR_LINE, 0x42);
|
||||
|
||||
/* TODO: this isn't completely correct */
|
||||
@ -2645,16 +2651,16 @@ static MACHINE_RESET( stv )
|
||||
static MACHINE_CONFIG_START( saturn, saturn_state )
|
||||
|
||||
/* basic machine hardware */
|
||||
MCFG_CPU_ADD("maincpu", SH2, MASTER_CLOCK_320/2) // 28.6364 MHz
|
||||
MCFG_CPU_ADD("maincpu", SH2, MASTER_CLOCK_352/2) // 28.6364 MHz
|
||||
MCFG_CPU_PROGRAM_MAP(saturn_mem)
|
||||
MCFG_CPU_CONFIG(sh2_conf_master)
|
||||
MCFG_TIMER_ADD_SCANLINE("scantimer", saturn_scanline, "screen", 0, 1)
|
||||
|
||||
MCFG_CPU_ADD("slave", SH2, MASTER_CLOCK_320/2) // 28.6364 MHz
|
||||
MCFG_CPU_ADD("slave", SH2, MASTER_CLOCK_352/2) // 28.6364 MHz
|
||||
MCFG_CPU_PROGRAM_MAP(saturn_mem)
|
||||
MCFG_CPU_CONFIG(sh2_conf_slave)
|
||||
|
||||
MCFG_CPU_ADD("audiocpu", M68000, MASTER_CLOCK_320/5) //11.46 MHz
|
||||
MCFG_CPU_ADD("audiocpu", M68000, MASTER_CLOCK_352/5) //11.46 MHz
|
||||
MCFG_CPU_PROGRAM_MAP(sound_mem)
|
||||
|
||||
MCFG_MACHINE_START(saturn)
|
||||
@ -2690,16 +2696,16 @@ MACHINE_CONFIG_END
|
||||
static MACHINE_CONFIG_START( stv, saturn_state )
|
||||
|
||||
/* basic machine hardware */
|
||||
MCFG_CPU_ADD("maincpu", SH2, MASTER_CLOCK_320/2) // 28.6364 MHz
|
||||
MCFG_CPU_ADD("maincpu", SH2, MASTER_CLOCK_352/2) // 28.6364 MHz
|
||||
MCFG_CPU_PROGRAM_MAP(stv_mem)
|
||||
MCFG_CPU_CONFIG(sh2_conf_master)
|
||||
MCFG_TIMER_ADD_SCANLINE("scantimer", saturn_scanline, "screen", 0, 1)
|
||||
|
||||
MCFG_CPU_ADD("slave", SH2, MASTER_CLOCK_320/2) // 28.6364 MHz
|
||||
MCFG_CPU_ADD("slave", SH2, MASTER_CLOCK_352/2) // 28.6364 MHz
|
||||
MCFG_CPU_PROGRAM_MAP(stv_mem)
|
||||
MCFG_CPU_CONFIG(sh2_conf_slave)
|
||||
|
||||
MCFG_CPU_ADD("audiocpu", M68000, MASTER_CLOCK_320/5) //11.46 MHz
|
||||
MCFG_CPU_ADD("audiocpu", M68000, MASTER_CLOCK_352/5) //11.46 MHz
|
||||
MCFG_CPU_PROGRAM_MAP(sound_mem)
|
||||
|
||||
MCFG_MACHINE_START(stv)
|
||||
@ -2821,6 +2827,7 @@ static void saturn_init_driver(running_machine &machine, int rgn)
|
||||
system_time systime;
|
||||
|
||||
state->saturn_region = rgn;
|
||||
state->m_vdp2.pal = (rgn == 12) ? 1 : 0;
|
||||
|
||||
// set compatible options
|
||||
sh2drc_set_options(machine.device("maincpu"), SH2DRC_STRICT_VERIFY|SH2DRC_STRICT_PCREL);
|
||||
|
@ -60,6 +60,7 @@ public:
|
||||
UINT8 *gfx_decode;
|
||||
bitmap_t *roz_bitmap[2];
|
||||
UINT8 dotsel;
|
||||
UINT8 pal;
|
||||
}m_vdp2;
|
||||
|
||||
struct {
|
||||
@ -99,6 +100,7 @@ DRIVER_INIT ( stv );
|
||||
|
||||
/*----------- defined in drivers/stvinit.c -----------*/
|
||||
|
||||
UINT8 get_vblank(running_machine &machine);
|
||||
void install_stvbios_speedups(running_machine &machine);
|
||||
DRIVER_INIT(mausuke);
|
||||
DRIVER_INIT(puyosun);
|
||||
@ -161,8 +163,6 @@ WRITE32_HANDLER ( saturn_vdp1_framebuffer0_w );
|
||||
|
||||
/*----------- defined in video/stvvdp2.c -----------*/
|
||||
|
||||
UINT8 stv_get_vblank(running_machine &machine);
|
||||
|
||||
READ32_HANDLER ( saturn_vdp2_vram_r );
|
||||
READ32_HANDLER ( saturn_vdp2_cram_r );
|
||||
READ32_HANDLER ( saturn_vdp2_regs_r );
|
||||
|
@ -272,7 +272,7 @@ WRITE32_HANDLER( saturn_vdp1_regs_w )
|
||||
else
|
||||
{
|
||||
if ( VDP1_LOG ) logerror( "VDP1: Access to register TVMR = %1X\n", STV_VDP1_TVMR );
|
||||
if ( STV_VDP1_VBE && stv_get_vblank(space->machine()) )
|
||||
if ( STV_VDP1_VBE && get_vblank(space->machine()) )
|
||||
{
|
||||
state->m_vdp1.framebuffer_clear_on_next_frame = 1;
|
||||
}
|
||||
|
@ -5161,14 +5161,9 @@ READ32_HANDLER ( saturn_vdp2_regs_r )
|
||||
{
|
||||
case 0x4/4:
|
||||
{
|
||||
int stv_hblank,stv_vblank,stv_odd;
|
||||
/*Screen Status Register*/
|
||||
stv_vblank = stv_get_vblank(space->machine());
|
||||
stv_hblank = get_hblank(space->machine());
|
||||
stv_odd = get_odd_bit(space->machine());
|
||||
|
||||
/*VBLANK HBLANK ODD PAL */
|
||||
state->m_vdp2_regs[offset] = (stv_vblank<<19) | (stv_hblank<<18) | (stv_odd << 17) | (0 << 16);
|
||||
/*VBLANK HBLANK ODD PAL */
|
||||
state->m_vdp2_regs[offset] = (get_vblank(space->machine())<<19) | (get_hblank(space->machine())<<18) | (get_odd_bit(space->machine()) << 17) | (state->m_vdp2.pal << 16);
|
||||
break;
|
||||
}
|
||||
case 0x8/4:
|
||||
@ -5314,19 +5309,22 @@ static int get_hblank_duration(running_machine &machine)
|
||||
}
|
||||
|
||||
/*some vblank lines measurements (according to Charles MacDonald)*/
|
||||
/* TODO: interlace mode "eats" one line, should be 262.5 */
|
||||
static int get_vblank_duration(running_machine &machine)
|
||||
{
|
||||
saturn_state *state = machine.driver_data<saturn_state>();
|
||||
int res;
|
||||
|
||||
/* TODO: interlace mode "eats" one line, should be 262.5 */
|
||||
res = (state->m_vdp2.pal) ? 313 : 263;
|
||||
|
||||
/* compensate for interlacing */
|
||||
if((STV_VDP2_LSMD & 3) == 3)
|
||||
res<<=1;
|
||||
|
||||
if(STV_VDP2_HRES & 4)
|
||||
return (STV_VDP2_HRES & 1) ? 561 : 525; //Hi-Vision / 31kHz Monitor
|
||||
res = (STV_VDP2_HRES & 1) ? 561 : 525; //Hi-Vision / 31kHz Monitor
|
||||
|
||||
if((STV_VDP2_LSMD & 3) == 3)
|
||||
return 263*2;
|
||||
|
||||
return 263; //TODO: PAL uses 313
|
||||
return res;
|
||||
}
|
||||
|
||||
static int get_pixel_clock(running_machine &machine)
|
||||
@ -5362,13 +5360,13 @@ static UINT8 get_hblank(running_machine &machine)
|
||||
return 0;
|
||||
}
|
||||
|
||||
UINT8 stv_get_vblank(running_machine &machine)
|
||||
UINT8 get_vblank(running_machine &machine)
|
||||
{
|
||||
saturn_state *state = machine.driver_data<saturn_state>();
|
||||
int cur_v,vblank;
|
||||
cur_v = machine.primary_screen->vpos();
|
||||
|
||||
vblank = 240;
|
||||
vblank = (state->m_vdp2.pal) ? 288 : 240;
|
||||
|
||||
if((STV_VDP2_LSMD & 3) == 3)
|
||||
vblank<<=1;
|
||||
@ -5488,8 +5486,10 @@ void stv_vdp2_dynamic_res_change(running_machine &machine)
|
||||
const int d_vres[4] = { 224, 240, 256, 256 };
|
||||
const int d_hres[4] = { 320, 352, 640, 704 };
|
||||
int horz_res,vert_res;
|
||||
int vres_mask;
|
||||
|
||||
vert_res = d_vres[STV_VDP2_VRES & 1]; //TODO: PAL uses mask 3, NTSC uses mask 1
|
||||
vres_mask = (state->m_vdp2.pal << 1)|1; //PAL uses mask 3, NTSC uses mask 1
|
||||
vert_res = d_vres[STV_VDP2_VRES & vres_mask];
|
||||
|
||||
if((STV_VDP2_VRES & 3) == 3)
|
||||
popmessage("Illegal VRES MODE, contact MAMEdev");
|
||||
|
Loading…
Reference in New Issue
Block a user