deco_mlc - further improved stadhr96, although we now use 1 bit for 2 things...

This commit is contained in:
David Haywood 2013-03-18 09:38:52 +00:00
parent ffb36e1244
commit 1180aa1e0f
3 changed files with 77 additions and 34 deletions

View File

@ -196,10 +196,7 @@ WRITE32_MEMBER(deco_mlc_state::mlc_irq_w)
// logerror("irqw %04x %04x (%d)\n", offset * 4, data&0xffff, scanline);
}
READ32_MEMBER(deco_mlc_state::mlc_spriteram_r)
{
return m_spriteram[offset]&0xffff;
}
READ32_MEMBER(deco_mlc_state::mlc_vram_r)
{
@ -238,6 +235,37 @@ WRITE32_MEMBER(deco_mlc_state::stadhr96_prot_146_w)
printf("%08x: Write prot %04x %08x\n", space.device().safe_pc(), offset, data);
}
READ32_MEMBER( deco_mlc_state::mlc_spriteram_r )
{
UINT32 retdata = 0;
if (mem_mask & 0xffff0000)
{
retdata |= 0xffff0000;
}
if (mem_mask & 0x0000ffff)
{
retdata |= m_mlc_spriteram[offset];
}
return retdata;
}
WRITE32_MEMBER( deco_mlc_state::mlc_spriteram_w )
{
if (mem_mask & 0xffff0000)
{
}
if (mem_mask & 0x0000ffff)
{
data &=0x0000ffff;
COMBINE_DATA(&m_mlc_spriteram[offset]);
}
}
/******************************************************************************/
static ADDRESS_MAP_START( decomlc_map, AS_PROGRAM, 32, deco_mlc_state )
@ -249,8 +277,8 @@ static ADDRESS_MAP_START( decomlc_map, AS_PROGRAM, 32, deco_mlc_state )
AM_RANGE(0x0200078, 0x020007f) AM_READ(test2_r) AM_MIRROR(0xff000000)
AM_RANGE(0x0200000, 0x020007f) AM_WRITE(mlc_irq_w) AM_SHARE("irq_ram") AM_MIRROR(0xff000000)
AM_RANGE(0x0200080, 0x02000ff) AM_RAM AM_SHARE("mlc_clip_ram") AM_MIRROR(0xff000000)
AM_RANGE(0x0204000, 0x0206fff) AM_RAM_READ(mlc_spriteram_r) AM_SHARE("spriteram") AM_MIRROR(0xff000000)
AM_RANGE(0x0280000, 0x029ffff) AM_RAM_READ(mlc_vram_r) AM_SHARE("mlc_vram") AM_MIRROR(0xff000000)
AM_RANGE(0x0204000, 0x0206fff) AM_READWRITE( mlc_spriteram_r, mlc_spriteram_w ) AM_MIRROR(0xff000000)
AM_RANGE(0x0280000, 0x029ffff) AM_RAM AM_SHARE("mlc_vram") AM_MIRROR(0xff000000)
AM_RANGE(0x0300000, 0x0307fff) AM_RAM_WRITE(avengrs_palette_w) AM_SHARE("paletteram") AM_MIRROR(0xff000000)
AM_RANGE(0x0400000, 0x0400003) AM_READ_PORT("INPUTS") AM_MIRROR(0xff000000)
AM_RANGE(0x0440000, 0x044001f) AM_READ(test3_r) AM_MIRROR(0xff000000)

View File

@ -6,13 +6,13 @@ public:
m_mlc_ram(*this, "mlc_ram"),
m_irq_ram(*this, "irq_ram"),
m_mlc_clip_ram(*this, "mlc_clip_ram"),
m_spriteram(*this, "spriteram"),
m_mlc_vram(*this, "mlc_vram"){ }
m_mlc_vram(*this, "mlc_vram")
{ }
required_shared_ptr<UINT32> m_mlc_ram;
required_shared_ptr<UINT32> m_irq_ram;
required_shared_ptr<UINT32> m_mlc_clip_ram;
required_shared_ptr<UINT32> m_spriteram;
required_shared_ptr<UINT32> m_mlc_vram;
timer_device *m_raster_irq_timer;
int m_mainCpuIsArm;
@ -22,19 +22,26 @@ public:
UINT32 m_vbl_i;
int m_lastScanline[9];
UINT32 m_colour_mask;
UINT32 *m_mlc_buffered_spriteram;
UINT16 *m_mlc_spriteram;
UINT16 *m_mlc_spriteram_spare;
UINT16 *m_mlc_buffered_spriteram;
DECLARE_READ32_MEMBER(test2_r);
DECLARE_READ32_MEMBER(test3_r);
DECLARE_WRITE32_MEMBER(avengrs_palette_w);
DECLARE_READ32_MEMBER(decomlc_vbl_r);
DECLARE_READ32_MEMBER(mlc_scanline_r);
DECLARE_WRITE32_MEMBER(mlc_irq_w);
DECLARE_READ32_MEMBER(mlc_spriteram_r);
DECLARE_READ32_MEMBER(mlc_vram_r);
DECLARE_READ32_MEMBER(stadhr96_prot_146_r);
DECLARE_WRITE32_MEMBER(stadhr96_prot_146_w);
DECLARE_READ32_MEMBER(avengrgs_speedup_r);
DECLARE_WRITE32_MEMBER(avengrs_eprom_w);
DECLARE_READ32_MEMBER(mlc_spriteram_r);
DECLARE_WRITE32_MEMBER(mlc_spriteram_w);
DECLARE_DRIVER_INIT(mlc);
DECLARE_DRIVER_INIT(avengrgs);
DECLARE_MACHINE_RESET(mlc);

View File

@ -23,7 +23,15 @@ VIDEO_START_MEMBER(deco_mlc_state,mlc)
m_colour_mask=0x1f;
// temp_bitmap = auto_bitmap_rgb32_alloc( machine(), 512, 512 );
m_mlc_buffered_spriteram = auto_alloc_array(machine(), UINT32, 0x3000/4);
m_mlc_buffered_spriteram = auto_alloc_array(machine(), UINT16, 0x3000/2);
m_mlc_spriteram_spare = auto_alloc_array(machine(), UINT16, 0x3000/2);
m_mlc_spriteram = auto_alloc_array(machine(), UINT16, 0x3000/2);
save_pointer(NAME(m_mlc_spriteram), 0x3000/2);
save_pointer(NAME(m_mlc_spriteram_spare), 0x3000/2);
save_pointer(NAME(m_mlc_buffered_spriteram), 0x3000/2);
}
@ -144,7 +152,7 @@ void deco_mlc_state::draw_sprites( const rectangle &cliprect, int scanline, UINT
int clipper=0;
rectangle user_clip;
UINT32* mlc_spriteram=m_mlc_buffered_spriteram; // spriteram32
UINT16* mlc_spriteram=m_mlc_buffered_spriteram; // spriteram32
//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]);
@ -167,8 +175,9 @@ void deco_mlc_state::draw_sprites( const rectangle &cliprect, int scanline, UINT
0x1000 - If set combine this 4bpp sprite & next one, into 8bpp sprite
0x0800 - This is set ingame on Stadium Hero 96, on graphics which otherwise obscure the playfield?
0x0400 - Use raster IRQ lookup table when drawing object
0x0300 - Selects clipping window to use
0x00ff - Colour/alpha shadow enable
0x0300 - Selects clipping window to use - and upper bits of raster select (stadhr96)
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?
0x007f - Colour/alpha shadow enable
Word 2: 0x07ff - Y position
Word 3: 0x07ff - X position
Word 4: 0x03ff - X scale
@ -203,6 +212,9 @@ void deco_mlc_state::draw_sprites( const rectangle &cliprect, int scanline, UINT
fy = mlc_spriteram[offs+1]&0x4000;
color = mlc_spriteram[offs+1]&0xff;
int raster_select = (mlc_spriteram[offs+1]&0x0180)>>7;
// there are 3 different sets of raster values, must be a way to selects
// between them? furthermore avengrgs doesn't even enable this
// although it doesn't seem to set the scroll values very often either
@ -289,8 +301,8 @@ void deco_mlc_state::draw_sprites( const rectangle &cliprect, int scanline, UINT
yoffs=index_ptr8[0]&0xff;
xoffs=index_ptr8[2]&0xff;
fy1=(index_ptr8[1]&0xf0)>>4;
fx1=(index_ptr8[3]&0xf0)>>4;
fy1=(index_ptr8[1]&0x10)>>4;
fx1=(index_ptr8[3]&0x10)>>4;
tileFormat=index_ptr8[4]&0x80;
@ -329,12 +341,12 @@ void deco_mlc_state::draw_sprites( const rectangle &cliprect, int scanline, UINT
yoffs=index_ptr[0]&0xff;
xoffs=index_ptr[1]&0xff;
fy1=(index_ptr[0]&0xf000)>>12;
fx1=(index_ptr[1]&0xf000)>>12;
fy1=(index_ptr[0]&0x1000)>>12;
fx1=(index_ptr[1]&0x1000)>>12;
}
if(fx1&1) fx^=0x8000;
if(fy1&1) fy^=0x4000;
if(fx1) fx^=0x8000;
if(fy1) fy^=0x4000;
int extra_x_scale = 0x100;
@ -344,23 +356,23 @@ void deco_mlc_state::draw_sprites( const rectangle &cliprect, int scanline, UINT
// (although as previously noted, it isn't writing valid per-scanline values either)
if (rasterMode)
{
// use of these is a bit weird.
// -ZZZ -YYY ---- -xxx -yyy -zzz
// use of these is a bit weird. (it's probably just 16-bit .. like spriteram so the upper dupes are ignored?)
// -ZZZ -yyy ---- -xxx -YYY -zzz
// xxx = x offset?
// yyy = y offset?
// zzz = xzoom (confirmed? stadium hero)
// 0x100 = no zoom
//
// XXX = duplicate bits of xxx?
// YYY = duplicate bits of yyy?
// ZZZ = (sometimes) duplicate bits of zzz
if ((clipper==0x0) || (clipper==0x2))
if (raster_select==1 || raster_select==2 || raster_select==3)
{
int irq_base_reg; /* 6, 9, 12 are possible */
if (clipper== 0) irq_base_reg = 6; // OK upper screen.. left?
else if (clipper== 2) irq_base_reg = 9; // OK upper screen.. main / center
if (raster_select== 1) irq_base_reg = 6; // OK upper screen.. left?
else if (raster_select== 2) irq_base_reg = 9; // OK upper screen.. main / center
else irq_base_reg = 12;
int extra_y_off = m_irq_ram[irq_base_reg+0] & 0x7ff;
@ -374,13 +386,9 @@ void deco_mlc_state::draw_sprites( const rectangle &cliprect, int scanline, UINT
x += extra_x_off;
y += extra_y_off;
}
else if (clipper==0x1)
else if (raster_select==0x0)
{
// right?
}
else if (clipper==0x3)
{
// bottom?
// possibly disabled?
}
}
@ -537,7 +545,7 @@ void deco_mlc_state::screen_eof_mlc(screen_device &screen, bool state)
lookup table. Without buffering incorrect one frame glitches are seen
in several places, especially in Hoops.
*/
memcpy(m_mlc_buffered_spriteram, m_spriteram, 0x3000);
memcpy(m_mlc_buffered_spriteram, m_mlc_spriteram, 0x3000/2);
}
}