From 39e73d5495d37b9eca1f0277565af1c858bfdecb Mon Sep 17 00:00:00 2001 From: Angelo Salese Date: Mon, 21 Apr 2014 13:12:24 +0000 Subject: [PATCH] Removed bogus AM_SHARE for paletteram --- src/mame/drivers/model2.c | 16 +++++++++------- src/mame/includes/model2.h | 6 +++--- src/mame/video/model2.c | 5 ++++- src/mame/video/model2rd.inc | 6 ++---- 4 files changed, 18 insertions(+), 15 deletions(-) diff --git a/src/mame/drivers/model2.c b/src/mame/drivers/model2.c index 05b6b0d043c..b5e2df2ed58 100644 --- a/src/mame/drivers/model2.c +++ b/src/mame/drivers/model2.c @@ -464,13 +464,15 @@ static void chcolor(palette_device &palette, pen_t color, UINT16 data) palette.set_pen_color(color, pal5bit(data >> 0), pal5bit(data >> 5), pal5bit(data >> 10)); } -WRITE32_MEMBER(model2_state::pal32_w) +WRITE16_MEMBER(model2_state::model2_palette_w) { - COMBINE_DATA(m_paletteram32 + offset); - if(ACCESSING_BITS_0_15) - chcolor(m_palette, offset * 2, m_paletteram32[offset]); - if(ACCESSING_BITS_16_31) - chcolor(m_palette, offset * 2 + 1, m_paletteram32[offset] >> 16); + COMBINE_DATA(&m_palram[offset]); + chcolor(m_palette, offset, m_palram[offset]); +} + +READ16_MEMBER(model2_state::model2_palette_r) +{ + return m_palram[offset]; } WRITE32_MEMBER(model2_state::ctrl0_w) @@ -1512,7 +1514,7 @@ static ADDRESS_MAP_START( model2_base_mem, AS_PROGRAM, 32, model2_state ) AM_RANGE(0x01070000, 0x01070003) AM_WRITENOP AM_MIRROR(0x100000) // Video synchronization switch AM_RANGE(0x01080000, 0x010fffff) AM_DEVREADWRITE("tile", segas24_tile, char32_r, char32_w) AM_MIRROR(0x100000) - AM_RANGE(0x01800000, 0x01803fff) AM_RAM_WRITE(pal32_w) AM_SHARE("paletteram32") + AM_RANGE(0x01800000, 0x01803fff) AM_READWRITE16(model2_palette_r,model2_palette_w,0xffffffff) AM_RANGE(0x01810000, 0x0181bfff) AM_RAM AM_SHARE("colorxlat") AM_RANGE(0x0181c000, 0x0181c003) AM_WRITE(model2_3d_zclip_w) AM_RANGE(0x01a10000, 0x01a1ffff) AM_READWRITE(network_r, network_w) diff --git a/src/mame/includes/model2.h b/src/mame/includes/model2.h index 4577dcad71e..bb3353b5ad7 100644 --- a/src/mame/includes/model2.h +++ b/src/mame/includes/model2.h @@ -16,7 +16,6 @@ public: : driver_device(mconfig, type, tag), m_workram(*this, "workram"), m_bufferram(*this, "bufferram"), - m_paletteram32(*this, "paletteram32"), m_colorxlat(*this, "colorxlat"), m_textureram0(*this, "textureram0"), m_textureram1(*this, "textureram1"), @@ -37,7 +36,7 @@ public: required_shared_ptr m_workram; required_shared_ptr m_bufferram; - required_shared_ptr m_paletteram32; + UINT16 *m_palram; required_shared_ptr m_colorxlat; required_shared_ptr m_textureram0; required_shared_ptr m_textureram1; @@ -113,7 +112,8 @@ public: DECLARE_CUSTOM_INPUT_MEMBER(rchase2_devices_r); DECLARE_READ32_MEMBER(timers_r); DECLARE_WRITE32_MEMBER(timers_w); - DECLARE_WRITE32_MEMBER(pal32_w); + DECLARE_READ16_MEMBER(model2_palette_r); + DECLARE_WRITE16_MEMBER(model2_palette_w); DECLARE_WRITE32_MEMBER(ctrl0_w); DECLARE_WRITE32_MEMBER(analog_2b_w); DECLARE_READ32_MEMBER(fifoctl_r); diff --git a/src/mame/video/model2.c b/src/mame/video/model2.c index 488784884d3..4004b3077d6 100644 --- a/src/mame/video/model2.c +++ b/src/mame/video/model2.c @@ -2713,6 +2713,9 @@ VIDEO_START_MEMBER(model2_state,model2) /* initialize the geometry engine */ geo_init( machine(), (UINT32*)memregion("user2")->base() ); + + /* init various video-related pointers */ + m_palram = auto_alloc_array_clear(machine(), UINT16, 0x2000); } UINT32 model2_state::screen_update_model2(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) @@ -2733,7 +2736,7 @@ UINT32 model2_state::screen_update_model2(screen_device &screen, bitmap_rgb32 &b /* tell the rasterizer we're starting a frame */ model2_3d_frame_start(this); - /* let the geometry engine do it's thing */ + /* let the geometry engine do it's thing */ /* TODO: don't do it here! */ geo_parse(this); /* have the rasterizer output the frame */ diff --git a/src/mame/video/model2rd.inc b/src/mame/video/model2rd.inc index 0a1a8e19b4e..cd13f37199b 100644 --- a/src/mame/video/model2rd.inc +++ b/src/mame/video/model2rd.inc @@ -67,7 +67,6 @@ static void MODEL2_FUNC_NAME(void *dest, INT32 scanline, const poly_extent *exte const UINT16 *colortable_g = (const UINT16 *)&state->m_colorxlat[0x4000/4]; const UINT16 *colortable_b = (const UINT16 *)&state->m_colorxlat[0x8000/4]; const UINT16 *lumaram = (const UINT16 *)state->m_lumaram.target(); - const UINT16 *palram = (const UINT16 *)state->m_paletteram32.target(); UINT32 lumabase = extra->lumabase; UINT32 color = extra->colorbase; UINT8 luma; @@ -81,7 +80,7 @@ static void MODEL2_FUNC_NAME(void *dest, INT32 scanline, const poly_extent *exte luma = lumaram[BYTE_XOR_LE(lumabase + (0xf << 3))] & 0x3F; - color = palram[BYTE_XOR_LE(color + 0x1000)] & 0x7fff; + color = state->m_palram[BYTE_XOR_LE(color + 0x1000)] & 0x7fff; colortable_r += ((color >> 0) & 0x1f) << 8; colortable_g += ((color >> 5) & 0x1f) << 8; @@ -123,7 +122,6 @@ static void MODEL2_FUNC_NAME(void *dest, INT32 scanline, const poly_extent *exte const UINT16 *colortable_g = (const UINT16 *)&state->m_colorxlat[0x4000/4]; const UINT16 *colortable_b = (const UINT16 *)&state->m_colorxlat[0x8000/4]; const UINT16 *lumaram = (const UINT16 *)state->m_lumaram.target(); - const UINT16 *palram = (const UINT16 *)state->m_paletteram32.target(); UINT32 colorbase = extra->colorbase; UINT32 lumabase = extra->lumabase; UINT32 tex_x = extra->texx; @@ -143,7 +141,7 @@ static void MODEL2_FUNC_NAME(void *dest, INT32 scanline, const poly_extent *exte tex_x_mask = tex_width - 1; tex_y_mask = tex_height - 1; - colorbase = palram[BYTE_XOR_LE(colorbase + 0x1000)] & 0x7fff; + colorbase = state->m_palram[BYTE_XOR_LE(colorbase + 0x1000)] & 0x7fff; colortable_r += ((colorbase >> 0) & 0x1f) << 8; colortable_g += ((colorbase >> 5) & 0x1f) << 8;