Previous 199869 Revisions Next

r21536 Saturday 2nd March, 2013 at 16:54:44 UTC by David Haywood
the first byte of the compressed data is the width of the compressed data stream in the texture page.
[src/mame/drivers]gunpey.c

trunk/src/mame/drivers/gunpey.c
r21535r21536
208208   DECLARE_READ8_MEMBER(gunpey_status_r);
209209   DECLARE_READ8_MEMBER(gunpey_inputs_r);
210210   DECLARE_WRITE8_MEMBER(gunpey_blitter_w);
211   DECLARE_WRITE8_MEMBER(gunpey_blitter_upper_w);
212   DECLARE_WRITE8_MEMBER(gunpey_blitter_upper2_w);
211213   DECLARE_WRITE8_MEMBER(gunpey_output_w);
212214   DECLARE_WRITE16_MEMBER(gunpey_vram_bank_w);
213215   DECLARE_WRITE16_MEMBER(gunpey_vregs_addr_w);
r21535r21536
563565   gunpey_irq_check(4);
564566}
565567
568#define SHOW_COMPRESSED_DATA_DEBUG
569
566570WRITE8_MEMBER(gunpey_state::gunpey_blitter_w)
567571{
568572//   UINT16 *blit_buffer = m_blit_buffer;
r21535r21536
608612      dstx<<=1;
609613      xsize<<=1;
610614
615
616      //int color = space.machine().rand()&0x1f;
617
618
611619      if(rle)
612620      {
613621         if(rle == 8)
614622         {
623
624            // compressed stream format:
625            //
626            // byte 0 = source width   (data is often stored in fairly narrow columns)
627
628#ifdef SHOW_COMPRESSED_DATA_DEBUG
629            printf("%02x %02x %02x %02x|%02x %02x %02x %02x|%02x %02x %02x %02x|%02x %02x %02x %02x\n"
630               ,blit_ram[0],blit_ram[1],blit_ram[2],blit_ram[3]
631               ,blit_ram[4],blit_ram[5],blit_ram[6],blit_ram[7]
632               ,blit_ram[8],blit_ram[9],blit_ram[0xa],blit_ram[0xb]
633               ,blit_ram[0xc],blit_ram[0xd],blit_ram[0xe],blit_ram[0xf]);
634            int count = 0;
635            printf("data: ");
636#endif
637
638            UINT8 sourcewide = blit_rom[(((srcy)&0x7ff)*0x800)+((srcx)&0x7ff)];
639
615640            for (int y=0;y<ysize;y++)
616641            {
617642               for (int x=0;x<xsize;x++)
618643               {
619                  //blit_rom[(((srcy+y)&0x7ff)*0x800)+((srcx+x)&0x7ff)];
620                  vram[(((dsty+y)&0x7ff)*0x800)+((dstx+x)&0x7ff)] = 0;
644                  UINT8 dat = blit_rom[(((srcy+y)&0x7ff)*0x800)+((srcx+x)&0x7ff)];
645                 
646                  // test.. (it's correct)
647                  if (x>sourcewide) dat = 0;
648                 
649                  vram[(((dsty+y)&0x7ff)*0x800)+((dstx+x)&0x7ff)] = dat;
650
651                 
652#ifdef SHOW_COMPRESSED_DATA_DEBUG
653                  if (count<8)
654                  {
655                     count++;
656                     printf("%02x", dat);
657                  }
658#endif
621659               }
622660            }
661#ifdef SHOW_COMPRESSED_DATA_DEBUG
662            printf("\n");
663#endif
623664         }
624665         else
625666            printf("unknown RLE mode %02x\n",rle);
r21535r21536
639680
640681
641682/*
642      printf("%02x %02x %02x %02x|%02x %02x %02x %02x|%02x %02x %02x %02x|%02x %02x %02x %02x\n"
643      ,blit_ram[0],blit_ram[1],blit_ram[2],blit_ram[3]
644      ,blit_ram[4],blit_ram[5],blit_ram[6],blit_ram[7]
645      ,blit_ram[8],blit_ram[9],blit_ram[0xa],blit_ram[0xb]
646      ,blit_ram[0xc],blit_ram[0xd],blit_ram[0xe],blit_ram[0xf]);
683
647684*/
648685   }
649686}
650687
688WRITE8_MEMBER(gunpey_state::gunpey_blitter_upper_w)
689{
690   //printf("gunpey_blitter_upper_w %02x %02x\n", offset, data);
691
692}
693
694WRITE8_MEMBER(gunpey_state::gunpey_blitter_upper2_w)
695{
696   //printf("gunpey_blitter_upper2_w %02x %02x\n", offset, data);
697
698}
699
700
651701WRITE8_MEMBER(gunpey_state::gunpey_output_w)
652702{
653703   //bit 0 is coin counter
r21535r21536
685735
686736   AM_RANGE(0x7fc8, 0x7fc9) AM_READWRITE8(gunpey_status_r,  gunpey_status_w, 0xffff )
687737   AM_RANGE(0x7fd0, 0x7fdf) AM_WRITE8(gunpey_blitter_w, 0xffff )
738   AM_RANGE(0x7fe0, 0x7fe5) AM_WRITE8(gunpey_blitter_upper_w, 0xffff )
739   AM_RANGE(0x7ff0, 0x7ff5) AM_WRITE8(gunpey_blitter_upper2_w, 0xffff )
740
688741   //AM_RANGE(0x7FF0, 0x7FF1) AM_RAM
689742   AM_RANGE(0x7fec, 0x7fed) AM_WRITE(gunpey_vregs_addr_w)
690743   AM_RANGE(0x7fee, 0x7fef) AM_WRITE(gunpey_vram_bank_w)

Previous 199869 Revisions Next


© 1997-2024 The MAME Team