From 7b55b281dcfc14a4befabcb359e1c4a0572d27aa Mon Sep 17 00:00:00 2001 From: Robbbert Date: Fri, 11 Jun 2021 00:30:28 +1000 Subject: [PATCH] mbee: fixed bug with telcom bankswitching. --- hash/mbee_cart.xml | 14 +++++++------- src/mame/includes/mbee.h | 5 ++++- src/mame/machine/mbee.cpp | 16 ++++++++-------- src/mame/video/mbee.cpp | 3 +-- 4 files changed, 20 insertions(+), 18 deletions(-) diff --git a/hash/mbee_cart.xml b/hash/mbee_cart.xml index 326ff054a4b..7ba2b8c4f58 100644 --- a/hash/mbee_cart.xml +++ b/hash/mbee_cart.xml @@ -352,7 +352,7 @@ Most roms can be mounted in any slot, although sometimes one is recommended in t 198? Microworld - + @@ -365,7 +365,7 @@ Most roms can be mounted in any slot, although sometimes one is recommended in t 198? Microworld - + @@ -378,7 +378,7 @@ Most roms can be mounted in any slot, although sometimes one is recommended in t 198? Microworld - + @@ -391,7 +391,7 @@ Most roms can be mounted in any slot, although sometimes one is recommended in t 198? Microworld - + @@ -404,7 +404,7 @@ Most roms can be mounted in any slot, although sometimes one is recommended in t 198? Microworld - + @@ -417,7 +417,7 @@ Most roms can be mounted in any slot, although sometimes one is recommended in t 198? Microworld - + @@ -430,7 +430,7 @@ Most roms can be mounted in any slot, although sometimes one is recommended in t 198? Microworld - + diff --git a/src/mame/includes/mbee.h b/src/mame/includes/mbee.h index f1248babb4c..04e212d0791 100644 --- a/src/mame/includes/mbee.h +++ b/src/mame/includes/mbee.h @@ -65,7 +65,10 @@ public: , m_bankr(*this, "bankr%d", 0U) , m_bankw(*this, "bankw%d", 0U) , m_pak(*this, "optrom%u", 0U) // "rom" causes issues - { } + { + for (u8 n : m_pak_extended) + m_pak_extended[n] = 0; + } void mbee56(machine_config &config); void mbeeppc(machine_config &config); diff --git a/src/mame/machine/mbee.cpp b/src/mame/machine/mbee.cpp index 68fb2e446ee..e6278c42e81 100644 --- a/src/mame/machine/mbee.cpp +++ b/src/mame/machine/mbee.cpp @@ -370,7 +370,7 @@ void mbee_state::port50_w(u8 data) Output the PAK number to choose an optional PAK ROM. The bios will support 256 PAKs, although normally only - 8 are available in hardware. Each PAK is normally a 8K + 6 are available in hardware. Each PAK is normally a 8K ROM. If 16K ROMs are used, the 2nd half becomes PAK+8, thus 16 PAKs in total. This is used in the PC85 models. @@ -386,7 +386,7 @@ void mbee_state::port0a_w(u8 data) u8 mbee_state::telcom_r(offs_t offset) { m_09 = BIT(offset, 8); - return 0xff; + return m_09; } u8 mbee_state::pak_r(offs_t offset) @@ -540,13 +540,14 @@ void mbee_state::machine_start() // set pak index to true for 16k roms if (m_pakdef) for (u8 i = 8; i < 14; i++) - m_pak_extended[(i & 7)+2] = (m_p_pakdef[(i<<13)] == 0xff) ? false : true; - else - for (u8 i = 2; i < 8; i++) - m_pak_extended[i] = false; + if (!(m_pak[i-8] && m_pak[i-8]->exists())) + if (m_p_pakdef[(i<<13)] != 0xff) + m_pak_extended[(i & 7)+2] = true; // set net index to true for 8k roms - m_pak_extended[1] = (m_netdef && (m_netdef->bytes() > 0x1000)) ? true : false; + if (m_netdef && (m_netdef->bytes() > 0x1000)) + if (!(m_pak[1] && m_pak[1]->exists())) + m_pak_extended[1] = true; } void mbee_state::machine_reset() @@ -760,7 +761,6 @@ image_init_result mbee_state::load_cart(device_image_interface &image, generic_s image.seterror(IMAGE_ERROR_UNSPECIFIED, "Unsupported ROM size"); return image_init_result::FAIL; } - m_pak_extended[pak_index] = (size > 0x1000) ? true : false; slot->rom_alloc(m_pak_extended ? 0x2000 : 0x1000, GENERIC_ROM8_WIDTH, ENDIANNESS_LITTLE); diff --git a/src/mame/video/mbee.cpp b/src/mame/video/mbee.cpp index 1a9ba1bdbc7..10d9ff271bf 100644 --- a/src/mame/video/mbee.cpp +++ b/src/mame/video/mbee.cpp @@ -344,10 +344,9 @@ void mbee_state::standard_palette(palette_device &palette) const { constexpr u8 bglevel[] = { 0, 0x54, 0xa0, 0xff }; constexpr u8 fglevel[] = { 0, 0xa0, 0xff, 0xff }; - u8 i; // set up background colours (00-63) - i = 0; + u8 i = 0; for (u8 b : bglevel) { for (u8 g : bglevel)