Previous 199869 Revisions Next

r29191 Wednesday 2nd April, 2014 at 17:14:37 UTC by Miodrag Milanović
moved some static variables into state (nw)
[src/mame/includes]snes.h
[src/mame/video]snes.c

trunk/src/mame/includes/snes.h
r29190r29191
450450      UINT16 ver_offset;
451451      UINT8 extbg;
452452   } m_mode7;
453   
454   struct OAM
455   {
456      UINT16 tile;
457      INT16 x, y;
458      UINT8 size, vflip, hflip, priority_bits, pal;
459      int height, width;
460   };
453461
462   struct OAM m_oam_spritelist[SNES_SCR_WIDTH / 2];
463
464   UINT8 m_oam_itemlist[32];
465
466   struct TILELIST {
467      INT16 x;
468      UINT16 priority, pal, tileaddr;
469      int hflip;
470   };
471
472   struct TILELIST m_oam_tilelist[34];
473
474   #if SNES_LAYER_DEBUG
475   struct DEBUGOPTS
476   {
477      UINT8 bg_disabled[5];
478      UINT8 mode_disabled[8];
479      UINT8 draw_subscreen;
480      UINT8 windows_disabled;
481      UINT8 mosaic_disabled;
482      UINT8 colormath_disabled;
483      UINT8 sprite_reversed;
484      UINT8 select_pri[5];
485   };
486   struct DEBUGOPTS m_debug_options;
487   #endif
488
454489   screen_device *m_screen;
455490
456491   UINT8 m_mosaic_size;
trunk/src/mame/video/snes.c
r29190r29191
8181#define SNES_CLIP_ALWAYS   3
8282
8383#if SNES_LAYER_DEBUG
84struct DEBUGOPTS
85{
86   UINT8 bg_disabled[5];
87   UINT8 mode_disabled[8];
88   UINT8 draw_subscreen;
89   UINT8 windows_disabled;
90   UINT8 mosaic_disabled;
91   UINT8 colormath_disabled;
92   UINT8 sprite_reversed;
93   UINT8 select_pri[5];
94};
95static struct DEBUGOPTS debug_options;
9684/*                                    red   green  blue    purple  yellow cyan    grey    white */
9785static const UINT16 dbg_mode_colours[8] = { 0x1f, 0x3e0, 0x7c00, 0x7c1f, 0x3ff, 0x7fe0, 0x4210, 0x7fff };
9886#endif /* SNES_LAYER_DEBUG */
r29190r29191
197185            UINT8 clipmask = m_clipmasks[layer][ii];
198186
199187#if SNES_LAYER_DEBUG
200            if (debug_options.windows_disabled)
188            if (m_debug_options.windows_disabled)
201189               clipmask = 0xff;
202190#endif /* SNES_LAYER_DEBUG */
203191
r29190r29191
232220            UINT8 clipmask = m_clipmasks[layer][ii >> 1];
233221
234222#if SNES_LAYER_DEBUG
235            if (debug_options.windows_disabled)
223            if (m_debug_options.windows_disabled)
236224               clipmask = 0xff;
237225#endif /* SNES_LAYER_DEBUG */
238226
r29190r29191
266254         UINT8 clipmask = m_clipmasks[SNES_OAM][pos];
267255
268256#if SNES_LAYER_DEBUG
269         if (debug_options.windows_disabled)
257         if (m_debug_options.windows_disabled)
270258            clipmask = 0xff;
271259#endif /* SNES_LAYER_DEBUG */
272260
r29190r29191
312300      UINT8 mosaic = m_layer[layer].mosaic_enabled;
313301
314302#if SNES_LAYER_DEBUG
315      if (debug_options.mosaic_disabled)
303      if (m_debug_options.mosaic_disabled)
316304         mosaic = 0;
317305#endif /* SNES_LAYER_DEBUG */
318306
r29190r29191
415403   UINT8 color_shift = 2 << color_depth;
416404
417405#if SNES_LAYER_DEBUG
418   if (debug_options.bg_disabled[layer])
406   if (m_debug_options.bg_disabled[layer])
419407      return;
420408#endif /* SNES_LAYER_DEBUG */
421409
r29190r29191
517505
518506#if SNES_LAYER_DEBUG
519507      /* if we want to draw only one of the priorities of this layer */
520      if (((debug_options.select_pri[layer] & 0x01) && (priority == priority_a)) ||
521         ((debug_options.select_pri[layer] & 0x02) && (priority == priority_b)))
508      if (((m_debug_options.select_pri[layer] & 0x01) && (priority == priority_a)) ||
509         ((m_debug_options.select_pri[layer] & 0x02) && (priority == priority_b)))
522510      {
523511         if (!hires && tile_size)
524512            ii += 16;
r29190r29191
597585   int screen;
598586
599587#if SNES_LAYER_DEBUG
600   if (debug_options.bg_disabled[layer])
588   if (m_debug_options.bg_disabled[layer])
601589      return;
602590#endif /* SNES_LAYER_DEBUG */
603591
r29190r29191
659647   }
660648
661649#if SNES_LAYER_DEBUG
662   if (debug_options.mosaic_disabled)
650   if (m_debug_options.mosaic_disabled)
663651   {
664652      mosaic_x =  m_mosaic_table[0];
665653      mosaic_y =  m_mosaic_table[0];
r29190r29191
712700
713701#if SNES_LAYER_DEBUG
714702      /* if we want to draw only one of the priorities of this layer */
715      if (((debug_options.select_pri[layer] & 0x01) && (priority == priority_a)) ||
716         ((debug_options.select_pri[layer] & 0x02) && (priority == priority_b)))
703      if (((m_debug_options.select_pri[layer] & 0x01) && (priority == priority_a)) ||
704         ((m_debug_options.select_pri[layer] & 0x02) && (priority == priority_b)))
717705         continue;
718706#endif /* SNES_LAYER_DEBUG */
719707      }
r29190r29191
726714            UINT8 clipmask = m_clipmasks[layer][xpos];
727715
728716#if SNES_LAYER_DEBUG
729            if (debug_options.windows_disabled)
717            if (m_debug_options.windows_disabled)
730718               clipmask = 0xff;
731719#endif /* SNES_LAYER_DEBUG */
732720
r29190r29191
784772 * test their priority with the one of the correct sprite - see update_objects.
785773 *************************************************************************************************/
786774
787struct OAM
788{
789   UINT16 tile;
790   INT16 x, y;
791   UINT8 size, vflip, hflip, priority_bits, pal;
792   int height, width;
793};
794775
795static struct OAM oam_spritelist[SNES_SCR_WIDTH / 2];
796
797static UINT8 oam_itemlist[32];
798
799struct TILELIST {
800   INT16 x;
801   UINT16 priority, pal, tileaddr;
802   int hflip;
803};
804
805static struct TILELIST oam_tilelist[34];
806
807776/*********************************************
808777 * update_obsel()
809778 *
r29190r29191
843812      if (((ii + 1) % 4) == 0)
844813         extra = oamram[oam_extra--];
845814
846      oam_spritelist[ii].vflip = (oamram[oam] & 0x80) >> 7;
847      oam_spritelist[ii].hflip = (oamram[oam] & 0x40) >> 6;
848      oam_spritelist[ii].priority_bits = (oamram[oam] & 0x30) >> 4;
849      oam_spritelist[ii].pal = 128 + ((oamram[oam] & 0x0e) << 3);
850      oam_spritelist[ii].tile = (oamram[oam--] & 0x1) << 8;
851      oam_spritelist[ii].tile |= oamram[oam--];
852      oam_spritelist[ii].y = oamram[oam--] + 1;
853      oam_spritelist[ii].x = oamram[oam--];
854      oam_spritelist[ii].size = (extra & 0x80) >> 7;
815      m_oam_spritelist[ii].vflip = (oamram[oam] & 0x80) >> 7;
816      m_oam_spritelist[ii].hflip = (oamram[oam] & 0x40) >> 6;
817      m_oam_spritelist[ii].priority_bits = (oamram[oam] & 0x30) >> 4;
818      m_oam_spritelist[ii].pal = 128 + ((oamram[oam] & 0x0e) << 3);
819      m_oam_spritelist[ii].tile = (oamram[oam--] & 0x1) << 8;
820      m_oam_spritelist[ii].tile |= oamram[oam--];
821      m_oam_spritelist[ii].y = oamram[oam--] + 1;
822      m_oam_spritelist[ii].x = oamram[oam--];
823      m_oam_spritelist[ii].size = (extra & 0x80) >> 7;
855824      extra <<= 1;
856      oam_spritelist[ii].x |= ((extra & 0x80) << 1);
825      m_oam_spritelist[ii].x |= ((extra & 0x80) << 1);
857826      extra <<= 1;
858827
859      oam_spritelist[ii].y *= m_obj_interlace;
860      oam_spritelist[ii].y &= 0x1ff;
828      m_oam_spritelist[ii].y *= m_obj_interlace;
829      m_oam_spritelist[ii].y &= 0x1ff;
861830
862      oam_spritelist[ii].x &= 0x1ff;
831      m_oam_spritelist[ii].x &= 0x1ff;
863832
864833      /* Determine object size */
865834      switch (m_oam.size)
866835      {
867836      case 0:         /* 8x8 or 16x16 */
868         oam_spritelist[ii].width  = oam_spritelist[ii].size ? 2 : 1;
869         oam_spritelist[ii].height = oam_spritelist[ii].size ? 2 : 1;
837         m_oam_spritelist[ii].width  = m_oam_spritelist[ii].size ? 2 : 1;
838         m_oam_spritelist[ii].height = m_oam_spritelist[ii].size ? 2 : 1;
870839         break;
871840      case 1:         /* 8x8 or 32x32 */
872         oam_spritelist[ii].width  = oam_spritelist[ii].size ? 4 : 1;
873         oam_spritelist[ii].height = oam_spritelist[ii].size ? 4 : 1;
841         m_oam_spritelist[ii].width  = m_oam_spritelist[ii].size ? 4 : 1;
842         m_oam_spritelist[ii].height = m_oam_spritelist[ii].size ? 4 : 1;
874843         break;
875844      case 2:         /* 8x8 or 64x64 */
876         oam_spritelist[ii].width  = oam_spritelist[ii].size ? 8 : 1;
877         oam_spritelist[ii].height = oam_spritelist[ii].size ? 8 : 1;
845         m_oam_spritelist[ii].width  = m_oam_spritelist[ii].size ? 8 : 1;
846         m_oam_spritelist[ii].height = m_oam_spritelist[ii].size ? 8 : 1;
878847         break;
879848      case 3:         /* 16x16 or 32x32 */
880         oam_spritelist[ii].width  = oam_spritelist[ii].size ? 4 : 2;
881         oam_spritelist[ii].height = oam_spritelist[ii].size ? 4 : 2;
849         m_oam_spritelist[ii].width  = m_oam_spritelist[ii].size ? 4 : 2;
850         m_oam_spritelist[ii].height = m_oam_spritelist[ii].size ? 4 : 2;
882851         break;
883852      case 4:         /* 16x16 or 64x64 */
884         oam_spritelist[ii].width  = oam_spritelist[ii].size ? 8 : 2;
885         oam_spritelist[ii].height = oam_spritelist[ii].size ? 8 : 2;
853         m_oam_spritelist[ii].width  = m_oam_spritelist[ii].size ? 8 : 2;
854         m_oam_spritelist[ii].height = m_oam_spritelist[ii].size ? 8 : 2;
886855         break;
887856      case 5:         /* 32x32 or 64x64 */
888         oam_spritelist[ii].width  = oam_spritelist[ii].size ? 8 : 4;
889         oam_spritelist[ii].height = oam_spritelist[ii].size ? 8 : 4;
857         m_oam_spritelist[ii].width  = m_oam_spritelist[ii].size ? 8 : 4;
858         m_oam_spritelist[ii].height = m_oam_spritelist[ii].size ? 8 : 4;
890859         break;
891860      case 6:         /* undocumented: 16x32 or 32x64 */
892         oam_spritelist[ii].width  = oam_spritelist[ii].size ? 4 : 2;
893         oam_spritelist[ii].height = oam_spritelist[ii].size ? 8 : 4;
894         if (m_obj_interlace && !oam_spritelist[ii].size)
895            oam_spritelist[ii].height = 2;
861         m_oam_spritelist[ii].width  = m_oam_spritelist[ii].size ? 4 : 2;
862         m_oam_spritelist[ii].height = m_oam_spritelist[ii].size ? 8 : 4;
863         if (m_obj_interlace && !m_oam_spritelist[ii].size)
864            m_oam_spritelist[ii].height = 2;
896865         break;
897866      case 7:         /* undocumented: 16x32 or 32x32 */
898         oam_spritelist[ii].width  = oam_spritelist[ii].size ? 4 : 2;
899         oam_spritelist[ii].height = oam_spritelist[ii].size ? 4 : 4;
900         if (m_obj_interlace && !oam_spritelist[ii].size)
901            oam_spritelist[ii].height = 2;
867         m_oam_spritelist[ii].width  = m_oam_spritelist[ii].size ? 4 : 2;
868         m_oam_spritelist[ii].height = m_oam_spritelist[ii].size ? 4 : 4;
869         if (m_obj_interlace && !m_oam_spritelist[ii].size)
870            m_oam_spritelist[ii].height = 2;
902871         break;
903872      default:
904873         /* we should never enter here... */
r29190r29191
919888{
920889   //if sprite is entirely offscreen and doesn't wrap around to the left side of the screen,
921890   //then it is not counted. this *should* be 256, and not 255, even though dot 256 is offscreen.
922   int spr_height = (oam_spritelist[sprite].height << 3);
891   int spr_height = (m_oam_spritelist[sprite].height << 3);
923892
924   if (oam_spritelist[sprite].x > 256 && (oam_spritelist[sprite].x + (oam_spritelist[sprite].width << 3) - 1) < 512)
893   if (m_oam_spritelist[sprite].x > 256 && (m_oam_spritelist[sprite].x + (m_oam_spritelist[sprite].width << 3) - 1) < 512)
925894      return 0;
926895
927   if (curline >= oam_spritelist[sprite].y && curline < (oam_spritelist[sprite].y + spr_height))
896   if (curline >= m_oam_spritelist[sprite].y && curline < (m_oam_spritelist[sprite].y + spr_height))
928897      return 1;
929898
930   if ((oam_spritelist[sprite].y + spr_height) >= 256 && curline < ((oam_spritelist[sprite].y + spr_height) & 255))
899   if ((m_oam_spritelist[sprite].y + spr_height) >= 256 && curline < ((m_oam_spritelist[sprite].y + spr_height) & 255))
931900      return 1;
932901
933902   return 0;
r29190r29191
962931   curline *= m_obj_interlace;
963932
964933   /* reset the list of first 32 objects which intersect current scanline */
965   memset(oam_itemlist, 0xff, 32);
934   memset(m_oam_itemlist, 0xff, 32);
966935
967936   /* populate the list of 32 objects */
968937   for (ii = 0; ii < 128; ii++)
r29190r29191
975944      if (range_over++ >= 32)
976945         break;
977946
978      oam_itemlist[range_over - 1] = active_sprite;
947      m_oam_itemlist[range_over - 1] = active_sprite;
979948   }
980949
981950   /* reset the list of first 34 tiles to be drawn */
982951   for (ii = 0; ii < 34; ii++)
983      oam_tilelist[ii].tileaddr = 0xffff;
952      m_oam_tilelist[ii].tileaddr = 0xffff;
984953
985954   /* populate the list of 34 tiles */
986955   for (ii = 31; ii >= 0; ii--)
987956   {
988      if (oam_itemlist[ii] == 0xff)
957      if (m_oam_itemlist[ii] == 0xff)
989958         continue;
990959
991      active_sprite = oam_itemlist[ii];
960      active_sprite = m_oam_itemlist[ii];
992961
993      tile = oam_spritelist[active_sprite].tile;
994      x = oam_spritelist[active_sprite].x;
995      y = oam_spritelist[active_sprite].y;
996      height = oam_spritelist[active_sprite].height;
997      width = oam_spritelist[active_sprite].width;
998      vflip = oam_spritelist[active_sprite].vflip;
999      hflip = oam_spritelist[active_sprite].hflip;
1000      priority = oam_spritelist[active_sprite].priority_bits;
1001      pal = oam_spritelist[active_sprite].pal;
962      tile = m_oam_spritelist[active_sprite].tile;
963      x = m_oam_spritelist[active_sprite].x;
964      y = m_oam_spritelist[active_sprite].y;
965      height = m_oam_spritelist[active_sprite].height;
966      width = m_oam_spritelist[active_sprite].width;
967      vflip = m_oam_spritelist[active_sprite].vflip;
968      hflip = m_oam_spritelist[active_sprite].hflip;
969      priority = m_oam_spritelist[active_sprite].priority_bits;
970      pal = m_oam_spritelist[active_sprite].pal;
1002971
1003972      /* Adjust y, if past maximum position (for sprites which overlap between top & bottom) */
1004973      if (y >= (0x100 - 16) * m_interlace)
r29190r29191
1030999               break;
10311000
10321001            xs = (hflip) ? (width - 1 - jj) : jj;
1033            oam_tilelist[time_over - 1].tileaddr = name_sel + tile + table_obj_offset[ys][xs] + line;
1034            oam_tilelist[time_over - 1].hflip = hflip;
1035            oam_tilelist[time_over - 1].x = xx;
1036            oam_tilelist[time_over - 1].pal = pal;
1037            oam_tilelist[time_over - 1].priority = priority;
1002            m_oam_tilelist[time_over - 1].tileaddr = name_sel + tile + table_obj_offset[ys][xs] + line;
1003            m_oam_tilelist[time_over - 1].hflip = hflip;
1004            m_oam_tilelist[time_over - 1].x = xx;
1005            m_oam_tilelist[time_over - 1].pal = pal;
1006            m_oam_tilelist[time_over - 1].priority = priority;
10381007         }
10391008      }
10401009   }
r29190r29191
10611030   int ii;
10621031
10631032#if SNES_LAYER_DEBUG
1064   if (debug_options.bg_disabled[SNES_OAM])
1033   if (m_debug_options.bg_disabled[SNES_OAM])
10651034      return;
10661035#endif /* SNES_LAYER_DEBUG */
10671036
r29190r29191
10851054   {
10861055      int tile = ii;
10871056#if SNES_LAYER_DEBUG
1088      if (debug_options.sprite_reversed)
1057      if (m_debug_options.sprite_reversed)
10891058         tile = 33 - ii;
10901059#endif /* SNES_LAYER_DEBUG */
10911060
1092      if (oam_tilelist[tile].tileaddr == 0xffff)
1061      if (m_oam_tilelist[tile].tileaddr == 0xffff)
10931062         continue;
10941063
1095      pri = priority[oam_tilelist[tile].priority];
1064      pri = priority[m_oam_tilelist[tile].priority];
10961065
10971066#if SNES_LAYER_DEBUG
1098      if (debug_options.select_pri[SNES_OAM])
1067      if (m_debug_options.select_pri[SNES_OAM])
10991068      {
1100         int oam_draw = debug_options.select_pri[SNES_OAM] - 1;
1101         if (oam_draw != oam_tilelist[tile].priority)
1069         int oam_draw = m_debug_options.select_pri[SNES_OAM] - 1;
1070         if (oam_draw != m_oam_tilelist[tile].priority)
11021071            continue;
11031072      }
11041073#endif /* SNES_LAYER_DEBUG */
11051074
11061075      /* OAM tiles have fixed planes (4), no direct color and no hires, but otherwise work the same as BG ones */
1107      draw_tile(4, SNES_OAM, charaddr + oam_tilelist[tile].tileaddr, oam_tilelist[tile].x, pri, oam_tilelist[tile].hflip, 0, oam_tilelist[tile].pal, 0);
1076      draw_tile(4, SNES_OAM, charaddr + m_oam_tilelist[tile].tileaddr, m_oam_tilelist[tile].x, pri, m_oam_tilelist[tile].hflip, 0, m_oam_tilelist[tile].pal, 0);
11081077   }
11091078}
11101079
r29190r29191
11181087void snes_ppu_class::update_mode_0( UINT16 curline )
11191088{
11201089#if SNES_LAYER_DEBUG
1121   if (debug_options.mode_disabled[0])
1090   if (m_debug_options.mode_disabled[0])
11221091      return;
11231092#endif /* SNES_LAYER_DEBUG */
11241093
r29190r29191
11321101void snes_ppu_class::update_mode_1( UINT16 curline )
11331102{
11341103#if SNES_LAYER_DEBUG
1135   if (debug_options.mode_disabled[1])
1104   if (m_debug_options.mode_disabled[1])
11361105      return;
11371106#endif /* SNES_LAYER_DEBUG */
11381107
r29190r29191
11551124void snes_ppu_class::update_mode_2( UINT16 curline )
11561125{
11571126#if SNES_LAYER_DEBUG
1158   if (debug_options.mode_disabled[2])
1127   if (m_debug_options.mode_disabled[2])
11591128      return;
11601129#endif /* SNES_LAYER_DEBUG */
11611130
r29190r29191
11671136void snes_ppu_class::update_mode_3( UINT16 curline )
11681137{
11691138#if SNES_LAYER_DEBUG
1170   if (debug_options.mode_disabled[3])
1139   if (m_debug_options.mode_disabled[3])
11711140      return;
11721141#endif /* SNES_LAYER_DEBUG */
11731142
r29190r29191
11791148void snes_ppu_class::update_mode_4( UINT16 curline )
11801149{
11811150#if SNES_LAYER_DEBUG
1182   if (debug_options.mode_disabled[4])
1151   if (m_debug_options.mode_disabled[4])
11831152      return;
11841153#endif /* SNES_LAYER_DEBUG */
11851154
r29190r29191
11911160void snes_ppu_class::update_mode_5( UINT16 curline )
11921161{
11931162#if SNES_LAYER_DEBUG
1194   if (debug_options.mode_disabled[5])
1163   if (m_debug_options.mode_disabled[5])
11951164      return;
11961165#endif /* SNES_LAYER_DEBUG */
11971166
r29190r29191
12031172void snes_ppu_class::update_mode_6( UINT16 curline )
12041173{
12051174#if SNES_LAYER_DEBUG
1206   if (debug_options.mode_disabled[6])
1175   if (m_debug_options.mode_disabled[6])
12071176      return;
12081177#endif /* SNES_LAYER_DEBUG */
12091178
r29190r29191
12141183void snes_ppu_class::update_mode_7( UINT16 curline )
12151184{
12161185#if SNES_LAYER_DEBUG
1217   if (debug_options.mode_disabled[7])
1186   if (m_debug_options.mode_disabled[7])
12181187      return;
12191188#endif /* SNES_LAYER_DEBUG */
12201189
r29190r29191
13591328inline void snes_ppu_class::draw_blend( UINT16 offset, UINT16 *colour, UINT8 prevent_color_math, UINT8 black_pen_clip, int switch_screens )
13601329{
13611330#if SNES_LAYER_DEBUG
1362   if (debug_options.colormath_disabled)
1331   if (m_debug_options.colormath_disabled)
13631332      return;
13641333#endif /* SNES_LAYER_DEBUG */
13651334
r29190r29191
13861355
13871356#if SNES_LAYER_DEBUG
13881357      /* Toggle drawing of SNES_SUBSCREEN or SNES_MAINSCREEN */
1389      if (debug_options.draw_subscreen)
1358      if (m_debug_options.draw_subscreen)
13901359      {
13911360         subscreen = switch_screens ? &m_scanlines[SNES_SUBSCREEN] : &m_scanlines[SNES_MAINSCREEN];
13921361      }
r29190r29191
15471516      }
15481517
15491518      /* Toggle drawing of SNES_SUBSCREEN or SNES_MAINSCREEN */
1550      if (debug_options.draw_subscreen)
1519      if (m_debug_options.draw_subscreen)
15511520      {
15521521         scanline1 = &m_scanlines[SNES_SUBSCREEN];
15531522         scanline2 = &m_scanlines[SNES_MAINSCREEN];
r29190r29191
16491618   running_machine &machine = screen.machine();
16501619
16511620#if SNES_LAYER_DEBUG
1652   memset(&debug_options, 0, sizeof(debug_options));
1621   memset(&m_debug_options, 0, sizeof(m_debug_options));
16531622#endif
16541623
16551624   m_vram = auto_alloc_array(machine, UINT8, SNES_VRAM_SIZE);
r29190r29191
26702639{
26712640   int i;
26722641   UINT8 toggles = machine.root_device().ioport("DEBUG1")->read_safe(0);
2673   debug_options.select_pri[SNES_BG1] = (toggles & 0x03);
2674   debug_options.select_pri[SNES_BG2] = (toggles & 0x0c) >> 2;
2675   debug_options.select_pri[SNES_BG3] = (toggles & 0x30) >> 4;
2676   debug_options.select_pri[SNES_BG4] = (toggles & 0xc0) >> 6;
2642   m_debug_options.select_pri[SNES_BG1] = (toggles & 0x03);
2643   m_debug_options.select_pri[SNES_BG2] = (toggles & 0x0c) >> 2;
2644   m_debug_options.select_pri[SNES_BG3] = (toggles & 0x30) >> 4;
2645   m_debug_options.select_pri[SNES_BG4] = (toggles & 0xc0) >> 6;
26772646
26782647   toggles = machine.root_device().ioport("DEBUG2")->read_safe(0);
26792648   for (i = 0; i < 4; i++)
2680      DEBUG_TOGGLE(i, debug_options.bg_disabled[i], ("Debug: Disabled BG%d.\n", i + 1), ("Debug: Enabled BG%d.\n", i + 1))
2681   DEBUG_TOGGLE(4, debug_options.bg_disabled[SNES_OAM], ("Debug: Disabled OAM.\n"), ("Debug: Enabled OAM.\n"))
2682   DEBUG_TOGGLE(5, debug_options.draw_subscreen, ("Debug: Switched screens.\n"), ("Debug: Switched screens.\n"))
2683   DEBUG_TOGGLE(6, debug_options.colormath_disabled, ("Debug: Disabled Color Math.\n"), ("Debug: Enabled Color Math.\n"))
2684   DEBUG_TOGGLE(7, debug_options.windows_disabled, ("Debug: Disabled Window Masks.\n"), ("Debug: Enabled Window Masks.\n"))
2649      DEBUG_TOGGLE(i, m_debug_options.bg_disabled[i], ("Debug: Disabled BG%d.\n", i + 1), ("Debug: Enabled BG%d.\n", i + 1))
2650   DEBUG_TOGGLE(4, m_debug_options.bg_disabled[SNES_OAM], ("Debug: Disabled OAM.\n"), ("Debug: Enabled OAM.\n"))
2651   DEBUG_TOGGLE(5, m_debug_options.draw_subscreen, ("Debug: Switched screens.\n"), ("Debug: Switched screens.\n"))
2652   DEBUG_TOGGLE(6, m_debug_options.colormath_disabled, ("Debug: Disabled Color Math.\n"), ("Debug: Enabled Color Math.\n"))
2653   DEBUG_TOGGLE(7, m_debug_options.windows_disabled, ("Debug: Disabled Window Masks.\n"), ("Debug: Enabled Window Masks.\n"))
26852654
26862655   toggles = machine.root_device().ioport("DEBUG4")->read_safe(0);
26872656   for (i = 0; i < 8; i++)
2688      DEBUG_TOGGLE(i, debug_options.mode_disabled[i], ("Debug: Disabled Mode %d drawing.\n", i), ("Debug: Enabled Mode %d drawing.\n", i))
2657      DEBUG_TOGGLE(i, m_debug_options.mode_disabled[i], ("Debug: Disabled Mode %d drawing.\n", i), ("Debug: Enabled Mode %d drawing.\n", i))
26892658
26902659   toggles = machine.root_device().ioport("DEBUG3")->read_safe(0);
2691   DEBUG_TOGGLE(2, debug_options.mosaic_disabled, ("Debug: Disabled Mosaic.\n"), ("Debug: Enabled Mosaic.\n"))
2692   debug_options.sprite_reversed = BIT(toggles, 7);
2693   debug_options.select_pri[SNES_OAM] = (toggles & 0x70) >> 4;
2660   DEBUG_TOGGLE(2, m_debug_options.mosaic_disabled, ("Debug: Disabled Mosaic.\n"), ("Debug: Enabled Mosaic.\n"))
2661   m_debug_options.sprite_reversed = BIT(toggles, 7);
2662   m_debug_options.select_pri[SNES_OAM] = (toggles & 0x70) >> 4;
26942663
26952664#ifdef MAME_DEBUG
26962665   /* Once per frame, log video properties */
r29190r29191
26982667   {
26992668      static const char WINLOGIC[4] = { '|', '&', '^', '!' };
27002669
2701      logerror("%s", debug_options.windows_disabled?" ":"W");
2670      logerror("%s", m_debug_options.windows_disabled?" ":"W");
27022671      logerror("%s1 %s%s%s%s%s%c%s%s%d%s %d %4X %4X",
2703            debug_options.bg_disabled[0]?" ":"*",
2672            m_debug_options.bg_disabled[0]?" ":"*",
27042673            (PPU_REG(TM) & 0x1)?"M":" ",
27052674            (PPU_REG(TS) & 0x1)?"S":" ",
27062675            (PPU_REG(CGADSUB) & 0x1)?"B":" ",
r29190r29191
27152684            (PPU_REG(BG1SC) & 0xfc) << 9,
27162685            m_layer[SNES_BG1].charmap << 13);
27172686      logerror("%s2 %s%s%s%s%s%c%s%s%d%s %d %4X %4X",
2718            debug_options.bg_disabled[1]?" ":"*",
2687            m_debug_options.bg_disabled[1]?" ":"*",
27192688            (PPU_REG(TM) & 0x2)?"M":" ",
27202689            (PPU_REG(TS) & 0x2)?"S":" ",
27212690            (PPU_REG(CGADSUB) & 0x2)?"B":" ",
r29190r29191
27302699            (PPU_REG(BG2SC) & 0xfc) << 9,
27312700            m_layer[SNES_BG2].charmap << 13);
27322701      logerror("%s3 %s%s%s%s%s%c%s%s%d%s%s%d %4X %4X",
2733            debug_options.bg_disabled[2]?" ":"*",
2702            m_debug_options.bg_disabled[2]?" ":"*",
27342703            (PPU_REG(TM) & 0x4)?"M":" ",
27352704            (PPU_REG(TS) & 0x4)?"S":" ",
27362705            (PPU_REG(CGADSUB) & 0x4)?"B":" ",
r29190r29191
27462715            (PPU_REG(BG3SC) & 0xfc) << 9,
27472716            m_layer[SNES_BG3].charmap << 13);
27482717      logerror("%s4 %s%s%s%s%s%c%s%s%d%s %d %4X %4X",
2749            debug_options.bg_disabled[3]?" ":"*",
2718            m_debug_options.bg_disabled[3]?" ":"*",
27502719            (PPU_REG(TM) & 0x8)?"M":" ",
27512720            (PPU_REG(TS) & 0x8)?"S":" ",
27522721            (PPU_REG(CGADSUB) & 0x8)?"B":" ",
r29190r29191
27612730            (PPU_REG(BG4SC) & 0xfc) << 9,
27622731            m_layer[SNES_BG4].charmap << 13 );
27632732      logerror("%sO %s%s%s%s%s%c%s%s       %4X",
2764            debug_options.bg_disabled[4]?" ":"*",
2733            m_debug_options.bg_disabled[4]?" ":"*",
27652734            (PPU_REG(TM) & 0x10)?"M":" ",
27662735            (PPU_REG(TS) & 0x10)?"S":" ",
27672736            (PPU_REG(CGADSUB) & 0x10)?"B":" ",
r29190r29191
27722741            (PPU_REG(WOBJSEL) & 0x8)?((PPU_REG(WOBJSEL) & 0x4)?"o":"i"):" ",
27732742            m_layer[SNES_OAM].charmap << 13 );
27742743      logerror("%sB   %s  %c%s%s",
2775            debug_options.colormath_disabled?" ":"*",
2744            m_debug_options.colormath_disabled?" ":"*",
27762745            (PPU_REG(CGADSUB) & 0x20)?"B":" ",
27772746            WINLOGIC[(PPU_REG(WOBJLOG) & 0xc)>>2],
27782747            (PPU_REG(WOBJSEL) & 0x20)?((PPU_REG(WOBJSEL) & 0x10)?"o":"i"):" ",

Previous 199869 Revisions Next


© 1997-2024 The MAME Team