Previous 15994 Revisions Next

r5389 Sunday 9th August, 2009 at 21:37:04 UTC by Angelo Salese
[SNES]: Hooked up interlace mode
[src/mame/machine]snes.c

src/mame/machine/snes.c
r5388r5389
3939static emu_timer *snes_nmi_timer;
4040static emu_timer *snes_hirq_timer;
4141static UINT16 hblank_offset;
42static UINT8 snes_interlace; //doubles the visible resolution
4243UINT16 snes_htmult;   /* in 512 wide, we run HTOTAL double and halve it on latching */
4344UINT8 snes_has_addon_chip;
4445
r5388r5389
279280
280281*************************************/
281282
283static void snes_dynamic_res_change(running_machine *machine)
284{
285   rectangle visarea = *video_screen_get_visible_area(machine->primary_screen);
286
287   visarea.min_x = visarea.min_y = 0;
288   visarea.max_y = snes_ppu.beam.last_visible_line*snes_interlace - 1;
289
290   // fixme: should compensate for SNES_DBG_video
291   if( snes_ppu.mode == 5 || snes_ppu.mode == 6 )
292   {
293      visarea.max_x = (SNES_SCR_WIDTH * 2) - 1;
294      snes_htmult = 2;
295   }
296   else
297   {
298      visarea.max_x = SNES_SCR_WIDTH - 1;
299      snes_htmult = 1;
300   }
301
302   if ((snes_ram[STAT78] & 0x10) == SNES_NTSC)
303      video_screen_configure(machine->primary_screen, SNES_HTOTAL*snes_htmult, SNES_VTOTAL_NTSC*snes_interlace, &visarea, video_screen_get_frame_period(machine->primary_screen).attoseconds);
304   else
305      video_screen_configure(machine->primary_screen, SNES_HTOTAL*snes_htmult, SNES_VTOTAL_PAL*snes_interlace, &visarea, video_screen_get_frame_period(machine->primary_screen).attoseconds);
306}
307
282308static READ8_HANDLER( snes_open_bus_r )
283309{
284310   static UINT8 recurse = 0;
r5388r5389
717743         }
718744      case BGMODE:   /* BG mode and character size settings */
719745         snes_ppu.mode = data & 0x07;
720         {
721            rectangle visarea = *video_screen_get_visible_area(space->machine->primary_screen);
722
723            visarea.min_x = visarea.min_y = 0;
724            visarea.max_y = snes_ppu.beam.last_visible_line - 1;
725
726            // fixme: should compensate for SNES_DBG_video
727            if( snes_ppu.mode == 5 || snes_ppu.mode == 6 )
728            {
729               visarea.max_x = (SNES_SCR_WIDTH * 2) - 1;
730               snes_htmult = 2;
731            }
732            else
733            {
734               visarea.max_x = SNES_SCR_WIDTH - 1;
735               snes_htmult = 1;
736            }
737
738            if ((snes_ram[STAT78] & 0x10) == SNES_NTSC)
739               video_screen_configure(space->machine->primary_screen, SNES_HTOTAL*snes_htmult, SNES_VTOTAL_NTSC, &visarea, video_screen_get_frame_period(space->machine->primary_screen).attoseconds);
740            else
741               video_screen_configure(space->machine->primary_screen, SNES_HTOTAL*snes_htmult, SNES_VTOTAL_PAL, &visarea, video_screen_get_frame_period(space->machine->primary_screen).attoseconds);
742         }
746         snes_dynamic_res_change(space->machine);
743747         snes_ppu.bg3_priority_bit = data & 0x08;
744748         snes_ppu.layer[0].tile_size = (data >> 4) & 0x1;
745749         snes_ppu.layer[1].tile_size = (data >> 5) & 0x1;
r5388r5389
10301034            snes_cgram[FIXED_COLOUR] = (r | (g << 5) | (b << 10));
10311035         } break;
10321036      case SETINI:   /* Screen mode/video select */
1033         /* FIXME: We only support line count here */
1037         /* FIXME: We only support line count and interlace here */
1038         snes_interlace = (data & 1) ? 2 : 1;
10341039         snes_ppu.beam.last_visible_line = (data & 0x4) ? 240 : 225;
1040         /* FIXME: move to a common routine */
1041         snes_dynamic_res_change(space->machine);
10351042#ifdef SNES_DBG_REG_W
10361043         if( (data & 0x8) != (snes_ram[SETINI] & 0x8) )
10371044            mame_printf_debug( "Pseudo 512 mode: %s\n", (data & 0x8) ? "on" : "off" );
r5388r5389
17501757   snes_ram[VTIMEH] = 0x1;
17511758
17521759   snes_htmult = 1;
1760   snes_interlace = 1;
17531761}
17541762
17551763

Previous 15994 Revisions Next


© 1998-2018 The MESS Team