Previous 15994 Revisions Next

r12503 Saturday 6th August, 2011 at 16:29:19 UTC by Angelo Salese
Implemented VDP2 window AND logic
[src/mame/video]stvvdp2.c

src/mame/video/stvvdp2.c
r12502r12503
43684368      //   popmessage("Line Window %s %08x enabled, contact MAMEdev",STV_VDP2_W0LWE ? "0" : "1",STV_VDP2_W0LWTA);
43694369
43704370      /* Akumajou Dracula, bits 2-4 */
4371      /* Arcana Strikes bit 5*/
4371      /* Arcana Strikes bit 5 */
43724372      /* Choh Makai Mura 0x0055 */
43734373      /* Sega Rally 0x0155 */
4374      if(STV_VDP2_SFPRMD & ~0x0155)
4374      /* Find Love  0x4400 */
4375      if(STV_VDP2_SFPRMD & ~0x4555)
43754376         popmessage("Special Priority Mode enabled %04x, contact MAMEdev",STV_VDP2_SFPRMD);
43764377   }
43774378}
r12502r12503
55715572
55725573   switch(offset)
55735574   {
5574      case 0x0/4:
5575      case 0x000/4:
55755576      {
55765577         /* latch h/v signals thru HV latch*/
55775578         if(!STV_VDP2_EXLTEN)
r12502r12503
55855586
55865587         break;
55875588      }
5588      case 0x4/4:
5589      case 0x004/4:
55895590      {
55905591         /*Screen Status Register*/
55915592                               /*VBLANK              HBLANK            ODD               PAL    */
5592         state->m_vdp2_regs[offset] = (state->m_vdp2.exltfg<<25) | (state->m_vdp2.exsyfg<<24) | (get_vblank(space->machine())<<19) | (get_hblank(space->machine())<<18) | (get_odd_bit(space->machine()) << 17) | (state->m_vdp2.pal << 16);
5593         state->m_vdp2_regs[offset] = (state->m_vdp2.exltfg<<25) |
5594                               (state->m_vdp2.exsyfg<<24) |
5595                               (get_vblank(space->machine())<<19) |
5596                               (get_hblank(space->machine())<<18) |
5597                               (get_odd_bit(space->machine()) << 17) |
5598                               (state->m_vdp2.pal << 16) |
5599                               (STV_VDP2_VRAMSZ << 15) |
5600                               ((0 << 0) & 0xf); // VDP2 version
55935601
55945602         /* vblank bit is always 1 if DISP bit is disabled */
55955603         if(!STV_VDP2_DISP)
r12502r12503
56015609            state->m_vdp2.exltfg &= ~1;
56025610            state->m_vdp2.exsyfg &= ~1;
56035611         }
5612         if(ACCESSING_BITS_0_15)
5613         {
5614            if(!space->debugger_access())
5615               printf("Warning: VDP2 version read\n");
5616         }
56045617         break;
56055618      }
5606      case 0x8/4:
5619      case 0x008/4:
56075620      /*H/V Counter Register*/
56085621      {
56095622         state->m_vdp2_regs[offset] = (state->m_vdp2.h_count<<16)|(state->m_vdp2.v_count);
r12502r12503
57575770      state->m_vdp2.old_tvmd = STV_VDP2_TVMD;
57585771      stv_vdp2_dynamic_res_change(space->machine());
57595772   }
5773
5774   if(STV_VDP2_VRAMSZ)
5775      printf("VDP2 sets up 8 Mbit VRAM!\n");
57605776}
57615777
57625778static int get_hblank_duration(running_machine &machine)
r12502r12503
60496065Done:
60506066-Basic support(w0 or w1),bitmaps only.
60516067-W0 (outside) for tilemaps and sprite layer.
6068-Window logic.
60526069
60536070Not Done:
60546071-Complete Windows on cells.A split between cells and bitmaps is in progress...
60556072-w0 & w1 at the same time.
6056-Window logic.
60576073-Line window.
60586074-Color Calculation.
60596075-Rotation parameter Window (already done?).
r12502r12503
61676183
61686184}
61696185
6170static int stv_vdp2_window_process(running_machine &machine,int x,int y)
6186static int get_window_pixel(UINT16 s_x,UINT16 e_x,UINT16 s_y,UINT16 e_y,int x, int y,UINT8 win_num)
61716187{
6172   UINT16 s_x=0,e_x=0,s_y=0,e_y=0;
6173
6174   if ((stv2_current_tilemap.window_control & 6) == 0)
6175      return 0;
6176
6177   stv_vdp2_get_window0_coordinates(machine,&s_x, &e_x, &s_y, &e_y);
6178
6179   if(stv2_current_tilemap.window_control & 2)
6188   if(stv2_current_tilemap.window_control & (2 << win_num))
61806189   {
61816190      /*Outside Area*/
6182      if(stv2_current_tilemap.window_control & 0x10)
6191      if(stv2_current_tilemap.window_control & (0x10 << win_num))
61836192      {
61846193         if(y < s_y || y > e_y)
61856194            return 1;
r12502r12503
62046213      }
62056214   }
62066215
6216   return 0;
6217}
6218
6219static int stv_vdp2_window_process(running_machine &machine,int x,int y)
6220{
6221   UINT16 s_x=0,e_x=0,s_y=0,e_y=0;
6222   UINT8 w0_pix, w1_pix;
6223
6224   if ((stv2_current_tilemap.window_control & 6) == 0)
6225      return 0;
6226
6227   stv_vdp2_get_window0_coordinates(machine,&s_x, &e_x, &s_y, &e_y);
6228   w0_pix = get_window_pixel(s_x,e_x,s_y,e_y,x,y,0);
6229
62076230   stv_vdp2_get_window1_coordinates(machine,&s_x, &e_x, &s_y, &e_y);
6231   w1_pix = get_window_pixel(s_x,e_x,s_y,e_y,x,y,1);
62086232
6209   if(stv2_current_tilemap.window_control & 4)
6210   {
6211      /*Outside Area*/
6212      if(stv2_current_tilemap.window_control & 0x20)
6213      {
6214         if(y < s_y || y > e_y)
6215            return 1;
6216         else
6217         {
6218            if(x < s_x || x > e_x)
6219               return 1;
6220            //else
6221            //  return 0;
6222         }
6223      }
6224      /*Inside Area*/
6225      else
6226      {
6227         if(y > s_y && y < e_y)
6228         {
6229            if(x > s_x && x < e_x)
6230               return 1;
6231         }
6232         //else
6233         //  return 0;
6234      }
6235   }
6236   return 0;
6237//  return 1;
6233   return stv2_current_tilemap.window_control & 1 ? (w0_pix & w1_pix) : (w0_pix | w1_pix);
62386234}
62396235
62406236static int stv_vdp2_apply_window_on_layer(running_machine &machine,rectangle *cliprect)

Previous 15994 Revisions Next


© 1998-2018 The MESS Team