From 5992d320a250dd21fe1f7bc3c3a479be652d9ab3 Mon Sep 17 00:00:00 2001 From: Robbbert Date: Fri, 19 Jun 2020 00:39:29 +1000 Subject: [PATCH] (nw) mbee: fixed stupid error causing random crash in mbee56/mbee128. --- src/mame/machine/mbee.cpp | 15 ++------------- src/mame/video/mbee.cpp | 11 ++++++----- 2 files changed, 8 insertions(+), 18 deletions(-) diff --git a/src/mame/machine/mbee.cpp b/src/mame/machine/mbee.cpp index 3540076b3b4..9293a3332be 100644 --- a/src/mame/machine/mbee.cpp +++ b/src/mame/machine/mbee.cpp @@ -303,8 +303,6 @@ void mbee_state::setup_banks(uint8_t data, bool first_time, uint8_t b_mask) if (!BIT(data, 5)) b_byte &= 0xfb; // U42/1 - S17 only valid if S5 is on - mem.unmap_read (b_vid, b_vid + 0xfff); - if (!BIT(b_byte, 4)) { // select video @@ -334,8 +332,6 @@ void mbee_state::setup_banks(uint8_t data, bool first_time, uint8_t b_mask) if (!BIT(data, 5)) b_byte &= 0xfb; // U42/1 - S17 only valid if S5 is on - mem.unmap_write (b_vid, b_vid + 0xfff); - if (!BIT(b_byte, 4)) { // select video @@ -436,13 +432,6 @@ uint8_t mbee_state::telcom_high_r() void mbee_state::machine_start() { - // must init these vars here, or weird random crashes can occur when scroll lock pressed - m_fdc_rq = 0; - m_08 = 0; - m_0a = 0; - m_0b = 0; - m_1c = 0; - save_item(NAME(m_features)); save_item(NAME(m_size)); save_item(NAME(m_b7_rtc)); @@ -513,8 +502,8 @@ void mbee_state::machine_start() } else { - m_pram = make_unique_clear(0x0800); - save_pointer(NAME(m_pram), 0x0800); + m_pram = make_unique_clear(0x1000); + save_pointer(NAME(m_pram), 0x1000); } // Banked systems diff --git a/src/mame/video/mbee.cpp b/src/mame/video/mbee.cpp index 30e1c607ce1..0d71aa2ba37 100644 --- a/src/mame/video/mbee.cpp +++ b/src/mame/video/mbee.cpp @@ -63,7 +63,7 @@ WRITE_LINE_MEMBER( mbee_state::crtc_vs ) uint8_t mbee_state::video_low_r(offs_t offset) { - if (BIT(m_features, 3) && ((m_1c & 0x9f) == 0x90)) + if ((m_1c & 0x9f) == 0x90) return m_aram[offset]; else if (m_0b) @@ -77,7 +77,7 @@ void mbee_state::video_low_w(offs_t offset, uint8_t data) if (BIT(m_1c, 4)) { // non-premium attribute writes are discarded - if (BIT(m_features, 3) && BIT(m_1c, 7)) + if (BIT(m_1c, 7)) m_aram[offset] = data; } else @@ -86,7 +86,7 @@ void mbee_state::video_low_w(offs_t offset, uint8_t data) uint8_t mbee_state::video_high_r(offs_t offset) { - if (BIT(m_08, 6)) + if (BIT(m_08, 6) && BIT(m_features, 0)) return m_cram[offset]; else return m_pram[(((m_1c & 15) + 1) << 11) | offset]; @@ -94,7 +94,7 @@ uint8_t mbee_state::video_high_r(offs_t offset) void mbee_state::video_high_w(offs_t offset, uint8_t data) { - if (BIT(m_08, 6) && (~m_0b & 1)) + if (BIT(m_08, 6) && (m_0b==0) && BIT(m_features, 0)) m_cram[offset] = data; else m_pram[(((m_1c & 15) + 1) << 11) | offset] = data; @@ -102,7 +102,8 @@ void mbee_state::video_high_w(offs_t offset, uint8_t data) void mbee_state::port0b_w(uint8_t data) { - m_0b = data & 1; + if (BIT(m_features, 0)) + m_0b = data & 1; } uint8_t mbee_state::port08_r()