Previous 199869 Revisions Next

r21087 Friday 15th February, 2013 at 14:42:16 UTC by Angelo Salese
Fixed SMPC change clock behaviour, fixes 2 credits at start-up for various ST-V games [Angelo Salese]
[src/emu/machine]smpc.c
[src/emu/video]stvvdp2.c
[src/mame/drivers]saturn.c stv.c
[src/mame/includes]stv.h

trunk/src/mame/drivers/stv.c
r21086r21087
658658
659659*/
660660
661READ32_MEMBER(saturn_state::astrass_hack_r)
662{
663   if(space.device().safe_pc() == 0x60011ba) return 0x00000000;
664
665   return m_workram_h[0x000770/4];
666}
667
668661DRIVER_INIT_MEMBER(saturn_state,astrass)
669662{
670663   sh2drc_add_pcflush(machine().device("maincpu"), 0x60011ba);
671664   sh2drc_add_pcflush(machine().device("maincpu"), 0x605b9da);
672665
673   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x06000770, 0x06000773, read32_delegate(FUNC(saturn_state::astrass_hack_r),this));
674
675666   install_astrass_protection(machine());
676667
677668   DRIVER_INIT_CALL(stv);
trunk/src/mame/drivers/saturn.c
r21086r21087
15201520TIMER_DEVICE_CALLBACK_MEMBER(saturn_state::saturn_scanline)
15211521{
15221522   int scanline = param;
1523   int max_y = machine().primary_screen->height();
15241523   int y_step,vblank_line;
15251524
1526   y_step = 2;
1525   vblank_line = get_vblank_start_position();
1526   y_step = get_ystep_count();
15271527
1528   if((max_y == 263 && m_vdp2.pal == 0) || (max_y == 313 && m_vdp2.pal == 1))
1529      y_step = 1;
1530
1531   vblank_line = (m_vdp2.pal) ? 288 : 240;
1532
15331528   //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]);
15341529
15351530   if(scanline == (0)*y_step)
trunk/src/mame/includes/stv.h
r21086r21087
151151   DECLARE_WRITE32_MEMBER(magzun_ioga_w32);
152152   DECLARE_READ32_MEMBER(magzun_hef_hack_r);
153153   DECLARE_READ32_MEMBER(magzun_rx_hack_r);
154   DECLARE_READ32_MEMBER(astrass_hack_r);
155154   DECLARE_INPUT_CHANGED_MEMBER(key_stroke);
156155   DECLARE_INPUT_CHANGED_MEMBER(nmi_reset);
157156   DECLARE_INPUT_CHANGED_MEMBER(tray_open);
r21086r21087
381380   int get_pixel_clock( void );
382381   UINT8 get_odd_bit( void );
383382   void stv_vdp2_dynamic_res_change( void );
383   int get_vblank_start_position( void );
384   int get_ystep_count( void );
384385
385386   void refresh_palette_data( void );
386387   int stv_vdp2_window_process(int x,int y);
trunk/src/emu/machine/smpc.c
r21086r21087
155155#define LOG_SMPC 0
156156#define LOG_PAD_CMD 0
157157
158#if 0
159/* TODO: move this into video functions */
160static int vblank_line(running_machine &machine)
161{
162   saturn_state *state = machine.driver_data<saturn_state>();
163   int max_y = machine.primary_screen->height();
164   int y_step,vblank_line;
165158
166   y_step = 2;
167
168   if((max_y == 263 && state->m_vdp2.pal == 0) || (max_y == 313 && state->m_vdp2.pal == 1))
169      y_step = 1;
170
171   vblank_line = (state->m_vdp2.pal) ? 288 : 240;
172
173   return vblank_line*y_step;
174}
175#endif
176
177
178159/********************************************
179160 *
180161 * Bankswitch code for ST-V Multi Cart mode
r21086r21087
273254   state->m_vdp2.dotsel = param ^ 1;
274255   state->stv_vdp2_dynamic_res_change();
275256
257   state->m_maincpu->set_input_line(INPUT_LINE_HALT, CLEAR_LINE);
276258   if(!state->m_NMI_reset)
277259      state->m_maincpu->set_input_line(INPUT_LINE_NMI, PULSE_LINE);
260   state->m_slave->set_input_line(INPUT_LINE_HALT, CLEAR_LINE);
278261   state->m_slave->set_input_line(INPUT_LINE_RESET, ASSERT_LINE);
262   state->m_audiocpu->set_input_line(INPUT_LINE_HALT, CLEAR_LINE);
279263
280264   /* put issued command in OREG31 */
281265   state->m_smpc.OREG[31] = 0x0e + param;
r21086r21087
721705         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());
722706
723707         /* on ST-V timing of this is pretty fussy, you get 2 credits at start-up otherwise
724            sokyugurentai threshold is 74 lines
725            shanhigw threshold is 90 lines
726            I assume that it needs ~100 lines, so 6666,(6) usecs. Obviously needs HW tests ... */
708            My current theory is that SMPC first stops all CPUs until it executes the whole snippet for this,
709            and restarts them when the screen is again ready for use. I really don't think that the system
710            can do an usable mid-frame clock switching anyway.
711            */
727712
728         space.machine().scheduler().timer_set(attotime::from_usec(6666), FUNC(smpc_change_clock),data & 1);
713         state->m_maincpu->set_input_line(INPUT_LINE_HALT, ASSERT_LINE);
714         state->m_slave->set_input_line(INPUT_LINE_HALT, ASSERT_LINE);
715         state->m_audiocpu->set_input_line(INPUT_LINE_HALT, ASSERT_LINE);
716
717         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);
729718         break;
730719      /*"Interrupt Back"*/
731720      case 0x10:
trunk/src/emu/video/stvvdp2.c
r21086r21087
62526252   return machine().primary_screen->frame_number() & 1;
62536253}
62546254
6255int saturn_state::get_vblank_start_position( void )
6256{
6257   int vblank_line;
6258
6259   vblank_line = (m_vdp2.pal) ? 288 : 240;
6260
6261   return vblank_line;
6262}
6263
6264int saturn_state::get_ystep_count( void )
6265{
6266   int max_y = machine().primary_screen->height();
6267   int y_step;
6268
6269   y_step = 2;
6270
6271   if((max_y == 263 && m_vdp2.pal == 0) || (max_y == 313 && m_vdp2.pal == 1))
6272      y_step = 1;
6273
6274   return y_step;
6275}
6276
62556277/* TODO: these needs to be checked via HW tests! */
62566278int saturn_state::get_hcounter( void )
62576279{

Previous 199869 Revisions Next


© 1997-2024 The MAME Team