Previous 199869 Revisions Next

r21888 Saturday 16th March, 2013 at 11:00:10 UTC by David Haywood
deco_mlc - this currently has no bearing on reality but...
[src/mame/drivers]deco_mlc.c
[src/mame/video]deco_mlc.c

trunk/src/mame/drivers/deco_mlc.c
r21887r21888
175175
176176WRITE32_MEMBER(deco_mlc_state::mlc_irq_w)
177177{
178   int scanline=machine().primary_screen->vpos();
179   m_irq_ram[offset]=data&0xffff;
178//   int scanline=machine().primary_screen->vpos();
179   COMBINE_DATA(&m_irq_ram[offset]);
180180
181
181182   switch (offset*4)
182183   {
183184   case 0x10: /* IRQ ack.  Value written doesn't matter */
r21887r21888
187188      m_raster_irq_timer->adjust(machine().primary_screen->time_until_pos(m_irq_ram[0x14/4]));
188189      //logerror("prepare scanline to fire at %d (currently on %d)\n", m_irq_ram[0x14/4], machine().primary_screen->vpos());
189190      return;
190   case 0x18:
191   case 0x1c:
192   case 0x20:
193   case 0x24:
194   case 0x28:
195   case 0x2c:
196   case 0x30:
197   case 0x34:
198   case 0x38:
199      if (scanline > 255)
200         scanline = 255;
201      /* Update scanlines up to present line */
202      while (m_lastScanline[offset-6]<scanline)
203      {
204         m_mlc_raster_table[offset-6][m_lastScanline[offset-6]+1]=m_mlc_raster_table[offset-6][m_lastScanline[offset-6]];
205         m_lastScanline[offset-6]++;
206      }
207191
208      if (m_lastScanline[offset-6] > scanline)
209         m_lastScanline[offset-6]=0;
210
211      /* Set current scanline value */
212      m_mlc_raster_table[offset-6][scanline]=data&0xffff;
213      break;
214
215192   default:
216193      break;
217194   };
trunk/src/mame/video/deco_mlc.c
r21887r21888
1111#include "emu.h"
1212#include "includes/deco_mlc.h"
1313
14//extern int mlc_raster_table[9][256];
15//extern UINT32 mlc_clipper[32];
16//static bitmap_rgb32 *temp_bitmap;
17
1814/******************************************************************************/
1915
2016VIDEO_START_MEMBER(deco_mlc_state,mlc)
r21887r21888
3026   m_mlc_buffered_spriteram = auto_alloc_array(machine(), UINT32, 0x3000/4);
3127}
3228
33#ifdef UNUSED_FUNCTION
34void deco_mlc_state::blitRaster(bitmap_rgb32 &bitmap, int rasterMode)
35{
36   int x,y;
37   for (y=0; y<256; y++) //todo
38   {
39      UINT32* src=&temp_bitmap->pix32(y&0x1ff);
40      UINT32* dst=&bitmap.pix32(y);
41      UINT32 xptr=(m_mlc_raster_table[0][y]<<13);
4229
43      if (machine().input().code_pressed(KEYCODE_X))
44         xptr=0;
45
46      for (x=0; x<320; x++)
47      {
48         if (src[x])
49            dst[x]=src[(xptr>>16)&0x1ff];
50
51         //if (machine().input().code_pressed(KEYCODE_X))
52         //  xptr+=0x10000;
53         //else if(rasterHackTest[0][y]<0)
54            xptr+=0x10000 - ((m_mlc_raster_table[2][y]&0x3ff)<<5);
55         //else
56         //  xptr+=0x10000 + (m_mlc_raster_table[0][y]<<5);
57      }
58   }
59}
60#endif
61
6230static void mlc_drawgfxzoomline(
6331      UINT32* dest,const rectangle &clip,gfx_element *gfx,
6432      UINT32 code1,UINT32 code2, UINT32 color,int flipx,int sx,
r21887r21888
7846   /* KW 991012 -- Added code to force clip to bitmap boundary */
7947
8048
81   const pen_t *pal = &gfx->machine().pens[gfx->colorbase() + gfx->granularity() * (color % gfx->colors())];
82   const UINT8 *code_base1 = gfx->get_data(code1 % gfx->elements());
83   const UINT8 *code_base2 = gfx->get_data(code2 % gfx->elements());
8449
8550   int sprite_screen_width = (scalex*16+(sx&0xffff))>>16;
8651
r21887r21888
12186
12287      if( ex>sx )
12388      { /* skip if inner loop doesn't draw anything */
89         const pen_t *pal = &gfx->machine().pens[gfx->colorbase() + gfx->granularity() * (color % gfx->colors())];
90         const UINT8 *code_base1 = gfx->get_data(code1 % gfx->elements());
12491
12592         /* no alpha */
12693         if (alpha == 0xff)
127         {     
94         {   
95            const UINT8 *code_base2 = gfx->get_data(code2 % gfx->elements());
12896            const UINT8 *source1 = code_base1 + (srcline) * gfx->rowbytes();
12997            const UINT8 *source2 = code_base2 + (srcline) * gfx->rowbytes();
13098
r21887r21888
172140   int useIndicesInRom=0;
173141   int hibits=0;
174142   int tileFormat=0;
175//  int rasterMode=0;
176//  int lastRasterMode=0;
177//  int rasterDirty=0;
143   int rasterMode=0;
144
178145   int clipper=0;
179146   rectangle user_clip;
180147   UINT32* mlc_spriteram=m_mlc_buffered_spriteram; // spriteram32
181148
149   //printf("%d - (%08x %08x %08x) (%08x %08x %08x) (%08x %08x %08x)\n", scanline, m_irq_ram[6], m_irq_ram[7], m_irq_ram[8], m_irq_ram[9], m_irq_ram[10], m_irq_ram[11] , m_irq_ram[12] , m_irq_ram[13] , m_irq_ram[14]);
150
182151   for (offs = (0x3000/4)-8; offs>=0; offs-=8)
183152   {
184153      if ((mlc_spriteram[offs+0]&0x8000)==0)
r21887r21888
233202      fx = mlc_spriteram[offs+1]&0x8000;
234203      fy = mlc_spriteram[offs+1]&0x4000;
235204      color = mlc_spriteram[offs+1]&0xff;
236//      rasterMode = (mlc_spriteram[offs+1]>>10)&0x1;
205
206      // there are 3 different sets of raster values, must be a way to selects
207      // between them? furthermore avengrgs doesn't even enable this
208      // although it doesn't seem to set the scroll values very often either
209      // so the irq mechanism might be wrong
210      rasterMode = (mlc_spriteram[offs+1]>>10)&0x1;
211     
212
213     
237214      clipper = (mlc_spriteram[offs+1]>>8)&0x3;
238215      indx = mlc_spriteram[offs+0]&0x3fff;
239216      yscale = mlc_spriteram[offs+4]&0x3ff;
r21887r21888
344321      if(fx1&1) fx^=0x8000;
345322      if(fy1&1) fy^=0x4000;
346323
324      if (rasterMode)
325      {
326         int irq_base_reg = 6 /* 6, 9, 12 */;
327
328         int extra_y_off = m_irq_ram[irq_base_reg+0] & 0x7ff;
329         int extra_x_off = m_irq_ram[irq_base_reg+1] & 0x7ff;
330         int extra_y_scale = (m_irq_ram[irq_base_reg+2]>>16) & 0x7ff;
331         int extra_x_scale = (m_irq_ram[irq_base_reg+2]>>0) & 0x7ff;
332
333         if (extra_x_off & 0x400) extra_x_off -= 0x800;
334         if (extra_y_off & 0x400) extra_y_off -= 0x800;
335
336         x += extra_x_off;
337         y += extra_x_off;
338
339         xscale = extra_x_scale;
340         yscale = extra_y_scale;
341
342      }
343
347344      int ybase=y<<16;
348345      int yinc=(yscale<<8)*16;
349346
r21887r21888
510507   {
511508      UINT32 *dest = &bitmap.pix32(i);
512509
510      /*
511      printf("%d -", i);
512      for (int j=0;j<0x20;j++)
513      {
514         printf("%08x, ",m_irq_ram[j]);
515      }
516      printf("\n");
517      */
513518      draw_sprites(cliprect, i, dest);
514519   }
515520   return 0;

Previous 199869 Revisions Next


© 1997-2024 The MAME Team