Previous 199869 Revisions Next

r21515 Friday 1st March, 2013 at 14:16:08 UTC by Angelo Salese
Added palette hook
[src/mame/drivers]gunpey.c

trunk/src/mame/drivers/gunpey.c
r21514r21515
1
2//#define USE_FAKE_ROM
3
41/********************************************************************************************
52
63   Gunpey (c) 2000 Banpresto
r21514r21515
220217   TIMER_DEVICE_CALLBACK_MEMBER(gunpey_scanline);
221218   TIMER_CALLBACK_MEMBER(blitter_end);
222219   void gunpey_irq_check(UINT8 irq_type);
220   void flush_pal_data(int x, int y);
223221   UINT16 m_vram_bank;
224222
225223   //UINT16 main_vram[0x800][0x800];
r21514r21515
239237   int bpp_sel;
240238   int height;
241239   int width;
240   int color;
242241   UINT16 vram_bank = m_vram_bank & 0x7fff;
243242   UINT8 *vram = memregion("vram")->base();
244243
r21514r21515
256255         height = (m_wram[count+5] >> 8);
257256         width = (m_wram[count+5] & 0xff);
258257         bpp_sel = (m_wram[count+0] & 0x18);
258         color = (m_wram[count+0] >> 8);
259259
260260         x-=0x160;
261261         y-=0x188;
r21514r21515
263263         //UINT32 col = 0xffffff;
264264
265265   //      UINT32 val = (m_wram[count+1] << 16) | ((m_wram[count+2]));
266                                             
267#ifdef USE_FAKE_ROM
268         int letter = -1;
269266
270/*
271-- TEST MODE --
272I/O TEST
273MONITOR TEST
274CG-ROM VIEWER
275CHARACTER CHECK
276SOUND TEST
277*/
278         // these are going to be co-ordinates in the bitmap, probably not the ROM, but the one the 'blitter' (gfx unpack device?) creates
279         if (val == 0x2080203b) { letter = ' '; }
280         if (val == 0x0080203b) { letter = '-'; }
281         if (val == 0x4080203b) { letter = '/'; }
282         if (val == 0x6080203b) { letter = '0'; }
283         if (val == 0x8080403a) { letter = '1'; }
284         if (val == 0xa080403a) { letter = '2'; }
285         if (val == 0xc080403a) { letter = '3'; }
286         if (val == 0xe080403a) { letter = '4'; }
287         if (val == 0x0080403b) { letter = '5'; }
288         if (val == 0x2080403b) { letter = '6'; }
289         if (val == 0x4080403b) { letter = '7'; }
290         if (val == 0x6080403b) { letter = '8'; }
291         if (val == 0x8080603a) { letter = '9'; }
292
293         if (val == 0x8080803a) { letter = 'A'; }
294         if (val == 0xa080803a) { letter = 'B'; }
295         if (val == 0xc080803a) { letter = 'C'; }
296         if (val == 0xe080803a) { letter = 'D'; }
297         if (val == 0x0080803b) { letter = 'E'; }
298         if (val == 0x2080803b) { letter = 'F'; }
299         if (val == 0x4080803b) { letter = 'G'; }
300         if (val == 0x6080803b) { letter = 'H'; }
301         if (val == 0x8080a03a) { letter = 'I'; }
302         if (val == 0xa080a03a) { letter = 'J'; }
303         if (val == 0xc080a03a) { letter = 'K'; }
304         if (val == 0xe080a03a) { letter = 'L'; }
305         if (val == 0x0080a03b) { letter = 'M'; }
306         if (val == 0x2080a03b) { letter = 'N'; }
307         if (val == 0x4080a03b) { letter = 'O'; }
308         if (val == 0x6080a03b) { letter = 'P'; }
309         if (val == 0x8080c03a) { letter = 'Q'; }
310         if (val == 0xa080c03a) { letter = 'R'; }
311         if (val == 0xc080c03a) { letter = 'S'; }
312         if (val == 0xe080c03a) { letter = 'T'; }
313         if (val == 0x0080c03b) { letter = 'U'; }
314         if (val == 0x2080c03b) { letter = 'V'; }
315         if (val == 0x4080c03b) { letter = 'W'; }
316         if (val == 0x6080c03b) { letter = 'X'; }
317         if (val == 0x8080e03a) { letter = 'Y'; }
318         if (val == 0xa080e03a) { letter = 'Z'; }
319
320#endif
321267         int xsource = ((m_wram[count+2] & 0x00ff) << 4) | ((m_wram[count+1] & 0xf000) >> 12);
322268         int ysource = ((m_wram[count+2] & 0xf000) >> 12)| ((m_wram[count+3] & 0x00ff) << 4);
323269
r21514r21515
334280
335281
336282
337
338#ifdef USE_FAKE_ROM
339         if (letter != -1)
340            drawgfx_opaque(bitmap,cliprect,machine().gfx[1],letter,1,0,0,x,y);
341         else
342#endif
343283         if(bpp_sel == 0x00)
344284         {
345285            for(int yi=0;yi<height;yi++)
r21514r21515
353293                  pix = (data & 0x0f);
354294
355295                  if(cliprect.contains(x+(xi*2), y+yi))
356                     bitmap.pix16(y+yi, x+(xi*2)) = pix;
296                     bitmap.pix16(y+yi, x+(xi*2)) = pix + color*0x10;
357297
358298                  pix = (data & 0xf0)>>4;
359299
360300                  if(cliprect.contains(x+1+(xi*2), y+yi))
361                     bitmap.pix16(y+yi, x+1+(xi*2)) = pix;
301                     bitmap.pix16(y+yi, x+1+(xi*2)) = pix + color*0x10;
362302               }
363303            }
364304         }
r21514r21515
366306      }
367307   }
368308
369   #if 0
370   for(y=0;y<512;y++)
371   {
372      for(x=0;x<512;x++)
373      {
374         UINT32 color;
375         int r,g,b;
376         color = (blit_buffer[count] & 0xffff);
377309
378         b = (color & 0x001f) << 3;
379         g = (color & 0x03e0) >> 2;
380         r = (color & 0x7c00) >> 7;
381
382         if(cliprect.contains(x, y))
383            bitmap.pix32(y, x) = b | (g<<8) | (r<<16);
384
385         count++;
386      }
387   }
388   #endif
389
390310   return 0;
391311}
392312
r21514r21515
442362   gunpey_irq_check(4);
443363}
444364
365void gunpey_state::flush_pal_data(int x, int y)
366{
367   if(y < 512 && x < 512)
368   {
369      UINT8 *vram = memregion("vram")->base();
370      int val = (vram[y*0x800+x]) | (vram[y*0x800+x+1]<<8);
371      int r,g,b;
372
373      b = (val & 0x001f) >> 0;
374      g = (val & 0x03e0) >> 5;
375      r = (val & 0x7c00) >> 10;
376
377      palette_set_color(machine(), y*256+x/2, MAKE_RGB(pal5bit(r), pal5bit(g), pal5bit(b)));
378   }
379}
380
445381WRITE8_MEMBER(gunpey_state::gunpey_blitter_w)
446382{
447383//   UINT16 *blit_buffer = m_blit_buffer;
r21514r21515
493429         for (int x=0;x<xsize;x++)
494430         {
495431            vram[(((dsty+y)&0x7ff)*0x800)+((dstx+x)&0x7ff)] = blit_rom[(((srcy+y)&0x7ff)*0x800)+((srcx+x)&0x7ff)];
432            flush_pal_data((dstx+x) & 0x7fe,(dsty+y) & 0x7ff);
496433         }
497434      }
498435
r21514r21515
649586/* test hack */
650587void gunpey_state::palette_init()
651588{
589   #if 0
652590   int i,r,g,b,val;
653591   UINT8 *blit_rom = memregion("blit_data")->base();
654592
r21514r21515
665603
666604      palette_set_color(machine(), i/2, MAKE_RGB(r, g, b));
667605   }
668
606   #endif
669607}
670608
671609
r21514r21515
708646
709647static GFXDECODE_START( gunpey )
710648   GFXDECODE_ENTRY( "blit_data", 0, gunpey,     0x0000, 0x1 )
711   GFXDECODE_ENTRY( "fakerom", 0x18000, fake_layout,   0x0, 2  )
712649   //GFXDECODE_ENTRY( "vram", 0, gunpey1024,     0x0000, 0x1 )
713650   GFXDECODE_ENTRY( "vram", 0, gunpey,     0x0000, 0x1 )
714651
r21514r21515
730667   MCFG_SCREEN_RAW_PARAMS(57242400/8, 442, 0, 320, 264, 0, 224) /* just to get ~60 Hz */
731668   MCFG_SCREEN_UPDATE_DRIVER(gunpey_state, screen_update_gunpey)
732669
733   MCFG_PALETTE_LENGTH(0x800)
670   MCFG_PALETTE_LENGTH(0x10000)
734671   MCFG_GFXDECODE(gunpey)
735672
736673   MCFG_SPEAKER_STANDARD_STEREO("lspeaker","rspeaker")
r21514r21515
762699
763700   ROM_REGION( 0x400000, "oki", 0 )
764701   ROM_LOAD( "gp_rom5.622",  0x000000, 0x400000,  CRC(f79903e0) SHA1(4fd50b4138e64a48ec1504eb8cd172a229e0e965)) // 1xxxxxxxxxxxxxxxxxxxxx = 0xFF
765
766   ROM_REGION( 0x20000, "fakerom", ROMREGION_ERASEFF )
767#ifdef USE_FAKE_ROM
768   ROM_LOAD( "video",  0x00000, 0x20000,  CRC(8857ec5a) SHA1(5bed14933af060cb4a1ce6a961c4ca1467a1cbc2) )
769#endif
770702ROM_END
771703
772704

Previous 199869 Revisions Next


© 1997-2024 The MAME Team