From 678cd3c9219c131366f4dcca29cb338257df9b43 Mon Sep 17 00:00:00 2001 From: AJR Date: Sun, 28 Mar 2021 09:38:11 -0400 Subject: [PATCH 1/2] asma2k: Fix memory-related regression --- src/mame/drivers/alphasma.cpp | 52 +++++++++++++---------------------- 1 file changed, 19 insertions(+), 33 deletions(-) diff --git a/src/mame/drivers/alphasma.cpp b/src/mame/drivers/alphasma.cpp index 3eb07232fa5cd..6310f3db7348a 100644 --- a/src/mame/drivers/alphasma.cpp +++ b/src/mame/drivers/alphasma.cpp @@ -9,6 +9,10 @@ TODO: - ADB and PS/2 - charset ROM is wrong + - asma2k keyboard doesn't work + - asma2k accesses memory below 0x8000; is there more ROM there? + - asma2k reads from nonexistent internal register at 0x0001 + (probably a bug, since the same code exists in both BIOSes) ****************************************************************************/ @@ -77,18 +81,20 @@ class asma2k_state : public alphasmart_state public: asma2k_state(const machine_config &mconfig, device_type type, const char *tag) : alphasmart_state(mconfig, type, tag) + , m_io_view(*this, "io") { } void asma2k(machine_config &config); private: - uint8_t io_r(offs_t offset); - void io_w(offs_t offset, uint8_t data); + void lcd_ctrl_w(uint8_t data); virtual void port_a_w(uint8_t data) override; void asma2k_mem(address_map &map); + memory_view m_io_view; + uint8_t m_lcd_ctrl; }; @@ -178,41 +184,16 @@ void alphasmart_state::alphasmart_mem(address_map &map) map(0xc000, 0xc000).w(FUNC(alphasmart_state::kb_matrixl_w)); } -uint8_t asma2k_state::io_r(offs_t offset) -{ - if (offset == 0x2000) - return kb_r(); - - //else printf("unknown r: %x\n", offset); - - return 0; -} - -void asma2k_state::io_w(offs_t offset, uint8_t data) +void asma2k_state::lcd_ctrl_w(uint8_t data) { - if (offset == 0x2000) - kb_matrixh_w(data); - else if (offset == 0x4000) - { - uint8_t changed = (m_lcd_ctrl ^ data) & data; - update_lcdc(changed & 0x01, changed & 0x02); - m_lcd_ctrl = data; - } - - //else printf("unknown w: %x %x\n", offset, data); + uint8_t changed = (m_lcd_ctrl ^ data) & data; + update_lcdc(changed & 0x01, changed & 0x02); + m_lcd_ctrl = data; } void asma2k_state::port_a_w(uint8_t data) { - if ((m_port_a ^ data) & 0x40) - { - address_space &space = m_maincpu->space(AS_PROGRAM); - - if (data & 0x40) - space.install_readwrite_bank(0x0000, 0x7fff, m_rambank); - else - space.install_readwrite_handler(0x0000, 0x7fff, read8sm_delegate(*this, FUNC(asma2k_state::io_r)), write8sm_delegate(*this, FUNC(asma2k_state::io_w))); - } + m_io_view.select(BIT(data, 6)); m_rambank->set_entry(((data>>4) & 0x03)); m_port_a = data; @@ -222,7 +203,12 @@ void asma2k_state::port_a_w(uint8_t data) void asma2k_state::asma2k_mem(address_map &map) { map.unmap_value_high(); - map(0x0000, 0x7fff).bankrw("rambank"); + map(0x0000, 0x7fff).view(m_io_view); + m_io_view[0](0x2000, 0x2000).rw(FUNC(asma2k_state::kb_r), FUNC(asma2k_state::kb_matrixh_w)); + m_io_view[0](0x4000, 0x4000).w(FUNC(asma2k_state::lcd_ctrl_w)); + m_io_view[0](0x7fd4, 0x7fd7).lr8(NAME([]() { return 0; })); // ? + m_io_view[0](0x7fe8, 0x7feb).lr8(NAME([]() { return 0; })); // ? + m_io_view[1](0x0000, 0x7fff).bankrw("rambank"); map(0x8000, 0xffff).rom().region("maincpu", 0); map(0x9000, 0x9000).w(FUNC(asma2k_state::kb_matrixl_w)); } From 438edcd151dae46de91c54a6e0c5ead8ed8f3800 Mon Sep 17 00:00:00 2001 From: Vas Crabb Date: Mon, 29 Mar 2021 04:30:37 +1100 Subject: [PATCH 2/2] Fix building with clang 6 Annoyingly, clang 6 produces warnings for unused private static data members, but does not recognise the [[maybe_unused]] attribute for them. --- scripts/genie.lua | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/scripts/genie.lua b/scripts/genie.lua index 895e8e3df3e7a..7ecd386cafa86 100644 --- a/scripts/genie.lua +++ b/scripts/genie.lua @@ -1086,6 +1086,12 @@ end "-Wno-unknown-warning-option", "-Wno-unused-value", } + if (version < 70000) or ((version < 100001) and (_OPTIONS["targetos"] == 'macosx')) then + buildoptions { -- clang 6.0 complains that [[maybe_unused]] is ignored for static data members + "-Wno-error=ignored-attributes", + "-Wno-error=unused-const-variable", + } + end if ((version >= 100000) and (_OPTIONS["targetos"] ~= 'macosx')) or (version >= 120000) then buildoptions { "-Wno-xor-used-as-pow", -- clang 10.0 complains that expressions like 10 ^ 7 look like exponention