Previous 15994 Revisions Next

r5356 Thursday 6th August, 2009 at 00:43:43 UTC by Fabio Priuli
SNES video updates:

* Re-enabled video debug functionalities in debug build (to toggle background layers)
* Added proper priority tables for various bg/obj layers
* Largely simplified tile and line drawing routines, and fixed small bits here and there
[src/mame/video]snes.c
[src/mess/drivers]snes.c

src/mame/video/snes.c
r5355r5356
8888#define SNES_CLIP_OUT   2
8989#define SNES_CLIP_ALL2  3
9090
91#ifdef SNES_DBG_video
91#ifdef MAME_DEBUG
9292struct DEBUGOPTS
9393{
9494   UINT8 input_count;
r5355r5356
100100static struct DEBUGOPTS debug_options  = {5, {0,0,0,0,0,0}, 0, 0, 0};
101101/*                                    red   green  blue    purple  yellow cyan    grey    white */
102102static const UINT16 dbg_mode_colours[8] = { 0x1f, 0x3e0, 0x7c00, 0x7c1f, 0x3ff, 0x7fe0, 0x4210, 0x7fff };
103static UINT8 snes_dbg_video(bitmap_t *bitmap, UINT16 curline);
104#endif /* SNES_DBG_video */
103static UINT8 snes_dbg_video(running_machine *machine, bitmap_t *bitmap, UINT16 curline);
104#endif /* MAME_DEBUG */
105105
106106/* Forward declarations */
107107static void snes_update_line_2(UINT8 screen, UINT8 layer, UINT16 curline );
r5355r5356
112112static void snes_update_line_mode7(UINT8 screen, UINT8 layer, UINT16 curline );
113113
114114/* Lookup tables */
115static const UINT8  table_bgd_pty[2][4][2] = { { {7,10}, {6,9}, {1,4}, {0,3} }, { {3,10}, {1,7}, {0,0}, {0,0} } };
116static const UINT8  table_obj_pty[4]       = { 2, 5, 8, 11 };
115static const UINT8 table_bgd_pty[10][4][2] = {{ {7,10}, {6,9}, {1,4}, {0,3} },   // mode 0
116                                   { {5,8}, {4,7}, {0,2}, {0,0} },   // mode 1
117                                   { {2,6}, {0,4}, {0,0}, {0,0} },   // mode 2
118                                   { {2,6}, {0,4}, {0,0}, {0,0} },   // mode 3
119                                   { {2,6}, {0,4}, {0,0}, {0,0} },   // mode 4
120                                   { {2,6}, {0,4}, {0,0}, {0,0} },   // mode 5
121                                   { {1,4}, {0,0}, {0,0}, {0,0} },   // mode 6
122                                   { {3,6}, {1,4}, {0,0}, {0,0} },   // mode 7 - this was used earlier... correct one: {1,1},{0,0}; or {2,2},{0,4} when EXTBG=1!
123                                   { {4,7}, {3,6}, {0,9}, {0,0} }   // mode 1 + BG3 priority bit (current code does not use this!)
124                                 };
125static const UINT8 table_obj_pty[10][4] = { {2, 5, 8, 11},   // mode 0
126                                 {1, 3, 6, 9},   // mode 1
127                                 {1, 3, 5, 7},   // mode 2
128                                 {1, 3, 5, 7},   // mode 3
129                                 {1, 3, 5, 7},   // mode 4
130                                 {1, 3, 5, 7},   // mode 5
131                                 {0, 2, 3, 5},   // mode 6
132                                 {2, 5, 8, 11},   // mode 7 - this was used earlier... correct one: {0,2,3,4}; or {1,3,5,6} when EXTBG=1!
133                                 {1, 2, 5, 8}   // mode 1 + BG3 priority bit (current code does not use this!)
134                              };
117135static const UINT16 table_obj_offset[8][8] =
118136{
119137   { (0*32),   (0*32)+32,   (0*32)+64,   (0*32)+96,   (0*32)+128,   (0*32)+160,   (0*32)+192,   (0*32)+224 },
r5355r5356
156174
157175extern UINT16 snes_htmult;
158176
177enum
178{
179   SNES_COLOR_DEPTH_2BPP = 0,
180   SNES_COLOR_DEPTH_4BPP,
181   SNES_COLOR_DEPTH_8BPP
182};
183
159184/*****************************************
160185 * snes_draw_blend()
161186 *
r5355r5356
167192   if( clip == SNES_CLIP_ALL2) // blending mode 3 == always OFF
168193      return;
169194
170#ifdef SNES_DBG_video
195#ifdef MAME_DEBUG
171196   if( !debug_options.transparency_disabled )
172#endif /* SNES_DBG_video */
197#endif /* MAME_DEBUG */
173198   if( (clip == SNES_CLIP_ALL) ||
174199      (clip == SNES_CLIP_IN  && snes_ppu.clipmasks[5][offset]) ||
175200      (clip == SNES_CLIP_OUT && !snes_ppu.clipmasks[5][offset]) )
r5355r5356
243268   }
244269}
245270
271
246272/*****************************************
247 * snes_draw_tile_2()
273 * snes_draw_tile_common()
248274 *
249 * Draw tiles with 2 bit planes(4 colors)
275 * Draw tiles with variable bit planes
250276 *****************************************/
251INLINE void snes_draw_tile_2(UINT8 screen, UINT8 layer, UINT16 tileaddr, INT16 x, UINT8 priority, UINT8 flip, UINT16 pal )
277INLINE void snes_draw_tile_common(UINT8 screen, UINT8 planes, UINT8 layer, UINT16 tileaddr, INT16 x, UINT8 priority, UINT8 flip, UINT16 pal )
252278{
253   UINT8 mask, plane[2];
279   UINT8 mask, plane[planes];
254280   UINT16 c;
255   INT16 ii;
281   INT16 ii, jj;
256282
257   plane[0] = snes_vram[tileaddr];
258   plane[1] = snes_vram[tileaddr + 1];
283   for (ii = 0; ii < planes / 2; ii++)
284   {
285      plane[2 * ii] = snes_vram[tileaddr + 16 * ii];
286      plane[2 * ii + 1] = snes_vram[tileaddr + 16 * ii + 1];   
287   }
259288
260   if( flip )
289   if (flip)
261290      mask = 0x1;
262291   else
263292      mask = 0x80;
264293
265   for( ii = x; ii < (x + 8); ii++ )
294   for (ii = x; ii < (x + 8); ii++)
266295   {
267      UINT8 colour;
268      if( flip )
296      UINT8 colour = 0;
297      if (flip)
269298      {
270         colour = (plane[0] & mask ? 1 : 0) | (plane[1] & mask ? 2 : 0);
299         for (jj = 0; jj < planes; jj++)
300            colour |= plane[jj] & mask ? (1 << jj) : 0;
301
271302         mask <<= 1;
272303      }
273304      else
274305      {
275         colour = (plane[0] & mask ? 1 : 0) | (plane[1] & mask ? 2 : 0);
306         for (jj = 0; jj < planes; jj++)
307            colour |= plane[jj] & mask ? (1 << jj) : 0;
308
276309         mask >>= 1;
277310      }
278311
279#ifdef SNES_DBG_video
280      if( !debug_options.windows_disabled )
281#endif /* SNES_DBG_video */
312#ifdef MAME_DEBUG
313      if(!debug_options.windows_disabled)
314#endif /* MAME_DEBUG */
282315      /* Clip to windows */
283      if( (screen == MAINSCREEN && (snes_ram[TMW] & (0x1 << layer))) || (screen == SUBSCREEN && (snes_ram[TSW] & (0x1 << layer))))
316      if ((screen == MAINSCREEN && (snes_ram[TMW] & (0x1 << layer))) || (screen == SUBSCREEN && (snes_ram[TSW] & (0x1 << layer))))
284317         colour &= snes_ppu.clipmasks[layer][ii];
285318
286319      /* Only draw if we have a colour (0 == transparent) */
287      if( colour )
320      if (colour)
288321      {
289         if( (scanlines[screen].zbuf[ii] <= priority) && (ii >= 0) )
322         if ((scanlines[screen].zbuf[ii] <= priority) && (ii >= 0))
290323         {
291324            c = snes_cgram[pal + colour];
292            if( screen == MAINSCREEN )   /* Only blend main screens */
293               snes_draw_blend(ii, &c, snes_ppu.layer[layer].blend, (snes_ram[CGWSEL] & 0x30) >> 4 );
294            if( snes_ram[MOSAIC] & (1 << layer) ) // handle horizontal mosaic
325            if (screen == MAINSCREEN)   /* Only blend main screens */
326               snes_draw_blend(ii, &c, snes_ppu.layer[layer].blend, (snes_ram[CGWSEL] & 0x30) >> 4);
327            if (snes_ram[MOSAIC] & (1 << layer)) // handle horizontal mosaic
295328            {
296329               int x_mos;
297330
298331               //TODO: 512 modes has the h values doubled.
299               for(x_mos = 0;x_mos < (((snes_ram[MOSAIC] & 0xf0)>>4)+1) ; x_mos++)
332               for (x_mos = 0; x_mos < (((snes_ram[MOSAIC] & 0xf0) >> 4) + 1) ; x_mos++)
300333               {
301334                  scanlines[screen].buffer[ii + x_mos] = c;
302335                  scanlines[screen].zbuf[ii + x_mos] = priority;
r5355r5356
314347}
315348
316349/*****************************************
350 * snes_draw_tile_2()
351 *
352 * Draw tiles with 2 bit planes(4 colors)
353 *****************************************/
354INLINE void snes_draw_tile_2(UINT8 screen, UINT8 layer, UINT16 tileaddr, INT16 x, UINT8 priority, UINT8 flip, UINT16 pal )
355{
356   snes_draw_tile_common(screen, 2, layer, tileaddr, x, priority, flip, pal);
357}
358
359/*****************************************
317360 * snes_draw_tile_2x2()
318361 *
319362 * Draw 2 tiles with 2 bit planes(4 colors)
r5355r5356
322365{
323366   if( flip )
324367   {
325      snes_draw_tile_2(screen, layer, tileaddr + 16, x, priority, flip, pal );
326      snes_draw_tile_2(screen, layer, tileaddr, x + 8, priority, flip, pal );
368      snes_draw_tile_2(screen, layer, tileaddr + 16, x, priority, flip, pal);
369      snes_draw_tile_2(screen, layer, tileaddr, x + 8, priority, flip, pal);
327370   }
328371   else
329372   {
330      snes_draw_tile_2(screen, layer, tileaddr, x, priority, flip, pal );
331      snes_draw_tile_2(screen, layer, tileaddr + 16, x + 8, priority, flip, pal );
373      snes_draw_tile_2(screen, layer, tileaddr, x, priority, flip, pal);
374      snes_draw_tile_2(screen, layer, tileaddr + 16, x + 8, priority, flip, pal);
332375   }
333376}
334377
r5355r5356
339382 *****************************************/
340383INLINE void snes_draw_tile_4(UINT8 screen, UINT8 layer, UINT16 tileaddr, INT16 x, UINT8 priority, UINT8 flip, UINT16 pal )
341384{
342   UINT8 mask, plane[4];
343   UINT16 c;
344   INT16 ii;
345
346   plane[0] = snes_vram[tileaddr];
347   plane[1] = snes_vram[tileaddr + 1];
348   plane[2] = snes_vram[tileaddr + 16];
349   plane[3] = snes_vram[tileaddr + 17];
350
351   if( flip )
352      mask = 0x1;
353   else
354      mask = 0x80;
355
356   for( ii = x; ii < (x + 8); ii++ )
357   {
358      UINT8 colour;
359      if( flip )
360      {
361         colour = (plane[0] & mask ? 1 : 0) | (plane[1] & mask ? 2 : 0) |
362                (plane[2] & mask ? 4 : 0) | (plane[3] & mask ? 8 : 0);
363         mask <<= 1;
364      }
365      else
366      {
367         colour = (plane[0] & mask ? 1 : 0) | (plane[1] & mask ? 2 : 0) |
368                (plane[2] & mask ? 4 : 0) | (plane[3] & mask ? 8 : 0);
369         mask >>= 1;
370      }
371
372#ifdef SNES_DBG_video
373      if( !debug_options.windows_disabled )
374#endif /* SNES_DBG_video */
375      /* Clip to windows */
376      if( (screen == MAINSCREEN && (snes_ram[TMW] & (0x1 << layer))) || (screen == SUBSCREEN && (snes_ram[TSW] & (0x1 << layer))))
377         colour &= snes_ppu.clipmasks[layer][ii];
378
379      /* Only draw if we have a colour (0 == transparent) */
380      if( colour )
381      {
382         if( (scanlines[screen].zbuf[ii] <= priority) && (ii >= 0) )
383         {
384            c = snes_cgram[pal + colour];
385            if( screen == MAINSCREEN )   /* Only blend main screens */
386               snes_draw_blend(ii, &c, snes_ppu.layer[layer].blend, (snes_ram[CGWSEL] & 0x30) >> 4 );
387            if( snes_ram[MOSAIC] & (1 << layer) ) // handle horizontal mosaic
388            {
389               int x_mos;
390
391               //TODO: 512 modes has the h values doubled.
392               for(x_mos = 0;x_mos < (((snes_ram[MOSAIC] & 0xf0)>>4)+1) ; x_mos++)
393               {
394                  scanlines[screen].buffer[ii + x_mos] = c;
395                  scanlines[screen].zbuf[ii + x_mos] = priority;
396               }
397               ii += x_mos - 1;
398            }
399            else
400            {
401               scanlines[screen].buffer[ii] = c;
402               scanlines[screen].zbuf[ii] = priority;
403            }
404         }
405      }
406   }
385   snes_draw_tile_common(screen, 4, layer, tileaddr, x, priority, flip, pal);
407386}
408387
409388/*****************************************
r5355r5356
415394{
416395   if( flip )
417396   {
418      snes_draw_tile_4(screen, layer, tileaddr + 32, x, priority, flip, pal );
419      snes_draw_tile_4(screen, layer, tileaddr, x + 8, priority, flip, pal );
397      snes_draw_tile_4(screen, layer, tileaddr + 32, x, priority, flip, pal);
398      snes_draw_tile_4(screen, layer, tileaddr, x + 8, priority, flip, pal);
420399   }
421400   else
422401   {
423      snes_draw_tile_4(screen, layer, tileaddr, x, priority, flip, pal );
424      snes_draw_tile_4(screen, layer, tileaddr + 32, x + 8, priority, flip, pal );
402      snes_draw_tile_4(screen, layer, tileaddr, x, priority, flip, pal);
403      snes_draw_tile_4(screen, layer, tileaddr + 32, x + 8, priority, flip, pal);
425404   }
426405}
427406
r5355r5356
432411 *****************************************/
433412INLINE void snes_draw_tile_8(UINT8 screen, UINT8 layer, UINT16 tileaddr, INT16 x, UINT8 priority, UINT8 flip )
434413{
435   UINT8 mask, plane[8];
436   UINT16 c;
437   INT16 ii;
438
439   plane[0] = snes_vram[tileaddr];
440   plane[1] = snes_vram[tileaddr + 1];
441   plane[2] = snes_vram[tileaddr + 16];
442   plane[3] = snes_vram[tileaddr + 17];
443   plane[4] = snes_vram[tileaddr + 32];
444   plane[5] = snes_vram[tileaddr + 33];
445   plane[6] = snes_vram[tileaddr + 48];
446   plane[7] = snes_vram[tileaddr + 49];
447
448   if( flip )
449      mask = 0x1;
450   else
451      mask = 0x80;
452
453   for( ii = x; ii < (x + 8); ii++ )
454   {
455      UINT8 colour;
456      if( flip )
457      {
458         colour = (plane[0] & mask ? 1 : 0)  | (plane[1] & mask ? 2 : 0)  |
459                (plane[2] & mask ? 4 : 0)  | (plane[3] & mask ? 8 : 0)  |
460                (plane[4] & mask ? 16 : 0) | (plane[5] & mask ? 32 : 0) |
461                (plane[6] & mask ? 64 : 0) | (plane[7] & mask ? 128 : 0);
462         mask <<= 1;
463      }
464      else
465      {
466         colour = (plane[0] & mask ? 1 : 0)  | (plane[1] & mask ? 2 : 0)  |
467                (plane[2] & mask ? 4 : 0)  | (plane[3] & mask ? 8 : 0)  |
468                (plane[4] & mask ? 16 : 0) | (plane[5] & mask ? 32 : 0) |
469                (plane[6] & mask ? 64 : 0) | (plane[7] & mask ? 128 : 0);
470         mask >>= 1;
471      }
472
473#ifdef SNES_DBG_video
474      if( !debug_options.windows_disabled )
475#endif /* SNES_DBG_video */
476      /* Clip to windows */
477      if( (screen == MAINSCREEN && (snes_ram[TMW] & (0x1 << layer))) || (screen == SUBSCREEN && (snes_ram[TSW] & (0x1 << layer))))
478         colour &= snes_ppu.clipmasks[layer][ii];
479
480      /* Only draw if we have a colour (0 == transparent) */
481      if( colour )
482      {
483         if( (scanlines[screen].zbuf[ii] <= priority) && (ii >= 0) )
484         {
485            c = snes_cgram[colour];
486            if( screen == MAINSCREEN )   /* Only blend main screens */
487               snes_draw_blend(ii, &c, snes_ppu.layer[layer].blend, (snes_ram[CGWSEL] & 0x30) >> 4 );
488            if( snes_ram[MOSAIC] & (1 << layer) ) // handle horizontal mosaic
489            {
490               int x_mos;
491
492               //TODO: 512 modes has the h values doubled.
493               for(x_mos = 0;x_mos < (((snes_ram[MOSAIC] & 0xf0)>>4)+1) ; x_mos++)
494               {
495                  scanlines[screen].buffer[ii + x_mos] = c;
496                  scanlines[screen].zbuf[ii + x_mos] = priority;
497               }
498               ii += x_mos - 1;
499            }
500            else
501            {
502               scanlines[screen].buffer[ii] = c;
503               scanlines[screen].zbuf[ii] = priority;
504            }
505         }
506      }
507   }
414   snes_draw_tile_common(screen, 8, layer, tileaddr, x, priority, flip, 0);
508415}
509416
510417/*****************************************
r5355r5356
516423{
517424   if( flip )
518425   {
519      snes_draw_tile_8(screen, layer, tileaddr + 64, x, priority, flip );
520      snes_draw_tile_8(screen, layer, tileaddr, x + 8, priority, flip );
426      snes_draw_tile_8(screen, layer, tileaddr + 64, x, priority, flip);
427      snes_draw_tile_8(screen, layer, tileaddr, x + 8, priority, flip);
521428   }
522429   else
523430   {
524      snes_draw_tile_8(screen, layer, tileaddr, x, priority, flip );
525      snes_draw_tile_8(screen, layer, tileaddr + 64, x + 8, priority, flip );
431      snes_draw_tile_8(screen, layer, tileaddr, x, priority, flip);
432      snes_draw_tile_8(screen, layer, tileaddr + 64, x + 8, priority, flip);
526433   }
527434}
528435
r5355r5356
565472         mask >>= 1;
566473      }
567474
568#ifdef SNES_DBG_video
475#ifdef MAME_DEBUG
569476      if( !debug_options.windows_disabled )
570#endif /* SNES_DBG_video */
477#endif /* MAME_DEBUG */
571478      /* Clip to windows */
572479      if( (screen == MAINSCREEN && (snes_ram[TMW] & 0x10)) || (screen == SUBSCREEN && (snes_ram[TSW] & 0x10)))
573480         colour &= snes_ppu.clipmasks[4][ii];
r5355r5356
629536         mask >>= 1;
630537      }
631538
632#ifdef SNES_DBG_video
539#ifdef MAME_DEBUG
633540      if( !debug_options.windows_disabled )
634#endif /* SNES_DBG_video */
541#endif /* MAME_DEBUG */
635542      /* Clip to windows */
636543      if( (screen == MAINSCREEN && (snes_ram[TMW] & 0x10)) || (screen == SUBSCREEN && (snes_ram[TSW] & 0x10)))
637544         colour &= snes_ppu.clipmasks[4][ii];
r5355r5356
655562}
656563
657564/*********************************************
658 * snes_update_line_2()
565 * snes_update_line_common()
659566 *
660 * Update an entire line of 2 bit plane tiles.
567 * Update an entire line of tiles.
661568 *********************************************/
662static void snes_update_line_2(UINT8 screen, UINT8 layer, UINT16 curline )
569INLINE void snes_update_line_common( UINT8 screen, UINT8 color_depth, UINT8 hires, UINT8 layer, UINT16 curline )
663570{
664571   UINT32 tmap, tile;
665572   UINT16 ii, vflip, hflip, pal;
r5355r5356
670577   UINT16 vscroll, hscroll, vtilescroll;
671578   UINT8 vshift, hshift, tile_size;
672579   UINT8 bg3_pty = 0;
580   UINT8 color_shift = 0;
581   UINT8 divider = 1;
673582
674#ifdef SNES_DBG_video
675   if( debug_options.bg_disabled[layer] )
583#ifdef MAME_DEBUG
584   if (debug_options.bg_disabled[layer])
676585      return;
677#endif /* SNES_DBG_video */
586#endif /* MAME_DEBUG */
678587
679588   /* set special priority bit */
680   if( snes_ppu.mode == 1 && snes_ram[BGMODE] & 0x8 )
589   if (color_depth == SNES_COLOR_DEPTH_2BPP && snes_ppu.mode == 1 && snes_ram[BGMODE] & 0x8)
681590      bg3_pty = 1;
682591
683592   /* Handle Mosaic effects */
684   if( snes_ram[MOSAIC] & (1 << layer) )
593   if (snes_ram[MOSAIC] & (1 << layer))
685594      curline -= (curline % ((snes_ram[MOSAIC] >> 4) + 1));
686595
687596   /* Find the size of the tiles (8x8 or 16x16) */
r5355r5356
696605   vtilescroll = vscroll + (curline >> (3 + tile_size));
697606   /* figure out which line to draw */
698607   line = (curline % (8 << tile_size)) + vshift;
699   if( line > ((8 << tile_size) - 1) )   /* scrolled into the next tile */
608   if (line > ((8 << tile_size) - 1))   /* scrolled into the next tile */
700609   {
701610      vtilescroll++;   /* pretend we scrolled by 1 tile line */
702611      line -= (8 << tile_size);
r5355r5356
717626   /* Scroll horizontally */
718627   tmap += (hscroll & 0x1f) << 1;
719628
720   for( ii = 0; ii < (66 >> tile_size); ii += 2 )
629   /* set a couple of variables depending on color_dept */
630   switch (color_depth)
721631   {
632      case SNES_COLOR_DEPTH_2BPP:
633         divider = 2;
634         color_shift = 0;
635         break;
636      case SNES_COLOR_DEPTH_4BPP:
637         divider = 2;
638         color_shift = 2;
639         break;
640      case SNES_COLOR_DEPTH_8BPP:
641         divider = 4;
642         color_shift = 6;   // 2009-08 FP: this should be 6 or 8, if I'm following correctly the drawing code
643         break;
644   }
645
646   for (ii = 0; ii < (66 >> tile_size); ii += 2)
647   {
722648      /* Have we scrolled into the next map? */
723      if( hscroll && ((ii >> 1) >= 32 - (hscroll & 0x1f)) )
649      if (hscroll && ((ii >> 1) >= 32 - (hscroll & 0x1f)))
724650      {
725651         tmap = basevmap + table_hscroll[snes_ppu.layer[layer].map_size & 3][((hscroll >> 5) + 1) & 3];
726652         tmap -= ii;
727653         hscroll = 0;   /* Make sure we don't do this again */
728654      }
729      if (tmap > 0x10000) tmap %= 0x10000;
730      vflip = (snes_vram[tmap + ii + 1] & 0x80);
655      if (tmap > 0x10000)
656         tmap %= 0x10000;
657
658      vflip = snes_vram[tmap + ii + 1] & 0x80;
731659      hflip = snes_vram[tmap + ii + 1] & 0x40;
732      priority = table_bgd_pty[snes_ppu.mode > 1][layer][(snes_vram[tmap + ii + 1] & 0x20) >> 5];
733      pal = (snes_vram[tmap + ii + 1] & 0x1c);      /* 8 palettes of 4 colours */
660      priority = table_bgd_pty[snes_ppu.mode + (/*bg3_pty ? 8 :*/ 0)][layer][(snes_vram[tmap + ii + 1] & 0x20) >> 5];   // if bg3_pty=1 we would need to also change the object, but currently we cannot (see comment below)
661      pal = (snes_vram[tmap + ii + 1] & 0x1c) << color_shift;      /* 8 palettes of (4 * color_shift) colours */
734662      tile = (snes_vram[tmap + ii + 1] & 0x3) << 8;
735      tile |= (snes_vram[tmap + ii] & 0xff);
663      tile |= snes_vram[tmap + ii] & 0xff;
736664
737665      /* Mode 0 palettes are layer specific */
738      if( snes_ppu.mode == 0 )
666      if (snes_ppu.mode == 0)
739667      {
740668         pal += (layer << 5);
741669      }
742670
671
743672      tile_line = line;
744      if( vflip )
673      if (vflip)
745674      {
746         if( tile_size )
675         if (tile_size)
747676         {
748            if( line > 7 )
677            if (line > 7)
749678            {
750679               tile_line -= 8;
751680            }
752681            else
753682            {
754               tile += 16;
683               tile += 32 / divider;
755684            }
756685         }
757686         tile_line = -tile_line + 7;
758687      }
759688      else
760689      {
761         if( line > 7 )
690         if (line > 7)
762691         {
763            tile += 16;
692            tile += 32 / divider;
764693            tile_line -= 8;
765694         }
766695      }
767696      tile_line <<= 1;
768697
769      /* Special case for bg3 */
770      if( layer == 2 && bg3_pty && (snes_vram[tmap + ii + 1] & 0x20) )
771         priority = table_obj_pty[3] + 1;      /* We want to have the highest priority here */
698      /* Special case for bg3 (we should use the proper priority table, but draw object does not have access to this priority bit) */
699      if (layer == 2 && bg3_pty && (snes_vram[tmap + ii + 1] & 0x20))
700         priority = table_obj_pty[snes_ppu.mode][3] + 1;      /* We want to have the highest priority here */
772701
773      if( tile_size )
702      /* The code below can probably simplified even more, by directly calling snes_draw_tile_common... */
703      if (tile_size)
774704      {
775         snes_draw_tile_2x2(screen, layer, snes_ppu.layer[layer].data + (tile << 4) + tile_line, ((ii >> 1) * (8 << tile_size)) - hshift, priority, hflip, pal );
776      }
777      else
778      {
779         snes_draw_tile_2(screen, layer, snes_ppu.layer[layer].data + (tile << 4) + tile_line, ((ii >> 1) * (8 << tile_size)) - hshift, priority, hflip, pal );
780      }
781   }
782}
783
784/*********************************************
785 * snes_update_line_2_hi()
786 *
787 * Update an entire line of 2 bit plane tiles.
788 * This is the hires version.
789 *********************************************/
790static void snes_update_line_2_hi(UINT8 screen, UINT8 layer, UINT16 curline )
791{
792   UINT32 tmap, tile;
793   UINT16 ii, vflip, hflip, pal;
794   INT8 line, tile_line;
795   UINT8 priority;
796   /* scrolling */
797   UINT32 basevmap;
798   UINT16 vscroll, hscroll, vtilescroll;
799   UINT8 vshift, hshift, tile_size;
800   UINT8 bg3_pty = 0;
801
802#ifdef SNES_DBG_video
803   if( debug_options.bg_disabled[layer] )
804      return;
805#endif /* SNES_DBG_video */
806
807   /* set special priority bit */
808   if( snes_ppu.mode == 1 && snes_ram[BGMODE] & 0x8 )
809      bg3_pty = 1;
810
811   /* Handle Mosaic effects */
812   if( snes_ram[MOSAIC] & (1 << layer) )
813      curline -= (curline % ((snes_ram[MOSAIC] >> 4) + 1));
814
815   /* Find the size of the tiles (8x8 or 16x16) */
816   tile_size = snes_ppu.layer[layer].tile_size;
817   /* Find scroll info */
818   vscroll = snes_ppu.layer[layer].offset.tile_vert;
819   vshift = snes_ppu.layer[layer].offset.shift_vert;
820   hscroll = snes_ppu.layer[layer].offset.tile_horz;
821   hshift = snes_ppu.layer[layer].offset.shift_horz;
822
823   /* Find vertical scroll amount */
824   vtilescroll = vscroll + (curline >> (3 + tile_size));
825   /* figure out which line to draw */
826   line = (curline % (8 << tile_size)) + vshift;
827   if( line > ((8 << tile_size) - 1) )   /* scrolled into the next tile */
828   {
829      vtilescroll++;   /* pretend we scrolled by 1 tile line */
830      line -= (8 << tile_size);
831   }
832   if( vtilescroll >= 128 )
833      vtilescroll -= 128;
834
835   /* Jump to base map address */
836   tmap = snes_ppu.layer[layer].map;
837   /* Offset vertically */
838   tmap += table_vscroll[snes_ppu.layer[layer].map_size][vtilescroll >> 5];
839   /* Scroll vertically */
840   tmap += (vtilescroll & 0x1f) << 6;
841   /* Remember this position */
842   basevmap = tmap;
843   /* Offset horizontally */
844   tmap += table_hscroll[snes_ppu.layer[layer].map_size & 3][(hscroll >> 5) & 3];
845   /* Scroll horizontally */
846   tmap += (hscroll & 0x1f) << 1;
847
848   for( ii = 0; ii < (66 >> tile_size); ii += 2 )
849   {
850      /* Have we scrolled into the next map? */
851      if( hscroll && ((ii >> 1) >= 32 - (hscroll & 0x1f)) )
852      {
853         tmap = basevmap + table_hscroll[snes_ppu.layer[layer].map_size & 3][((hscroll >> 5) + 1) & 3];
854         tmap -= ii;
855         hscroll = 0;   /* Make sure we don't do this again */
856      }
857      if (tmap > 0x10000) tmap %= 0x10000;
858      vflip = (snes_vram[tmap + ii + 1] & 0x80);
859      hflip = snes_vram[tmap + ii + 1] & 0x40;
860      priority = table_bgd_pty[snes_ppu.mode > 1][layer][(snes_vram[tmap + ii + 1] & 0x20) >> 5];
861      pal = (snes_vram[tmap + ii + 1] & 0x1c);      /* 8 palettes of 4 colours */
862      tile = (snes_vram[tmap + ii + 1] & 0x3) << 8;
863      tile |= snes_vram[tmap + ii];
864
865      /* Mode 0 palettes are layer specific */
866      if( snes_ppu.mode == 0 )
867      {
868         pal += (layer << 5);
869      }
870
871      tile_line = line;
872      if( vflip )
873      {
874         if( tile_size )
705         if (hires)   /* Hi-Res: 2bpp & 4bpp */
875706         {
876            if( line > 7 )
707            if (hflip)
877708            {
878               tile_line -= 8;
709               switch (color_depth)
710               {
711               case SNES_COLOR_DEPTH_2BPP:
712                  snes_draw_tile_2x2(screen, layer, snes_ppu.layer[layer].data + (tile << 4) + tile_line, ((ii >> 1) * (8 << (tile_size + 1))) - (hshift << 1) + 16, priority, hflip, pal );
713                  snes_draw_tile_2x2(screen, layer, snes_ppu.layer[layer].data + ((tile + 2) << 4) + tile_line, ((ii >> 1) * (8 << (tile_size + 1))) - (hshift << 1), priority, hflip, pal );
714                  break;
715               case SNES_COLOR_DEPTH_4BPP:
716                  snes_draw_tile_4x2(screen, layer, snes_ppu.layer[layer].data + (tile << 5) + tile_line, ((ii >> 1) * (8 << (tile_size + 1))) - (hshift << 1) + 16, priority, hflip, pal );
717                  snes_draw_tile_4x2(screen, layer, snes_ppu.layer[layer].data + ((tile + 2) << 5) + tile_line, ((ii >> 1) * (8 << (tile_size + 1))) - (hshift << 1), priority, hflip, pal );
718                  break;
719               }
879720            }
880721            else
881722            {
882               tile += 16;
723               switch (color_depth)
724               {
725               case SNES_COLOR_DEPTH_2BPP:
726                  snes_draw_tile_2x2(screen, layer, snes_ppu.layer[layer].data + (tile << 4) + tile_line, ((ii >> 1) * (8 << (tile_size + 1))) - (hshift << 1), priority, hflip, pal );
727                  snes_draw_tile_2x2(screen, layer, snes_ppu.layer[layer].data + ((tile + 2) << 4) + tile_line, ((ii >> 1) * (8 << (tile_size + 1))) - (hshift << 1) + 16, priority, hflip, pal );
728                  break;
729
730               case SNES_COLOR_DEPTH_4BPP:
731                  snes_draw_tile_4x2(screen, layer, snes_ppu.layer[layer].data + (tile << 5) + tile_line, ((ii >> 1) * (8 << (tile_size + 1))) - (hshift << 1), priority, hflip, pal );
732                  snes_draw_tile_4x2(screen, layer, snes_ppu.layer[layer].data + ((tile + 2) << 5) + tile_line, ((ii >> 1) * (8 << (tile_size + 1))) - (hshift << 1) + 16, priority, hflip, pal );
733                  break;
734               }
883735            }
884736         }
885         tile_line = -tile_line + 7;
886      }
887      else
888      {
889         if( line > 7 )
737         else   /* No Hi-Res: 2bpp, 4bpp & 8bpp */
890738         {
891            tile += 16;
892            tile_line -= 8;
893         }
894      }
895      tile_line <<= 1;
739            switch (color_depth)
740            {
741               case SNES_COLOR_DEPTH_2BPP:
742                  snes_draw_tile_2x2(screen, layer, snes_ppu.layer[layer].data + (tile << 4) + tile_line, ((ii >> 1) * (8 << tile_size)) - hshift, priority, hflip, pal );
743                  break;
896744
897      /* Special case for bg3 */
898      if( layer == 2 && bg3_pty && (snes_vram[tmap + ii + 1] & 0x20) )
899         priority = table_obj_pty[3] + 1;      /* We want to have the highest priority here */
745               case SNES_COLOR_DEPTH_4BPP:
746                  snes_draw_tile_4x2(screen, layer, snes_ppu.layer[layer].data + (tile << 5) + tile_line, ((ii >> 1) * (8 << tile_size)) - hshift, priority, hflip, pal );
747                  break;
900748
901      if( tile_size )
749               case SNES_COLOR_DEPTH_8BPP:
750                  snes_draw_tile_8x2(screen, layer, snes_ppu.layer[layer].data + (tile << 6) + tile_line, ((ii >> 1) * (8 << tile_size)) - hshift, priority, hflip );
751                  break;
752            }
753         }
754      }
755      else   /* tile_size = 0 */
902756      {
903         if( hflip )
757         if (hires)   /* Hi-Res: 2bpp & 4bpp */
904758         {
905            snes_draw_tile_2x2(screen, layer, snes_ppu.layer[layer].data + (tile << 4) + tile_line, ((ii >> 1) * (8 << (tile_size + 1))) - (hshift << 1) + 16, priority, hflip, pal );
906            snes_draw_tile_2x2(screen, layer, snes_ppu.layer[layer].data + ((tile + 2) << 4) + tile_line, ((ii >> 1) * (8 << (tile_size + 1))) - (hshift << 1), priority, hflip, pal );
759            switch (color_depth)
760            {
761            case SNES_COLOR_DEPTH_2BPP:
762               snes_draw_tile_2x2(screen, layer, snes_ppu.layer[layer].data + (tile << 4) + tile_line, ((ii >> 1) * (8 << (tile_size + 1))) - (hshift << 1), priority, hflip, pal );
763               break;
764
765            case SNES_COLOR_DEPTH_4BPP:
766               snes_draw_tile_4x2(screen, layer, snes_ppu.layer[layer].data + (tile << 5) + tile_line, ((ii >> 1) * (8 << (tile_size + 1))) - (hshift << 1), priority, hflip, pal );
767               break;
768            }
907769         }
908         else
770         else   /* No Hi-Res: 2bpp, 4bpp & 8bpp */
909771         {
910            snes_draw_tile_2x2(screen, layer, snes_ppu.layer[layer].data + (tile << 4) + tile_line, ((ii >> 1) * (8 << (tile_size + 1))) - (hshift << 1), priority, hflip, pal );
911            snes_draw_tile_2x2(screen, layer, snes_ppu.layer[layer].data + ((tile + 2) << 4) + tile_line, ((ii >> 1) * (8 << (tile_size + 1))) - (hshift << 1) + 16, priority, hflip, pal );
772            switch (color_depth)
773            {
774            case SNES_COLOR_DEPTH_2BPP:
775               snes_draw_tile_2(screen, layer, snes_ppu.layer[layer].data + (tile << 4) + tile_line, ((ii >> 1) * (8 << tile_size)) - hshift, priority, hflip, pal );
776               break;
777
778            case SNES_COLOR_DEPTH_4BPP:
779               snes_draw_tile_4(screen, layer, snes_ppu.layer[layer].data + (tile << 5) + tile_line, ((ii >> 1) * (8 << tile_size)) - hshift, priority, hflip, pal );
780               break;
781
782            case SNES_COLOR_DEPTH_8BPP:
783               snes_draw_tile_8(screen, layer, snes_ppu.layer[layer].data + (tile << 6) + tile_line, ((ii >> 1) * (8 << tile_size)) - hshift, priority, hflip );
784               break;
785            }
912786         }
913787      }
914      else
915      {
916         snes_draw_tile_2x2(screen, layer, snes_ppu.layer[layer].data + (tile << 4) + tile_line, ((ii >> 1) * (8 << (tile_size + 1))) - (hshift << 1), priority, hflip, pal );
917      }
918788   }
919789}
920790
921791/*********************************************
792 * snes_update_line_2()
793 *
794 * Update an entire line of 2 bit plane tiles.
795 *********************************************/
796static void snes_update_line_2(UINT8 screen, UINT8 layer, UINT16 curline )
797{
798   snes_update_line_common(screen, SNES_COLOR_DEPTH_2BPP, 0, layer, curline);
799}
800
801/*********************************************
802 * snes_update_line_2_hi()
803 *
804 * Update an entire line of 2 bit plane tiles.
805 * This is the hires version.
806 *********************************************/
807static void snes_update_line_2_hi(UINT8 screen, UINT8 layer, UINT16 curline )
808{
809   snes_update_line_common(screen, SNES_COLOR_DEPTH_2BPP, 1, layer, curline);
810}
811
812/*********************************************
922813 * snes_update_line_4()
923814 *
924815 * Update an entire line of 4 bit plane tiles.
925816 *********************************************/
926817static void snes_update_line_4(UINT8 screen, UINT8 layer, UINT16 curline )
927818{
928   UINT32 tmap, tile;
929   UINT16 ii, vflip, hflip, pal;
930   INT8 line, tile_line;
931   UINT8 priority;
932   /* scrolling */
933   UINT32 basevmap;
934   UINT16 vscroll, hscroll, vtilescroll;
935   UINT8 vshift, hshift, tile_size;
936
937#ifdef SNES_DBG_video
938   if( debug_options.bg_disabled[layer] )
939      return;
940#endif /* SNES_DBG_video */
941
942   /* Handle Mosaic effects */
943   if( snes_ram[MOSAIC] & (1 << layer) )
944      curline -= (curline % ((snes_ram[MOSAIC] >> 4) + 1));
945
946   /* Find the size of the tiles (8x8 or 16x16) */
947   tile_size = snes_ppu.layer[layer].tile_size;
948   /* Find scroll info */
949   vscroll = snes_ppu.layer[layer].offset.tile_vert;
950   vshift = snes_ppu.layer[layer].offset.shift_vert;
951   hscroll = snes_ppu.layer[layer].offset.tile_horz;
952   hshift = snes_ppu.layer[layer].offset.shift_horz;
953
954   /* Jump to base map address */
955   tmap = snes_ppu.layer[layer].map;
956
957   /* Find vertical scroll amount */
958   vtilescroll = vscroll + (curline >> (3 + tile_size));
959   /* figure out which line to draw */
960   line = (curline % (8 << tile_size)) + vshift;
961   if( line > ((8 << tile_size) - 1) )   /* scrolled into the next tile */
962   {
963      vtilescroll++;   /* pretend we scrolled by 1 tile line */
964      line -= (8 << tile_size);
965   }
966   if( vtilescroll >= 128 )
967      vtilescroll -= 128;
968
969   /* Offset vertically */
970   tmap += table_vscroll[snes_ppu.layer[layer].map_size][vtilescroll >> 5];
971   /* Scroll vertically */
972   tmap += (vtilescroll & 0x1f) << 6;
973   /* Remember this position */
974   basevmap = tmap;
975   /* Offset horizontally */
976   tmap += table_hscroll[snes_ppu.layer[layer].map_size & 3][(hscroll >> 5) & 3];
977   /* Scroll horizontally */
978   tmap += (hscroll & 0x1f) << 1;
979
980   for( ii = 0; ii < (66 >> tile_size); ii += 2 )
981   {
982      /* Have we scrolled into the next map? */
983      if( hscroll && ((ii >> 1) >= 32 - (hscroll & 0x1f)) )
984      {
985         tmap = basevmap + table_hscroll[snes_ppu.layer[layer].map_size & 3][((hscroll >> 5) + 1) & 3];
986         tmap -= ii;
987         hscroll = 0;   /* Make sure we don't do this again */
988      }
989      if (tmap > 0x10000) tmap %= 0x10000;
990      vflip = snes_vram[tmap + ii + 1] & 0x80;
991      hflip = snes_vram[tmap + ii + 1] & 0x40;
992      priority = table_bgd_pty[snes_ppu.mode > 1][layer][(snes_vram[tmap + ii + 1] & 0x20) >> 5];      /* is this even right??? */
993      pal = (snes_vram[tmap + ii + 1] & 0x1c) << 2;   /* 8 palettes of 16 colours */
994      tile = (snes_vram[tmap + ii + 1] & 0x3) << 8;
995      tile |= snes_vram[tmap + ii];
996
997      tile_line = line;
998      if( vflip )
999      {
1000         if( tile_size )
1001         {
1002            if( line > 7 )
1003            {
1004               tile_line -= 8;
1005            }
1006            else
1007            {
1008               tile += 16;
1009            }
1010         }
1011         tile_line = -tile_line + 7;
1012      }
1013      else
1014      {
1015         if( line > 7 )
1016         {
1017            tile += 16;
1018            tile_line -= 8;
1019         }
1020      }
1021      tile_line <<= 1;
1022
1023      if( tile_size )
1024      {
1025         snes_draw_tile_4x2(screen, layer, snes_ppu.layer[layer].data + (tile << 5) + tile_line, ((ii >> 1) * (8 << tile_size)) - hshift, priority, hflip, pal );
1026      }
1027      else
1028      {
1029         snes_draw_tile_4(screen, layer, snes_ppu.layer[layer].data + (tile << 5) + tile_line, ((ii >> 1) * (8 << tile_size)) - hshift, priority, hflip, pal );
1030      }
1031   }
819   snes_update_line_common(screen, SNES_COLOR_DEPTH_4BPP, 0, layer, curline);
1032820}
1033821
1034822/*********************************************
r5355r5356
1039827 *********************************************/
1040828static void snes_update_line_4_hi(UINT8 screen, UINT8 layer, UINT16 curline )
1041829{
1042   UINT32 tmap, tile;
1043   UINT16 ii, vflip, hflip, pal;
1044   INT8 line, tile_line;
1045   UINT8 priority;
1046   /* scrolling */
1047   UINT32 basevmap;
1048   UINT16 vscroll, hscroll, vtilescroll;
1049   UINT8 vshift, hshift, tile_size;
1050
1051#ifdef SNES_DBG_video
1052   if( debug_options.bg_disabled[layer] )
1053      return;
1054#endif /* SNES_DBG_video */
1055
1056   /* Handle Mosaic effects */
1057   if( snes_ram[MOSAIC] & (1 << layer) )
1058      curline -= (curline % ((snes_ram[MOSAIC] >> 4) + 1));
1059
1060   /* Find the size of the tiles (8x8 or 16x16) */
1061   tile_size = snes_ppu.layer[layer].tile_size;
1062   /* Find scroll info */
1063   vscroll = snes_ppu.layer[layer].offset.tile_vert;
1064   vshift = snes_ppu.layer[layer].offset.shift_vert;
1065   hscroll = snes_ppu.layer[layer].offset.tile_horz;
1066   hshift = snes_ppu.layer[layer].offset.shift_horz;
1067
1068   /* Find vertical scroll amount */
1069   vtilescroll = vscroll + (curline >> (3 + tile_size));
1070   /* figure out which line to draw */
1071   line = (curline % (8 << tile_size)) + vshift;
1072   if( line > ((8 << tile_size) - 1) )   /* scrolled into the next tile */
1073   {
1074      vtilescroll++;   /* pretend we scrolled by 1 tile line */
1075      line -= (8 << tile_size);
1076   }
1077   if( vtilescroll >= 128 )
1078      vtilescroll -= 128;
1079
1080   /* Jump to base map address */
1081   tmap = snes_ppu.layer[layer].map;
1082   /* Offset vertically */
1083   tmap += table_vscroll[snes_ppu.layer[layer].map_size][vtilescroll >> 5];
1084   /* Scroll vertically */
1085   tmap += (vtilescroll & 0x1f) << 6;
1086   /* Remember this position */
1087   basevmap = tmap;
1088   /* Offset horizontally */
1089   tmap += table_hscroll[snes_ppu.layer[layer].map_size & 3][(hscroll >> 5) & 3];
1090   /* Scroll horizontally */
1091   tmap += (hscroll & 0x1f) << 1;
1092
1093   for( ii = 0; ii < (66 >> tile_size); ii += 2 )
1094   {
1095      /* Have we scrolled into the next map? */
1096      if( hscroll && ((ii >> 1) >= 32 - (hscroll & 0x1f)) )
1097      {
1098         tmap = basevmap + table_hscroll[snes_ppu.layer[layer].map_size & 3][((hscroll >> 5) + 1) & 3];
1099         tmap -= ii;
1100         hscroll = 0;   /* Make sure we don't do this again */
1101      }
1102      if (tmap > 0x10000) tmap %= 0x10000;
1103
1104      vflip = snes_vram[tmap + ii + 1] & 0x80;
1105      hflip = snes_vram[tmap + ii + 1] & 0x40;
1106      priority = table_bgd_pty[snes_ppu.mode > 1][layer][(snes_vram[tmap + ii + 1] & 0x20) >> 5];      /* is this even right??? */
1107      pal = (snes_vram[tmap + ii + 1] & 0x1c) << 2;   /* 8 palettes of 16 colours */
1108      tile = (snes_vram[tmap + ii + 1] & 0x3) << 8;
1109      tile |= snes_vram[tmap + ii];
1110
1111      tile_line = line;
1112      if( vflip )
1113      {
1114         if( tile_size )
1115         {
1116            if( line > 7 )
1117            {
1118               tile_line -= 8;
1119            }
1120            else
1121            {
1122               tile += 16;
1123            }
1124         }
1125         tile_line = -tile_line + 7;
1126      }
1127      else
1128      {
1129         if( line > 7 )
1130         {
1131            tile += 16;
1132            tile_line -= 8;
1133         }
1134      }
1135      tile_line <<= 1;
1136
1137      /* Does hi-res support the tile-size option? */
1138      if( tile_size )
1139      {
1140         if( hflip )
1141         {
1142            snes_draw_tile_4x2(screen, layer, snes_ppu.layer[layer].data + (tile << 5) + tile_line, ((ii >> 1) * (8 << (tile_size + 1))) - (hshift << 1) + 16, priority, hflip, pal );
1143            snes_draw_tile_4x2(screen, layer, snes_ppu.layer[layer].data + ((tile + 2) << 5) + tile_line, ((ii >> 1) * (8 << (tile_size + 1))) - (hshift << 1), priority, hflip, pal );
1144         }
1145         else
1146         {
1147            snes_draw_tile_4x2(screen, layer, snes_ppu.layer[layer].data + (tile << 5) + tile_line, ((ii >> 1) * (8 << (tile_size + 1))) - (hshift << 1), priority, hflip, pal );
1148            snes_draw_tile_4x2(screen, layer, snes_ppu.layer[layer].data + ((tile + 2) << 5) + tile_line, ((ii >> 1) * (8 << (tile_size + 1))) - (hshift << 1) + 16, priority, hflip, pal );
1149         }
1150      }
1151      else
1152      {
1153         snes_draw_tile_4x2(screen, layer, snes_ppu.layer[layer].data + (tile << 5) + tile_line, ((ii >> 1) * (8 << (tile_size + 1))) - (hshift << 1), priority, hflip, pal );
1154      }
1155   }
830   /* Does hi-res support the tile-size option? */
831   snes_update_line_common(screen, SNES_COLOR_DEPTH_4BPP, 1, layer, curline);
1156832}
1157833
1158834/*********************************************
r5355r5356
1162838 *********************************************/
1163839static void snes_update_line_8(UINT8 screen, UINT8 layer, UINT16 curline )
1164840{
1165   UINT32 tmap, tile;
1166   UINT16 ii, vflip, hflip, pal;
1167   INT8 line, tile_line;
1168   UINT8 priority;
1169   /* scrolling */
1170   UINT32 basevmap;
1171   UINT16 vscroll, hscroll, vtilescroll;
1172   UINT8 vshift, hshift, tile_size;
1173
1174#ifdef SNES_DBG_video
1175   if( debug_options.bg_disabled[layer] )
1176      return;
1177#endif /* SNES_DBG_video */
1178
1179   /* Handle Mosaic effects */
1180   if( snes_ram[MOSAIC] & (1 << layer) )
1181      curline -= (curline % ((snes_ram[MOSAIC] >> 4) + 1));
1182
1183   /* Find the size of the tiles (8x8 or 16x16) */
1184   tile_size = snes_ppu.layer[layer].tile_size;
1185   /* Find scroll info */
1186   vscroll = snes_ppu.layer[layer].offset.tile_vert;
1187   vshift = snes_ppu.layer[layer].offset.shift_vert;
1188   hscroll = snes_ppu.layer[layer].offset.tile_horz;
1189   hshift = snes_ppu.layer[layer].offset.shift_horz;
1190
1191   /* Find vertical scroll amount */
1192   vtilescroll = vscroll + (curline >> (3 + tile_size));
1193   /* figure out which line to draw */
1194   line = (curline % (8 << tile_size)) + vshift;
1195   if( line > ((8 << tile_size) - 1) )   /* scrolled into the next tile */
1196   {
1197      vtilescroll++;   /* pretend we scrolled by 1 tile line */
1198      line -= (8 << tile_size);
1199   }
1200   if( vtilescroll >= 128 )
1201      vtilescroll -= 128;
1202
1203   /* Jump to base map address */
1204   tmap = snes_ppu.layer[layer].map;
1205   /* Offset vertically */
1206   tmap += table_vscroll[snes_ppu.layer[layer].map_size][vtilescroll >> 5];
1207   /* Scroll vertically */
1208   tmap += (vtilescroll & 0x1f) << 6;
1209   /* Remember this position */
1210   basevmap = tmap;
1211   /* Offset horizontally */
1212   tmap += table_hscroll[snes_ppu.layer[layer].map_size & 3][(hscroll >> 5) & 3];
1213   /* Scroll horizontally */
1214   tmap += (hscroll & 0x1f) << 1;
1215
1216   for( ii = 0; ii < (66 >> tile_size); ii += 2 )
1217   {
1218      /* Have we scrolled into the next map? */
1219      if( hscroll && ((ii >> 1) >= 32 - (hscroll & 0x1f)) )
1220      {
1221         tmap = basevmap + table_hscroll[snes_ppu.layer[layer].map_size & 3][((hscroll >> 5) + 1) & 3];
1222         tmap -= ii;
1223         hscroll = 0;   /* Make sure we don't do this again */
1224      }
1225      if (tmap > 0x10000) tmap %= 0x10000;
1226      vflip = (snes_vram[tmap + ii + 1] & 0x80);
1227      hflip = snes_vram[tmap + ii + 1] & 0x40;
1228      priority = table_bgd_pty[snes_ppu.mode > 1][layer][(snes_vram[tmap + ii + 1] & 0x20) >> 5];
1229      pal = (snes_vram[tmap + ii + 1] & 0x1c);      /* what does this do for 8 bit screen? */
1230      tile = (snes_vram[tmap + ii + 1] & 0x3) << 8;
1231      tile |= snes_vram[tmap + ii];
1232
1233      tile_line = line;
1234      if( vflip )
1235      {
1236         if( tile_size )
1237         {
1238            if( line > 7 )
1239            {
1240               tile_line -= 8;
1241            }
1242            else
1243            {
1244               tile += 8;
1245            }
1246         }
1247         tile_line = -tile_line + 7;
1248      }
1249      else
1250      {
1251         if( line > 7 )
1252         {
1253            tile += 8;
1254            tile_line -= 8;
1255         }
1256      }
1257      tile_line <<= 1;
1258
1259      if( tile_size )
1260      {
1261         snes_draw_tile_8x2(screen, layer, snes_ppu.layer[layer].data + (tile << 6) + tile_line, ((ii >> 1) * (8 << tile_size)) - hshift, priority, hflip );
1262      }
1263      else
1264      {
1265         snes_draw_tile_8(screen, layer, snes_ppu.layer[layer].data + (tile << 6) + tile_line, ((ii >> 1) * (8 << tile_size)) - hshift, priority, hflip );
1266      }
1267   }
841   snes_update_line_common(screen, SNES_COLOR_DEPTH_8BPP, 0, layer, curline);
1268842}
1269843
1270844/*********************************************
r5355r5356
1280854   UINT8 priority = 0;
1281855   UINT8 colour = 0;
1282856
1283#ifdef SNES_DBG_video
857#ifdef MAME_DEBUG
1284858   if( debug_options.bg_disabled[0] )
1285859      return;
1286#endif /* SNES_DBG_video */
860#endif /* MAME_DEBUG */
1287861
1288862   ma = snes_ppu.mode7.matrix_a;
1289863   mb = snes_ppu.mode7.matrix_b;
r5355r5356
1369943      colour &= snes_ppu.clipmasks[0][xpos];
1370944
1371945      /* Draw pixel if appropriate */
1372      if( scanlines[screen].zbuf[xpos] < table_bgd_pty[1][0][priority] && colour > 0 )
946      if( scanlines[screen].zbuf[xpos] < table_bgd_pty[7][0][priority] && colour > 0 )
1373947      {
1374948         UINT16 clr;
1375949         /* Direct select */
r5355r5356
1382956            snes_draw_blend(xpos, &clr, snes_ppu.layer[0].blend, (snes_ram[CGWSEL] & 0x30) >> 4 );      /* FIXME: Need to support clip mode */
1383957
1384958         scanlines[screen].buffer[xpos] = clr;
1385         scanlines[screen].zbuf[xpos] = table_bgd_pty[1][0][priority];
959         scanlines[screen].zbuf[xpos] = table_bgd_pty[7][0][priority];
1386960      }
1387961   }
1388962}
r5355r5356
1406980   UINT8 *oamram = (UINT8 *)snes_oam;
1407981   UINT32 name_sel = 0;
1408982
1409#ifdef SNES_DBG_video
983#ifdef MAME_DEBUG
1410984   if( debug_options.bg_disabled[4] )
1411985      return;
1412#endif /* SNES_DBG_video */
986#endif /* MAME_DEBUG */
1413987
1414988   if( snes_ppu.mode == 5 || snes_ppu.mode == 6 )
1415989      widemode = 1;
r5355r5356
1424998
1425999      vflip = (oamram[oam] & 0x80) >> 7;
14261000      hflip = (oamram[oam] & 0x40) >> 6;
1427      priority = table_obj_pty[(oamram[oam] & 0x30) >> 4];
1001      priority = table_obj_pty[snes_ppu.mode][(oamram[oam] & 0x30) >> 4];
14281002      pal = 128 + ((oamram[oam] & 0xE) << 3);
14291003      tile = (oamram[oam--] & 0x1) << 8;
14301004      tile |= oamram[oam--];
r5355r5356
18331407 *
18341408 * Redraw the current line.
18351409 *********************************************/
1836static void snes_refresh_scanline(bitmap_t *bitmap, UINT16 curline )
1410static void snes_refresh_scanline( running_machine *machine, bitmap_t *bitmap, UINT16 curline )
18371411{
18381412   UINT16 ii;
18391413   int x;
r5355r5356
18771451            snes_modedefs[snes_ppu.mode].drawLayer[ii](SUBSCREEN, ii, curline );
18781452      }
18791453      /* Draw the back plane */
1880#ifdef SNES_DBG_video
1454#ifdef MAME_DEBUG
18811455      if( !debug_options.bg_disabled[5] )
1882#endif /* SNES_DBG_video */
1456#endif /* MAME_DEBUG */
18831457      if( snes_ram[CGADSUB] & 0x20 )
18841458      {
18851459         for( ii = 0; ii < SNES_SCR_WIDTH * snes_htmult; ii++ )
r5355r5356
18961470            snes_modedefs[snes_ppu.mode].drawLayer[ii](MAINSCREEN, ii, curline );
18971471      }
18981472
1899#ifdef SNES_DBG_video
1900      if( snes_dbg_video(bitmap, curline ) )
1473#ifdef MAME_DEBUG
1474      if( snes_dbg_video(machine, bitmap, curline) )
19011475      {
19021476         profiler_mark(PROFILER_END);
19031477         return;
r5355r5356
19071481      if( debug_options.draw_subscreen )
19081482         scanline = &scanlines[SUBSCREEN];
19091483      else
1910#endif /* SNES_DBG_video */
1484#endif /* MAME_DEBUG */
19111485         scanline = &scanlines[MAINSCREEN];
19121486
19131487      /* Phew! Draw the line to screen */
r5355r5356
19301504   int y;
19311505
19321506   for (y = cliprect->min_y; y <= cliprect->max_y; y++)
1933      snes_refresh_scanline(bitmap, y);
1507      snes_refresh_scanline(screen->machine, bitmap, y);
19341508   return 0;
19351509}
19361510
19371511
19381512/***** Debug Functions *****/
19391513
1940#ifdef SNES_DBG_video
1514#ifdef MAME_DEBUG
19411515
1942static void snes_dbg_draw_maps(bitmap_t *bitmap, UINT32 tmap, UINT8 bpl, UINT16 curline, UINT8 layer )
1516static void snes_dbg_draw_maps( bitmap_t *bitmap, UINT32 tmap, UINT8 bpl, UINT16 curline, UINT8 layer )
19431517{
19441518   UINT32 tile, addr = tmap;
19451519   UINT16 ii, vflip, hflip, pal;
19461520   INT8 line;
1947   char str[50];
19481521
19491522   tmap += (curline >> 3) * 64;
19501523   for( ii = 0; ii < 64; ii += 2 )
r5355r5356
19761549      }
19771550   }
19781551
1979   sprintf( str, "%d : %8X  ", layer, addr );
1552   logerror("%d : %8X  ", layer, addr );
19801553   //ui_draw_text( str, 0, 227 );
19811554}
19821555
1983static void snes_dbg_draw_all_tiles(bitmap_t *bitmap, UINT32 tileaddr, UINT8 bpl, UINT16 pal )
1556static void snes_dbg_draw_all_tiles( running_machine *machine, bitmap_t *bitmap, UINT32 tileaddr, UINT8 bpl, UINT16 pal )
19841557{
19851558   UINT16 ii, jj, kk;
19861559   UINT32 addr = tileaddr;
1987   char str[50];
19881560
19891561   for( jj = 0; jj < 32; jj++ )
19901562   {
r5355r5356
20221594      }
20231595   }
20241596
2025   sprintf( str, "  %8X  ", tileaddr );
1597   logerror("  %8X  ", tileaddr );
20261598   //ui_draw_text( str, 0, 227 );
20271599}
20281600
2029static UINT8 snes_dbg_video(bitmap_t *bitmap, UINT16 curline )
1601static UINT8 snes_dbg_video( running_machine *machine, bitmap_t *bitmap, UINT16 curline )
20301602{
20311603   UINT16 ii;
20321604
r5355r5356
20361608   if( curline == 0 )
20371609   {
20381610      //UINT16 y = 1;
2039      char t[100];
20401611      static const char WINLOGIC[4] = { '|', '&', '^', '!' };
20411612
20421613      if( !debug_options.input_count-- )
r5355r5356
20641635         debug_options.input_count = 5;
20651636      }
20661637      /* Display some debug info on the screen */
2067      sprintf( t, "%s%s", debug_options.windows_disabled?" ":"W", debug_options.transparency_disabled?" ":"T" );
1638      logerror("%s%s", debug_options.windows_disabled?" ":"W", debug_options.transparency_disabled?" ":"T" );
20681639      //ui_draw_text( t, SNES_DBG_HORZ_POS, y++ * 9 );
2069      sprintf( t, "%s1 %s%s%s%s%s%c%s%s%d%s %d %4X %4X",
1640      logerror("%s1 %s%s%s%s%s%c%s%s%d%s %d %4X %4X",
20701641            debug_options.bg_disabled[0]?" ":"*",
20711642            (snes_ram[TM] & 0x1)?"M":" ",
20721643            (snes_ram[TS] & 0x1)?"S":" ",
r5355r5356
20821653            (snes_ram[BG1SC] & 0xfc) << 9,
20831654            snes_ppu.layer[0].data );
20841655      //ui_draw_text( t, SNES_DBG_HORZ_POS, y++ * 9 );
2085      sprintf( t, "%s2 %s%s%s%s%s%c%s%s%d%s %d %4X %4X",
1656      logerror("%s2 %s%s%s%s%s%c%s%s%d%s %d %4X %4X",
20861657            debug_options.bg_disabled[1]?" ":"*",
20871658            (snes_ram[TM] & 0x2)?"M":" ",
20881659            (snes_ram[TS] & 0x2)?"S":" ",
r5355r5356
20981669            (snes_ram[BG2SC] & 0xfc) << 9,
20991670            snes_ppu.layer[1].data );
21001671      //ui_draw_text( t, SNES_DBG_HORZ_POS, y++ * 9 );
2101      sprintf( t, "%s3 %s%s%s%s%s%c%s%s%d%s%s%d %4X %4X",
1672      logerror("%s3 %s%s%s%s%s%c%s%s%d%s%s%d %4X %4X",
21021673            debug_options.bg_disabled[2]?" ":"*",
21031674            (snes_ram[TM] & 0x4)?"M":" ",
21041675            (snes_ram[TS] & 0x4)?"S":" ",
r5355r5356
21151686            (snes_ram[BG3SC] & 0xfc) << 9,
21161687            snes_ppu.layer[2].data );
21171688      //ui_draw_text( t, SNES_DBG_HORZ_POS, y++ * 9 );
2118      sprintf( t, "%s4 %s%s%s%s%s%c%s%s%d%s %d %4X %4X",
1689      logerror("%s4 %s%s%s%s%s%c%s%s%d%s %d %4X %4X",
21191690            debug_options.bg_disabled[3]?" ":"*",
21201691            (snes_ram[TM] & 0x8)?"M":" ",
21211692            (snes_ram[TS] & 0x8)?"S":" ",
r5355r5356
21311702            (snes_ram[BG4SC] & 0xfc) << 9,
21321703            snes_ppu.layer[3].data );
21331704      //ui_draw_text( t, SNES_DBG_HORZ_POS, y++ * 9 );
2134      sprintf( t, "%sO %s%s%s%s%s%c%s%s%d%d       %4X",
1705      logerror("%sO %s%s%s%s%s%c%s%s%d%d       %4X",
21351706            debug_options.bg_disabled[4]?" ":"*",
21361707            (snes_ram[TM] & 0x10)?"M":" ",
21371708            (snes_ram[TS] & 0x10)?"S":" ",
r5355r5356
21441715            snes_ppu.oam.size[0], snes_ppu.oam.size[1],
21451716            snes_ppu.layer[4].data );
21461717      //ui_draw_text( t, SNES_DBG_HORZ_POS, y++ * 9 );
2147      sprintf( t, "%sB   %s  %c%s%s",
1718      logerror("%sB   %s  %c%s%s",
21481719            debug_options.bg_disabled[5]?" ":"*",
21491720            (snes_ram[CGADSUB] & 0x20)?"B":" ",
21501721            WINLOGIC[(snes_ram[WOBJLOG] & 0xc)>>2],
21511722            (snes_ram[WOBJSEL] & 0x20)?((snes_ram[WOBJSEL] & 0x10)?"o":"i"):" ",
21521723            (snes_ram[WOBJSEL] & 0x80)?((snes_ram[WOBJSEL] & 0x40)?"o":"i"):" " );
21531724      //ui_draw_text( t, SNES_DBG_HORZ_POS, y++ * 9 );
2154      sprintf( t, "1) %3d %3d   2) %3d %3d", (snes_ppu.bgd_offset.horizontal[0] & 0x3ff) >> 3, (snes_ppu.bgd_offset.vertical[0] & 0x3ff) >> 3, (snes_ppu.bgd_offset.horizontal[1] & 0x3ff) >> 3, (snes_ppu.bgd_offset.vertical[1] & 0x3ff) >> 3 );
1725      logerror("1) %3d %3d   2) %3d %3d", (snes_ppu.bgd_offset.horizontal[0] & 0x3ff) >> 3, (snes_ppu.bgd_offset.vertical[0] & 0x3ff) >> 3, (snes_ppu.bgd_offset.horizontal[1] & 0x3ff) >> 3, (snes_ppu.bgd_offset.vertical[1] & 0x3ff) >> 3 );
21551726      //ui_draw_text( t, SNES_DBG_HORZ_POS, y++ * 9 );
2156      sprintf( t, "3) %3d %3d   4) %3d %3d", (snes_ppu.bgd_offset.horizontal[2] & 0x3ff) >> 3, (snes_ppu.bgd_offset.vertical[2] & 0x3ff) >> 3, (snes_ppu.bgd_offset.horizontal[3] & 0x3ff) >> 3, (snes_ppu.bgd_offset.vertical[3] & 0x3ff) >> 3 );
1727      logerror("3) %3d %3d   4) %3d %3d", (snes_ppu.bgd_offset.horizontal[2] & 0x3ff) >> 3, (snes_ppu.bgd_offset.vertical[2] & 0x3ff) >> 3, (snes_ppu.bgd_offset.horizontal[3] & 0x3ff) >> 3, (snes_ppu.bgd_offset.vertical[3] & 0x3ff) >> 3 );
21571728      //ui_draw_text( t, SNES_DBG_HORZ_POS, y++ * 9 );
2158      sprintf( t, "Flags: %s%s%s %s %2d", (snes_ram[CGWSEL] & 0x2)?"S":"F", (snes_ram[CGADSUB] & 0x80)?"-":"+", (snes_ram[CGADSUB] & 0x40)?" 50%":"100%",(snes_ram[CGWSEL] & 0x1)?"D":"P", (snes_ram[MOSAIC] & 0xf0) >> 4 );
1729      logerror("Flags: %s%s%s %s %2d", (snes_ram[CGWSEL] & 0x2)?"S":"F", (snes_ram[CGADSUB] & 0x80)?"-":"+", (snes_ram[CGADSUB] & 0x40)?" 50%":"100%",(snes_ram[CGWSEL] & 0x1)?"D":"P", (snes_ram[MOSAIC] & 0xf0) >> 4 );
21591730      //ui_draw_text( t, SNES_DBG_HORZ_POS, y++ * 9 );
2160      sprintf( t, "SetINI: %s %s %s %s %s %s", (snes_ram[SETINI] & 0x1)?" I":"NI", (snes_ram[SETINI] & 0x2)?"P":"R", (snes_ram[SETINI] & 0x4)?"240":"225",(snes_ram[SETINI] & 0x8)?"512":"256",(snes_ram[SETINI] & 0x40)?"E":"N",(snes_ram[SETINI] & 0x80)?"ES":"NS" );
1731      logerror("SetINI: %s %s %s %s %s %s", (snes_ram[SETINI] & 0x1)?" I":"NI", (snes_ram[SETINI] & 0x2)?"P":"R", (snes_ram[SETINI] & 0x4)?"240":"225",(snes_ram[SETINI] & 0x8)?"512":"256",(snes_ram[SETINI] & 0x40)?"E":"N",(snes_ram[SETINI] & 0x80)?"ES":"NS" );
21611732      //ui_draw_text( t, SNES_DBG_HORZ_POS, y++ * 9 );
2162      sprintf( t, "Mode7: A %5d B %5d", snes_ppu.mode7.matrix_a, snes_ppu.mode7.matrix_b );
1733      logerror("Mode7: A %5d B %5d", snes_ppu.mode7.matrix_a, snes_ppu.mode7.matrix_b );
21631734      //ui_draw_text( t, SNES_DBG_HORZ_POS, y++ * 9 );
2164      sprintf( t, " %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 );
1735      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 );
21651736      //ui_draw_text( t, SNES_DBG_HORZ_POS, y++ * 9 );
2166      sprintf( t, "       X %5d Y %5d", snes_ppu.mode7.origin_x, snes_ppu.mode7.origin_y );
1737      logerror("       X %5d Y %5d", snes_ppu.mode7.origin_x, snes_ppu.mode7.origin_y );
21671738      //ui_draw_text( t, SNES_DBG_HORZ_POS, y++ * 9 );
21681739   }
21691740   /* Just for testing, draw as many tiles as possible */
r5355r5356
21911762            {
21921763               scanlines[MAINSCREEN].buffer[ii] = 0;
21931764            }
2194            snes_dbg_draw_all_tiles(bitmap, addr, dt, pal * 16 );
1765            snes_dbg_draw_all_tiles(machine, bitmap, addr, dt, pal * 16 );
21951766         }
21961767         return 1;
21971768      }
r5355r5356
22261797         return 1;
22271798            }
22281799      }
2229
1800#if 0   // 2009-08 FP: what was the purpose of these lines?
22301801         /* Draw some useful information about the back/fixed colours and current bg mode etc. */
22311802         *BITMAP_ADDR32(bitmap, curline, SNES_DBG_HORZ_POS - 26) = machine->pens[dbg_mode_colours[(snes_ram[CGWSEL] & 0xc0) >> 6]];
22321803         *BITMAP_ADDR32(bitmap, curline, SNES_DBG_HORZ_POS - 24) = machine->pens[dbg_mode_colours[(snes_ram[CGWSEL] & 0x30) >> 4]];
r5355r5356
22431814         scanlines[MAINSCREEN].buffer[snes_ram[WH1]] = machine->pens[dbg_mode_colours[0]];
22441815         scanlines[MAINSCREEN].buffer[snes_ram[WH2]] = machine->pens[dbg_mode_colours[2]];
22451816         scanlines[MAINSCREEN].buffer[snes_ram[WH3]] = machine->pens[dbg_mode_colours[2]];
2246
1817#endif
22471818   return 0;
22481819   }
22491820
2250#endif /* SNES_DBG_video */
1821#endif /* MAME_DEBUG */
src/mess/drivers/snes.c
r5355r5356
158158   PORT_DIPSETTING(   0xc, "8bpl" )
159159
160160   PORT_START("DEBUG2")   /* debug switches */
161   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON7 ) PORT_NAME("Toggle BG 1")  PORT_PLAYER(2)
162   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON8 ) PORT_NAME("Toggle BG 2")  PORT_PLAYER(2)
163   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_BUTTON9 ) PORT_NAME("Toggle BG 3")  PORT_PLAYER(2)
164   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_BUTTON10 ) PORT_NAME("Toggle BG 4")  PORT_PLAYER(2)
165   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_BUTTON7 ) PORT_NAME("Toggle Objects")  PORT_PLAYER(3)
166   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_BUTTON8 ) PORT_NAME("Toggle Main/Sub")  PORT_PLAYER(3)
167   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_BUTTON9 ) PORT_NAME("Toggle Back col")  PORT_PLAYER(3)
168   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_BUTTON10 ) PORT_NAME("Toggle Windows")  PORT_PLAYER(3)
161   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("Toggle BG 1") PORT_CODE(KEYCODE_1_PAD)
162   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("Toggle BG 2") PORT_CODE(KEYCODE_2_PAD)
163   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("Toggle BG 3") PORT_CODE(KEYCODE_3_PAD)
164   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("Toggle BG 4") PORT_CODE(KEYCODE_4_PAD)
165   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("Toggle Objects") PORT_CODE(KEYCODE_5_PAD)
166   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("Toggle Main/Sub") PORT_CODE(KEYCODE_6_PAD)
167   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("Toggle Back col") PORT_CODE(KEYCODE_7_PAD)
168   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("Toggle Windows") PORT_CODE(KEYCODE_8_PAD)
169169
170170   PORT_START("DEBUG3")   /* IN 11 : debug input */
171   PORT_BIT( 0x1, IP_ACTIVE_HIGH, IPT_BUTTON9 ) PORT_NAME("Pal prev")
172   PORT_BIT( 0x2, IP_ACTIVE_HIGH, IPT_BUTTON10 ) PORT_NAME("Pal next")
173   PORT_BIT( 0x4, IP_ACTIVE_HIGH, IPT_BUTTON7 ) PORT_NAME("Toggle Transparency")  PORT_PLAYER(4)
171   PORT_BIT( 0x1, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("Pal prev") PORT_CODE(KEYCODE_B)
172   PORT_BIT( 0x2, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("Pal next") PORT_CODE(KEYCODE_N)
173   PORT_BIT( 0x4, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("Toggle Transparency") PORT_CODE(KEYCODE_9_PAD)
174174#endif
175175INPUT_PORTS_END
176176

Previous 15994 Revisions Next


© 1998-2018 The MESS Team