From 07591974578844a0fbe6ca8757e304d7dea83387 Mon Sep 17 00:00:00 2001 From: Curt Coder Date: Tue, 24 Apr 2018 22:46:04 +0300 Subject: [PATCH] vic10: Implemented MultiMAX cartridge. [Curt Coder] --- hash/vic10.xml | 10 +++---- src/devices/bus/vic10/multimax.cpp | 42 +++++++++++++++++++++++++++++- src/devices/bus/vic10/multimax.h | 4 +++ 3 files changed, 50 insertions(+), 6 deletions(-) diff --git a/hash/vic10.xml b/hash/vic10.xml index 115fef67556..4b3c804eb00 100644 --- a/hash/vic10.xml +++ b/hash/vic10.xml @@ -322,16 +322,16 @@ - - MultiMax + + MultiMAX 2014 Rob Clarke & Michal Pleban - - + - + + diff --git a/src/devices/bus/vic10/multimax.cpp b/src/devices/bus/vic10/multimax.cpp index de197530004..3ab9ae80ad9 100644 --- a/src/devices/bus/vic10/multimax.cpp +++ b/src/devices/bus/vic10/multimax.cpp @@ -28,7 +28,8 @@ DEFINE_DEVICE_TYPE(MULTIMAX, multimax_t, "multimax", "MultiMAX Cartridge") //------------------------------------------------- multimax_t::multimax_t(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : - device_t(mconfig, MULTIMAX, tag, owner, clock), device_vic10_expansion_card_interface(mconfig, *this) + device_t(mconfig, MULTIMAX, tag, owner, clock), device_vic10_expansion_card_interface(mconfig, *this), + m_latch(0) { } @@ -39,6 +40,18 @@ multimax_t::multimax_t(const machine_config &mconfig, const char *tag, device_t void multimax_t::device_start() { + // state saving + save_item(NAME(m_latch)); +} + + +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- + +void multimax_t::device_reset() +{ + m_latch = 0; } @@ -48,6 +61,22 @@ void multimax_t::device_start() uint8_t multimax_t::vic10_cd_r(address_space &space, offs_t offset, uint8_t data, int lorom, int uprom, int exram) { + if (!lorom) + { + data = m_lorom[((m_latch & 0x3f) << 14) | (offset & 0x1fff)]; + } + else if (!uprom) + { + data = m_lorom[((m_latch & 0x3f) << 14) | 0x2000 | (offset & 0x1fff)]; + } + else if (!exram) + { + if (m_latch) + { + data = m_exram[offset & 0x7ff]; + } + } + return data; } @@ -58,4 +87,15 @@ uint8_t multimax_t::vic10_cd_r(address_space &space, offs_t offset, uint8_t data void multimax_t::vic10_cd_w(address_space &space, offs_t offset, uint8_t data, int lorom, int uprom, int exram) { + if (!exram) + { + if (m_latch) + { + m_exram[offset & 0x7ff] = data; + } + else + { + m_latch = data; + } + } } diff --git a/src/devices/bus/vic10/multimax.h b/src/devices/bus/vic10/multimax.h index 96d8cf54213..ae4cfa968d1 100644 --- a/src/devices/bus/vic10/multimax.h +++ b/src/devices/bus/vic10/multimax.h @@ -31,10 +31,14 @@ public: protected: // device-level overrides virtual void device_start() override; + virtual void device_reset() override; // device_vic10_expansion_card_interface overrides virtual uint8_t vic10_cd_r(address_space &space, offs_t offset, uint8_t data, int lorom, int uprom, int exram) override; virtual void vic10_cd_w(address_space &space, offs_t offset, uint8_t data, int lorom, int uprom, int exram) override; + +private: + uint8_t m_latch; };