Previous 199869 Revisions Next

r21123 Saturday 16th February, 2013 at 15:14:49 UTC by Angelo Salese
Death to window_control with bit pattern (wtf I was smoking that day) and old bitmap code
[src/emu/video]stvvdp2.c
[src/mame/includes]stv.h

trunk/src/mame/includes/stv.h
r21122r21123
474474      UINT8  plane_size;
475475      UINT8  colour_ram_address_offset;
476476      UINT8  fade_control;
477      UINT8  window_control;
477      struct{
478         UINT8 logic;
479         UINT8 enabled[2];
480         UINT8 area[2];
481      }window_control;
478482
479483      UINT8  line_screen_enabled;
480484      UINT8  mosaic_screen_enabled;
trunk/src/emu/video/stvvdp2.c
r21122r21123
25762576
25772577   gfxdata = m_vdp2.gfx_decode + code * 0x20;
25782578
2579   if(stv2_current_tilemap.window_control & 6)
2579   if(stv2_current_tilemap.window_control.enabled[0] ||
2580      stv2_current_tilemap.window_control.enabled[1])
25802581      popmessage("Window Enabled for RGB555 Zoom");
25812582
25822583   if (!scalex || !scaley) return;
r21122r21123
28022803   gfxdata = m_vdp2.gfx_decode + code * 0x20;
28032804   sprite_screen_width = sprite_screen_height = 8;
28042805
2805   if(stv2_current_tilemap.window_control & 6)
2806      popmessage("Window Enabled for RGB555");
2806   if(stv2_current_tilemap.window_control.enabled[0] ||
2807      stv2_current_tilemap.window_control.enabled[1])
2808      popmessage("Window Enabled for RGB555 tiles");
28072809
28082810   /* KW 991012 -- Added code to force clip to bitmap boundary */
28092811   myclip = clip;
r21122r21123
29152917   gfxdata = m_vdp2.gfx_decode + code * 0x20;
29162918   sprite_screen_width = sprite_screen_height = 8;
29172919
2918   if(stv2_current_tilemap.window_control & 6)
2919      popmessage("Window Enabled for RGB888");
2920   if(stv2_current_tilemap.window_control.enabled[0] ||
2921      stv2_current_tilemap.window_control.enabled[1])
2922      popmessage("Window Enabled for RGB888 tiles");
29202923
29212924   /* KW 991012 -- Added code to force clip to bitmap boundary */
29222925   myclip = clip;
r21122r21123
34053408
34063409void saturn_state::stv_vdp2_draw_basic_bitmap(bitmap_rgb32 &bitmap, const rectangle &cliprect)
34073410{
3408//  if(LOG_VDP2) logerror ("bitmap enable %02x size %08x depth %08x\n", stv2_current_tilemap.layer_name, stv2_current_tilemap.bitmap_size, stv2_current_tilemap.colour_depth);
3409//  popmessage ("bitmap enable %02x size %08x depth %08x number %02x", stv2_current_tilemap.layer_name, stv2_current_tilemap.bitmap_size, stv2_current_tilemap.colour_depth,stv2_current_tilemap.bitmap_palette_number);
3410   //popmessage("%04x",STV_VDP2_SCRCTL);
3411
3412   int xsize = 0, xsizemask = 0;
3413   int ysize = 0/*, ysizemask = 0*/;
3414   int xlinesize = 0/*, xpixelsize = 0*/;
3415   int xcnt,ycnt;
3416   UINT8* gfxdata = m_vdp2.gfx_decode;
3417   UINT32 *destline;
3418   UINT16 pal_color_offset = 0;
3419   UINT8* gfxdatalow, *gfxdatahigh;
3420   int screen_x,screen_y;
3421
34223411   if (!stv2_current_tilemap.enabled) return;
34233412
34243413   /* new bitmap code, supposed to rewrite the old one. Not supposed to be clean, but EFFICIENT! */
r21122r21123
34333422      }
34343423
34353424      /* intentional fall-through*/
3436      popmessage("%d %s %s %s %s",stv2_current_tilemap.colour_depth,
3425      popmessage("%d %s %s %s",stv2_current_tilemap.colour_depth,
34373426                           stv2_current_tilemap.transparency == STV_TRANSPARENCY_NONE ? "no trans" : "trans",
3438                           stv2_current_tilemap.window_control & 6 ? "window" : "no window",
34393427                           stv2_current_tilemap.colour_calculation_enabled ? "cc" : "no cc",
34403428                           (stv2_current_tilemap.incx == 0x10000 && stv2_current_tilemap.incy == 0x10000) ? "no zoom" : "zoom");
34413429   }
r21122r21123
34503438      }
34513439
34523440      /* intentional fall-through*/
3453      popmessage("%d %s %s %s %s",stv2_current_tilemap.colour_depth,
3441      popmessage("%d %s %s %s",stv2_current_tilemap.colour_depth,
34543442                           stv2_current_tilemap.transparency == STV_TRANSPARENCY_NONE ? "no trans" : "trans",
3455                           stv2_current_tilemap.window_control & 6 ? "window" : "no window",
34563443                           stv2_current_tilemap.colour_calculation_enabled ? "cc" : "no cc",
34573444                           (stv2_current_tilemap.incx == 0x10000 && stv2_current_tilemap.incy == 0x10000) ? "no zoom" : "zoom");
34583445   }
3459
3460   /* size for n0 / n1 */
3461   switch (stv2_current_tilemap.bitmap_size)
3462   {
3463      case 0: xsize=512; ysize=256; break;
3464      case 1: xsize=512; ysize=512; break;
3465      case 2: xsize=1024; ysize=256; break;
3466      case 3: xsize=1024; ysize=512; break;
3467   }
3468   xsizemask = xsize - 1;
3469   /*ysizemask = ysize - 1;*/
3470
3471   switch( stv2_current_tilemap.colour_depth )
3472   {
3473      case 0: xlinesize = xsize / 2; /*xpixelsize = 0;*/ break;
3474      case 1: xlinesize = xsize; /*xpixelsize = 1;*/ break;
3475      case 2: case 3: xlinesize = xsize * 2; /*xpixelsize = 2;*/ break;
3476      case 4: xlinesize = xsize * 4; /*xpixelsize = 4;*/ break;
3477   }
3478
3479   if(stv2_current_tilemap.colour_depth == 0)
3480      stv2_current_tilemap.scrollx /= 2;
3481   if(stv2_current_tilemap.colour_depth == 2 || stv2_current_tilemap.colour_depth == 3)
3482      stv2_current_tilemap.scrollx*=2;
3483   if(stv2_current_tilemap.colour_depth == 4)
3484      stv2_current_tilemap.scrollx*=4;
3485
3486   gfxdatalow = gfxdata + stv2_current_tilemap.bitmap_map * 0x20000;
3487   gfxdata+=(
3488   (stv2_current_tilemap.scrollx & (xlinesize-1)) +
3489   ((stv2_current_tilemap.scrolly & (ysize-1)) * (xlinesize)) + /* TODO: mask ysize, check me! */
3490   (stv2_current_tilemap.bitmap_map * 0x20000)
3491   );
3492   gfxdatahigh = gfxdatalow + xlinesize*ysize;
3493
3494//  popmessage("%04x %04x",stv2_current_tilemap.scrollx,stv2_current_tilemap.scrolly);
3495
3496   /*Enable fading bit*/
3497   if(stv2_current_tilemap.fade_control & 1)
3498   {
3499      /*Select fading bit*/
3500      pal_color_offset += ((stv2_current_tilemap.fade_control & 2) ? (2*2048) : (2048));
3501   }
3502
3503   stv2_current_tilemap.bitmap_palette_number+=stv2_current_tilemap.colour_ram_address_offset;
3504   stv2_current_tilemap.bitmap_palette_number&=7;//safety check
3505
3506   screen_x = machine().primary_screen->visible_area().max_x;
3507   screen_y = machine().primary_screen->visible_area().max_y;
3508
3509   switch(stv2_current_tilemap.colour_depth)
3510   {
3511      /*Palette Format*/
3512      case 0:
3513         for (ycnt = 0; ycnt <ysize;ycnt++)
3514         {
3515            for (xcnt = 0; xcnt <xsize;xcnt+=2)
3516            {
3517               if (!stv_vdp2_window_process(xcnt+1,ycnt))
3518               {
3519                  if ((gfxdata[0] & 0x0f) || (stv2_current_tilemap.transparency == STV_TRANSPARENCY_NONE))
3520                  {
3521                     if (((xcnt + 1) <= screen_x) && (ycnt <= screen_y))
3522                     {
3523                        if ( stv2_current_tilemap.colour_calculation_enabled == 0 )
3524                           bitmap.pix32(ycnt, xcnt+1) = machine().pens[((gfxdata[0] & 0x0f) >> 0) | (stv2_current_tilemap.bitmap_palette_number * 0x100) | pal_color_offset];
3525                        else
3526                           bitmap.pix32(ycnt, xcnt+1) = alpha_blend_r32(bitmap.pix32(ycnt, xcnt+1), machine().pens[((gfxdata[0] & 0x0f) >> 0) | (stv2_current_tilemap.bitmap_palette_number * 0x100) | pal_color_offset], stv2_current_tilemap.alpha);
3527                     }
3528                  }
3529               }
3530               if (!stv_vdp2_window_process(xcnt,ycnt))
3531               {
3532                  if ((gfxdata[0] & 0xf0) || (stv2_current_tilemap.transparency == STV_TRANSPARENCY_NONE))
3533                  {
3534                     if (((xcnt + 0) <= screen_x) && (ycnt <= screen_y))
3535                     {
3536                        if ( stv2_current_tilemap.colour_calculation_enabled == 0 )
3537                           bitmap.pix32(ycnt, xcnt) = machine().pens[((gfxdata[0] & 0xf0) >> 4) | (stv2_current_tilemap.bitmap_palette_number * 0x100) | pal_color_offset];
3538                        else
3539                           bitmap.pix32(ycnt, xcnt) = alpha_blend_r32(bitmap.pix32(ycnt, xcnt), machine().pens[((gfxdata[0] & 0xf0) >> 4) | (stv2_current_tilemap.bitmap_palette_number * 0x100) | pal_color_offset], stv2_current_tilemap.alpha);
3540                     }
3541                  }
3542               }
3543               gfxdata++;
3544               if ( gfxdata >= gfxdatahigh ) gfxdata = gfxdatalow;
3545            }
3546         }
3547         break;
3548      case 1:
3549         if ( stv2_current_tilemap.incx == 0x10000 && stv2_current_tilemap.incy == 0x10000 )
3550         {
3551            //int gfx_wraparound = -1;
3552
3553            gfxdata += xlinesize*cliprect.min_y;
3554
3555            for (ycnt = cliprect.min_y; ycnt <= cliprect.max_y; ycnt++)
3556            {
3557               for (xcnt = cliprect.min_x; xcnt <= cliprect.max_x; xcnt++)
3558               {
3559                  int xs = xcnt & xsizemask;
3560
3561                  if (!stv_vdp2_window_process(xcnt,ycnt))
3562                  {
3563                     //60aee2c = $0013 at @605d838
3564                     if ((gfxdata[xs] & 0xff) || (stv2_current_tilemap.transparency == STV_TRANSPARENCY_NONE))
3565                     {
3566                        if (((xcnt + 0) <= screen_x) && (ycnt <= screen_y))
3567                        {
3568                           if ( stv2_current_tilemap.colour_calculation_enabled == 0 )
3569                              bitmap.pix32(ycnt, xcnt) = machine().pens[(gfxdata[xs] & 0xff) | (stv2_current_tilemap.bitmap_palette_number * 0x100) | pal_color_offset];
3570                           else
3571                              bitmap.pix32(ycnt, xcnt) = alpha_blend_r32(bitmap.pix32(ycnt, xcnt), machine().pens[(gfxdata[xs] & 0xff) | (stv2_current_tilemap.bitmap_palette_number * 0x100) | pal_color_offset], stv2_current_tilemap.alpha);
3572                        }
3573                     }
3574                  }
3575                  if ( (gfxdata + xs) >= gfxdatahigh )
3576                  {
3577                     //gfx_wraparound = (ycnt << 16) | xcnt;
3578                     gfxdata = gfxdatalow - xs;
3579                  }
3580               }
3581               if ( (gfxdata + xlinesize) < gfxdatahigh )
3582               {
3583                  gfxdata += xlinesize;
3584               }
3585               else
3586               {
3587                  gfxdata = gfxdatalow + ((gfxdata + xlinesize) - gfxdatahigh);
3588               }
3589            }
3590
3591         }
3592         else
3593         {
3594            int xx, xs, yy=0;
3595            for (ycnt = cliprect.min_y; ycnt <= cliprect.max_y; yy+=stv2_current_tilemap.incy, ycnt++ )
3596            {
3597               gfxdata += xlinesize*(yy>>16);
3598               yy &= 0xffff;
3599
3600               xx = 0;
3601               for (xcnt = cliprect.min_x; xcnt <= cliprect.max_x; xx+=stv2_current_tilemap.incx, xcnt++)
3602               {
3603                  xs = xx >> 16;
3604                  if (!stv_vdp2_window_process(xcnt,ycnt))
3605                  {
3606                     if ((gfxdata[xs] & 0xff) || (stv2_current_tilemap.transparency == STV_TRANSPARENCY_NONE))
3607                     {
3608                        if (((xcnt + 0) <= screen_x) && (ycnt <= screen_y))
3609                        {
3610                           if ( stv2_current_tilemap.colour_calculation_enabled == 0 )
3611                              bitmap.pix32(ycnt, xcnt) = machine().pens[(gfxdata[xs] & 0xff) | (stv2_current_tilemap.bitmap_palette_number * 0x100) | pal_color_offset];
3612                           else
3613                              bitmap.pix32(ycnt, xcnt) = alpha_blend_r32(bitmap.pix32(ycnt, xcnt), machine().pens[(gfxdata[xs] & 0xff) | (stv2_current_tilemap.bitmap_palette_number * 0x100) | pal_color_offset], stv2_current_tilemap.alpha);
3614                        }
3615                     }
3616                  }
3617
3618                  if ( (gfxdata + xs) >= gfxdatahigh ) gfxdata = gfxdatalow;
3619
3620               }
3621            }
3622         }
3623         break;
3624      case 2:
3625         for (ycnt = 0; ycnt <ysize;ycnt++)
3626         {
3627            for (xcnt = 0; xcnt <xsize;xcnt++)
3628            {
3629               if (!stv_vdp2_window_process(xcnt,ycnt))
3630               {
3631                  if (((gfxdata[0] & 0x07) | (gfxdata[1] & 0xff)) || (stv2_current_tilemap.transparency == STV_TRANSPARENCY_NONE))
3632                  {
3633                     if (((xcnt + 0) <= screen_x) && (ycnt <= screen_y))
3634                     {
3635                        if ( stv2_current_tilemap.colour_calculation_enabled == 0 )
3636                           bitmap.pix32(ycnt, xcnt) = machine().pens[((gfxdata[0] & 0x07) * 0x100) | (gfxdata[1] & 0xff) | pal_color_offset];
3637                        else
3638                           bitmap.pix32(ycnt, xcnt) = alpha_blend_r32(bitmap.pix32(ycnt, xcnt), machine().pens[((gfxdata[0] & 0x07) * 0x100) | (gfxdata[1] & 0xff) | pal_color_offset], stv2_current_tilemap.alpha);
3639                     }
3640                  }
3641               }
3642
3643               gfxdata+=2;
3644               if ( gfxdata >= gfxdatahigh ) gfxdata = gfxdatalow;
3645            }
3646         }
3647         break;
3648      /*RGB format*/
3649      /*
3650      M                     L
3651      S                     S
3652      B                     B
3653      --------BBBBBGGGGGRRRRR
3654      */
3655      case 3:
3656         if ( stv2_current_tilemap.incx == 0x10000 && stv2_current_tilemap.incy == 0x10000 )
3657         {
3658            /* adjust for cliprect */
3659            gfxdata += xlinesize*cliprect.min_y;
3660
3661            for (ycnt = cliprect.min_y; ycnt <= cliprect.max_y; ycnt++)
3662            {
3663               destline = &bitmap.pix32(ycnt);
3664
3665               for (xcnt = cliprect.min_x; xcnt <= cliprect.max_x; xcnt++)
3666               {
3667                  int r,g,b;
3668                  int xs = xcnt & xsizemask;
3669
3670                  if ((gfxdata[2*xs] & 0x80) || (stv2_current_tilemap.transparency == STV_TRANSPARENCY_NONE))
3671                  {
3672                     b = pal5bit(((gfxdata[2*xs] & 0x7c) >> 2));
3673                     g = pal5bit(((gfxdata[2*xs] & 0x03) << 3) | ((gfxdata[2*xs+1] & 0xe0) >> 5));
3674                     r = pal5bit(gfxdata[2*xs+1] & 0x1f);
3675                     if(stv2_current_tilemap.fade_control & 1)
3676                        stv_vdp2_compute_color_offset(&r,&g,&b,stv2_current_tilemap.fade_control & 2);
3677
3678                     if (!stv_vdp2_window_process(xcnt,ycnt))
3679                     {
3680                        if (((xcnt + 0) <= screen_x) && (ycnt <= screen_y))
3681                        {
3682                           if ( stv2_current_tilemap.colour_calculation_enabled == 0 )
3683                              destline[xcnt] = MAKE_RGB(r, g, b);
3684                           else
3685                              destline[xcnt] = alpha_blend_r32( destline[xcnt], MAKE_RGB(r, g, b), stv2_current_tilemap.alpha );
3686                        }
3687                     }
3688                  }
3689
3690                  if ( (gfxdata + 2*xs) >= gfxdatahigh ) gfxdata = gfxdatalow;
3691               }
3692
3693               gfxdata += xlinesize;
3694               if ( gfxdata >= gfxdatahigh ) gfxdata = gfxdatalow + (gfxdata - gfxdatahigh);
3695            }
3696
3697         }
3698         else
3699         {
3700            int xx, xs, yy=0;
3701
3702            for (ycnt = cliprect.min_y; ycnt <= cliprect.max_y; yy+=stv2_current_tilemap.incy, ycnt++ )
3703            {
3704               gfxdata += xlinesize*(yy>>16);
3705               yy &= 0xffff;
3706
3707               destline = &bitmap.pix32(ycnt);
3708               xx = 0;
3709               for (xcnt = cliprect.min_x; xcnt <= cliprect.max_x; xx+=stv2_current_tilemap.incx, xcnt++)
3710               {
3711                  int r,g,b;
3712
3713                  xs = xx >> 16;
3714                  b = pal5bit(((gfxdata[2*xs] & 0x7c) >> 2));
3715                  g = pal5bit(((gfxdata[2*xs] & 0x03) << 3) | ((gfxdata[2*xs+1] & 0xe0) >> 5));
3716                  r = pal5bit(gfxdata[2*xs+1] & 0x1f);
3717                  if(stv2_current_tilemap.fade_control & 1)
3718                     stv_vdp2_compute_color_offset( &r,&g,&b,stv2_current_tilemap.fade_control & 2);
3719
3720                  if (!stv_vdp2_window_process(xcnt,ycnt))
3721                  {
3722                     if ((gfxdata[2*xs] & 0x80) || (stv2_current_tilemap.transparency == STV_TRANSPARENCY_NONE))
3723                     {
3724                        if (((xcnt + 0) <= screen_x) && (ycnt <= screen_y))
3725                        {
3726                        if ( stv2_current_tilemap.colour_calculation_enabled == 1 )
3727                           destline[xcnt] = alpha_blend_r32( destline[xcnt], MAKE_RGB(r, g, b), stv2_current_tilemap.alpha );
3728                        else
3729                           destline[xcnt] = MAKE_RGB(r, g, b);
3730                        }
3731                     }
3732                  }
3733
3734                  if ( (gfxdata + 2*xs) >= gfxdatahigh ) gfxdata = gfxdatalow;
3735               }
3736               /*Guess: myfairlady needs that the vertical resolution is doubled because it's using the double density mode.*/
3737               if(STV_VDP2_LSMD == 3) { gfxdata += xlinesize*(yy>>16); }
3738               else                   { gfxdata += xlinesize; }
3739               if ( gfxdata >= gfxdatahigh ) gfxdata = gfxdatalow + (gfxdata - gfxdatahigh);
3740            }
3741         }
3742         break;
3743      /*
3744      M                              L
3745      S                              S
3746      B                              B
3747      --------BBBBBBBBGGGGGGGGRRRRRRRR
3748      */
3749      case 4:
3750         /* adjust for cliprect */
3751         gfxdata += xlinesize*(cliprect.min_y);
3752
3753         for (ycnt = cliprect.min_y; ycnt <= cliprect.max_y; ycnt++)
3754         {
3755            destline = &bitmap.pix32(ycnt);
3756
3757            for (xcnt = cliprect.min_x; xcnt <= cliprect.max_x; xcnt++)
3758            {
3759               int r,g,b;
3760               int xs = xcnt & xsizemask;
3761               UINT32 dot_data;
3762
3763               dot_data = (gfxdata[4*xs+0]<<24)|(gfxdata[4*xs+1]<<16)|(gfxdata[4*xs+2]<<8)|(gfxdata[4*xs+3]<<0);
3764               if ((dot_data & 0x80000000) || (stv2_current_tilemap.transparency == STV_TRANSPARENCY_NONE))
3765               {
3766                  b = ((dot_data & 0x00ff0000) >> 16);
3767                  g = ((dot_data & 0x0000ff00) >> 8);
3768                  r = ((dot_data & 0x000000ff) >> 0);
3769
3770                  if(stv2_current_tilemap.fade_control & 1)
3771                     stv_vdp2_compute_color_offset(&r,&g,&b,stv2_current_tilemap.fade_control & 2);
3772
3773                  if (!stv_vdp2_window_process(xcnt,ycnt))
3774                  {
3775                     if (((xcnt + 0) <= screen_x) && (ycnt <= screen_y))
3776                     {
3777                        if ( stv2_current_tilemap.colour_calculation_enabled == 0 )
3778                           destline[xcnt] = MAKE_RGB(r, g, b);
3779                        else
3780                           destline[xcnt] = alpha_blend_r32( destline[xcnt], MAKE_RGB(r, g, b), stv2_current_tilemap.alpha );
3781                     }
3782                  }
3783               }
3784
3785               if ( (gfxdata + 4*xs) >= gfxdatahigh ) gfxdata = gfxdatalow;
3786            }
3787
3788            gfxdata += xlinesize;
3789            if ( gfxdata >= gfxdatahigh ) gfxdata = gfxdatalow + (gfxdata - gfxdatahigh);
3790         }
3791
3792         break;
3793   }
37943446}
37953447
37963448   /*---------------------------------------------------------------------------
r21122r21123
52454897   stv2_current_tilemap.colour_ram_address_offset = STV_VDP2_N0CAOS;
52464898   stv2_current_tilemap.fade_control = (STV_VDP2_N0COEN * 1) | (STV_VDP2_N0COSL * 2);
52474899   stv_vdp2_check_fade_control_for_layer();
5248   stv2_current_tilemap.window_control = (STV_VDP2_N0LOG << 0) |
5249                                 (STV_VDP2_N0W0E << 1) |
5250                                 (STV_VDP2_N0W1E << 2) |
5251                                 (STV_VDP2_N0SWE << 3) |
5252                                 (STV_VDP2_N0W0A << 4) |
5253                                 (STV_VDP2_N0W1A << 5) |
5254                                 (STV_VDP2_N0SWA << 6);
4900   stv2_current_tilemap.window_control.logic = STV_VDP2_N0LOG;
4901   stv2_current_tilemap.window_control.enabled[0] = STV_VDP2_N0W0E;
4902   stv2_current_tilemap.window_control.enabled[1] = STV_VDP2_N0W1E;
4903//   stv2_current_tilemap.window_control.? = STV_VDP2_N0SWE;
4904   stv2_current_tilemap.window_control.area[0] = STV_VDP2_N0W0A;
4905   stv2_current_tilemap.window_control.area[1] = STV_VDP2_N0W1A;
4906//   stv2_current_tilemap.window_control.? = STV_VDP2_N0SWA;
52554907
52564908   stv2_current_tilemap.line_screen_enabled = STV_VDP2_N0LCEN;
52574909   stv2_current_tilemap.mosaic_screen_enabled = STV_VDP2_N0MZE;
r21122r21123
53454997   stv2_current_tilemap.colour_ram_address_offset = STV_VDP2_N1CAOS;
53464998   stv2_current_tilemap.fade_control = (STV_VDP2_N1COEN * 1) | (STV_VDP2_N1COSL * 2);
53474999   stv_vdp2_check_fade_control_for_layer();
5348   stv2_current_tilemap.window_control = (STV_VDP2_N1LOG << 0) |
5349                                 (STV_VDP2_N1W0E << 1) |
5350                                 (STV_VDP2_N1W1E << 2) |
5351                                 (STV_VDP2_N1SWE << 3) |
5352                                 (STV_VDP2_N1W0A << 4) |
5353                                 (STV_VDP2_N1W1A << 5) |
5354                                 (STV_VDP2_N1SWA << 6);
5000   stv2_current_tilemap.window_control.logic = STV_VDP2_N1LOG;
5001   stv2_current_tilemap.window_control.enabled[0] = STV_VDP2_N1W0E;
5002   stv2_current_tilemap.window_control.enabled[1] = STV_VDP2_N1W1E;
5003//   stv2_current_tilemap.window_control.? = STV_VDP2_N1SWE;
5004   stv2_current_tilemap.window_control.area[0] = STV_VDP2_N1W0A;
5005   stv2_current_tilemap.window_control.area[1] = STV_VDP2_N1W1A;
5006//   stv2_current_tilemap.window_control.? = STV_VDP2_N1SWA;
53555007
53565008   stv2_current_tilemap.line_screen_enabled = STV_VDP2_N1LCEN;
53575009   stv2_current_tilemap.mosaic_screen_enabled = STV_VDP2_N1MZE;
r21122r21123
54465098   stv2_current_tilemap.colour_ram_address_offset = STV_VDP2_N2CAOS;
54475099   stv2_current_tilemap.fade_control = (STV_VDP2_N2COEN * 1) | (STV_VDP2_N2COSL * 2);
54485100   stv_vdp2_check_fade_control_for_layer();
5449   stv2_current_tilemap.window_control = (STV_VDP2_N2LOG << 0) |
5450                                 (STV_VDP2_N2W0E << 1) |
5451                                 (STV_VDP2_N2W1E << 2) |
5452                                 (STV_VDP2_N2SWE << 3) |
5453                                 (STV_VDP2_N2W0A << 4) |
5454                                 (STV_VDP2_N2W1A << 5) |
5455                                 (STV_VDP2_N2SWA << 6);
5101   stv2_current_tilemap.window_control.logic = STV_VDP2_N2LOG;
5102   stv2_current_tilemap.window_control.enabled[0] = STV_VDP2_N2W0E;
5103   stv2_current_tilemap.window_control.enabled[1] = STV_VDP2_N2W1E;
5104//   stv2_current_tilemap.window_control.? = STV_VDP2_N2SWE;
5105   stv2_current_tilemap.window_control.area[0] = STV_VDP2_N2W0A;
5106   stv2_current_tilemap.window_control.area[1] = STV_VDP2_N2W1A;
5107//   stv2_current_tilemap.window_control.? = STV_VDP2_N2SWA;
54565108
54575109   stv2_current_tilemap.line_screen_enabled = STV_VDP2_N2LCEN;
54585110   stv2_current_tilemap.mosaic_screen_enabled = STV_VDP2_N2MZE;
r21122r21123
55495201   stv2_current_tilemap.colour_ram_address_offset = STV_VDP2_N3CAOS;
55505202   stv2_current_tilemap.fade_control = (STV_VDP2_N3COEN * 1) | (STV_VDP2_N3COSL * 2);
55515203   stv_vdp2_check_fade_control_for_layer();
5552   stv2_current_tilemap.window_control = (STV_VDP2_N3LOG << 0) |
5553                                 (STV_VDP2_N3W0E << 1) |
5554                                 (STV_VDP2_N3W1E << 2) |
5555                                 (STV_VDP2_N3SWE << 3) |
5556                                 (STV_VDP2_N3W0A << 4) |
5557                                 (STV_VDP2_N3W1A << 5) |
5558                                 (STV_VDP2_N3SWA << 6);
5204   stv2_current_tilemap.window_control.logic = STV_VDP2_N3LOG;
5205   stv2_current_tilemap.window_control.enabled[0] = STV_VDP2_N3W0E;
5206   stv2_current_tilemap.window_control.enabled[1] = STV_VDP2_N3W1E;
5207//   stv2_current_tilemap.window_control.? = STV_VDP2_N3SWE;
5208   stv2_current_tilemap.window_control.area[0] = STV_VDP2_N3W0A;
5209   stv2_current_tilemap.window_control.area[1] = STV_VDP2_N3W1A;
5210//   stv2_current_tilemap.window_control.? = STV_VDP2_N3SWA;
55595211
55605212   stv2_current_tilemap.line_screen_enabled = STV_VDP2_N3LCEN;
55615213   stv2_current_tilemap.mosaic_screen_enabled = STV_VDP2_N3MZE;
r21122r21123
55795231   int planesizex = 0, planesizey = 0;
55805232   int planerenderedsizex, planerenderedsizey;
55815233   UINT8 colour_calculation_enabled;
5582   UINT8 window_control;
55835234   UINT8 fade_control;
55845235
55855236   if ( iRP == 1)
r21122r21123
57055356
57065357      colour_calculation_enabled = stv2_current_tilemap.colour_calculation_enabled;
57075358      stv2_current_tilemap.colour_calculation_enabled = 0;
5708      window_control = stv2_current_tilemap.window_control;
5709      stv2_current_tilemap.window_control = 0;
5359//      window_control = stv2_current_tilemap.window_control;
5360//      stv2_current_tilemap.window_control = 0;
57105361      fade_control = stv2_current_tilemap.fade_control;
57115362      stv2_current_tilemap.fade_control = 0;
57125363      g_profiler.start(PROFILER_USER1);
r21122r21123
57385389
57395390      mycliprect = cliprect;
57405391
5741      if ( window_control )
5392      /* TODO: remove me. */
5393      if ( stv2_current_tilemap.window_control.enabled[0] || stv2_current_tilemap.window_control.enabled[1] )
57425394      {
57435395         //popmessage("Window control for RBG");
5744         stv2_current_tilemap.window_control = window_control;
5396         stv2_current_tilemap.window_control.enabled[0] = 0;
5397         stv2_current_tilemap.window_control.enabled[1] = 0;
57455398         stv_vdp2_apply_window_on_layer(mycliprect);
57465399      }
57475400
r21122r21123
58095462   stv2_current_tilemap.colour_ram_address_offset = STV_VDP2_R0CAOS;
58105463   stv2_current_tilemap.fade_control = (STV_VDP2_R0COEN * 1) | (STV_VDP2_R0COSL * 2);
58115464   stv_vdp2_check_fade_control_for_layer();
5812   stv2_current_tilemap.window_control = (STV_VDP2_R0LOG << 0) |
5813                                 (STV_VDP2_R0W0E << 1) |
5814                                 (STV_VDP2_R0W1E << 2) |
5815                                 (STV_VDP2_R0SWE << 3) |
5816                                 (STV_VDP2_R0W0A << 4) |
5817                                 (STV_VDP2_R0W1A << 5) |
5818                                 (STV_VDP2_R0SWA << 6);
5465   stv2_current_tilemap.window_control.logic = STV_VDP2_R0LOG;
5466   stv2_current_tilemap.window_control.enabled[0] = STV_VDP2_R0W0E;
5467   stv2_current_tilemap.window_control.enabled[1] = STV_VDP2_R0W1E;
5468//   stv2_current_tilemap.window_control.? = STV_VDP2_R0SWE;
5469   stv2_current_tilemap.window_control.area[0] = STV_VDP2_R0W0A;
5470   stv2_current_tilemap.window_control.area[1] = STV_VDP2_R0W1A;
5471//   stv2_current_tilemap.window_control.? = STV_VDP2_R0SWA;
58195472
58205473   stv2_current_tilemap.scrollx = 0;
58215474   stv2_current_tilemap.scrolly = 0;
r21122r21123
59545607            stv_rbg_cache_data.watch_vdp2_vram_writes &= ~STV_VDP2_RBG_ROTATION_PARAMETER_B;
59555608         }
59565609      }
5957
59585610   }
5959
59605611}
59615612
59625613READ16_MEMBER ( saturn_state::saturn_vdp2_regs_r )
r21122r21123
65916242   int res;
65926243
65936244   res = 1;
6594   if(stv2_current_tilemap.window_control & (2 << win_num))
6245   if(stv2_current_tilemap.window_control.enabled[win_num])
65956246   {
6596      if(stv2_current_tilemap.window_control & (0x10 << win_num))
6247      if(stv2_current_tilemap.window_control.area[win_num])
65976248         res = (y >= s_y && y <= e_y && x >= s_x && x <= e_x);
65986249      else
65996250         res = (y >= s_y && y <= e_y && x >= s_x && x <= e_x) ^ 1;
r21122r21123
66076258   int s_x=0,e_x=0,s_y=0,e_y=0;
66086259   int w0_pix, w1_pix;
66096260
6610   if ((stv2_current_tilemap.window_control & 6) == 0)
6261   if (stv2_current_tilemap.window_control.enabled[0] == 0 &&
6262       stv2_current_tilemap.window_control.enabled[1] == 0)
66116263      return 1;
66126264
66136265   stv_vdp2_get_window0_coordinates(&s_x, &e_x, &s_y, &e_y);
r21122r21123
66166268   stv_vdp2_get_window1_coordinates(&s_x, &e_x, &s_y, &e_y);
66176269   w1_pix = get_window_pixel(s_x,e_x,s_y,e_y,x,y,1);
66186270
6619   return stv2_current_tilemap.window_control & 1 ? (w0_pix | w1_pix) : (w0_pix & w1_pix);
6271   return stv2_current_tilemap.window_control.logic & 1 ? (w0_pix | w1_pix) : (w0_pix & w1_pix);
66206272}
66216273
6274/* TODO: remove this crap. */
66226275int saturn_state::stv_vdp2_apply_window_on_layer(rectangle &cliprect)
66236276{
66246277   int s_x=0,e_x=0,s_y=0,e_y=0;
66256278
6626   if ( stv2_current_tilemap.window_control == 0x12 )
6279   if ( stv2_current_tilemap.window_control.enabled[0] && stv2_current_tilemap.window_control.area[0])
66276280   {
66286281      /* w0, transparent outside supported */
66296282      stv_vdp2_get_window0_coordinates(&s_x, &e_x, &s_y, &e_y);
r21122r21123
66356288
66366289      return 1;
66376290   }
6638   else if ( stv2_current_tilemap.window_control == 0x24 )
6291   else if ( stv2_current_tilemap.window_control.enabled[1] && stv2_current_tilemap.window_control.area[1] )
66396292   {
66406293      /* w1, transparent outside supported */
66416294      stv_vdp2_get_window1_coordinates(&s_x, &e_x, &s_y, &e_y);
r21122r21123
67576410      double_x = 0;
67586411
67596412   /* window control */
6760   stv2_current_tilemap.window_control = (STV_VDP2_SPLOG * 0x01) |
6761                                 (STV_VDP2_SPW0E * 0x02) |
6762                                 (STV_VDP2_SPW1E * 0x04) |
6763                                 (STV_VDP2_SPSWE * 0x08) |
6764                                 (STV_VDP2_SPW0A * 0x10) |
6765                                 (STV_VDP2_SPW1A * 0x20) |
6766                                 (STV_VDP2_SPSWA * 0x40);
6413   stv2_current_tilemap.window_control.logic = STV_VDP2_SPLOG;
6414   stv2_current_tilemap.window_control.enabled[0] = STV_VDP2_SPW0E;
6415   stv2_current_tilemap.window_control.enabled[1] = STV_VDP2_SPW1E;
6416//   stv2_current_tilemap.window_control.? = STV_VDP2_SPSWE;
6417   stv2_current_tilemap.window_control.area[0] = STV_VDP2_SPW0A;
6418   stv2_current_tilemap.window_control.area[1] = STV_VDP2_SPW1A;
6419//   stv2_current_tilemap.window_control.? = STV_VDP2_SPSWA;
67676420
67686421//   stv_vdp2_apply_window_on_layer(mycliprect);
67696422

Previous 199869 Revisions Next


© 1997-2024 The MAME Team