Previous 199869 Revisions Next

r21931 Monday 18th March, 2013 at 09:38:52 UTC by David Haywood
deco_mlc - further improved stadhr96, although we now use 1 bit for 2 things...
[src/mame/drivers]deco_mlc.c
[src/mame/includes]deco_mlc.h
[src/mame/video]deco_mlc.c

trunk/src/mame/drivers/deco_mlc.c
r21930r21931
196196//  logerror("irqw %04x %04x (%d)\n", offset * 4, data&0xffff, scanline);
197197}
198198
199READ32_MEMBER(deco_mlc_state::mlc_spriteram_r)
200{
201   return m_spriteram[offset]&0xffff;
202}
203199
200
204201READ32_MEMBER(deco_mlc_state::mlc_vram_r)
205202{
206203   return m_mlc_vram[offset]&0xffff;
r21930r21931
238235   printf("%08x:  Write prot %04x %08x\n", space.device().safe_pc(), offset, data);
239236}
240237
238READ32_MEMBER( deco_mlc_state::mlc_spriteram_r )
239{
240   UINT32 retdata = 0;
241
242   if (mem_mask & 0xffff0000)
243   {
244      retdata |= 0xffff0000;
245   }
246   
247   if (mem_mask & 0x0000ffff)
248   {
249      retdata |= m_mlc_spriteram[offset];
250   }
251
252   return retdata;
253}
254
255
256WRITE32_MEMBER( deco_mlc_state::mlc_spriteram_w )
257{
258   if (mem_mask & 0xffff0000)
259   {
260     
261   }
262
263   if (mem_mask & 0x0000ffff)
264   {
265      data &=0x0000ffff;
266      COMBINE_DATA(&m_mlc_spriteram[offset]);
267   }
268}
241269/******************************************************************************/
242270
243271static ADDRESS_MAP_START( decomlc_map, AS_PROGRAM, 32, deco_mlc_state )
r21930r21931
249277   AM_RANGE(0x0200078, 0x020007f) AM_READ(test2_r) AM_MIRROR(0xff000000)
250278   AM_RANGE(0x0200000, 0x020007f) AM_WRITE(mlc_irq_w) AM_SHARE("irq_ram") AM_MIRROR(0xff000000)
251279   AM_RANGE(0x0200080, 0x02000ff) AM_RAM AM_SHARE("mlc_clip_ram") AM_MIRROR(0xff000000)
252   AM_RANGE(0x0204000, 0x0206fff) AM_RAM_READ(mlc_spriteram_r) AM_SHARE("spriteram") AM_MIRROR(0xff000000)
253   AM_RANGE(0x0280000, 0x029ffff) AM_RAM_READ(mlc_vram_r) AM_SHARE("mlc_vram") AM_MIRROR(0xff000000)
280   AM_RANGE(0x0204000, 0x0206fff) AM_READWRITE( mlc_spriteram_r, mlc_spriteram_w ) AM_MIRROR(0xff000000)
281   AM_RANGE(0x0280000, 0x029ffff) AM_RAM AM_SHARE("mlc_vram") AM_MIRROR(0xff000000)
254282   AM_RANGE(0x0300000, 0x0307fff) AM_RAM_WRITE(avengrs_palette_w) AM_SHARE("paletteram") AM_MIRROR(0xff000000)
255283   AM_RANGE(0x0400000, 0x0400003) AM_READ_PORT("INPUTS") AM_MIRROR(0xff000000)
256284   AM_RANGE(0x0440000, 0x044001f) AM_READ(test3_r) AM_MIRROR(0xff000000)
trunk/src/mame/video/deco_mlc.c
r21930r21931
2323      m_colour_mask=0x1f;
2424
2525//  temp_bitmap = auto_bitmap_rgb32_alloc( machine(), 512, 512 );
26   m_mlc_buffered_spriteram = auto_alloc_array(machine(), UINT32, 0x3000/4);
26   m_mlc_buffered_spriteram = auto_alloc_array(machine(), UINT16, 0x3000/2);
27   m_mlc_spriteram_spare = auto_alloc_array(machine(), UINT16, 0x3000/2);
28   m_mlc_spriteram = auto_alloc_array(machine(), UINT16, 0x3000/2);
29
30
31   save_pointer(NAME(m_mlc_spriteram), 0x3000/2);
32   save_pointer(NAME(m_mlc_spriteram_spare), 0x3000/2);
33   save_pointer(NAME(m_mlc_buffered_spriteram), 0x3000/2);
34
2735}
2836
2937
r21930r21931
144152
145153   int clipper=0;
146154   rectangle user_clip;
147   UINT32* mlc_spriteram=m_mlc_buffered_spriteram; // spriteram32
155   UINT16* mlc_spriteram=m_mlc_buffered_spriteram; // spriteram32
148156
149157   //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]);
150158
r21930r21931
167175                  0x1000 - If set combine this 4bpp sprite & next one, into 8bpp sprite
168176                  0x0800 - This is set ingame on Stadium Hero 96, on graphics which otherwise obscure the playfield?
169177                  0x0400 - Use raster IRQ lookup table when drawing object
170                  0x0300 - Selects clipping window to use
171                  0x00ff - Colour/alpha shadow enable
178                  0x0300 - Selects clipping window to use - and upper bits of raster select (stadhr96)
179               0x0080 - seems to be both the lower bit of the raster select (stadhr96) AND the upper bit of colour / alpha (avngrgs?) - might depend on other bits?
180                  0x007f - Colour/alpha shadow enable
172181          Word 2: 0x07ff - Y position
173182          Word 3: 0x07ff - X position
174183          Word 4: 0x03ff - X scale
r21930r21931
203212      fy = mlc_spriteram[offs+1]&0x4000;
204213      color = mlc_spriteram[offs+1]&0xff;
205214
215      int raster_select = (mlc_spriteram[offs+1]&0x0180)>>7;
216
217
206218      // there are 3 different sets of raster values, must be a way to selects
207219      // between them? furthermore avengrgs doesn't even enable this
208220      // although it doesn't seem to set the scroll values very often either
r21930r21931
289301         yoffs=index_ptr8[0]&0xff;
290302         xoffs=index_ptr8[2]&0xff;
291303
292         fy1=(index_ptr8[1]&0xf0)>>4;
293         fx1=(index_ptr8[3]&0xf0)>>4;
304         fy1=(index_ptr8[1]&0x10)>>4;
305         fx1=(index_ptr8[3]&0x10)>>4;
294306
295307         tileFormat=index_ptr8[4]&0x80;
296308
r21930r21931
329341         yoffs=index_ptr[0]&0xff;
330342         xoffs=index_ptr[1]&0xff;
331343
332         fy1=(index_ptr[0]&0xf000)>>12;
333         fx1=(index_ptr[1]&0xf000)>>12;
344         fy1=(index_ptr[0]&0x1000)>>12;
345         fx1=(index_ptr[1]&0x1000)>>12;
334346      }
335347
336      if(fx1&1) fx^=0x8000;
337      if(fy1&1) fy^=0x4000;
348      if(fx1) fx^=0x8000;
349      if(fy1) fy^=0x4000;
338350
339351      int extra_x_scale = 0x100;
340352
r21930r21931
344356      //  (although as previously noted, it isn't writing valid per-scanline values either)
345357      if (rasterMode)
346358      {
347            // use of these is a bit weird.
348            // -ZZZ -YYY   ---- -xxx   -yyy -zzz
359            // use of these is a bit weird.  (it's probably just 16-bit .. like spriteram so the upper dupes are ignored?)
360            // -ZZZ -yyy   ---- -xxx   -YYY -zzz
349361
350362            // xxx = x offset?
351363            // yyy = y offset?
352364            // zzz = xzoom (confirmed? stadium hero)
353365            //  0x100 = no zoom
354366            //
355            // XXX = duplicate bits of xxx?
367            // YYY = duplicate bits of yyy?
356368            // ZZZ = (sometimes) duplicate bits of zzz
357369
358         if ((clipper==0x0) || (clipper==0x2))
370         if (raster_select==1 || raster_select==2 || raster_select==3)
359371         {
360372         
361373            int irq_base_reg; /* 6, 9, 12  are possible */
362            if (clipper== 0) irq_base_reg = 6;     // OK upper screen.. left?
363            else if (clipper== 2) irq_base_reg = 9; // OK upper screen.. main / center
374            if (raster_select== 1) irq_base_reg = 6;     // OK upper screen.. left?
375            else if (raster_select== 2) irq_base_reg = 9; // OK upper screen.. main / center
364376            else irq_base_reg = 12;
365377
366378            int extra_y_off = m_irq_ram[irq_base_reg+0] & 0x7ff;
r21930r21931
374386            x += extra_x_off;
375387            y += extra_y_off;
376388         }
377         else if (clipper==0x1)
389         else if (raster_select==0x0)
378390         {
379            // right?
391            // possibly disabled?
380392         }
381         else if (clipper==0x3)
382         {
383            // bottom?
384         }
385393
386394      }
387395
r21930r21931
537545      lookup table.  Without buffering incorrect one frame glitches are seen
538546      in several places, especially in Hoops.
539547      */
540      memcpy(m_mlc_buffered_spriteram, m_spriteram, 0x3000);
548      memcpy(m_mlc_buffered_spriteram, m_mlc_spriteram, 0x3000/2);
541549   }
542550}
543551
trunk/src/mame/includes/deco_mlc.h
r21930r21931
66      m_mlc_ram(*this, "mlc_ram"),
77      m_irq_ram(*this, "irq_ram"),
88      m_mlc_clip_ram(*this, "mlc_clip_ram"),
9      m_spriteram(*this, "spriteram"),
10      m_mlc_vram(*this, "mlc_vram"){ }
9      m_mlc_vram(*this, "mlc_vram")
10   
11   { }
1112
1213   required_shared_ptr<UINT32> m_mlc_ram;
1314   required_shared_ptr<UINT32> m_irq_ram;
1415   required_shared_ptr<UINT32> m_mlc_clip_ram;
15   required_shared_ptr<UINT32> m_spriteram;
1616   required_shared_ptr<UINT32> m_mlc_vram;
1717   timer_device *m_raster_irq_timer;
1818   int m_mainCpuIsArm;
r21930r21931
2222   UINT32 m_vbl_i;
2323   int m_lastScanline[9];
2424   UINT32 m_colour_mask;
25   UINT32 *m_mlc_buffered_spriteram;
25
26   UINT16 *m_mlc_spriteram;
27   UINT16 *m_mlc_spriteram_spare;
28   UINT16 *m_mlc_buffered_spriteram;
2629   DECLARE_READ32_MEMBER(test2_r);
2730   DECLARE_READ32_MEMBER(test3_r);
2831   DECLARE_WRITE32_MEMBER(avengrs_palette_w);
2932   DECLARE_READ32_MEMBER(decomlc_vbl_r);
3033   DECLARE_READ32_MEMBER(mlc_scanline_r);
3134   DECLARE_WRITE32_MEMBER(mlc_irq_w);
32   DECLARE_READ32_MEMBER(mlc_spriteram_r);
3335   DECLARE_READ32_MEMBER(mlc_vram_r);
3436   DECLARE_READ32_MEMBER(stadhr96_prot_146_r);
3537   DECLARE_WRITE32_MEMBER(stadhr96_prot_146_w);
3638   DECLARE_READ32_MEMBER(avengrgs_speedup_r);
3739   DECLARE_WRITE32_MEMBER(avengrs_eprom_w);
40   DECLARE_READ32_MEMBER(mlc_spriteram_r);
41   DECLARE_WRITE32_MEMBER(mlc_spriteram_w);
42
43   
44
3845   DECLARE_DRIVER_INIT(mlc);
3946   DECLARE_DRIVER_INIT(avengrgs);
4047   DECLARE_MACHINE_RESET(mlc);

Previous 199869 Revisions Next


© 1997-2024 The MAME Team