Previous 15994 Revisions Next

r6957 Wednesday 6th January, 2010 at 15:38:27 UTC by Angelo Salese
[ACAN]: Improved scrollx/y
[src/mess/drivers]supracan.c

src/mess/drivers/supracan.c
r6956r6957
9090   int scrollx,scrolly;
9191   int region;
9292   int gfx_mode;
93   int x_size;
93   int size;
9494   UINT16 tile_bank;
9595
9696   count = (tilemap_base_addr[layer]);
97   scrollx = (tilemap_scrolly[layer] & 0x800) ? (0x100 - (tilemap_scrolly[layer] & 0xff)) : (tilemap_scrolly[layer] & 0xff);
98   scrolly = (tilemap_scrollx[layer] & 0x800) ? (0x100 - (tilemap_scrollx[layer] & 0xff)) : (tilemap_scrollx[layer] & 0xff);
99   x_size = (tilemap_flags[layer] & 0x200) ? 64 : 32;
97   size = (tilemap_flags[layer] & 0x200) ? 64 : 32;
98   /* FIXME: swap scrollx / scrolly */
99   if(size == 64)
100   {
101      scrolly = (tilemap_scrolly[layer] & 0x800) ? ((tilemap_scrolly[layer] & 0x1ff) - 0x200) : (tilemap_scrolly[layer] & 0x1ff);
102      scrollx = (tilemap_scrollx[layer] & 0x800) ? ((tilemap_scrollx[layer] & 0x1ff) - 0x200) : (tilemap_scrollx[layer] & 0x1ff);
103   }
104   else
105   {
106      scrolly = (tilemap_scrolly[layer] & 0x800) ? ((tilemap_scrolly[layer] & 0xff) - 0x100) : (tilemap_scrolly[layer] & 0xff);
107      scrollx = (tilemap_scrollx[layer] & 0x800) ? ((tilemap_scrollx[layer] & 0xff) - 0x100) : (tilemap_scrollx[layer] & 0xff);
108   }
100109   gfx_mode = (tilemap_mode[layer] & 0x7000) >> 12;
101110
102111   switch(gfx_mode)
r6956r6957
108117   }
109118
110119
111   for (y=0;y<64;y++)
120   for (y=0;y<size;y++)
112121   {
113      for (x=0;x<x_size;x++)
122      for (x=0;x<size;x++)
114123      {
115124         int tile, flipx, flipy, pal;
116125         tile = (supracan_vram[count] & 0x03ff) + tile_bank;
r6956r6957
118127         flipy = (supracan_vram[count] & 0x0400) ? 1 : 0;
119128         pal = (supracan_vram[count] & 0xf000) >> 12;
120129
121         drawgfx_transpen(bitmap,cliprect,machine->gfx[region],tile,pal,flipx,flipy,(x*8)-scrollx,(y*8)-scrolly,0);
122         if(tilemap_flags[layer] & 0x20) //wrap-around enable
130         if(size == 64)
123131         {
124            drawgfx_transpen(bitmap,cliprect,machine->gfx[region],tile,pal,flipx,flipy,(x*8)-scrollx+256,(y*8)-scrolly,0);
125            drawgfx_transpen(bitmap,cliprect,machine->gfx[region],tile,pal,flipx,flipy,(x*8)-scrollx,(y*8)-scrolly+256,0);
126            drawgfx_transpen(bitmap,cliprect,machine->gfx[region],tile,pal,flipx,flipy,(x*8)-scrollx+256,(y*8)-scrolly+256,0);
132            drawgfx_transpen(bitmap,cliprect,machine->gfx[region],tile,pal,flipx,flipy,(x*8)-scrollx,(y*8)-scrolly,0);
133            if(tilemap_flags[layer] & 0x20) //wrap-around enable
134            {
135               drawgfx_transpen(bitmap,cliprect,machine->gfx[region],tile,pal,flipx,flipy,(x*8)-scrollx+512,(y*8)-scrolly,0);
136               drawgfx_transpen(bitmap,cliprect,machine->gfx[region],tile,pal,flipx,flipy,(x*8)-scrollx,(y*8)-scrolly+512,0);
137               drawgfx_transpen(bitmap,cliprect,machine->gfx[region],tile,pal,flipx,flipy,(x*8)-scrollx+512,(y*8)-scrolly+512,0);
138            }
127139         }
140         else
141         {
142            drawgfx_transpen(bitmap,cliprect,machine->gfx[region],tile,pal,flipx,flipy,(x*8)-scrollx,(y*8)-scrolly,0);
143            if(tilemap_flags[layer] & 0x20) //wrap-around enable
144            {
145               drawgfx_transpen(bitmap,cliprect,machine->gfx[region],tile,pal,flipx,flipy,(x*8)-scrollx+256,(y*8)-scrolly,0);
146               drawgfx_transpen(bitmap,cliprect,machine->gfx[region],tile,pal,flipx,flipy,(x*8)-scrollx,(y*8)-scrolly+256,0);
147               drawgfx_transpen(bitmap,cliprect,machine->gfx[region],tile,pal,flipx,flipy,(x*8)-scrollx+256,(y*8)-scrolly+256,0);
148            }
149         }
128150         count++;
129151      }
130152   }
r6956r6957
333355         break;
334356      case 0x0a/2: // Control
335357         //if(acan_dma_regs.dest != 0xf00200)
336         //printf("%08x %08x %02x %04x\n",acan_dma_regs.source,acan_dma_regs.dest,acan_dma_regs.count + 1,data);
358         printf("%08x %08x %02x %04x\n",acan_dma_regs.source,acan_dma_regs.dest,acan_dma_regs.count + 1,data);
337359         if(data & 0x8800)
338360         {
339361            //if(data != 0x9800 && data != 0x8800)
340362            //{
341363            //   fatalerror("%04x",data);
342364            //}
365            if(data & 0x2000)
366               acan_dma_regs.source-=2;
343367            verboselog(space->machine, 0, "supracan_dma_w: Kicking off a DMA from %08x to %08x, %d bytes (%04x)\n", acan_dma_regs.source, acan_dma_regs.dest, acan_dma_regs.count + 1, data);
344368            for(i = 0; i <= acan_dma_regs.count; i++)
345369            {
r6956r6957
353377               {
354378                  memory_write_byte(space, acan_dma_regs.dest, memory_read_byte(space, acan_dma_regs.source));
355379                  acan_dma_regs.dest++;
356                  acan_dma_regs.source++;
380                  if(data & 0x2000)
381                     acan_dma_regs.source--;
382                  else
383                     acan_dma_regs.source++;
357384               }
358385            }
359386         }
r6956r6957
431458   PORT_DIPNAME( 0x20, 0x00, DEF_STR( Unknown ) )
432459   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
433460   PORT_DIPSETTING(    0x20, DEF_STR( On ) )
434   PORT_DIPNAME( 0x40, 0x00, DEF_STR( Unknown ) )
435   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
436   PORT_DIPSETTING(    0x40, DEF_STR( On ) )
461   PORT_BIT(0x0040, IP_ACTIVE_HIGH, IPT_BUTTON4 ) PORT_PLAYER(1) PORT_NAME("P1 Joypad B4")
437462   PORT_BIT(0x0080, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_PLAYER(1) PORT_NAME("P1 Joypad B2")
438463   PORT_BIT(0x0100, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(1) PORT_NAME("P1 Joypad Right")
439464   PORT_BIT(0x0200, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_PLAYER(1) PORT_NAME("P1 Joypad Left")
r6956r6957
443468   PORT_DIPSETTING(    0x0000, DEF_STR( Off ) )
444469   PORT_DIPSETTING(    0x1000, DEF_STR( On ) )
445470   PORT_BIT(0x2000, IP_ACTIVE_HIGH, IPT_START1 )
446   PORT_DIPNAME( 0x4000, 0x0000, DEF_STR( Unknown ) )
447   PORT_DIPSETTING(    0x0000, DEF_STR( Off ) )
448   PORT_DIPSETTING(    0x4000, DEF_STR( On ) )
471   PORT_BIT(0x4000, IP_ACTIVE_HIGH, IPT_BUTTON3 ) PORT_PLAYER(1) PORT_NAME("P1 Joypad B3")
449472   PORT_BIT(0x8000, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_PLAYER(1) PORT_NAME("P1 Joypad B1")
450473
451474   PORT_START("P2")
r6956r6957
467490   PORT_DIPNAME( 0x20, 0x00, DEF_STR( Unknown ) )
468491   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
469492   PORT_DIPSETTING(    0x20, DEF_STR( On ) )
470   PORT_DIPNAME( 0x40, 0x00, DEF_STR( Unknown ) )
471   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
472   PORT_DIPSETTING(    0x40, DEF_STR( On ) )
493   PORT_BIT(0x0040, IP_ACTIVE_HIGH, IPT_BUTTON4 ) PORT_PLAYER(2) PORT_NAME("P2 Joypad B4")
473494   PORT_BIT(0x0080, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_PLAYER(2) PORT_NAME("P2 Joypad B2")
474495   PORT_BIT(0x0100, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(2) PORT_NAME("P2 Joypad Right")
475496   PORT_BIT(0x0200, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_PLAYER(2) PORT_NAME("P2 Joypad Left")
r6956r6957
479500   PORT_DIPSETTING(    0x0000, DEF_STR( Off ) )
480501   PORT_DIPSETTING(    0x1000, DEF_STR( On ) )
481502   PORT_BIT(0x2000, IP_ACTIVE_HIGH, IPT_START2 )
482   PORT_DIPNAME( 0x4000, 0x0000, DEF_STR( Unknown ) )
483   PORT_DIPSETTING(    0x0000, DEF_STR( Off ) )
484   PORT_DIPSETTING(    0x4000, DEF_STR( On ) )
503   PORT_BIT(0x4000, IP_ACTIVE_HIGH, IPT_BUTTON3 ) PORT_PLAYER(2) PORT_NAME("P2 Joypad B3")
485504   PORT_BIT(0x8000, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_PLAYER(2) PORT_NAME("P2 Joypad B1")
486505
487506   PORT_START("P3")
r6956r6957
503522   PORT_DIPNAME( 0x20, 0x00, DEF_STR( Unknown ) )
504523   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
505524   PORT_DIPSETTING(    0x20, DEF_STR( On ) )
506   PORT_DIPNAME( 0x40, 0x00, DEF_STR( Unknown ) )
507   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
508   PORT_DIPSETTING(    0x40, DEF_STR( On ) )
525   PORT_BIT(0x0040, IP_ACTIVE_HIGH, IPT_BUTTON4 ) PORT_PLAYER(3) PORT_NAME("P3 Joypad B4")
509526   PORT_BIT(0x0080, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_PLAYER(3) PORT_NAME("P3 Joypad B2")
510527   PORT_BIT(0x0100, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(3) PORT_NAME("P3 Joypad Right")
511528   PORT_BIT(0x0200, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_PLAYER(3) PORT_NAME("P3 Joypad Left")
r6956r6957
515532   PORT_DIPSETTING(    0x0000, DEF_STR( Off ) )
516533   PORT_DIPSETTING(    0x1000, DEF_STR( On ) )
517534   PORT_BIT(0x2000, IP_ACTIVE_HIGH, IPT_START3 )
518   PORT_DIPNAME( 0x4000, 0x0000, DEF_STR( Unknown ) )
519   PORT_DIPSETTING(    0x0000, DEF_STR( Off ) )
520   PORT_DIPSETTING(    0x4000, DEF_STR( On ) )
535   PORT_BIT(0x4000, IP_ACTIVE_HIGH, IPT_BUTTON3 ) PORT_PLAYER(3) PORT_NAME("P3 Joypad B3")
521536   PORT_BIT(0x8000, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_PLAYER(3) PORT_NAME("P3 Joypad B1")
522537
523538   PORT_START("P4")
r6956r6957
539554   PORT_DIPNAME( 0x20, 0x00, DEF_STR( Unknown ) )
540555   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
541556   PORT_DIPSETTING(    0x20, DEF_STR( On ) )
542   PORT_DIPNAME( 0x40, 0x00, DEF_STR( Unknown ) )
543   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
544   PORT_DIPSETTING(    0x40, DEF_STR( On ) )
557   PORT_BIT(0x0040, IP_ACTIVE_HIGH, IPT_BUTTON4 ) PORT_PLAYER(4) PORT_NAME("P4 Joypad B4")
545558   PORT_BIT(0x0080, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_PLAYER(4) PORT_NAME("P4 Joypad B2")
546559   PORT_BIT(0x0100, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(4) PORT_NAME("P4 Joypad Right")
547560   PORT_BIT(0x0200, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_PLAYER(4) PORT_NAME("P4 Joypad Left")
r6956r6957
551564   PORT_DIPSETTING(    0x0000, DEF_STR( Off ) )
552565   PORT_DIPSETTING(    0x1000, DEF_STR( On ) )
553566   PORT_BIT(0x2000, IP_ACTIVE_HIGH, IPT_START4 )
554   PORT_DIPNAME( 0x4000, 0x0000, DEF_STR( Unknown ) )
555   PORT_DIPSETTING(    0x0000, DEF_STR( Off ) )
556   PORT_DIPSETTING(    0x4000, DEF_STR( On ) )
567   PORT_BIT(0x4000, IP_ACTIVE_HIGH, IPT_BUTTON3 ) PORT_PLAYER(4) PORT_NAME("P4 Joypad B3")
557568   PORT_BIT(0x8000, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_PLAYER(4) PORT_NAME("P4 Joypad B1")
558569INPUT_PORTS_END
559570

Previous 15994 Revisions Next


© 1998-2018 The MESS Team