Previous 15994 Revisions Next

r5455 Monday 17th August, 2009 at 21:38:11 UTC by Angelo Salese
[SNES]: Made the gfx mode switches more accurate.
[src/mame/machine]snes.c

src/mame/machine/snes.c
r5454r5455
290290
291291*************************************/
292292
293static TIMER_CALLBACK( snes_dynamic_res_change )
293static void snes_dynamic_res_change( running_machine *machine )
294294{
295295   rectangle visarea = *video_screen_get_visible_area(machine->primary_screen);
296   attoseconds_t refresh;
296297
297298   visarea.min_x = visarea.min_y = 0;
298299   visarea.max_y = snes_ppu.beam.last_visible_line*snes_ppu.interlace - 1;
300   visarea.max_x = (SNES_SCR_WIDTH * 2) - 1;
299301
300302   // fixme: should compensate for SNES_DBG_video
301303   if( snes_ppu.mode == 5 || snes_ppu.mode == 6 )
302   {
303      visarea.max_x = (SNES_SCR_WIDTH * 2) - 1;
304304      snes_htmult = 2;
305   }
306305   else
307   {
308      visarea.max_x = SNES_SCR_WIDTH - 1;
309306      snes_htmult = 1;
310   }
311307
308   /* FIXME: does the timing changes when the gfx mode is equal to 5 or 6? */
312309   if ((snes_ram[STAT78] & 0x10) == SNES_NTSC)
313      video_screen_configure(machine->primary_screen, SNES_HTOTAL*snes_htmult, SNES_VTOTAL_NTSC*snes_ppu.interlace, &visarea, video_screen_get_frame_period(machine->primary_screen).attoseconds);
310      refresh = HZ_TO_ATTOSECONDS(DOTCLK_NTSC) * SNES_HTOTAL * SNES_VTOTAL_NTSC;
314311   else
315      video_screen_configure(machine->primary_screen, SNES_HTOTAL*snes_htmult, SNES_VTOTAL_PAL*snes_ppu.interlace, &visarea, video_screen_get_frame_period(machine->primary_screen).attoseconds);
312      refresh = HZ_TO_ATTOSECONDS(DOTCLK_PAL) * SNES_HTOTAL * SNES_VTOTAL_PAL;
313
314   if ((snes_ram[STAT78] & 0x10) == SNES_NTSC)
315      video_screen_configure(machine->primary_screen, SNES_HTOTAL*2, SNES_VTOTAL_NTSC*snes_ppu.interlace, &visarea, refresh);
316   else
317      video_screen_configure(machine->primary_screen, SNES_HTOTAL*2, SNES_VTOTAL_PAL*snes_ppu.interlace, &visarea, refresh);
316318}
317319
318320static READ8_HANDLER( snes_open_bus_r )
r5454r5455
785787         }
786788      case BGMODE:   /* BG mode and character size settings */
787789         snes_ppu.mode = data & 0x07;
788         timer_set(space->machine, video_screen_get_time_until_pos(space->machine->primary_screen, snes_ppu.beam.last_visible_line, 0), NULL, 0, snes_dynamic_res_change);
790         snes_dynamic_res_change(space->machine);
789791         snes_ppu.bg3_priority_bit = data & 0x08;
790792         snes_ppu.layer[0].tile_size = (data >> 4) & 0x1;
791793         snes_ppu.layer[1].tile_size = (data >> 5) & 0x1;
r5454r5455
11551157         /* FIXME: We only support line count and interlace here */
11561158         snes_ppu.interlace = (data & 1) ? 2 : 1;
11571159         snes_ppu.beam.last_visible_line = (data & 0x4) ? 240 : 225;
1158         timer_set(space->machine, video_screen_get_time_until_pos(space->machine->primary_screen, snes_ppu.beam.last_visible_line, 0), NULL, 0, snes_dynamic_res_change);
1160         snes_dynamic_res_change(space->machine);
11591161#ifdef SNES_DBG_REG_W
11601162         if( (data & 0x8) != (snes_ram[SETINI] & 0x8) )
11611163            mame_printf_debug( "Pseudo 512 mode: %s\n", (data & 0x8) ? "on" : "off" );

Previous 15994 Revisions Next


© 1998-2018 The MESS Team