src/mame/machine/snes.c
| r5454 | r5455 | |
| 290 | 290 | |
| 291 | 291 | *************************************/ |
| 292 | 292 | |
| 293 | | static TIMER_CALLBACK( snes_dynamic_res_change ) |
| 293 | static void snes_dynamic_res_change( running_machine *machine ) |
| 294 | 294 | { |
| 295 | 295 | rectangle visarea = *video_screen_get_visible_area(machine->primary_screen); |
| 296 | attoseconds_t refresh; |
| 296 | 297 | |
| 297 | 298 | visarea.min_x = visarea.min_y = 0; |
| 298 | 299 | visarea.max_y = snes_ppu.beam.last_visible_line*snes_ppu.interlace - 1; |
| 300 | visarea.max_x = (SNES_SCR_WIDTH * 2) - 1; |
| 299 | 301 | |
| 300 | 302 | // fixme: should compensate for SNES_DBG_video |
| 301 | 303 | if( snes_ppu.mode == 5 || snes_ppu.mode == 6 ) |
| 302 | | { |
| 303 | | visarea.max_x = (SNES_SCR_WIDTH * 2) - 1; |
| 304 | 304 | snes_htmult = 2; |
| 305 | | } |
| 306 | 305 | else |
| 307 | | { |
| 308 | | visarea.max_x = SNES_SCR_WIDTH - 1; |
| 309 | 306 | snes_htmult = 1; |
| 310 | | } |
| 311 | 307 | |
| 308 | /* FIXME: does the timing changes when the gfx mode is equal to 5 or 6? */ |
| 312 | 309 | 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; |
| 314 | 311 | 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); |
| 316 | 318 | } |
| 317 | 319 | |
| 318 | 320 | static READ8_HANDLER( snes_open_bus_r ) |
| r5454 | r5455 | |
| 785 | 787 | } |
| 786 | 788 | case BGMODE: /* BG mode and character size settings */ |
| 787 | 789 | 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); |
| 789 | 791 | snes_ppu.bg3_priority_bit = data & 0x08; |
| 790 | 792 | snes_ppu.layer[0].tile_size = (data >> 4) & 0x1; |
| 791 | 793 | snes_ppu.layer[1].tile_size = (data >> 5) & 0x1; |
| r5454 | r5455 | |
| 1155 | 1157 | /* FIXME: We only support line count and interlace here */ |
| 1156 | 1158 | snes_ppu.interlace = (data & 1) ? 2 : 1; |
| 1157 | 1159 | 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); |
| 1159 | 1161 | #ifdef SNES_DBG_REG_W |
| 1160 | 1162 | if( (data & 0x8) != (snes_ram[SETINI] & 0x8) ) |
| 1161 | 1163 | mame_printf_debug( "Pseudo 512 mode: %s\n", (data & 0x8) ? "on" : "off" ); |