Previous 199869 Revisions Next

r21523 Friday 1st March, 2013 at 17:14:52 UTC by David Haywood
notes
[src/mame/drivers]gunpey.c

trunk/src/mame/drivers/gunpey.c
r21522r21523
217217   TIMER_DEVICE_CALLBACK_MEMBER(gunpey_scanline);
218218   TIMER_CALLBACK_MEMBER(blitter_end);
219219   void gunpey_irq_check(UINT8 irq_type);
220   UINT8 draw_gfx(bitmap_ind16 &bitmap,const rectangle &cliprect,int count);
220   UINT8 draw_gfx(running_machine &machine, bitmap_ind16 &bitmap,const rectangle &cliprect,int count);
221221   UINT16 m_vram_bank;
222222
223223
r21522r21523
230230   m_blit_buffer = auto_alloc_array(machine(), UINT16, 512*512);
231231}
232232
233UINT8 gunpey_state::draw_gfx(bitmap_ind16 &bitmap,const rectangle &cliprect,int count)
233UINT8 gunpey_state::draw_gfx(running_machine &machine, bitmap_ind16 &bitmap,const rectangle &cliprect,int count)
234234{
235235   int x,y;
236236   int bpp_sel;
r21522r21523
239239   int color;
240240   UINT8 *vram = memregion("vram")->base();
241241
242   // +0                    +1                    +2                    +3                    +4                    +5                    +6                    +7
243   // cccc cccc e--b b--- | xxxx ---- u--- ---- | yyyy ---- --XX XXXX | nnnn nnnn ---Y YYYY | mmmm mmmm -MMM -NNN | hhhh hhhh wwww wwww | ---- ---- ---- ---- | ---- ---- ---- ---- |
244
245   // c = color palette
246   // e = END marker
247   // b = bpp select
248   // x = LSB x source
249   // X = MSB x source
250   // y = LSB y source
251   // Y = MSB y source
252   // n = LSB X DRAW position
253   // N = MSB X DRAW position
254   // m = LSB Y DRAW position
255   // M = MSB Y DRAW position
256   // h = height
257   // w = width
258   // u = unknown, set on text, maybe 'solid' ?
259
260
242261   if(!(m_wram[count+0] & 1))
243262   {
244263      x = (m_wram[count+3] >> 8) | ((m_wram[count+4] & 0x03) << 8);
r21522r21523
253272
254273      //UINT32 col = 0xffffff;
255274   //      UINT32 val = (m_wram[count+1] << 16) | ((m_wram[count+2]));
256      int xsource = ((m_wram[count+2] & 0x00ff) << 4) | ((m_wram[count+1] & 0xf000) >> 12);
257      int ysource = ((m_wram[count+2] & 0xf000) >> 12)| ((m_wram[count+3] & 0x00ff) << 4);
275      int xsource = ((m_wram[count+2] & 0x003f) << 4) | ((m_wram[count+1] & 0xf000) >> 12);
276      int ysource = ((m_wram[count+3] & 0x001f) << 4) | ((m_wram[count+2] & 0xf000) >> 12);
258277      //printf("%08x  %04x %04x\n", val, m_wram[count+1],m_wram[count+2] );
259278   //   UINT16 xsource = (m_wram[count+2] & 0x00ff << 4) | (m_wram[count+1] & 0xf000 >> 12);
260279      //xsource<<=1;
r21522r21523
262281      xsource<<=1;
263282      ysource <<=2;
264283
284      UINT8 testhack = vram[((((ysource+0)&0x7ff)*0x800) + ((xsource+0)&0x7ff))];
285      UINT8 testhack2 = vram[((((ysource+0)&0x7ff)*0x800) + ((xsource+1)&0x7ff))];
286
287      //if (m_wram[count+1] & 0x0080) // set on text
288      //   color =  machine.rand()&0xf;
289
290
291
292      printf("sprite %04x %04x %04x %04x %04x %04x %04x %04x\n", m_wram[count+0], m_wram[count+1], m_wram[count+2], m_wram[count+3], m_wram[count+4], m_wram[count+5], m_wram[count+6], m_wram[count+7]);
293
294      if ((testhack2 & 0x0f) == 0x08)
295         return m_wram[count+0] & 0x80;
296
297      printf("testhack1 %02x %02x\n", testhack, testhack2);
298
265299      if(bpp_sel == 0x00)  // 4bpp
266300      {
267301         for(int yi=0;yi<height;yi++)
r21522r21523
273307               UINT32 col_offs;
274308               UINT16 color_data;
275309
310         
311
276312               pix = (data & 0x0f);
277313               col_offs = ((pix + color*0x10) & 0xff) << 1;
278314               col_offs+= ((pix + color*0x10) >> 8)*0x800;
r21522r21523
355391   /* last 4 entries are special, skip them for now. */
356392   for(count = vram_bank/2;count<(vram_bank+0x1000)/2;count+=0x10/2)
357393   {
358      end_mark = draw_gfx(bitmap,cliprect,count);
394      end_mark = draw_gfx(screen.machine(), bitmap,cliprect,count);
359395
360396      if(end_mark == 0x80)
361397         break;
r21522r21523
363399
364400   for(count = (vram_bank+0x1000)/2;count<(vram_bank+0x2000)/2;count+=0x10/2)
365401   {
366      end_mark = draw_gfx(bitmap,cliprect,count);
402      end_mark = draw_gfx(screen.machine(), bitmap,cliprect,count);
367403
368404      if(end_mark == 0x80)
369405         break;
r21522r21523
449485      int ysize = blit_ram[0x0e]+1;
450486//      int color,color_offs;
451487
452      printf("%04x %04x %04x %04x\n",srcx,srcy,dstx,dsty);
488//      printf("%04x %04x %04x %04x\n",srcx,srcy,dstx,dsty);
453489
454490/*
455491     printf("%02x %02x %02x %02x| (X SRC 4: %02x 5: %02x (val %04x))  (Y SRC 6: %02x 7: %02x (val %04x))  | (X DEST 8: %02x 9: %02x (val %04x))  (Y DEST a: %02x b: %02x (val %04x)) |  %02x %02x %02x %02x\n"

Previous 199869 Revisions Next


© 1997-2024 The MAME Team