From fffd5250abc377759ac2dc0c983288f5eecfe1a5 Mon Sep 17 00:00:00 2001 From: hap Date: Fri, 15 Nov 2024 14:07:56 +0100 Subject: swimmer: no need for m_sidepen variable --- src/mame/nichibutsu/cclimber.cpp | 8 +++-- src/mame/nichibutsu/cclimber.h | 26 ++++++-------- src/mame/nichibutsu/cclimber_m.cpp | 5 ++- src/mame/nichibutsu/cclimber_v.cpp | 74 ++++++++++++++------------------------ src/mame/taito/taitosj.cpp | 6 ++-- 5 files changed, 49 insertions(+), 70 deletions(-) diff --git a/src/mame/nichibutsu/cclimber.cpp b/src/mame/nichibutsu/cclimber.cpp index 4d35923cb60..12a2f4d270a 100644 --- a/src/mame/nichibutsu/cclimber.cpp +++ b/src/mame/nichibutsu/cclimber.cpp @@ -1662,7 +1662,6 @@ void swimmer_state::swimmer(machine_config &config) GFXDECODE(config, m_gfxdecode, m_palette, gfx_swimmer); PALETTE(config, m_palette, FUNC(swimmer_state::swimmer_palette), 32*8+4*8+1); - set_sidepen(0x120); // audio hardware SPEAKER(config, "speaker").front_center(); @@ -1684,8 +1683,13 @@ void swimmer_state::au(machine_config &config) { swimmer(config); + // basic machine hardware m_maincpu->set_addrmap(AS_PROGRAM, &swimmer_state::au_map); + // no custom bgcolor or palette bank + m_mainlatch->q_out_cb<3>().set_nop(); + m_mainlatch->q_out_cb<4>().set_nop(); + m_audiocpu->remove_periodic_int(); m_screen->screen_vblank().append_inputline(m_audiocpu, INPUT_LINE_NMI); @@ -1693,10 +1697,10 @@ void swimmer_state::au(machine_config &config) subdevice("ay1")->set_clock(18.432_MHz_XTAL / 12); subdevice("ay2")->set_clock(18.432_MHz_XTAL / 12); + // video hardware m_gfxdecode->set_info(gfx_au); PALETTE(config.replace(), m_palette).set_format(palette_device::xBGR_333_nibble, 64).set_endianness(ENDIANNESS_BIG); - set_sidepen(0); } diff --git a/src/mame/nichibutsu/cclimber.h b/src/mame/nichibutsu/cclimber.h index a49b62f1164..bb1d88524ce 100644 --- a/src/mame/nichibutsu/cclimber.h +++ b/src/mame/nichibutsu/cclimber.h @@ -77,8 +77,8 @@ protected: void nmi_mask_w(int state); void cclimber_colorram_w(offs_t offset, uint8_t data); - void flip_screen_x_w(int state); - void flip_screen_y_w(int state); + void flip_screen_x_w(int state) { m_flip_x = state; } + void flip_screen_y_w(int state) { m_flip_y = state; } void cclimber_portmap(address_map &map) ATTR_COLD; @@ -123,7 +123,7 @@ class swimmer_state : public cclimber_state public: swimmer_state(const machine_config &mconfig, device_type type, const char* tag) : cclimber_state(mconfig, type, tag), - m_swimmer_background_color(*this, "bgcolor"), + m_bgcolor(*this, "bgcolor"), m_soundlatch(*this, "soundlatch") { } @@ -135,18 +135,15 @@ protected: virtual void video_start() override ATTR_COLD; private: - optional_shared_ptr m_swimmer_background_color; + optional_shared_ptr m_bgcolor; optional_device m_soundlatch; - static constexpr int SWIMMER_BG_SPLIT = 0x18 * 8; - - bool m_side_background_enabled = false; + bool m_sidebg_enabled = false; bool m_palettebank = false; - uint16_t m_sidepen = 0; uint8_t soundlatch_read_and_clear(); - void sidebg_enable_w(int state); - void palette_bank_w(int state); + void sidebg_enable_w(int state) { m_sidebg_enabled = state; } + void palette_bank_w(int state) { m_palettebank = state; } void swimmer_root_map(address_map &map) ATTR_COLD; void swimmer_map(address_map &map) ATTR_COLD; @@ -159,7 +156,6 @@ private: void swimmer_draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect, gfx_element* gfx); uint32_t screen_update_swimmer(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); void set_background_pen(); - void set_sidepen(uint16_t pen) { m_sidepen = pen; } TILE_GET_INFO_MEMBER(swimmer_get_pf_tile_info); }; @@ -168,8 +164,8 @@ class toprollr_state : public cclimber_state public: toprollr_state(const machine_config &mconfig, device_type type, const char* tag) : cclimber_state(mconfig, type, tag), - m_toprollr_bg_videoram(*this, "bg_videoram"), - m_toprollr_bg_coloram(*this, "bg_coloram"), + m_bg_videoram(*this, "bg_videoram"), + m_bg_coloram(*this, "bg_coloram"), m_bank1(*this, "bank1"), m_bank1d(*this, "bank1d") { } @@ -182,8 +178,8 @@ protected: virtual void video_start() override ATTR_COLD; private: - optional_shared_ptr m_toprollr_bg_videoram; - optional_shared_ptr m_toprollr_bg_coloram; + optional_shared_ptr m_bg_videoram; + optional_shared_ptr m_bg_coloram; required_memory_bank m_bank1; required_memory_bank m_bank1d; diff --git a/src/mame/nichibutsu/cclimber_m.cpp b/src/mame/nichibutsu/cclimber_m.cpp index 35edfeea6dc..2461fabb1ec 100644 --- a/src/mame/nichibutsu/cclimber_m.cpp +++ b/src/mame/nichibutsu/cclimber_m.cpp @@ -12,15 +12,14 @@ void cclimber_state::cclimber_decode(const uint8_t convtable[8][16]) for (int A = 0x0000;A < 0x6000;A++) { - int i,j; uint8_t src = rom[A]; // pick the translation table from bit 0 of the address // and from bits 1 7 of the source data - i = (A & 1) | (src & 0x02) | ((src & 0x80) >> 5); + int i = (A & 1) | (src & 0x02) | ((src & 0x80) >> 5); // pick the offset in the table from bits 0 2 4 6 of the source data - j = (src & 0x01) | ((src & 0x04) >> 1) | ((src & 0x10) >> 2) | ((src & 0x40) >> 3); + int j = (src & 0x01) | ((src & 0x04) >> 1) | ((src & 0x10) >> 2) | ((src & 0x40) >> 3); // decode the opcodes m_decrypted_opcodes[A] = (src & 0xaa) | convtable[i][j]; diff --git a/src/mame/nichibutsu/cclimber_v.cpp b/src/mame/nichibutsu/cclimber_v.cpp index e8c2a8f94bb..3c2041a2f9d 100644 --- a/src/mame/nichibutsu/cclimber_v.cpp +++ b/src/mame/nichibutsu/cclimber_v.cpp @@ -165,9 +165,10 @@ void swimmer_state::swimmer_palette(palette_device &palette) const // side panel backgrond pen #if 0 // values calculated from the resistors don't seem to match the real board - palette.set_pen_color(m_sidepen, rgb_t(0x24, 0x5d, 0x4e)); + palette.set_pen_color(0x120, rgb_t(0x24, 0x5d, 0x4e)); +#else + palette.set_pen_color(0x120, rgb_t(0x20, 0x98, 0x79)); #endif - palette.set_pen_color(m_sidepen, rgb_t(0x20, 0x98, 0x79)); } @@ -286,20 +287,20 @@ void swimmer_state::set_background_pen() // red component bit0 = 0; - bit1 = (*m_swimmer_background_color >> 6) & 0x01; - bit2 = (*m_swimmer_background_color >> 7) & 0x01; + bit1 = (*m_bgcolor >> 6) & 0x01; + bit2 = (*m_bgcolor >> 7) & 0x01; int const r = 0x20 * bit0 + 0x40 * bit1 + 0x80 * bit2; // green component - bit0 = (*m_swimmer_background_color >> 3) & 0x01; - bit1 = (*m_swimmer_background_color >> 4) & 0x01; - bit2 = (*m_swimmer_background_color >> 5) & 0x01; + bit0 = (*m_bgcolor >> 3) & 0x01; + bit1 = (*m_bgcolor >> 4) & 0x01; + bit2 = (*m_bgcolor >> 5) & 0x01; int const g = 0x20 * bit0 + 0x40 * bit1 + 0x80 * bit2; // blue component - bit0 = (*m_swimmer_background_color >> 0) & 0x01; - bit1 = (*m_swimmer_background_color >> 1) & 0x01; - bit2 = (*m_swimmer_background_color >> 2) & 0x01; + bit0 = (*m_bgcolor >> 0) & 0x01; + bit1 = (*m_bgcolor >> 1) & 0x01; + bit2 = (*m_bgcolor >> 2) & 0x01; int const b = 0x20 * bit0 + 0x40 * bit1 + 0x80 * bit2; m_palette->set_pen_color(0, rgb_t(r, g, b)); @@ -310,31 +311,7 @@ void cclimber_state::cclimber_colorram_w(offs_t offset, uint8_t data) { // A5 is not connected, there is only 0x200 bytes of RAM m_colorram[offset & ~0x20] = data; - m_colorram[offset | 0x20] = data; -} - - -void cclimber_state::flip_screen_x_w(int state) -{ - m_flip_x = state; -} - - -void cclimber_state::flip_screen_y_w(int state) -{ - m_flip_y = state; -} - - -void swimmer_state::sidebg_enable_w(int state) -{ - m_side_background_enabled = state; -} - - -void swimmer_state::palette_bank_w(int state) -{ - m_palettebank = state; + m_colorram[offset | 0x20] = data; } @@ -412,8 +389,8 @@ TILE_GET_INFO_MEMBER(toprollr_state::toprollr_get_bs_tile_info) TILE_GET_INFO_MEMBER(toprollr_state::toproller_get_bg_tile_info) { - const int code = ((m_toprollr_bg_coloram[tile_index] & 0x40) << 2) | m_toprollr_bg_videoram[tile_index]; - const int color = m_toprollr_bg_coloram[tile_index] & 0x0f; + const int code = ((m_bg_coloram[tile_index] & 0x40) << 2) | m_bg_videoram[tile_index]; + const int color = m_bg_coloram[tile_index] & 0x0f; tileinfo.set(3, code, color, TILE_FLIPX); } @@ -455,7 +432,7 @@ void swimmer_state::video_start() save_item(NAME(m_flip_x)); save_item(NAME(m_flip_y)); - save_item(NAME(m_side_background_enabled)); + save_item(NAME(m_sidebg_enabled)); save_item(NAME(m_palettebank)); } @@ -725,32 +702,35 @@ uint32_t yamato_state::screen_update_yamato(screen_device &screen, bitmap_rgb32 uint32_t swimmer_state::screen_update_swimmer(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - if (m_swimmer_background_color) + if (m_bgcolor) set_background_pen(); - if (m_side_background_enabled) + // fill side panel background + if (m_sidebg_enabled) { + const uint8_t split_pos = 0x18 * 8; + if (m_flip_x) { - rectangle split_rect_left(0, 0xff - SWIMMER_BG_SPLIT, 0, 0xff); - rectangle split_rect_right(0x100 - SWIMMER_BG_SPLIT, 0xff, 0, 0xff); + rectangle split_rect_left(0, 0xff - split_pos, 0, 0xff); + rectangle split_rect_right(0x100 - split_pos, 0xff, 0, 0xff); split_rect_left &= cliprect; - bitmap.fill(m_sidepen, split_rect_left); + bitmap.fill(0x120, split_rect_left); split_rect_right &= cliprect; bitmap.fill(0, split_rect_right); } else { - rectangle split_rect_left(0, SWIMMER_BG_SPLIT - 1, 0, 0xff); - rectangle split_rect_right(SWIMMER_BG_SPLIT, 0xff, 0, 0xff); + rectangle split_rect_left(0, split_pos - 1, 0, 0xff); + rectangle split_rect_right(split_pos, 0xff, 0, 0xff); split_rect_left &= cliprect; bitmap.fill(0, split_rect_left); split_rect_right &= cliprect; - bitmap.fill(m_sidepen, split_rect_right); + bitmap.fill(0x120, split_rect_right); } } else @@ -784,7 +764,7 @@ uint32_t toprollr_state::screen_update_toprollr(screen_device &screen, bitmap_in bitmap.fill(0, cliprect); - m_bg_tilemap->set_scrollx(0, m_toprollr_bg_videoram[0]); + m_bg_tilemap->set_scrollx(0, m_bg_videoram[0]); m_bg_tilemap->set_flip((m_flip_x ? TILEMAP_FLIPX : 0) | (m_flip_y ? TILEMAP_FLIPY : 0)); m_bg_tilemap->mark_all_dirty(); m_bg_tilemap->draw(screen, bitmap, scroll_area_clip, 0, 0); diff --git a/src/mame/taito/taitosj.cpp b/src/mame/taito/taitosj.cpp index e22b6113670..b79f414cd02 100644 --- a/src/mame/taito/taitosj.cpp +++ b/src/mame/taito/taitosj.cpp @@ -148,15 +148,15 @@ port B: bit 0 NMI enable Notes: ------ -- Alpine Sky uses the feature where write to d50e-d50f can be processed by a PAL and +- Alpine Ski uses the feature where write to d50e-d50f can be processed by a PAL and answer read back from d40b. Kickstart Wheelie King : -- additional ram @ $d800-$dfff (scroll ram + ??) +- additional ram @ $d800-$dfff (scroll ram + ??) - color bank @ $d000-$d001 - taitosj_scroll @ $d002-$d007 - strange controls : - - 'revolve type' - 3 pos switch (gears) + button/pedal (accel) + - 'revolve type' - 3 pos switch (gears) + button/pedal (accel) - two buttons for gear change, auto acceleration TODO: -- cgit v1.2.3