Previous 15994 Revisions Next

r6875 Saturday 2nd January, 2010 at 19:04:51 UTC by Angelo Salese
[ACAN]: Refactored code to use the entire vram range for all of its video elements and implemented very crude sprite function
[src/mess/drivers]supracan.c

src/mess/drivers/supracan.c
r6874r6875
3030static UINT16 *supracan_soundram_16;
3131static UINT16 supracan_video_regs[256];
3232static emu_timer *supracan_video_timer;
33static UINT16 *supracan_charram;
3433static UINT16 *supracan_vram;
35static UINT16 *supracan_rram;
36static UINT16 *supracan_rozpal;
3734
3835static READ16_HANDLER( supracan_unk1_r );
3936static WRITE16_HANDLER( supracan_soundram_w );
r6874r6875
6865
6966}
7067
68/* FIXME: vram is currently hardcoded, but there's an high chance it's tied to some video registers */
7169static VIDEO_UPDATE( supracan )
7270{
7371   int x,y,count;
7472   const gfx_element *gfx = screen->machine->gfx[0];
7573
76   count = 0;
74   bitmap_fill(bitmap, cliprect, 0);
7775
76   count = 0x4400/2;
77
7878   for (y=0;y<64;y++)
7979   {
8080      for (x=0;x<32;x += 8)
r6874r6875
8282         static UINT16 dot_data;
8383
8484         /* FIXME: likely to be clutted */
85         dot_data = supracan_rram[count] ^ 0xffff;
85         dot_data = supracan_vram[count] ^ 0xffff;
8686
8787         *BITMAP_ADDR16(bitmap, y, 128+x+0) = ((dot_data >> 14) & 0x0003) + 0x20;
8888         *BITMAP_ADDR16(bitmap, y, 128+x+1) = ((dot_data >> 12) & 0x0003) + 0x20;
r6874r6875
9696      }
9797   }
9898
99   count = 0;
99   count = 0x4200/2;
100100
101101   for (y=0;y<16;y++)
102102   {
r6874r6875
110110      }
111111   }
112112
113   {
114      int x,y,spr_offs,col,i,spr_base;
115
116      spr_base = 0x1d000;
117
118      for(i=spr_base/2;i<(spr_base+0x100)/2;i+=4)
119      {
120         y = supracan_vram[i+0] & 0xff;
121         x = supracan_vram[i+3] & 0xff;
122         spr_offs = supracan_vram[i+2] & 0x1ff;;
123         col = (supracan_vram[i+1] & 0x000f);
124
125         drawgfx_transpen(bitmap,cliprect,screen->machine->gfx[1],spr_offs,col,0,0,x,y,0);
126      }
127   }
128
113129   return 0;
114130}
115131
r6874r6875
216232   AM_RANGE( 0xe90020, 0xe9002b ) AM_WRITE( supracan_dma_w )
217233   AM_RANGE( 0xf00000, 0xf001ff ) AM_READWRITE( supracan_video_r, supracan_video_w )
218234   AM_RANGE( 0xf00200, 0xf003ff ) AM_RAM_WRITE(paletteram16_xBBBBBGGGGGRRRRR_word_w) AM_BASE_GENERIC(paletteram)
219   AM_RANGE( 0xf40000, 0xf43fff ) AM_RAM_WRITE(supracan_char_w) AM_BASE(&supracan_charram)   /* Unknown, some data gets copied here during boot */
220   AM_RANGE( 0xf44000, 0xf441ff ) AM_RAM AM_BASE(&supracan_rozpal) /* Unknown */
221   AM_RANGE( 0xf44200, 0xf443ff ) AM_RAM AM_BASE(&supracan_vram)   /* Foreground tilemap layer */
222   AM_RANGE( 0xf44400, 0xf445ff ) AM_RAM AM_BASE(&supracan_rram)   /* ROZ layer tiles */
223   AM_RANGE( 0xf44600, 0xf44fff ) AM_RAM   /* Unknown, stuff gets written here. Zoom table?? */
224   AM_RANGE( 0xf48000, 0xf4ffff ) AM_RAM /* more character data */
225   AM_RANGE( 0xf5d000, 0xf5d0ff ) AM_RAM
235   AM_RANGE( 0xf40000, 0xf5ffff ) AM_RAM_WRITE(supracan_char_w) AM_BASE(&supracan_vram)   /* Unknown, some data gets copied here during boot */
236//   AM_RANGE( 0xf44000, 0xf441ff ) AM_RAM AM_BASE(&supracan_rozpal) /* clut data for the ROZ? */
237//   AM_RANGE( 0xf44600, 0xf44fff ) AM_RAM   /* Unknown, stuff gets written here. Zoom table?? */
226238   AM_RANGE( 0xfc0000, 0xfcffff ) AM_RAM    /* System work ram */
227239   AM_RANGE( 0xff8000, 0xffffff ) AM_RAM   /* System work ram */
228240ADDRESS_MAP_END
r6874r6875
235247
236248static WRITE16_HANDLER( supracan_char_w )
237249{
238   COMBINE_DATA(&supracan_charram[offset]);
250   COMBINE_DATA(&supracan_vram[offset]);
239251
240252   {
241253      UINT8 *gfx = memory_region(space->machine, "ram_gfx");
242254
243      gfx[offset*2+0] = (supracan_charram[offset] & 0xff00) >> 8;
244      gfx[offset*2+1] = (supracan_charram[offset] & 0x00ff) >> 0;
255      gfx[offset*2+0] = (supracan_vram[offset] & 0xff00) >> 8;
256      gfx[offset*2+1] = (supracan_vram[offset] & 0x00ff) >> 0;
245257
246258      gfx_element_mark_dirty(space->machine->gfx[0], offset/32);
247259      gfx_element_mark_dirty(space->machine->gfx[1], offset/16);
r6874r6875
382394         acan_sprdma_regs.count = data;
383395         break;
384396      case 0x1e/2:
385         //if(data != 0xa000)
386397         //printf("%08x %08x %04x %04x\n",acan_sprdma_regs.src,acan_sprdma_regs.dst,acan_sprdma_regs.count,data);
387398         if(data & 0xa000) //0x2000 selects dword transfer?
388399         {
r6874r6875
390401            {
391402               if(data & 0x0100) //dma 0x00 fill (or fixed value?)
392403               {
393                  memory_write_dword(space, acan_sprdma_regs.dst, 0x00000000);
404                  memory_write_dword(space, acan_sprdma_regs.dst, 0);
394405                  acan_sprdma_regs.dst+=4;
395406               }
396407               else
r6874r6875
506517ROM_START( supracan )
507518   ROM_REGION( 0x80000, "cart", ROMREGION_ERASEFF )
508519
509   ROM_REGION( 0x4000, "ram_gfx", ROMREGION_ERASEFF )
520   ROM_REGION( 0x20000, "ram_gfx", ROMREGION_ERASEFF )
510521
511522//   ROM_REGION( 0x8000, "spr_gfx", ROMREGION_ERASEFF )
512523

Previous 15994 Revisions Next


© 1998-2018 The MESS Team