From 6a15c5b88f296158e1eab880000f997ed4f1e0ae Mon Sep 17 00:00:00 2001 From: angelosa Date: Tue, 29 May 2018 15:18:48 +0200 Subject: [PATCH] tatsumi.cpp: roundup5 variable cleanups (nw) --- src/mame/drivers/tatsumi.cpp | 28 ++++++++++++++-------------- src/mame/includes/tatsumi.h | 33 ++++++++++++++++----------------- src/mame/machine/tatsumi.cpp | 14 ++++---------- src/mame/video/tatsumi.cpp | 20 ++++++++++---------- 4 files changed, 44 insertions(+), 51 deletions(-) diff --git a/src/mame/drivers/tatsumi.cpp b/src/mame/drivers/tatsumi.cpp index 753675cb29b..41864c115a8 100644 --- a/src/mame/drivers/tatsumi.cpp +++ b/src/mame/drivers/tatsumi.cpp @@ -270,9 +270,9 @@ void apache3_state::apache3_v30_map(address_map &map) void apache3_state::apache3_68000_map(address_map &map) { map(0x00000, 0x7ffff).rom(); - map(0x80000, 0x83fff).ram().share("68k_ram"); + map(0x80000, 0x83fff).ram().share("sharedram"); map(0x90000, 0x93fff).ram().share("spriteram"); - map(0x9a000, 0x9a1ff).rw(this, FUNC(apache3_state::tatsumi_sprite_control_r), FUNC(apache3_state::tatsumi_sprite_control_w)).share("sprite_ctlram"); + map(0x9a000, 0x9a1ff).rw(this, FUNC(apache3_state::tatsumi_sprite_control_r), FUNC(apache3_state::tatsumi_sprite_control_w)).share("obj_ctrl_ram"); map(0xa0000, 0xa0001).w(this, FUNC(apache3_state::apache3_rotate_w)); // /BNKCS map(0xb0000, 0xb0001).w(this, FUNC(apache3_state::apache3_z80_ctrl_w)); map(0xc0000, 0xc0001).w(this, FUNC(apache3_state::apache3_road_z_w)); // /LINCS @@ -305,7 +305,7 @@ void roundup5_state::roundup5_v30_map(address_map &map) map(0x08000, 0x0bfff).ram().w(this, FUNC(roundup5_state::text_w)).share("videoram"); map(0x0c000, 0x0c003).w(this, FUNC(tatsumi_state::hd6445_crt_w)).umask16(0x00ff); map(0x0d000, 0x0d001).portr("DSW"); - map(0x0d400, 0x0d40f).ram().share("ru5_unknown0"); + map(0x0d400, 0x0d40f).ram().share("vregs"); map(0x0d800, 0x0d801).writeonly().share("bg_scrollx"); map(0x0dc00, 0x0dc01).writeonly().share("bg_scrolly"); map(0x0e000, 0x0e001).w(this, FUNC(roundup5_state::roundup5_control_w)); @@ -319,14 +319,14 @@ void roundup5_state::roundup5_v30_map(address_map &map) void roundup5_state::roundup5_68000_map(address_map &map) { map(0x00000, 0x7ffff).rom(); - map(0x80000, 0x83fff).ram().share("68k_ram"); + map(0x80000, 0x83fff).ram().share("sharedram"); map(0x90000, 0x93fff).ram().share("spriteram"); - map(0x9a000, 0x9a1ff).rw(this, FUNC(roundup5_state::tatsumi_sprite_control_r), FUNC(roundup5_state::tatsumi_sprite_control_w)).share("sprite_ctlram"); - map(0xa0000, 0xa0fff).ram().share("roundup_r_ram"); // Road control data - map(0xb0000, 0xb0fff).ram().share("roundup_p_ram"); // Road pixel data - map(0xc0000, 0xc0fff).ram().share("roundup_l_ram"); // Road colour data - map(0xd0000, 0xd0003).ram().w(this, FUNC(roundup5_state::roundup5_d0000_w)).share("ru5_d0000_ram"); - map(0xe0000, 0xe0001).ram().w(this, FUNC(roundup5_state::roundup5_e0000_w)).share("ru5_e0000_ram"); + map(0x9a000, 0x9a1ff).rw(this, FUNC(roundup5_state::tatsumi_sprite_control_r), FUNC(roundup5_state::tatsumi_sprite_control_w)).share("obj_ctrl_ram"); + map(0xa0000, 0xa0fff).ram().share("road_ctrl_ram"); // Road control data + map(0xb0000, 0xb0fff).ram().share("road_pixel_ram"); // Road pixel data + map(0xc0000, 0xc0fff).ram().share("road_color_ram"); // Road colour data + map(0xd0000, 0xd0001).ram().share("road_yclip"); + map(0xe0000, 0xe0001).ram().w(this, FUNC(roundup5_state::road_vregs_w)).share("road_vregs"); } void roundup5_state::roundup5_z80_map(address_map &map) @@ -359,7 +359,7 @@ void cyclwarr_state::cyclwarr_68000a_map(address_map &map) map(0x0ba000, 0x0ba00f).rw("io2", FUNC(cxd1095_device::read), FUNC(cxd1095_device::write)).umask16(0x00ff).cswidth(16); map(0x0bc000, 0x0bc001).w(this, FUNC(cyclwarr_state::output_w)); map(0x0c0000, 0x0c3fff).rw(this, FUNC(cyclwarr_state::cyclwarr_sprite_r), FUNC(cyclwarr_state::cyclwarr_sprite_w)).share("spriteram"); - map(0x0ca000, 0x0ca1ff).rw(this, FUNC(cyclwarr_state::tatsumi_sprite_control_r), FUNC(cyclwarr_state::tatsumi_sprite_control_w)).share("sprite_ctlram"); + map(0x0ca000, 0x0ca1ff).rw(this, FUNC(cyclwarr_state::tatsumi_sprite_control_r), FUNC(cyclwarr_state::tatsumi_sprite_control_w)).share("obj_ctrl_ram"); map(0x0d0000, 0x0d3fff).ram().w(m_palette, FUNC(palette_device::write16)).share("palette"); map(0x140000, 0x1bffff).bankr("bank2"); /* CPU B ROM */ map(0x2c0000, 0x33ffff).bankr("bank1"); /* CPU A ROM */ @@ -379,7 +379,7 @@ void cyclwarr_state::cyclwarr_68000b_map(address_map &map) map(0x0b9000, 0x0b900f).rw("io1", FUNC(cxd1095_device::read), FUNC(cxd1095_device::write)).umask16(0x00ff).cswidth(16); map(0x0ba000, 0x0ba00f).rw("io2", FUNC(cxd1095_device::read), FUNC(cxd1095_device::write)).umask16(0x00ff).cswidth(16); map(0x0c0000, 0x0c3fff).rw(this, FUNC(cyclwarr_state::cyclwarr_sprite_r), FUNC(cyclwarr_state::cyclwarr_sprite_w)); - map(0x0ca000, 0x0ca1ff).rw(this, FUNC(cyclwarr_state::tatsumi_sprite_control_r), FUNC(cyclwarr_state::tatsumi_sprite_control_w)).share("sprite_ctlram"); + map(0x0ca000, 0x0ca1ff).rw(this, FUNC(cyclwarr_state::tatsumi_sprite_control_r), FUNC(cyclwarr_state::tatsumi_sprite_control_w)).share("obj_ctrl_ram"); map(0x0d0000, 0x0d3fff).ram().w(m_palette, FUNC(palette_device::write16)).share("palette"); map(0x140000, 0x1bffff).bankr("bank2"); /* CPU B ROM */ map(0x2c0000, 0x33ffff).bankr("bank1"); /* CPU A ROM */ @@ -418,7 +418,7 @@ void cyclwarr_state::bigfight_68000a_map(address_map &map) map(0x0ba000, 0x0ba00f).rw("io2", FUNC(cxd1095_device::read), FUNC(cxd1095_device::write)).umask16(0x00ff).cswidth(16); map(0x0bc000, 0x0bc001).w(this, FUNC(cyclwarr_state::output_w)); map(0x0c0000, 0x0c3fff).rw(this, FUNC(cyclwarr_state::cyclwarr_sprite_r), FUNC(cyclwarr_state::cyclwarr_sprite_w)).share("spriteram"); - map(0x0ca000, 0x0ca1ff).rw(this, FUNC(cyclwarr_state::tatsumi_sprite_control_r), FUNC(cyclwarr_state::tatsumi_sprite_control_w)).share("sprite_ctlram"); + map(0x0ca000, 0x0ca1ff).rw(this, FUNC(cyclwarr_state::tatsumi_sprite_control_r), FUNC(cyclwarr_state::tatsumi_sprite_control_w)).share("obj_ctrl_ram"); map(0x0d0000, 0x0d3fff).ram().w(m_palette, FUNC(palette_device::write16)).share("palette"); map(0x100000, 0x17ffff).bankr("bank2"); /* CPU A ROM */ map(0x200000, 0x27ffff).bankr("bank1"); /* CPU B ROM */ @@ -436,7 +436,7 @@ void cyclwarr_state::bigfight_68000b_map(address_map &map) map(0x0b9000, 0x0b900f).rw("io1", FUNC(cxd1095_device::read), FUNC(cxd1095_device::write)).umask16(0x00ff).cswidth(16); map(0x0ba000, 0x0ba00f).rw("io2", FUNC(cxd1095_device::read), FUNC(cxd1095_device::write)).umask16(0x00ff).cswidth(16); map(0x0c0000, 0x0c3fff).rw(this, FUNC(cyclwarr_state::cyclwarr_sprite_r), FUNC(cyclwarr_state::cyclwarr_sprite_w)); - map(0x0ca000, 0x0ca1ff).rw(this, FUNC(cyclwarr_state::tatsumi_sprite_control_r), FUNC(cyclwarr_state::tatsumi_sprite_control_w)).share("sprite_ctlram"); + map(0x0ca000, 0x0ca1ff).rw(this, FUNC(cyclwarr_state::tatsumi_sprite_control_r), FUNC(cyclwarr_state::tatsumi_sprite_control_w)).share("obj_ctrl_ram"); map(0x0d0000, 0x0d3fff).ram().w(m_palette, FUNC(palette_device::write16)).share("palette"); map(0x100000, 0x17ffff).bankr("bank2"); /* CPU A ROM */ map(0x200000, 0x27ffff).bankr("bank1"); /* CPU B ROM */ diff --git a/src/mame/includes/tatsumi.h b/src/mame/includes/tatsumi.h index 9675055e278..f2ab3313726 100644 --- a/src/mame/includes/tatsumi.h +++ b/src/mame/includes/tatsumi.h @@ -20,8 +20,8 @@ public: , m_gfxdecode(*this, "gfxdecode") , m_palette(*this, "palette") , m_videoram(*this, "videoram") - , m_68k_ram(*this, "68k_ram") - , m_sprite_control_ram(*this, "sprite_ctlram") + , m_sharedram(*this, "sharedram") + , m_sprite_control_ram(*this, "obj_ctrl_ram") , m_spriteram(*this, "spriteram") , m_mainregion(*this, "maincpu") , m_subregion(*this, "sub") @@ -36,7 +36,7 @@ public: required_device m_palette; optional_shared_ptr m_videoram; - optional_shared_ptr m_68k_ram; + optional_shared_ptr m_sharedram; required_shared_ptr m_sprite_control_ram; required_shared_ptr m_spriteram; required_memory_region m_mainregion; @@ -132,22 +132,21 @@ class roundup5_state : public tatsumi_state public: roundup5_state(const machine_config &mconfig, device_type type, const char *tag) : tatsumi_state(mconfig, type, tag) - , m_roundup5_d0000_ram(*this, "ru5_d0000_ram") - , m_roundup5_e0000_ram(*this, "ru5_e0000_ram") - , m_roundup5_unknown0(*this, "ru5_unknown0") + , m_vregs(*this, "vregs") , m_bg_scrollx(*this, "bg_scrollx") , m_bg_scrolly(*this, "bg_scrolly") - , m_roundup_r_ram(*this, "roundup_r_ram") - , m_roundup_p_ram(*this, "roundup_p_ram") - , m_roundup_l_ram(*this, "roundup_l_ram") + , m_road_ctrl_ram(*this, "road_ctrl_ram") + , m_road_pixel_ram(*this, "road_pixel_ram") + , m_road_color_ram(*this, "road_color_ram") + , m_road_yclip(*this, "road_yclip") + , m_road_vregs(*this, "road_vregs") { } DECLARE_READ16_MEMBER(roundup_v30_z80_r); DECLARE_WRITE16_MEMBER(roundup_v30_z80_w); DECLARE_WRITE16_MEMBER(roundup5_control_w); - DECLARE_WRITE16_MEMBER(roundup5_d0000_w); - DECLARE_WRITE16_MEMBER(roundup5_e0000_w); + DECLARE_WRITE16_MEMBER(road_vregs_w); DECLARE_READ8_MEMBER(gfxdata_r); DECLARE_WRITE8_MEMBER(gfxdata_w); DECLARE_WRITE8_MEMBER(output_w); @@ -168,14 +167,14 @@ private: void draw_road(bitmap_rgb32 &bitmap, const rectangle &cliprect, bitmap_ind8 &shadow_bitmap); void draw_landscape(bitmap_rgb32 &bitmap, const rectangle &cliprect, uint8_t type); - required_shared_ptr m_roundup5_d0000_ram; - required_shared_ptr m_roundup5_e0000_ram; - required_shared_ptr m_roundup5_unknown0; + required_shared_ptr m_vregs; required_shared_ptr m_bg_scrollx; required_shared_ptr m_bg_scrolly; - required_shared_ptr m_roundup_r_ram; - required_shared_ptr m_roundup_p_ram; - required_shared_ptr m_roundup_l_ram; + required_shared_ptr m_road_ctrl_ram; + required_shared_ptr m_road_pixel_ram; + required_shared_ptr m_road_color_ram; + required_shared_ptr m_road_yclip; + required_shared_ptr m_road_vregs; std::unique_ptr m_tx_gfxram; std::unique_ptr m_bg_gfxram; diff --git a/src/mame/machine/tatsumi.cpp b/src/mame/machine/tatsumi.cpp index 79ba471fb38..4a5559c30e1 100644 --- a/src/mame/machine/tatsumi.cpp +++ b/src/mame/machine/tatsumi.cpp @@ -207,19 +207,13 @@ WRITE16_MEMBER(roundup5_state::roundup5_control_w) m_last_control = m_control_word; } -WRITE16_MEMBER(roundup5_state::roundup5_d0000_w) -{ - COMBINE_DATA(&m_roundup5_d0000_ram[offset]); -// logerror("d_68k_d0000_w %s %04x\n", m_maincpu->pc(), data); -} - -WRITE16_MEMBER(roundup5_state::roundup5_e0000_w) +WRITE16_MEMBER(roundup5_state::road_vregs_w) { /* Bit 0x10 is road bank select, Bit 0x100 is used, but unknown */ - COMBINE_DATA(&m_roundup5_e0000_ram[offset]); + COMBINE_DATA(&m_road_vregs[offset]); m_subcpu->set_input_line(INPUT_LINE_IRQ4, CLEAR_LINE); // guess, probably wrong // logerror("d_68k_e0000_w %s %04x\n", m_maincpu->pc(), data); @@ -286,7 +280,7 @@ READ16_MEMBER(tatsumi_state::tatsumi_v30_68000_r) } #endif - return m_68k_ram[offset & 0x1fff]; + return m_sharedram[offset & 0x1fff]; } /* Read from 68k ROM */ @@ -300,7 +294,7 @@ WRITE16_MEMBER(tatsumi_state::tatsumi_v30_68000_w) if ((m_control_word&0x1f)!=0x18) logerror("68k write in bank %05x\n",m_control_word); - COMBINE_DATA(&m_68k_ram[offset]); + COMBINE_DATA(&m_sharedram[offset]); } /***********************************************************************************/ diff --git a/src/mame/video/tatsumi.cpp b/src/mame/video/tatsumi.cpp index 96c58affb88..81d50cf819e 100644 --- a/src/mame/video/tatsumi.cpp +++ b/src/mame/video/tatsumi.cpp @@ -760,18 +760,18 @@ pos is 11.5 fixed point */ int y,x; int visible_line=0; - const uint16_t *data = m_roundup_r_ram; + const uint16_t *data = m_road_ctrl_ram; // Road layer enable (?) - if ((m_roundup5_unknown0[0x1]&0x1)==0) + if ((m_vregs[0x1]&0x1)==0) return; // Road data bank select (double buffered) - if (m_roundup5_e0000_ram[0]&0x10) + if (m_road_vregs[0]&0x10) data+=0x400; // Apply clipping: global screen + local road y offsets - y = 256 - ((m_roundup5_unknown0[0xa/2] >> 8) + m_roundup5_d0000_ram[0]); + y = 256 - ((m_vregs[0xa/2] >> 8) + m_road_yclip[0]); data+=y*4; visible_line=0; @@ -783,10 +783,10 @@ pos is 11.5 fixed point int pal = 4; //(data[3]>>8)&0xf; int step=((data[1]&0xff)<<8)|((data[1]&0xff00)>>8); int samplePos=0; - const uint16_t* linedata=m_roundup_p_ram;// + (0x100 * pal); + const uint16_t* linedata=m_road_pixel_ram;// + (0x100 * pal); int startPos=0, endPos=0; - int palette_byte;//=m_roundup_l_ram[visible_line/8]; + int palette_byte;//=m_road_color_ram[visible_line/8]; /* Each road line consists of up to two sets of 128 pixel data that can be positioned @@ -811,7 +811,7 @@ offset is from last pixel of first road segment? */ - palette_byte=m_roundup_l_ram[visible_line/8]; + palette_byte=m_road_color_ram[visible_line/8]; pal = 4 + ((palette_byte>>(visible_line%8))&1); visible_line++; @@ -1060,8 +1060,8 @@ if (0) { void roundup5_state::draw_landscape(bitmap_rgb32 &bitmap, const rectangle &cliprect, uint8_t type) { // TODO: guess, assume back layer having less scroll increment than front for parallax scrolling. - // also notice that unknown0[8/2] >> 8 is identical to [0x0c/2], always? - uint16_t x_base = type ? m_bg_scrollx[0] : m_roundup5_unknown0[0xc/2]; + // also notice that m_vregs[8/2] >> 8 is identical to [0x0c/2], always? + uint16_t x_base = type ? m_bg_scrollx[0] : m_vregs[0xc/2]; // TODO: maybe [0xa/2] applies here as well? uint16_t y_base = m_bg_scrolly[0] & 0x1ff; uint16_t y_scroll = 0x180 - y_base; @@ -1073,7 +1073,7 @@ void roundup5_state::draw_landscape(bitmap_rgb32 &bitmap, const rectangle &clipr if(type) y_scroll += 64; - //popmessage("%04x %04x %04x",m_roundup5_unknown0[8/2],m_roundup5_unknown0[0xc/2],m_bg_scrollx[0]); + //popmessage("%04x %04x %04x",m_vregs[8/2],m_vregs[0xc/2],m_bg_scrollx[0]); for(int y = 0; y < ysize; y++) {