Previous 15994 Revisions Next

r12459 Tuesday 2nd August, 2011 at 20:29:04 UTC by Angelo Salese
Preliminary mosaic effect, disabled by default
[src/mame/video]stvvdp2.c

src/mame/video/stvvdp2.c
r12458r12459
11/* Sega Saturn VDP2 */
22
33#define DEBUG_MODE 0
4#define TEST_FUNCTIONS 0
45
56/*
67
r12458r12459
371372
372373   #define STV_VDP2_MZCTL ((state->m_vdp2_regs[0x020/4] >> 0)&0x0000ffff)
373374
375   #define STV_VDP2_MZSZV ((STV_VDP2_MZCTL & 0xf000) >> 12)
376   #define STV_VDP2_MZSZH ((STV_VDP2_MZCTL & 0x0f00) >> 8)
374377   #define STV_VDP2_R0MZE ((STV_VDP2_MZCTL & 0x0010) >> 4)
375378   #define STV_VDP2_N3MZE ((STV_VDP2_MZCTL & 0x0008) >> 3)
376379   #define STV_VDP2_N2MZE ((STV_VDP2_MZCTL & 0x0004) >> 2)
r12458r12459
21382141   UINT8  window_control;
21392142
21402143   UINT8  line_screen_enabled;
2144   UINT8  mosaic_screen_enabled;
21412145
21422146//  UINT8  real_map_offset[16];
21432147
r12458r12459
42344238   }
42354239}
42364240
4241static void stv_vdp2_draw_mosaic(running_machine &machine, bitmap_t *bitmap, const rectangle *cliprect, UINT8 is_roz)
4242{
4243   saturn_state *state = machine.driver_data<saturn_state>();
4244   int x,y,xi,yi;
4245   UINT8 h_size,v_size;
4246   UINT16 pix;
4247
4248   h_size = STV_VDP2_MZSZH+1;
4249   v_size = STV_VDP2_MZSZV+1;
4250
4251   if(is_roz)
4252      v_size = 1;
4253
4254   if(h_size == 1 && v_size == 1)
4255      return; // don't bother
4256
4257   if(STV_VDP2_LSMD == 3)
4258      v_size <<= 1;
4259
4260   for(y=cliprect->min_y;y<=cliprect->max_y;y+=v_size)
4261   {
4262      for(x=cliprect->min_x;x<=cliprect->max_x;x+=h_size)
4263      {
4264         pix = *BITMAP_ADDR16(bitmap, y,x);
4265
4266         for(yi=0;yi<v_size;yi++)
4267            for(xi=0;xi<h_size;xi++)
4268               *BITMAP_ADDR16(bitmap, y+yi, x+xi) = pix;
4269      }
4270   }
4271}
4272
42374273static void stv_vdp2_check_tilemap(running_machine &machine, bitmap_t *bitmap, const rectangle *cliprect)
42384274{
42394275   /* the idea is here we check the tilemap capabilities / whats enabled and call an appropriate tilemap drawing routine, or
r12458r12459
42714307      stv_vdp2_draw_basic_tilemap(machine, bitmap, &mycliprect);
42724308   }
42734309
4274   if(stv2_current_tilemap.line_screen_enabled)
4310   /* post-processing functions (TODO: needs layer bitmaps to be individual planes to work correctly) */
4311   if(stv2_current_tilemap.line_screen_enabled && TEST_FUNCTIONS)
42754312      stv_vdp2_draw_line(machine,bitmap,cliprect);
42764313
4314   if(stv2_current_tilemap.mosaic_screen_enabled && TEST_FUNCTIONS)
4315      stv_vdp2_draw_mosaic(machine,bitmap,cliprect,stv2_current_tilemap.layer_name & 0x80);
42774316
4317
42784318   {
42794319      /* Capcom Collection Dai 2 - Choh Makaimura (Duh!) */
42804320      if(STV_VDP2_MZCTL & 0x1f && 0)
42814321         popmessage("Mosaic control enabled = %04x\n",STV_VDP2_MZCTL);
42824322
42834323      /* Bio Hazard bit 1 */
4324      /* Airs Adventure 0x3e */
42844325      if(STV_VDP2_LNCLEN & ~2)
42854326         popmessage("Line Colour screen enabled %04x %08x, contact MAMEdev",STV_VDP2_LNCLEN,STV_VDP2_LCTAU<<16|STV_VDP2_LCTAL);
42864327
r12458r12459
42904331      if(STV_VDP2_CCCR & 0xf000)
42914332         popmessage("Gradation enabled %04x, contact MAMEdev",STV_VDP2_CCCR);
42924333
4293      /* Advanced VG, Shining Force 3 */
4334      /* Advanced VG, Shining Force III */
42944335      if(STV_VDP2_SFCCMD && 0)
42954336         popmessage("Special Color Calculation enable %04x, contact MAMEdev",STV_VDP2_SFCCMD);
42964337
r12458r12459
43004341      if(STV_VDP2_SFSEL)
43014342         popmessage("Special Function Code Select enable %04x %04x, contact MAMEdev",STV_VDP2_SFSEL,STV_VDP2_SFCODE);
43024343
4344      /* Albert Odyssey Gaiden 0x0001 */
4345      /* Asuka 120% (doesn't make sense?) 0x0101 */
43034346      if(STV_VDP2_ZMCTL)
43044347         popmessage("Reduction enable %04x, contact MAMEdev",STV_VDP2_ZMCTL);
43054348
43064349      if(STV_VDP2_SCRCTL & 0x0101)
43074350         popmessage("Vertical cell scroll enable %04x, contact MAMEdev",STV_VDP2_SCRCTL);
43084351
4309      if(STV_VDP2_WCTLD & 0x2606)
4352      /* Magical Drop III 0x200 -> color calculation window */
4353      if(STV_VDP2_WCTLD & 0x200a)
43104354         popmessage("Special window enabled %04x, contact MAMEdev",STV_VDP2_WCTLD);
43114355
43124356      /* Shining Force III, After Burner 2 (doesn't make a proper use tho?) */
43134357      if(STV_VDP2_W0LWE || STV_VDP2_W1LWE)
43144358         popmessage("Line Window %s %08x enabled, contact MAMEdev",STV_VDP2_W0LWE ? "0" : "1",STV_VDP2_W0LWTA);
43154359
4316      if(STV_VDP2_SFPRMD)
4360      /* Akumajou Dracula, bits 2-4 */
4361      /* Arcana Strikes bit 5*/
4362      /* Choh Makai Mura 0x0055 */
4363      if(STV_VDP2_SFPRMD & ~0x0055)
43174364         popmessage("Special Priority Mode enabled %04x, contact MAMEdev",STV_VDP2_SFPRMD);
43184365   }
43194366}
r12458r12459
47964843                                (STV_VDP2_N0SWA << 6);
47974844
47984845   stv2_current_tilemap.line_screen_enabled = STV_VDP2_N0LCEN;
4846   stv2_current_tilemap.mosaic_screen_enabled = STV_VDP2_N0MZE;
47994847
4800   stv2_current_tilemap.layer_name=0;
4848   stv2_current_tilemap.layer_name=(STV_VDP2_R1ON) ? 0x81 : 0;
48014849
48024850   if ( stv2_current_tilemap.enabled && (!(STV_VDP2_R1ON))) /* TODO: check cycle pattern for RBG1 */
48034851   {
r12458r12459
48964944                                (STV_VDP2_N1SWA << 6);
48974945
48984946   stv2_current_tilemap.line_screen_enabled = STV_VDP2_N1LCEN;
4947   stv2_current_tilemap.mosaic_screen_enabled = STV_VDP2_N1MZE;
48994948
49004949   stv2_current_tilemap.layer_name=1;
49014950
r12458r12459
49985047                                (STV_VDP2_N2SWA << 6);
49995048
50005049   stv2_current_tilemap.line_screen_enabled = STV_VDP2_N2LCEN;
5050   stv2_current_tilemap.mosaic_screen_enabled = STV_VDP2_N2MZE;
50015051
50025052   stv2_current_tilemap.layer_name=2;
50035053
r12458r12459
51015151                                (STV_VDP2_N3SWA << 6);
51025152
51035153   stv2_current_tilemap.line_screen_enabled = STV_VDP2_N3LCEN;
5154   stv2_current_tilemap.mosaic_screen_enabled = STV_VDP2_N3MZE;
51045155
51055156   stv2_current_tilemap.layer_name=3;
51065157
r12458r12459
53755426   stv2_current_tilemap.linezoom_enable = 0;
53765427
53775428   stv2_current_tilemap.line_screen_enabled = STV_VDP2_R0LCEN;
5429   stv2_current_tilemap.mosaic_screen_enabled = STV_VDP2_R0MZE;
53785430
53795431   /*Use 0x80 as a normal/rotate switch*/
53805432   stv2_current_tilemap.layer_name=0x80;
r12458r12459
56865738
56875739   if(state->m_vdp2.old_crmd != STV_VDP2_CRMD)
56885740   {
5689      printf("%02x %02x\n",state->m_vdp2.old_crmd,STV_VDP2_CRMD);
56905741      state->m_vdp2.old_crmd = STV_VDP2_CRMD;
56915742      refresh_palette_data(space->machine());
56925743   }
r12458r12459
58445895   machine.add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(stv_vdp2_exit), &machine));
58455896
58465897   state->m_vdp2_regs = auto_alloc_array_clear(machine, UINT32, 0x040000/4 );
5847   state->m_vdp2_vram = auto_alloc_array_clear(machine, UINT32, 0x100000/4 ); // actually we only need half of it since we don't emulate extra 4mbit ram cart.
5898   state->m_vdp2_vram = auto_alloc_array_clear(machine, UINT32, 0x100000/4 );
58485899   state->m_vdp2_cram = auto_alloc_array_clear(machine, UINT32, 0x080000/4 );
58495900   state->m_vdp2.gfx_decode = auto_alloc_array(machine, UINT8, 0x100000 );
58505901

Previous 15994 Revisions Next


© 1998-2018 The MESS Team