src/mame/machine/snes.c
| r5388 | r5389 | |
| 39 | 39 | static emu_timer *snes_nmi_timer; |
| 40 | 40 | static emu_timer *snes_hirq_timer; |
| 41 | 41 | static UINT16 hblank_offset; |
| 42 | static UINT8 snes_interlace; //doubles the visible resolution |
| 42 | 43 | UINT16 snes_htmult; /* in 512 wide, we run HTOTAL double and halve it on latching */ |
| 43 | 44 | UINT8 snes_has_addon_chip; |
| 44 | 45 | |
| r5388 | r5389 | |
| 279 | 280 | |
| 280 | 281 | *************************************/ |
| 281 | 282 | |
| 283 | static 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 | |
| 282 | 308 | static READ8_HANDLER( snes_open_bus_r ) |
| 283 | 309 | { |
| 284 | 310 | static UINT8 recurse = 0; |
| r5388 | r5389 | |
| 717 | 743 | } |
| 718 | 744 | case BGMODE: /* BG mode and character size settings */ |
| 719 | 745 | 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); |
| 743 | 747 | snes_ppu.bg3_priority_bit = data & 0x08; |
| 744 | 748 | snes_ppu.layer[0].tile_size = (data >> 4) & 0x1; |
| 745 | 749 | snes_ppu.layer[1].tile_size = (data >> 5) & 0x1; |
| r5388 | r5389 | |
| 1030 | 1034 | snes_cgram[FIXED_COLOUR] = (r | (g << 5) | (b << 10)); |
| 1031 | 1035 | } break; |
| 1032 | 1036 | 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; |
| 1034 | 1039 | snes_ppu.beam.last_visible_line = (data & 0x4) ? 240 : 225; |
| 1040 | /* FIXME: move to a common routine */ |
| 1041 | snes_dynamic_res_change(space->machine); |
| 1035 | 1042 | #ifdef SNES_DBG_REG_W |
| 1036 | 1043 | if( (data & 0x8) != (snes_ram[SETINI] & 0x8) ) |
| 1037 | 1044 | mame_printf_debug( "Pseudo 512 mode: %s\n", (data & 0x8) ? "on" : "off" ); |
| r5388 | r5389 | |
| 1750 | 1757 | snes_ram[VTIMEH] = 0x1; |
| 1751 | 1758 | |
| 1752 | 1759 | snes_htmult = 1; |
| 1760 | snes_interlace = 1; |
| 1753 | 1761 | } |
| 1754 | 1762 | |
| 1755 | 1763 | |