src/mame/video/snes.c
| r7612 | r7613 | |
| 85 | 85 | struct DEBUGOPTS |
| 86 | 86 | { |
| 87 | 87 | UINT8 input_count; |
| 88 | | UINT8 bg_disabled[6]; |
| 88 | UINT8 bg_disabled[5]; |
| 89 | 89 | UINT8 mode_disabled[8]; |
| 90 | 90 | UINT8 draw_subscreen; |
| 91 | 91 | UINT8 windows_disabled; |
| 92 | 92 | UINT8 mosaic_disabled; |
| 93 | 93 | UINT8 colormath_disabled; |
| 94 | 94 | UINT8 sprite_reversed; |
| 95 | | UINT8 select_oam; |
| 95 | UINT8 select_pri[5]; |
| 96 | 96 | }; |
| 97 | 97 | static struct DEBUGOPTS debug_options; |
| 98 | 98 | /* red green blue purple yellow cyan grey white */ |
| r7612 | r7613 | |
| 791 | 791 | pal += (layer << 5); |
| 792 | 792 | } |
| 793 | 793 | |
| 794 | #ifdef SNES_LAYER_DEBUG |
| 795 | /* if we want to draw only one of the priorities of this layer */ |
| 796 | if (((debug_options.select_pri[layer] & 0x01) && (priority == priority_a)) || |
| 797 | ((debug_options.select_pri[layer] & 0x02) && (priority == priority_b))) |
| 798 | { |
| 799 | if (!hires && tile_size) |
| 800 | ii += 16; |
| 801 | else |
| 802 | ii += 8; |
| 803 | continue; |
| 804 | } |
| 805 | #endif /* SNES_LAYER_DEBUG */ |
| 806 | |
| 807 | |
| 794 | 808 | /* figure out which line to draw */ |
| 795 | 809 | yscroll = ypos & ((8 << tile_size) - 1); |
| 796 | 810 | |
| r7612 | r7613 | |
| 976 | 990 | { |
| 977 | 991 | priority = ((colour & 0x80) >> 7) ? priority_a : priority_b; |
| 978 | 992 | colour &= 0x7f; |
| 993 | |
| 994 | #ifdef SNES_LAYER_DEBUG |
| 995 | /* if we want to draw only one of the priorities of this layer */ |
| 996 | if (((debug_options.select_pri[layer] & 0x01) && (priority == priority_a)) || |
| 997 | ((debug_options.select_pri[layer] & 0x02) && (priority == priority_b))) |
| 998 | continue; |
| 999 | #endif /* SNES_LAYER_DEBUG */ |
| 979 | 1000 | } |
| 980 | 1001 | |
| 981 | 1002 | if (scanlines[SNES_MAINSCREEN].enable) |
| r7612 | r7613 | |
| 1328 | 1349 | pri = priority[oam_tilelist[tile].priority]; |
| 1329 | 1350 | |
| 1330 | 1351 | #ifdef SNES_LAYER_DEBUG |
| 1331 | | if (debug_options.select_oam) |
| 1352 | if (debug_options.select_pri[SNES_OAM]) |
| 1332 | 1353 | { |
| 1333 | | int oam_draw = debug_options.select_oam - 1; |
| 1354 | int oam_draw = debug_options.select_pri[SNES_OAM] - 1; |
| 1334 | 1355 | if (oam_draw != oam_tilelist[tile].priority) |
| 1335 | 1356 | continue; |
| 1336 | 1357 | } |
| r7612 | r7613 | |
| 1737 | 1758 | /* Check if the user has enabled or disabled stuff */ |
| 1738 | 1759 | if (curline == 1) |
| 1739 | 1760 | { |
| 1740 | | //UINT16 y = 1; |
| 1741 | | static const char WINLOGIC[4] = { '|', '&', '^', '!' }; |
| 1742 | | |
| 1743 | 1761 | if (!debug_options.input_count--) |
| 1744 | 1762 | { |
| 1763 | int i; |
| 1745 | 1764 | UINT8 toggles = input_port_read_safe(machine, "DEBUG1", 0); |
| 1746 | | debug_options.sprite_reversed = BIT(toggles, 7); |
| 1747 | | debug_options.select_oam = (toggles & 0x70) >> 4; |
| 1765 | debug_options.select_pri[SNES_BG1] = (toggles & 0x03); |
| 1766 | debug_options.select_pri[SNES_BG2] = (toggles & 0x0c) >> 2; |
| 1767 | debug_options.select_pri[SNES_BG3] = (toggles & 0x30) >> 4; |
| 1768 | debug_options.select_pri[SNES_BG4] = (toggles & 0xc0) >> 6; |
| 1748 | 1769 | |
| 1749 | 1770 | toggles = input_port_read_safe(machine, "DEBUG2", 0); |
| 1750 | | if (BIT(toggles, 0)) |
| 1751 | | debug_options.bg_disabled[0] = !debug_options.bg_disabled[0]; |
| 1752 | | if (BIT(toggles, 1)) |
| 1753 | | debug_options.bg_disabled[1] = !debug_options.bg_disabled[1]; |
| 1754 | | if (BIT(toggles, 2)) |
| 1755 | | debug_options.bg_disabled[2] = !debug_options.bg_disabled[2]; |
| 1756 | | if (BIT(toggles, 3)) |
| 1757 | | debug_options.bg_disabled[3] = !debug_options.bg_disabled[3]; |
| 1771 | for (i = 0; i < 4; i++) |
| 1772 | { |
| 1773 | if (BIT(toggles, i)) |
| 1774 | { |
| 1775 | debug_options.bg_disabled[i] = !debug_options.bg_disabled[i]; |
| 1776 | popmessage("Debug: %s BG%d.\n", debug_options.bg_disabled[i] ? "Disabled" : "Enabled", i + 1); |
| 1777 | } |
| 1778 | } |
| 1758 | 1779 | if (BIT(toggles, 4)) |
| 1759 | | debug_options.bg_disabled[4] = !debug_options.bg_disabled[4]; |
| 1780 | { |
| 1781 | debug_options.bg_disabled[SNES_OAM] = !debug_options.bg_disabled[SNES_OAM]; |
| 1782 | popmessage("Debug: %s OAM.\n", debug_options.bg_disabled[SNES_OAM] ? "Disabled" : "Enabled"); |
| 1783 | } |
| 1760 | 1784 | if (BIT(toggles, 5)) |
| 1785 | { |
| 1761 | 1786 | debug_options.draw_subscreen = !debug_options.draw_subscreen; |
| 1787 | popmessage("Debug: Switched screens.\n"); |
| 1788 | } |
| 1762 | 1789 | if (BIT(toggles, 6)) |
| 1790 | { |
| 1763 | 1791 | debug_options.colormath_disabled = !debug_options.colormath_disabled; |
| 1792 | popmessage("Debug: %s Color Math.\n", debug_options.colormath_disabled ? "Disabled" : "Enabled"); |
| 1793 | } |
| 1764 | 1794 | if (BIT(toggles, 7)) |
| 1795 | { |
| 1765 | 1796 | debug_options.windows_disabled = !debug_options.windows_disabled; |
| 1797 | popmessage("Debug: %s Window Masks.\n", debug_options.windows_disabled ? "Disabled" : "Enabled"); |
| 1798 | } |
| 1799 | |
| 1766 | 1800 | toggles = input_port_read_safe(machine, "DEBUG4", 0); |
| 1767 | | if (BIT(toggles, 0)) |
| 1768 | | debug_options.mode_disabled[0] = !debug_options.mode_disabled[0]; |
| 1769 | | if (BIT(toggles, 1)) |
| 1770 | | debug_options.mode_disabled[1] = !debug_options.mode_disabled[1]; |
| 1771 | | if (BIT(toggles, 2)) |
| 1772 | | debug_options.mode_disabled[2] = !debug_options.mode_disabled[2]; |
| 1773 | | if (BIT(toggles, 3)) |
| 1774 | | debug_options.mode_disabled[3] = !debug_options.mode_disabled[3]; |
| 1775 | | if (BIT(toggles, 4)) |
| 1776 | | debug_options.mode_disabled[4] = !debug_options.mode_disabled[4]; |
| 1777 | | if (BIT(toggles, 5)) |
| 1778 | | debug_options.mode_disabled[5] = !debug_options.mode_disabled[5]; |
| 1779 | | if (BIT(toggles, 6)) |
| 1780 | | debug_options.mode_disabled[6] = !debug_options.mode_disabled[6]; |
| 1781 | | if (BIT(toggles, 7)) |
| 1782 | | debug_options.mode_disabled[7] = !debug_options.mode_disabled[7]; |
| 1801 | for (i = 0; i < 8; i++) |
| 1802 | { |
| 1803 | if (BIT(toggles, i)) |
| 1804 | { |
| 1805 | debug_options.mode_disabled[i] = !debug_options.mode_disabled[i]; |
| 1806 | popmessage("Debug: %s Mode %d drawing.\n", debug_options.mode_disabled[i] ? "Disabled" : "Enabled", i); |
| 1807 | } |
| 1808 | } |
| 1809 | |
| 1783 | 1810 | toggles = input_port_read_safe(machine, "DEBUG3", 0); |
| 1784 | 1811 | if (toggles & 0x4) |
| 1812 | { |
| 1785 | 1813 | debug_options.mosaic_disabled = !debug_options.mosaic_disabled; |
| 1814 | popmessage("Debug: %s Mosaic.\n", debug_options.mosaic_disabled ? "Disabled" : "Enabled"); |
| 1815 | } |
| 1816 | debug_options.sprite_reversed = BIT(toggles, 7); |
| 1817 | debug_options.select_pri[SNES_OAM] = (toggles & 0x70) >> 4; |
| 1818 | |
| 1786 | 1819 | debug_options.input_count = 5; |
| 1787 | 1820 | } |
| 1788 | 1821 | |
| 1822 | #ifdef MAME_DEBUG |
| 1823 | static const char WINLOGIC[4] = { '|', '&', '^', '!' }; |
| 1824 | |
| 1789 | 1825 | logerror("%s", debug_options.windows_disabled?" ":"W"); |
| 1790 | 1826 | logerror("%s1 %s%s%s%s%s%c%s%s%d%s %d %4X %4X", |
| 1791 | 1827 | debug_options.bg_disabled[0]?" ":"*", |
| r7612 | r7613 | |
| 1872 | 1908 | logerror("Mode7: A %5d B %5d", snes_ppu.mode7.matrix_a, snes_ppu.mode7.matrix_b ); |
| 1873 | 1909 | logerror(" %s%s%s C %5d D %5d", (snes_ram[M7SEL] & 0xc0)?((snes_ram[M7SEL] & 0x40)?"0":"C"):"R", (snes_ram[M7SEL] & 0x1)?"H":" ", (snes_ram[M7SEL] & 0x2)?"V":" ", snes_ppu.mode7.matrix_c, snes_ppu.mode7.matrix_d ); |
| 1874 | 1910 | logerror(" X %5d Y %5d", snes_ppu.mode7.origin_x, snes_ppu.mode7.origin_y ); |
| 1911 | #endif |
| 1875 | 1912 | } |
| 1876 | 1913 | |
| 1877 | 1914 | return 0; |
| 1878 | 1915 | } |
| 1879 | | |
| 1880 | 1916 | #endif /* SNES_LAYER_DEBUG */ |
src/mess/drivers/snes.c
| r7612 | r7613 | |
| 296 | 296 | |
| 297 | 297 | #ifdef SNES_LAYER_DEBUG |
| 298 | 298 | PORT_START("DEBUG1") |
| 299 | | PORT_CONFNAME( 0x70, 0x00, "Select OAM" ) |
| 300 | | PORT_CONFSETTING( 0x00, "All" ) |
| 301 | | PORT_CONFSETTING( 0x10, "OAM0 only" ) |
| 302 | | PORT_CONFSETTING( 0x20, "OAM1 only" ) |
| 303 | | PORT_CONFSETTING( 0x30, "OAM2 only" ) |
| 304 | | PORT_CONFSETTING( 0x40, "OAM3 only" ) |
| 305 | | PORT_CONFNAME( 0x80, 0x00, "Draw sprite in reverse order" ) |
| 306 | | PORT_CONFSETTING( 0x00, DEF_STR( Off ) ) |
| 307 | | PORT_CONFSETTING( 0x80, DEF_STR( On ) ) |
| 299 | PORT_CONFNAME( 0x03, 0x00, "Select BG1 priority" ) |
| 300 | PORT_CONFSETTING( 0x00, "All" ) |
| 301 | PORT_CONFSETTING( 0x01, "BG1B (lower) only" ) |
| 302 | PORT_CONFSETTING( 0x02, "BG1A (higher) only" ) |
| 303 | PORT_CONFNAME( 0x0c, 0x00, "Select BG2 priority" ) |
| 304 | PORT_CONFSETTING( 0x00, "All" ) |
| 305 | PORT_CONFSETTING( 0x04, "BG2B (lower) only" ) |
| 306 | PORT_CONFSETTING( 0x08, "BG2A (higher) only" ) |
| 307 | PORT_CONFNAME( 0x30, 0x00, "Select BG3 priority" ) |
| 308 | PORT_CONFSETTING( 0x00, "All" ) |
| 309 | PORT_CONFSETTING( 0x10, "BG3B (lower) only" ) |
| 310 | PORT_CONFSETTING( 0x20, "BG3A (higher) only" ) |
| 311 | PORT_CONFNAME( 0xc0, 0x00, "Select BG4 priority" ) |
| 312 | PORT_CONFSETTING( 0x00, "All" ) |
| 313 | PORT_CONFSETTING( 0x40, "BG4B (lower) only" ) |
| 314 | PORT_CONFSETTING( 0x80, "BG4A (higher) only" ) |
| 308 | 315 | |
| 309 | 316 | PORT_START("DEBUG2") |
| 310 | 317 | PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("Toggle BG 1") PORT_CODE(KEYCODE_1_PAD) |
| r7612 | r7613 | |
| 318 | 325 | |
| 319 | 326 | PORT_START("DEBUG3") |
| 320 | 327 | PORT_BIT( 0x4, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("Toggle Mosaic") PORT_CODE(KEYCODE_9_PAD) |
| 328 | PORT_CONFNAME( 0x70, 0x00, "Select OAM priority" ) |
| 329 | PORT_CONFSETTING( 0x00, "All" ) |
| 330 | PORT_CONFSETTING( 0x10, "OAM0 only" ) |
| 331 | PORT_CONFSETTING( 0x20, "OAM1 only" ) |
| 332 | PORT_CONFSETTING( 0x30, "OAM2 only" ) |
| 333 | PORT_CONFSETTING( 0x40, "OAM3 only" ) |
| 334 | PORT_CONFNAME( 0x80, 0x00, "Draw sprite in reverse order" ) |
| 335 | PORT_CONFSETTING( 0x00, DEF_STR( Off ) ) |
| 336 | PORT_CONFSETTING( 0x80, DEF_STR( On ) ) |
| 321 | 337 | |
| 322 | 338 | PORT_START("DEBUG4") |
| 323 | 339 | PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("Toggle Mode 0 draw") |