Previous 15994 Revisions Next

r7606 Friday 19th March, 2010 at 15:21:12 UTC by Fabio Priuli
[SNES] some internal refactoring, some new debug functions and a small mode7 fix
[src/mame/video]snes.c
[src/mess/drivers]snes.c

src/mame/video/snes.c
r7605r7606
8989   UINT8 mode_disabled[8];
9090   UINT8 draw_subscreen;
9191   UINT8 windows_disabled;
92   UINT8 transparency_disabled;
92   UINT8 mosaic_disabled;
93   UINT8 colormath_disabled;
9394   UINT8 sprite_reversed;
9495   UINT8 select_oam;
9596};
r7605r7606
140141
141142INLINE void snes_draw_blend( UINT16 offset, UINT16 *colour, UINT8 prevent_color_math, UINT8 black_pen_clip, int switch_screens )
142143{
144#ifdef SNES_LAYER_DEBUG
145   if (debug_options.colormath_disabled)
146      return;
147#endif /* SNES_LAYER_DEBUG */
148
143149   /* when color math is applied to subscreen pixels, the blending depends on the blending used by the previous mainscreen
144150    pixel, except for subscreen pixel 0 which has no previous mainscreen pixel, see comments in snes_refresh_scanline */
145151   if (switch_screens && offset > 0)
r7605r7606
153159   if (prevent_color_math == SNES_CLIP_ALWAYS) // blending mode 3 == always OFF
154160      return;
155161
156#ifdef SNES_LAYER_DEBUG
157   if (!debug_options.transparency_disabled)
158#endif /* SNES_LAYER_DEBUG */
159162   if ((prevent_color_math == SNES_CLIP_NEVER) ||
160163      (prevent_color_math == SNES_CLIP_IN  && !snes_ppu.clipmasks[SNES_COLOR][offset]) ||
161164      (prevent_color_math == SNES_CLIP_OUT && snes_ppu.clipmasks[SNES_COLOR][offset]))
r7605r7606
294297            if (scanlines[SNES_MAINSCREEN].priority[ii] <= priority)
295298            {
296299               UINT8 clr = colour;
300               UINT8 mask = snes_ppu.clipmasks[layer][ii];
301               UINT8 mosaic = snes_ppu.layer[SNES_MAINSCREEN].mosaic_enabled;
297302
298303#ifdef SNES_LAYER_DEBUG
299               if (!debug_options.windows_disabled)
304               if (debug_options.windows_disabled)
305                  mask = 0xff;
306               if (debug_options.mosaic_disabled)
307                  mosaic = 0;
300308#endif /* SNES_LAYER_DEBUG */
309
301310               /* Clip to windows */
302311               if (scanlines[SNES_MAINSCREEN].clip)
303                  clr &= snes_ppu.clipmasks[layer][ii];
312                  clr &= mask;
304313
305            /* Only draw if we have a colour (0 == transparent) */
314               /* Only draw if we have a colour (0 == transparent) */
306315               if (clr)
307316               {
308317                  if (direct_colors)
r7605r7606
314323                  else
315324                     c = snes_cgram[(pal + clr) % FIXED_COLOUR];
316325
317                  if (snes_ppu.layer[SNES_MAINSCREEN].mosaic_enabled) // handle horizontal mosaic
326                  if (mosaic) // handle horizontal mosaic
318327                  {
319328                     int x_mos;
320329
r7605r7606
343352            if (scanlines[SNES_SUBSCREEN].priority[ii] <= priority)
344353            {
345354               UINT8 clr = colour;
355               UINT8 mask = snes_ppu.clipmasks[layer][ii];
356               UINT8 mosaic = snes_ppu.layer[SNES_SUBSCREEN].mosaic_enabled;
346357
347358#ifdef SNES_LAYER_DEBUG
348               if (!debug_options.windows_disabled)
359               if (debug_options.windows_disabled)
360                  mask = 0xff;
361               if (debug_options.mosaic_disabled)
362                  mosaic = 0;
349363#endif /* SNES_LAYER_DEBUG */
364
350365               /* Clip to windows */
351366               if (scanlines[SNES_SUBSCREEN].clip)
352                  clr &= snes_ppu.clipmasks[layer][ii];
367                  clr &= mask;
353368
354369               /* Only draw if we have a colour (0 == transparent) */
355370               if (clr)
r7605r7606
363378                  else
364379                     c = snes_cgram[(pal + clr) % FIXED_COLOUR];
365380
366                  if (snes_ppu.layer[SNES_SUBSCREEN].mosaic_enabled) // handle horizontal mosaic
381                  if (mosaic) // handle horizontal mosaic
367382                  {
368383                     int x_mos;
369384
r7605r7606
394409            if (scanlines[SNES_MAINSCREEN].priority[ii >> 1] <= priority)
395410            {
396411               UINT8 clr = colour;
412               UINT8 mask = snes_ppu.clipmasks[layer][ii];
413               UINT8 mosaic = snes_ppu.layer[SNES_MAINSCREEN].mosaic_enabled;
397414
398415#ifdef SNES_LAYER_DEBUG
399               if (!debug_options.windows_disabled)
416               if (debug_options.windows_disabled)
417                  mask = 0xff;
418               if (debug_options.mosaic_disabled)
419                  mosaic = 0;
400420#endif /* SNES_LAYER_DEBUG */
421
401422               /* Clip to windows */
402423               if (scanlines[SNES_MAINSCREEN].clip)
403                  clr &= snes_ppu.clipmasks[layer][ii >> 1];
424                  clr &= mask;
404425
405426               /* Only draw if we have a colour (0 == transparent) */
406427               if (clr)
r7605r7606
414435                  else
415436                     c = snes_cgram[(pal + clr) % FIXED_COLOUR];
416437
417                  if (snes_ppu.layer[layer].mosaic_enabled) // handle horizontal mosaic
438                  if (mosaic) // handle horizontal mosaic
418439                  {
419440                     int x_mos;
420441
r7605r7606
442463            if (scanlines[SNES_SUBSCREEN].priority[ii >> 1] <= priority)
443464            {
444465               UINT8 clr = colour;
466               UINT8 mask = snes_ppu.clipmasks[layer][ii];
467               UINT8 mosaic = snes_ppu.layer[SNES_SUBSCREEN].mosaic_enabled;
445468
446469#ifdef SNES_LAYER_DEBUG
447               if (!debug_options.windows_disabled)
470               if (debug_options.windows_disabled)
471                  mask = 0xff;
472               if (debug_options.mosaic_disabled)
473                  mosaic = 0;
448474#endif /* SNES_LAYER_DEBUG */
475
449476               /* Clip to windows */
450477               if (scanlines[SNES_SUBSCREEN].clip)
451                  clr &= snes_ppu.clipmasks[layer][ii >> 1];
478                  clr &= mask;
452479
453480               /* Only draw if we have a colour (0 == transparent) */
454481               if (clr)
r7605r7606
462489                  else
463490                     c = snes_cgram[(pal + clr) % FIXED_COLOUR];
464491
465                  if (snes_ppu.layer[layer].mosaic_enabled) // handle horizontal mosaic
492                  if (mosaic) // handle horizontal mosaic
466493                  {
467494                     int x_mos;
468495
r7605r7606
558585         if (scanlines[SNES_MAINSCREEN].priority[pos] <= priority)
559586         {
560587            UINT8 clr = colour;
588            UINT8 mask = snes_ppu.clipmasks[SNES_OAM][pos];
561589
562590#ifdef SNES_LAYER_DEBUG
563            if (!debug_options.windows_disabled)
591            if (debug_options.windows_disabled)
592               mask = 0xff;
564593#endif /* SNES_LAYER_DEBUG */
594
565595            /* Clip to windows */
566596            if (scanlines[SNES_MAINSCREEN].clip)
567               clr &= snes_ppu.clipmasks[SNES_OAM][pos];
597               clr &= mask;
568598
569599            /* Only draw if we have a colour (0 == transparent) */
570600            if (clr)
r7605r7606
585615         if (scanlines[SNES_SUBSCREEN].priority[pos] <= priority)
586616         {
587617            UINT8 clr = colour;
618            UINT8 mask = snes_ppu.clipmasks[SNES_OAM][pos];
588619
589620#ifdef SNES_LAYER_DEBUG
590            if (!debug_options.windows_disabled)
621            if (debug_options.windows_disabled)
622               mask = 0xff;
591623#endif /* SNES_LAYER_DEBUG */
624
592625            /* Clip to windows */
593626            if (scanlines[SNES_SUBSCREEN].clip)
594               clr &= snes_ppu.clipmasks[SNES_OAM][pos];
627               clr &= mask;
595628
596629            /* Only draw if we have a colour (0 == transparent) */
597630            if (clr)
r7605r7606
638671 * Update an entire line of tiles.
639672 *********************************************/
640673
641INLINE void snes_update_line( UINT8 color_depth, UINT8 hires, UINT8 priority_a, UINT8 priority_b, UINT8 layer, UINT16 curline, UINT8 offset_per_tile, UINT8 direct_colors )
674INLINE void snes_update_line( UINT16 curline, UINT8 layer, UINT8 priority_b, UINT8 priority_a, UINT8 color_depth, UINT8 hires, UINT8 offset_per_tile, UINT8 direct_colors )
642675{
643676   UINT32 tmap, tile, xoff, yoff;
644677   UINT32 charaddr;
r7605r7606
746779      tilemap = snes_vram[addr] | (snes_vram[addr + 1] << 8);
747780      vflip = BIT(tilemap, 15);
748781      hflip = BIT(tilemap, 14);
749      priority = BIT(tilemap, 13) ? priority_b : priority_a;
782      priority = BIT(tilemap, 13) ? priority_a : priority_b;
750783      pal_direct = ((tilemap & 0x1c00) >> 8);
751784      tile = tilemap & 0x03ff;
752785
r7605r7606
820853
821854#define MODE7_CLIP(x) (((x) & 0x2000) ? ((x) | ~0x03ff) : ((x) & 0x03ff))
822855
823static void snes_update_line_mode7( UINT8 priority_a, UINT8 priority_b, UINT8 layer, UINT16 curline )
856static void snes_update_line_mode7( UINT16 curline, UINT8 layer, UINT8 priority_b, UINT8 priority_a )
824857{
825858   UINT32 tiled;
826859   INT16 ma, mb, mc, md;
827860   INT32 xc, yc, tx, ty, sx, sy, hs, vs, xpos, xdir, x0, y0;
828   UINT8 priority = priority_a;
861   UINT8 priority = priority_b;
829862   UINT8 colour = 0;
830863   UINT16 *mosaic_x, *mosaic_y;
831864   UINT16 c;
r7605r7606
881914   }
882915
883916   /* MOSAIC - to be verified */
884   if (layer == 1)   // BG2 use two different bits for horizontal and vertical mosaic
917   if (layer == SNES_BG2)   // BG2 use two different bits for horizontal and vertical mosaic
885918   {
886919      mosaic_x = snes_ppu.mosaic_table[snes_ppu.layer[SNES_BG2].mosaic_enabled ? snes_ppu.mosaic_size : 0];
887920      mosaic_y = snes_ppu.mosaic_table[snes_ppu.layer[SNES_BG1].mosaic_enabled ? snes_ppu.mosaic_size : 0];
r7605r7606
892925      mosaic_y =  snes_ppu.mosaic_table[snes_ppu.layer[SNES_BG1].mosaic_enabled ? snes_ppu.mosaic_size : 0];
893926   }
894927
928#ifdef SNES_LAYER_DEBUG
929   if (debug_options.mosaic_disabled)
930   {
931      mosaic_x =  snes_ppu.mosaic_table[0];
932      mosaic_y =  snes_ppu.mosaic_table[0];
933   }
934#endif /* SNES_LAYER_DEBUG */
935
895936   /* Let's do some mode7 drawing huh? */
896937   /* These can be computed only once, since they do not depend on sx */
897938   x0 = ((ma * MODE7_CLIP(hs - xc)) & ~0x3f) + ((mb * mosaic_y[sy]) & ~0x3f) + ((mb * MODE7_CLIP(vs - yc)) & ~0x3f) + (xc << 8);
r7605r7606
912953            colour = snes_vram[tiled + ((tx & 0x07) * 2) + ((ty & 0x07) * 16) + 1];
913954            break;
914955         case 0x02:   /* Single colour backdrop screen if outside screen area */
915            if ((tx > 0) && (tx < 1024) && (ty > 0) && (ty < 1024))
956            if ((tx >= 0) && (tx < 1024) && (ty >= 0) && (ty < 1024))
916957            {
917958               tiled = snes_vram[(((tx >> 3) & 0x7f) + (((ty >> 3) & 0x7f) * 128)) * 2] << 7;
918959               colour = snes_vram[tiled + ((tx & 0x07) * 2) + ((ty & 0x07) * 16) + 1];
r7605r7606
921962               colour = 0;
922963            break;
923964         case 0x03:   /* Character 0x00 repeat if outside screen area */
924            if ((tx > 0) && (tx < 1024) && (ty > 0) && (ty < 1024))
965            if ((tx >= 0) && (tx < 1024) && (ty >= 0) && (ty < 1024))
925966               tiled = snes_vram[(((tx >> 3) & 0x7f) + (((ty >> 3) & 0x7f) * 128)) * 2] << 7;
926967            else
927968               tiled = 0;
r7605r7606
931972      }
932973
933974      /* The last bit is for priority in EXTBG mode (used only for BG2) */
934      if (layer == 1)
975      if (layer == SNES_BG2)
935976      {
936         priority = ((colour & 0x80) >> 7) ? priority_b : priority_a;
977         priority = ((colour & 0x80) >> 7) ? priority_a : priority_b;
937978         colour &= 0x7f;
938979      }
939980
940981      if (scanlines[SNES_MAINSCREEN].enable)
941982      {
942983         UINT8 clr = colour;
984         UINT8 mask = snes_ppu.clipmasks[layer][xpos];
943985
986#ifdef SNES_LAYER_DEBUG
987         if (debug_options.windows_disabled)
988            mask = 0xff;
989#endif /* SNES_LAYER_DEBUG */
990
991         /* Clip to windows */
944992         if (scanlines[SNES_MAINSCREEN].clip)
945            clr &= snes_ppu.clipmasks[layer][xpos];
993            clr &= mask;
946994
947995         /* Draw pixel if appropriate */
948996         if (scanlines[SNES_MAINSCREEN].priority[xpos] <= priority && clr > 0)
949997         {
950998            /* Direct select, but only outside EXTBG! */
951            if (snes_ppu.direct_color && layer == 0)
999            if (snes_ppu.direct_color && layer == SNES_BG1)
9521000            {
9531001               /* 0 | BB000 | GGG00 | RRR00, HW confirms that the data is zero padded. */
9541002               c = ((clr & 0x07) << 2) | ((clr & 0x38) << 4) | ((clr & 0xc0) << 7);
r7605r7606
9651013      if (scanlines[SNES_SUBSCREEN].enable)
9661014      {
9671015         UINT8 clr = colour;
1016         UINT8 mask = snes_ppu.clipmasks[layer][xpos];
9681017
1018#ifdef SNES_LAYER_DEBUG
1019         if (debug_options.windows_disabled)
1020            mask = 0xff;
1021#endif /* SNES_LAYER_DEBUG */
1022
1023         /* Clip to windows */
9691024         if (scanlines[SNES_SUBSCREEN].clip)
970            clr &= snes_ppu.clipmasks[layer][xpos];
1025            clr &= mask;
9711026
9721027         /* Draw pixel if appropriate */
9731028         if (scanlines[SNES_SUBSCREEN].priority[xpos] <= priority && clr > 0)
9741029         {
9751030            /* Direct select, but only outside EXTBG! */
976            if (snes_ppu.direct_color && layer == 0)
1031            if (snes_ppu.direct_color && layer == SNES_BG1)
9771032            {
9781033               /* 0 | BB000 | GGG00 | RRR00, HW confirms that the data is zero padded. */
9791034               c = ((clr & 0x07) << 2) | ((clr & 0x38) << 4) | ((clr & 0xc0) << 7);
r7605r7606
12321287      snes_ppu.stat77_flags |= 0x80;
12331288}
12341289
1235static void snes_update_objects( UINT8 priority_tbl )
1290static void snes_update_objects( UINT8 priority_oam0, UINT8 priority_oam1, UINT8 priority_oam2, UINT8 priority_oam3 )
12361291{
1237   UINT8 priority;
1292   UINT8 pri, priority[4];
12381293   UINT32 charaddr;
12391294   int i;
1240   static const UINT8 table_obj_priority[10][4] = {
1241                  {2, 5, 8, 11},   // mode 0
1242                  {1, 3, 6, 9},   // mode 1
1243                  {1, 3, 5, 7},   // mode 2
1244                  {1, 3, 5, 7},   // mode 3
1245                  {1, 3, 5, 7},   // mode 4
1246                  {1, 3, 5, 7},   // mode 5
1247                  {0, 2, 3, 5},   // mode 6
1248                  {0, 2, 3, 4},   // mode 7
1249                  {1, 3, 5, 6},   // mode 7 EXTBG
1250                  {1, 2, 5, 8}   // mode 1 + BG3 priority bit
1251   };
12521295
12531296#ifdef SNES_LAYER_DEBUG
12541297   if (debug_options.bg_disabled[SNES_OAM])
r7605r7606
12651308
12661309   charaddr = snes_ppu.layer[SNES_OAM].charmap << 13;
12671310
1311   priority[0] = priority_oam0;
1312   priority[1] = priority_oam1;
1313   priority[2] = priority_oam2;
1314   priority[3] = priority_oam3;
1315
12681316   /* finally draw the tiles from the tilelist */
12691317   for (i = 0; i < 34; i++)
12701318   {
r7605r7606
12771325      if (oam_tilelist[tile].tileaddr == 0xffff)
12781326         continue;
12791327
1280      priority = table_obj_priority[priority_tbl][oam_tilelist[tile].priority];
1328      pri = priority[oam_tilelist[tile].priority];
12811329
12821330#ifdef SNES_LAYER_DEBUG
12831331      if (debug_options.select_oam)
12841332      {
12851333         int oam_draw = debug_options.select_oam - 1;
12861334         if (oam_draw != oam_tilelist[tile].priority)
1287            priority = 0;
1335            continue;
12881336      }
12891337#endif /* SNES_LAYER_DEBUG */
12901338
1291      snes_draw_tile_object(charaddr + oam_tilelist[tile].tileaddr, oam_tilelist[tile].x, priority, oam_tilelist[tile].hflip, oam_tilelist[tile].pal);
1339      snes_draw_tile_object(charaddr + oam_tilelist[tile].tileaddr, oam_tilelist[tile].x, pri, oam_tilelist[tile].hflip, oam_tilelist[tile].pal);
12921340   }
12931341}
12941342
r7605r7606
13061354      return;
13071355#endif /* SNES_LAYER_DEBUG */
13081356
1309   snes_update_line(SNES_COLOR_DEPTH_2BPP, 0, 0, 3, SNES_BG4, curline, SNES_OPT_NONE, 0);
1310   snes_update_line(SNES_COLOR_DEPTH_2BPP, 0, 1, 4, SNES_BG3, curline, SNES_OPT_NONE, 0);
1311   snes_update_line(SNES_COLOR_DEPTH_2BPP, 0, 6, 9, SNES_BG2, curline, SNES_OPT_NONE, 0);
1312   snes_update_line(SNES_COLOR_DEPTH_2BPP, 0, 7, 10, SNES_BG1, curline, SNES_OPT_NONE, 0);
1313   snes_update_objects(0);
1357   snes_update_line(curline, SNES_BG4, 1, 4,  SNES_COLOR_DEPTH_2BPP, 0, SNES_OPT_NONE, 0);
1358   snes_update_line(curline, SNES_BG3, 2, 5,  SNES_COLOR_DEPTH_2BPP, 0, SNES_OPT_NONE, 0);
1359   snes_update_line(curline, SNES_BG2, 7, 10, SNES_COLOR_DEPTH_2BPP, 0, SNES_OPT_NONE, 0);
1360   snes_update_line(curline, SNES_BG1, 8, 11, SNES_COLOR_DEPTH_2BPP, 0, SNES_OPT_NONE, 0);
1361   snes_update_objects(3, 6, 9, 12);
13141362}
13151363
13161364static void snes_update_mode_1( UINT16 curline )
r7605r7606
13221370
13231371   if (!snes_ppu.bg3_priority_bit)
13241372   {
1325      snes_update_line(SNES_COLOR_DEPTH_2BPP, 0, 0, 2, SNES_BG3, curline, SNES_OPT_NONE, 0);
1326      snes_update_line(SNES_COLOR_DEPTH_4BPP, 0, 4, 7, SNES_BG2, curline, SNES_OPT_NONE, 0);
1327      snes_update_line(SNES_COLOR_DEPTH_4BPP, 0, 5, 8, SNES_BG1, curline, SNES_OPT_NONE, 0);
1328      snes_update_objects(1);
1373      snes_update_line(curline, SNES_BG3, 1, 3, SNES_COLOR_DEPTH_2BPP, 0, SNES_OPT_NONE, 0);
1374      snes_update_line(curline, SNES_BG2, 5, 8, SNES_COLOR_DEPTH_4BPP, 0, SNES_OPT_NONE, 0);
1375      snes_update_line(curline, SNES_BG1, 6, 9, SNES_COLOR_DEPTH_4BPP, 0, SNES_OPT_NONE, 0);
1376      snes_update_objects(2, 4, 7, 10);
13291377   }
13301378   else
13311379   {
1332      snes_update_line(SNES_COLOR_DEPTH_2BPP, 0, 0, 9, SNES_BG3, curline, SNES_OPT_NONE, 0);
1333      snes_update_line(SNES_COLOR_DEPTH_4BPP, 0, 3, 6, SNES_BG2, curline, SNES_OPT_NONE, 0);
1334      snes_update_line(SNES_COLOR_DEPTH_4BPP, 0, 4, 7, SNES_BG1, curline, SNES_OPT_NONE, 0);
1335      snes_update_objects(9);
1380      snes_update_line(curline, SNES_BG3, 1, 10, SNES_COLOR_DEPTH_2BPP, 0, SNES_OPT_NONE, 0);
1381      snes_update_line(curline, SNES_BG2, 4, 7,  SNES_COLOR_DEPTH_4BPP, 0, SNES_OPT_NONE, 0);
1382      snes_update_line(curline, SNES_BG1, 5, 8,  SNES_COLOR_DEPTH_4BPP, 0, SNES_OPT_NONE, 0);
1383      snes_update_objects(2, 3, 6, 9);
13361384   }
13371385}
13381386
r7605r7606
13431391      return;
13441392#endif /* SNES_LAYER_DEBUG */
13451393
1346   snes_update_line(SNES_COLOR_DEPTH_4BPP, 0, 0, 4, SNES_BG2, curline, SNES_OPT_MODE2, 0);
1347   snes_update_line(SNES_COLOR_DEPTH_4BPP, 0, 2, 6, SNES_BG1, curline, SNES_OPT_MODE2, 0);
1348   snes_update_objects(2);
1394   snes_update_line(curline, SNES_BG2, 1, 5, SNES_COLOR_DEPTH_4BPP, 0, SNES_OPT_MODE2, 0);
1395   snes_update_line(curline, SNES_BG1, 3, 7, SNES_COLOR_DEPTH_4BPP, 0, SNES_OPT_MODE2, 0);
1396   snes_update_objects(2, 4, 6, 8);
13491397}
13501398
13511399static void snes_update_mode_3( UINT16 curline )
r7605r7606
13551403      return;
13561404#endif /* SNES_LAYER_DEBUG */
13571405
1358   snes_update_line(SNES_COLOR_DEPTH_4BPP, 0, 0, 4, SNES_BG2, curline, SNES_OPT_NONE, 0);
1359   snes_update_line(SNES_COLOR_DEPTH_8BPP, 0, 2, 6, SNES_BG1, curline, SNES_OPT_NONE, snes_ppu.direct_color);
1360   snes_update_objects(3);
1406   snes_update_line(curline, SNES_BG2, 1, 5, SNES_COLOR_DEPTH_4BPP, 0, SNES_OPT_NONE, 0);
1407   snes_update_line(curline, SNES_BG1, 3, 7, SNES_COLOR_DEPTH_8BPP, 0, SNES_OPT_NONE, snes_ppu.direct_color);
1408   snes_update_objects(2, 4, 6, 8);
13611409}
13621410
13631411static void snes_update_mode_4( UINT16 curline )
r7605r7606
13671415      return;
13681416#endif /* SNES_LAYER_DEBUG */
13691417
1370   snes_update_line(SNES_COLOR_DEPTH_2BPP, 0, 0, 4, SNES_BG2, curline, SNES_OPT_MODE4, 0);
1371   snes_update_line(SNES_COLOR_DEPTH_8BPP, 0, 2, 6, SNES_BG1, curline, SNES_OPT_MODE4, snes_ppu.direct_color);
1372   snes_update_objects(4);
1418   snes_update_line(curline, SNES_BG2, 1, 5, SNES_COLOR_DEPTH_2BPP, 0, SNES_OPT_MODE4, 0);
1419   snes_update_line(curline, SNES_BG1, 3, 7, SNES_COLOR_DEPTH_8BPP, 0, SNES_OPT_MODE4, snes_ppu.direct_color);
1420   snes_update_objects(2, 4, 6, 8);
13731421}
13741422
13751423static void snes_update_mode_5( UINT16 curline )
r7605r7606
13791427      return;
13801428#endif /* SNES_LAYER_DEBUG */
13811429
1382   snes_update_line(SNES_COLOR_DEPTH_2BPP, 1, 0, 4, SNES_BG2, curline, SNES_OPT_NONE, 0);
1383   snes_update_line(SNES_COLOR_DEPTH_4BPP, 1, 2, 6, SNES_BG1, curline, SNES_OPT_NONE, 0);
1384   snes_update_objects(5);
1430   snes_update_line(curline, SNES_BG2, 1, 5, SNES_COLOR_DEPTH_2BPP, 1, SNES_OPT_NONE, 0);
1431   snes_update_line(curline, SNES_BG1, 3, 7, SNES_COLOR_DEPTH_4BPP, 1, SNES_OPT_NONE, 0);
1432   snes_update_objects(2, 4, 6, 8);
13851433}
13861434
13871435static void snes_update_mode_6( UINT16 curline )
r7605r7606
13911439      return;
13921440#endif /* SNES_LAYER_DEBUG */
13931441
1394   snes_update_line(SNES_COLOR_DEPTH_4BPP, 1, 1, 4, SNES_BG1, curline, SNES_OPT_MODE6, 0);
1395   snes_update_objects(6);
1442   snes_update_line(curline, SNES_BG1, 2, 5, SNES_COLOR_DEPTH_4BPP, 1, SNES_OPT_MODE6, 0);
1443   snes_update_objects(1, 3, 4, 6);
13961444}
13971445
13981446static void snes_update_mode_7( UINT16 curline )
r7605r7606
14041452
14051453   if (!snes_ppu.mode7.extbg)
14061454   {
1407      snes_update_line_mode7(1, 1, SNES_BG1, curline);
1408      snes_update_objects(7);
1455      snes_update_line_mode7(curline, SNES_BG1, 2, 2);
1456      snes_update_objects(1, 3, 4, 5);
14091457   }
14101458   else
14111459   {
1412      snes_update_line_mode7(0, 4, SNES_BG2, curline);
1413      snes_update_line_mode7(2, 2, SNES_BG1, curline);
1414      snes_update_objects(8);
1460      snes_update_line_mode7(curline, SNES_BG2, 1, 5);
1461      snes_update_line_mode7(curline, SNES_BG1, 3, 3);
1462      snes_update_objects(2, 4, 6, 7);
14151463   }
14161464}
14171465
r7605r7606
17121760         if (BIT(toggles, 5))
17131761            debug_options.draw_subscreen = !debug_options.draw_subscreen;
17141762         if (BIT(toggles, 6))
1715            debug_options.bg_disabled[5] = !debug_options.bg_disabled[5];
1763            debug_options.colormath_disabled = !debug_options.colormath_disabled;
17161764         if (BIT(toggles, 7))
17171765            debug_options.windows_disabled = !debug_options.windows_disabled;
17181766         toggles = input_port_read_safe(machine, "DEBUG4", 0);
r7605r7606
17341782            debug_options.mode_disabled[7] = !debug_options.mode_disabled[7];
17351783         toggles = input_port_read_safe(machine, "DEBUG3", 0);
17361784         if (toggles & 0x4)
1737            debug_options.transparency_disabled = !debug_options.transparency_disabled;
1785            debug_options.mosaic_disabled = !debug_options.mosaic_disabled;
17381786         debug_options.input_count = 5;
17391787      }
17401788
1741      logerror("%s%s", debug_options.windows_disabled?" ":"W", debug_options.transparency_disabled?" ":"T" );
1789      logerror("%s", debug_options.windows_disabled?" ":"W");
17421790      logerror("%s1 %s%s%s%s%s%c%s%s%d%s %d %4X %4X",
17431791            debug_options.bg_disabled[0]?" ":"*",
17441792            (snes_ram[TM] & 0x1)?"M":" ",
r7605r7606
18121860            (snes_ram[WOBJSEL] & 0x8)?((snes_ram[WOBJSEL] & 0x4)?"o":"i"):" ",
18131861            snes_ppu.layer[SNES_OAM].charmap << 13 );
18141862      logerror("%sB   %s  %c%s%s",
1815            debug_options.bg_disabled[5]?" ":"*",
1863            debug_options.colormath_disabled?" ":"*",
18161864            (snes_ram[CGADSUB] & 0x20)?"B":" ",
18171865            WINLOGIC[(snes_ram[WOBJLOG] & 0xc)>>2],
18181866            (snes_ram[WOBJSEL] & 0x20)?((snes_ram[WOBJSEL] & 0x10)?"o":"i"):" ",
src/mess/drivers/snes.c
r7605r7606
298298   PORT_START("DEBUG1")
299299   PORT_CONFNAME( 0x70, 0x00, "Select OAM" )
300300   PORT_CONFSETTING(   0x00, "All" )
301   PORT_CONFSETTING(   0x10, "OAM1 only" )
302   PORT_CONFSETTING(   0x20, "OAM2 only" )
303   PORT_CONFSETTING(   0x30, "OAM3 only" )
304   PORT_CONFSETTING(   0x40, "OAM4 only" )
301   PORT_CONFSETTING(   0x10, "OAM0 only" )
302   PORT_CONFSETTING(   0x20, "OAM1 only" )
303   PORT_CONFSETTING(   0x30, "OAM2 only" )
304   PORT_CONFSETTING(   0x40, "OAM3 only" )
305305   PORT_CONFNAME( 0x80, 0x00, "Draw sprite in reverse order" )
306306   PORT_CONFSETTING(   0x00, DEF_STR( Off ) )
307307   PORT_CONFSETTING(   0x80, DEF_STR( On ) )
r7605r7606
313313   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("Toggle BG 4") PORT_CODE(KEYCODE_4_PAD)
314314   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("Toggle Objects") PORT_CODE(KEYCODE_5_PAD)
315315   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("Toggle Main/Sub") PORT_CODE(KEYCODE_6_PAD)
316   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("Toggle Back col") PORT_CODE(KEYCODE_7_PAD)
316   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("Toggle Color Math") PORT_CODE(KEYCODE_7_PAD)
317317   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("Toggle Windows") PORT_CODE(KEYCODE_8_PAD)
318318
319319   PORT_START("DEBUG3")
320   PORT_BIT( 0x1, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("Pal prev") PORT_CODE(KEYCODE_B)
321   PORT_BIT( 0x2, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("Pal next") PORT_CODE(KEYCODE_N)
322   PORT_BIT( 0x4, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("Toggle Transparency") PORT_CODE(KEYCODE_9_PAD)
320   PORT_BIT( 0x4, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("Toggle Mosaic") PORT_CODE(KEYCODE_9_PAD)
323321
324322   PORT_START("DEBUG4")
325323   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("Toggle Mode 0 draw")

Previous 15994 Revisions Next


© 1998-2018 The MESS Team