Previous 15994 Revisions Next

r7613 Sunday 21st March, 2010 at 11:24:28 UTC by Fabio Priuli
[SNES] a few video debug features
[src/mame/video]snes.c
[src/mess/drivers]snes.c

src/mame/video/snes.c
r7612r7613
8585struct DEBUGOPTS
8686{
8787   UINT8 input_count;
88   UINT8 bg_disabled[6];
88   UINT8 bg_disabled[5];
8989   UINT8 mode_disabled[8];
9090   UINT8 draw_subscreen;
9191   UINT8 windows_disabled;
9292   UINT8 mosaic_disabled;
9393   UINT8 colormath_disabled;
9494   UINT8 sprite_reversed;
95   UINT8 select_oam;
95   UINT8 select_pri[5];
9696};
9797static struct DEBUGOPTS debug_options;
9898/*                                    red   green  blue    purple  yellow cyan    grey    white */
r7612r7613
791791         pal += (layer << 5);
792792      }
793793
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
794808      /* figure out which line to draw */
795809      yscroll = ypos & ((8 << tile_size) - 1);
796810
r7612r7613
976990      {
977991         priority = ((colour & 0x80) >> 7) ? priority_a : priority_b;
978992         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 */
9791000      }
9801001
9811002      if (scanlines[SNES_MAINSCREEN].enable)
r7612r7613
13281349      pri = priority[oam_tilelist[tile].priority];
13291350
13301351#ifdef SNES_LAYER_DEBUG
1331      if (debug_options.select_oam)
1352      if (debug_options.select_pri[SNES_OAM])
13321353      {
1333         int oam_draw = debug_options.select_oam - 1;
1354         int oam_draw = debug_options.select_pri[SNES_OAM] - 1;
13341355         if (oam_draw != oam_tilelist[tile].priority)
13351356            continue;
13361357      }
r7612r7613
17371758   /* Check if the user has enabled or disabled stuff */
17381759   if (curline == 1)
17391760   {
1740      //UINT16 y = 1;
1741      static const char WINLOGIC[4] = { '|', '&', '^', '!' };
1742
17431761      if (!debug_options.input_count--)
17441762      {
1763         int i;
17451764         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;
17481769
17491770         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         }
17581779         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         }
17601784         if (BIT(toggles, 5))
1785         {
17611786            debug_options.draw_subscreen = !debug_options.draw_subscreen;
1787            popmessage("Debug: Switched screens.\n");
1788         }
17621789         if (BIT(toggles, 6))
1790         {
17631791            debug_options.colormath_disabled = !debug_options.colormath_disabled;
1792            popmessage("Debug: %s Color Math.\n", debug_options.colormath_disabled ? "Disabled" : "Enabled");
1793         }
17641794         if (BIT(toggles, 7))
1795         {
17651796            debug_options.windows_disabled = !debug_options.windows_disabled;
1797            popmessage("Debug: %s Window Masks.\n", debug_options.windows_disabled ? "Disabled" : "Enabled");
1798         }
1799
17661800         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
17831810         toggles = input_port_read_safe(machine, "DEBUG3", 0);
17841811         if (toggles & 0x4)
1812         {
17851813            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
17861819         debug_options.input_count = 5;
17871820      }
17881821
1822#ifdef MAME_DEBUG
1823      static const char WINLOGIC[4] = { '|', '&', '^', '!' };
1824
17891825      logerror("%s", debug_options.windows_disabled?" ":"W");
17901826      logerror("%s1 %s%s%s%s%s%c%s%s%d%s %d %4X %4X",
17911827            debug_options.bg_disabled[0]?" ":"*",
r7612r7613
18721908      logerror("Mode7: A %5d B %5d", snes_ppu.mode7.matrix_a, snes_ppu.mode7.matrix_b );
18731909      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 );
18741910      logerror("       X %5d Y %5d", snes_ppu.mode7.origin_x, snes_ppu.mode7.origin_y );
1911#endif
18751912   }
18761913
18771914   return 0;
18781915}
1879
18801916#endif /* SNES_LAYER_DEBUG */
src/mess/drivers/snes.c
r7612r7613
296296
297297#ifdef SNES_LAYER_DEBUG
298298   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" )
308315
309316   PORT_START("DEBUG2")
310317   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("Toggle BG 1") PORT_CODE(KEYCODE_1_PAD)
r7612r7613
318325
319326   PORT_START("DEBUG3")
320327   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 ) )
321337
322338   PORT_START("DEBUG4")
323339   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("Toggle Mode 0 draw")

Previous 15994 Revisions Next


© 1998-2018 The MESS Team