diff --git a/src/emu/machine/smpc.c b/src/emu/machine/smpc.c index 3d5c673ac1d..d89331413d5 100644 --- a/src/emu/machine/smpc.c +++ b/src/emu/machine/smpc.c @@ -155,25 +155,6 @@ TODO: #define LOG_SMPC 0 #define LOG_PAD_CMD 0 -#if 0 -/* TODO: move this into video functions */ -static int vblank_line(running_machine &machine) -{ - saturn_state *state = machine.driver_data(); - int max_y = machine.primary_screen->height(); - int y_step,vblank_line; - - 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; - - return vblank_line*y_step; -} -#endif - /******************************************** * @@ -273,9 +254,12 @@ static TIMER_CALLBACK( smpc_change_clock ) state->m_vdp2.dotsel = param ^ 1; state->stv_vdp2_dynamic_res_change(); + state->m_maincpu->set_input_line(INPUT_LINE_HALT, CLEAR_LINE); if(!state->m_NMI_reset) state->m_maincpu->set_input_line(INPUT_LINE_NMI, PULSE_LINE); + state->m_slave->set_input_line(INPUT_LINE_HALT, CLEAR_LINE); state->m_slave->set_input_line(INPUT_LINE_RESET, ASSERT_LINE); + state->m_audiocpu->set_input_line(INPUT_LINE_HALT, CLEAR_LINE); /* put issued command in OREG31 */ state->m_smpc.OREG[31] = 0x0e + param; @@ -721,11 +705,16 @@ static void smpc_comreg_exec(address_space &space, UINT8 data, UINT8 is_stv) if(LOG_SMPC) printf ("SMPC: Change Clock to %s (%d %d)\n",data & 1 ? "320" : "352",space.machine().primary_screen->hpos(),space.machine().primary_screen->vpos()); /* on ST-V timing of this is pretty fussy, you get 2 credits at start-up otherwise - sokyugurentai threshold is 74 lines - shanhigw threshold is 90 lines - I assume that it needs ~100 lines, so 6666,(6) usecs. Obviously needs HW tests ... */ + My current theory is that SMPC first stops all CPUs until it executes the whole snippet for this, + and restarts them when the screen is again ready for use. I really don't think that the system + can do an usable mid-frame clock switching anyway. + */ - space.machine().scheduler().timer_set(attotime::from_usec(6666), FUNC(smpc_change_clock),data & 1); + state->m_maincpu->set_input_line(INPUT_LINE_HALT, ASSERT_LINE); + state->m_slave->set_input_line(INPUT_LINE_HALT, ASSERT_LINE); + state->m_audiocpu->set_input_line(INPUT_LINE_HALT, ASSERT_LINE); + + space.machine().scheduler().timer_set(space.machine().primary_screen->time_until_pos(state->get_vblank_start_position()*state->get_ystep_count(), 0), FUNC(smpc_change_clock),data & 1); break; /*"Interrupt Back"*/ case 0x10: diff --git a/src/emu/video/stvvdp2.c b/src/emu/video/stvvdp2.c index 66a3a0b4d40..c51e66198e8 100644 --- a/src/emu/video/stvvdp2.c +++ b/src/emu/video/stvvdp2.c @@ -6252,6 +6252,28 @@ UINT8 saturn_state::get_odd_bit( void ) return machine().primary_screen->frame_number() & 1; } +int saturn_state::get_vblank_start_position( void ) +{ + int vblank_line; + + vblank_line = (m_vdp2.pal) ? 288 : 240; + + return vblank_line; +} + +int saturn_state::get_ystep_count( void ) +{ + int max_y = machine().primary_screen->height(); + int y_step; + + y_step = 2; + + if((max_y == 263 && m_vdp2.pal == 0) || (max_y == 313 && m_vdp2.pal == 1)) + y_step = 1; + + return y_step; +} + /* TODO: these needs to be checked via HW tests! */ int saturn_state::get_hcounter( void ) { diff --git a/src/mame/drivers/saturn.c b/src/mame/drivers/saturn.c index 42b96d19286..b0fd8999c41 100644 --- a/src/mame/drivers/saturn.c +++ b/src/mame/drivers/saturn.c @@ -1520,15 +1520,10 @@ TODO: TIMER_DEVICE_CALLBACK_MEMBER(saturn_state::saturn_scanline) { int scanline = param; - int max_y = machine().primary_screen->height(); int y_step,vblank_line; - y_step = 2; - - if((max_y == 263 && m_vdp2.pal == 0) || (max_y == 313 && m_vdp2.pal == 1)) - y_step = 1; - - vblank_line = (m_vdp2.pal) ? 288 : 240; + vblank_line = get_vblank_start_position(); + y_step = get_ystep_count(); //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]); diff --git a/src/mame/drivers/stv.c b/src/mame/drivers/stv.c index 23b814d7970..5f6bf13a7bc 100644 --- a/src/mame/drivers/stv.c +++ b/src/mame/drivers/stv.c @@ -658,20 +658,11 @@ bp 6001d22 (60ffef0) */ -READ32_MEMBER(saturn_state::astrass_hack_r) -{ - if(space.device().safe_pc() == 0x60011ba) return 0x00000000; - - return m_workram_h[0x000770/4]; -} - DRIVER_INIT_MEMBER(saturn_state,astrass) { sh2drc_add_pcflush(machine().device("maincpu"), 0x60011ba); sh2drc_add_pcflush(machine().device("maincpu"), 0x605b9da); - machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x06000770, 0x06000773, read32_delegate(FUNC(saturn_state::astrass_hack_r),this)); - install_astrass_protection(machine()); DRIVER_INIT_CALL(stv); diff --git a/src/mame/includes/stv.h b/src/mame/includes/stv.h index 04ff831cd8c..071cb10ef70 100644 --- a/src/mame/includes/stv.h +++ b/src/mame/includes/stv.h @@ -151,7 +151,6 @@ public: DECLARE_WRITE32_MEMBER(magzun_ioga_w32); DECLARE_READ32_MEMBER(magzun_hef_hack_r); DECLARE_READ32_MEMBER(magzun_rx_hack_r); - DECLARE_READ32_MEMBER(astrass_hack_r); DECLARE_INPUT_CHANGED_MEMBER(key_stroke); DECLARE_INPUT_CHANGED_MEMBER(nmi_reset); DECLARE_INPUT_CHANGED_MEMBER(tray_open); @@ -381,6 +380,8 @@ public: int get_pixel_clock( void ); UINT8 get_odd_bit( void ); void stv_vdp2_dynamic_res_change( void ); + int get_vblank_start_position( void ); + int get_ystep_count( void ); void refresh_palette_data( void ); int stv_vdp2_window_process(int x,int y);