Previous 15994 Revisions Next

r12415 Sunday 31st July, 2011 at 16:11:02 UTC by Angelo Salese
Rewrote VDP2 back screen, fixes at least background color in Fuusui Sensei
[src/mame/video]stvvdp2.c

src/mame/video/stvvdp2.c
r12414r12415
14031403   #define STV_VDP2_BKTA_UL (state->m_vdp2_regs[0x0ac/4])
14041404
14051405   #define STV_VDP2_BKCLMD ((STV_VDP2_BKTA_UL & 0x80000000) >> 31)
1406   #define STV_VDP2_BKTA   ((STV_VDP2_BKTA_UL & 0x0003ffff) >> 0)
1407   /*MSB of this register is used when the extra RAM cart is used,ignore it for now.*/
1408   //  #define STV_VDP2_BKTA   ((STV_VDP2_BKTA_UL & 0x0007ffff) >> 0)
1406   #define STV_VDP2_BKTA   ((STV_VDP2_BKTA_UL & 0x0007ffff) >> 0)
14091407
14101408/* 1800b0 - RPMD - Rotation Parameter Mode
14111409 bit-> /----15----|----14----|----13----|----12----|----11----|----10----|----09----|----08----\
r12414r12415
52705268static void stv_vdp2_draw_back(running_machine &machine, bitmap_t *bitmap, const rectangle *cliprect)
52715269{
52725270   saturn_state *state = machine.driver_data<saturn_state>();
5273   int xcnt,ycnt;
5271   int x,y;
52745272   UINT8* gfxdata = state->m_vdp2.gfx_decode;
5275   static UINT16 *destline;
5276   int r,b,g;
5277   UINT16 data;
5273   UINT32 base_offs,base_mask;
52785274
5279   if(!(STV_VDP2_BDCLMD & 1))
5275   //popmessage("Back screen %08x %08x %08x",STV_VDP2_BDCLMD,STV_VDP2_BKCLMD,STV_VDP2_BKTA);
5276
5277   /* draw black if BDCLMD and DISP are cleared */
5278   if(!(STV_VDP2_BDCLMD) && !(STV_VDP2_DISP))
52805279      bitmap_fill(bitmap, cliprect, get_black_pen(machine));
52815280   else
52825281   {
5283      #if DEBUG_MODE
5284      //popmessage("Back screen enabled %08x",STV_VDP2_BKTA);
5285      #endif
5286      gfxdata+=((STV_VDP2_BKTA)<<1);
5282      base_mask = STV_VDP2_VRAMSZ ? 0x7ffff : 0x3ffff;
52875283
5288      b = ((gfxdata[0] & 0x7c) >> 2);
5289      g = ((gfxdata[0] & 0x03) << 3) | ((gfxdata[1] & 0xe0) >> 5);
5290      r = ((gfxdata[1] & 0x1f));
5291      data = b | g << 5 | r << 10;
5292
5293      for (ycnt = cliprect->min_y; ycnt <= cliprect->max_y;ycnt++)
5284      for(y=cliprect->min_y;y<=cliprect->max_y;y++)
52945285      {
5295         destline = BITMAP_ADDR16(bitmap, ycnt, 0);
5286         base_offs = (STV_VDP2_BKTA & base_mask) << 1;
5287         if(STV_VDP2_BKCLMD)
5288            base_offs += (y << 1);
52965289
5297         for (xcnt = cliprect->min_x; xcnt <=cliprect->max_x;xcnt++)
5290         for(x=cliprect->min_x;x<=cliprect->max_x;x++)
52985291         {
5299            destline[xcnt] = data;
5292            int r,g,b;
5293            UINT16 dot;
5294
5295            dot = (gfxdata[base_offs+0]<<8)|gfxdata[base_offs+1];
5296            b = (dot & 0x7c00) >> 10;
5297            g = (dot & 0x03e0) >> 5;
5298            r = (dot & 0x001f) >> 0;
5299
5300            *BITMAP_ADDR16(bitmap, y,x) = b | g << 5 | r << 10;
53005301         }
5301         if(STV_VDP2_BKCLMD)
5302         {
5303            gfxdata+=2;
5304            b = ((gfxdata[0] & 0x7c) >> 2);
5305            g = ((gfxdata[0] & 0x03) << 3) | ((gfxdata[1] & 0xe0) >> 5);
5306            r = ((gfxdata[1] & 0x1f));
5307            data = b | g << 5 | r << 10;
5308         }
53095302      }
53105303   }
53115304}

Previous 15994 Revisions Next


© 1998-2018 The MESS Team