summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--src/devices/machine/pccard_sram.cpp96
-rw-r--r--src/devices/machine/pccard_sram.h26
-rw-r--r--src/mame/amiga/amiga.cpp1
3 files changed, 112 insertions, 11 deletions
diff --git a/src/devices/machine/pccard_sram.cpp b/src/devices/machine/pccard_sram.cpp
index 59571b865fb..1a4f652a814 100644
--- a/src/devices/machine/pccard_sram.cpp
+++ b/src/devices/machine/pccard_sram.cpp
@@ -21,6 +21,10 @@
// DEVICE DEFINITIONS
//**************************************************************************
+// devices without attribute memory
+DEFINE_DEVICE_TYPE(PCCARD_SRAM_MITSUBISHI_1M, pccard_mitsubishi_mf31m1_lycat01_device, "mitsubishi_mf31m1_lycat01", "Mitsubishi Melcard 1 MB SRAM")
+
+// devices with attribute memory
DEFINE_DEVICE_TYPE(PCCARD_SRAM_CENTENNIAL_1M, pccard_centennial_sl01m_15_11194_device, "centennial_sl01m_15_11194", "Centennial 1 MB SRAM")
DEFINE_DEVICE_TYPE(PCCARD_SRAM_CENTENNIAL_2M, pccard_centennial_sl02m_15_11194_device, "centennial_sl02m_15_11194", "Centennial 2 MB SRAM")
DEFINE_DEVICE_TYPE(PCCARD_SRAM_CENTENNIAL_4M, pccard_centennial_sl04m_15_11194_device, "centennial_sl04m_15_11194", "Centennial 4 MB SRAM")
@@ -31,15 +35,15 @@ DEFINE_DEVICE_TYPE(PCCARD_SRAM_CENTENNIAL_4M, pccard_centennial_sl04m_15_11194_d
static INPUT_PORTS_START( card )
PORT_START("switches")
- PORT_DIPNAME(0x01, 0x00, "Battery Failed") PORT_WRITE_LINE_DEVICE_MEMBER(DEVICE_SELF, pccard_sram_device, battery_voltage_1_w)
- PORT_DIPSETTING( 0x01, DEF_STR(Yes))
- PORT_DIPSETTING( 0x00, DEF_STR(No))
- PORT_DIPNAME(0x02, 0x00, "Battery Low") PORT_WRITE_LINE_DEVICE_MEMBER(DEVICE_SELF, pccard_sram_device, battery_voltage_2_w)
- PORT_DIPSETTING( 0x02, DEF_STR(Yes))
- PORT_DIPSETTING( 0x00, DEF_STR(No))
- PORT_DIPNAME(0x04, 0x04, "Write Protect") PORT_WRITE_LINE_DEVICE_MEMBER(DEVICE_SELF, pccard_sram_device, write_protect_w)
- PORT_DIPSETTING( 0x04, DEF_STR(No))
- PORT_DIPSETTING( 0x00, DEF_STR(Yes))
+ PORT_CONFNAME(0x01, 0x00, "Battery Failed") PORT_WRITE_LINE_DEVICE_MEMBER(DEVICE_SELF, pccard_sram_device, battery_voltage_1_w)
+ PORT_CONFSETTING( 0x01, DEF_STR(Yes))
+ PORT_CONFSETTING( 0x00, DEF_STR(No))
+ PORT_CONFNAME(0x02, 0x00, "Battery Low") PORT_WRITE_LINE_DEVICE_MEMBER(DEVICE_SELF, pccard_sram_device, battery_voltage_2_w)
+ PORT_CONFSETTING( 0x02, DEF_STR(Yes))
+ PORT_CONFSETTING( 0x00, DEF_STR(No))
+ PORT_CONFNAME(0x04, 0x04, "Write Protect") PORT_WRITE_LINE_DEVICE_MEMBER(DEVICE_SELF, pccard_sram_device, write_protect_w)
+ PORT_CONFSETTING( 0x04, DEF_STR(No))
+ PORT_CONFSETTING( 0x00, DEF_STR(Yes))
INPUT_PORTS_END
ioport_constructor pccard_sram_device::device_input_ports() const
@@ -132,7 +136,7 @@ uint16_t pccard_sram_device::read_reg(offs_t offset, uint16_t mem_mask)
{
uint16_t data = 0xffff;
- if (m_card_detect)
+ if (has_configured_map(1) && m_card_detect)
data = space(1).read_word(offset * 2, mem_mask);
LOGMASKED(LOG_ATTRIBUTE, "attribute memory r: %06x = %04x & %04x\n", offset, data, mem_mask);
@@ -144,7 +148,7 @@ void pccard_sram_device::write_reg(offs_t offset, uint16_t data, uint16_t mem_ma
{
LOGMASKED(LOG_ATTRIBUTE, "attribute memory w: %06x = %04x & %04x\n", offset, data, mem_mask);
- if (m_card_detect && BIT(m_switches->read(), 2))
+ if (has_configured_map(1) && m_card_detect && BIT(m_switches->read(), 2))
space(1).write_word(offset * 2, data & 0x00ff, mem_mask);
}
@@ -157,6 +161,76 @@ void pccard_sram_device::card_inserted(bool state)
/***************************************************************************
+ Mitsubishi Melcard
+
+ MF31M1-LYCAT01: 8/16-bit Data Bus Static RAM Card
+
+***************************************************************************/
+
+pccard_mitsubishi_sram_device::pccard_mitsubishi_sram_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock) :
+ pccard_sram_device(mconfig, type, tag, owner, clock),
+ m_sram(*this, "sram")
+{
+}
+
+image_init_result pccard_mitsubishi_sram_device::call_load()
+{
+ card_inserted(false);
+
+ if (length() != m_sram.bytes())
+ return image_init_result::FAIL;
+
+ if (fread(&m_sram[0], m_sram.bytes()) != m_sram.bytes())
+ return image_init_result::FAIL;
+
+ card_inserted(true);
+
+ return image_init_result::PASS;
+}
+
+image_init_result pccard_mitsubishi_sram_device::call_create(int format_type, util::option_resolution *format_options)
+{
+ card_inserted(false);
+
+ // clear ram
+ std::fill_n(&m_sram[0], m_sram.length(), 0);
+
+ if (fwrite(&m_sram[0], m_sram.bytes()) != m_sram.bytes())
+ return image_init_result::FAIL;
+
+ card_inserted(true);
+
+ return image_init_result::PASS;
+}
+
+void pccard_mitsubishi_sram_device::call_unload()
+{
+ if (m_card_detect && !is_readonly())
+ {
+ fseek(0, SEEK_SET);
+ fwrite(&m_sram[0], m_sram.bytes());
+ }
+
+ std::fill_n(&m_sram[0], m_sram.length(), 0);
+
+ card_inserted(false);
+}
+
+pccard_mitsubishi_mf31m1_lycat01_device::pccard_mitsubishi_mf31m1_lycat01_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
+ pccard_mitsubishi_sram_device(mconfig, PCCARD_SRAM_MITSUBISHI_1M, tag, owner, clock)
+{
+ m_memory_space_config = address_space_config("memory", ENDIANNESS_LITTLE, 16, 20, 0, address_map_constructor(FUNC(pccard_mitsubishi_mf31m1_lycat01_device::memory_map), this));
+ m_attribute_space_config = address_space_config("attribute", ENDIANNESS_LITTLE, 16, 14, 0);
+}
+
+void pccard_mitsubishi_mf31m1_lycat01_device::memory_map(address_map &map)
+{
+ map(0x000000, 0x0fffff).ram().share("sram");
+}
+
+
+/***************************************************************************
+
Centennial SRAM
SL01M-15-11194: 1 MB SRAM w/ Write Protect - 150 ns Rechargeable Lithium Battery
diff --git a/src/devices/machine/pccard_sram.h b/src/devices/machine/pccard_sram.h
index fb800b858f1..2cc43e335c1 100644
--- a/src/devices/machine/pccard_sram.h
+++ b/src/devices/machine/pccard_sram.h
@@ -70,6 +70,31 @@ private:
required_ioport m_switches;
};
+class pccard_mitsubishi_sram_device : public pccard_sram_device
+{
+protected:
+ pccard_mitsubishi_sram_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock);
+
+protected:
+ // device_image_interface overrides
+ virtual image_init_result call_load() override;
+ virtual image_init_result call_create(int format_type, util::option_resolution *format_options) override;
+ virtual void call_unload() override;
+
+private:
+ required_shared_ptr<uint16_t> m_sram;
+};
+
+class pccard_mitsubishi_mf31m1_lycat01_device : public pccard_mitsubishi_sram_device
+{
+public:
+ // construction/destruction
+ pccard_mitsubishi_mf31m1_lycat01_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock = 0);
+
+private:
+ void memory_map(address_map &map);
+};
+
class pccard_centennial_sram_device : public pccard_sram_device
{
protected:
@@ -133,6 +158,7 @@ private:
};
// device type definition
+DECLARE_DEVICE_TYPE(PCCARD_SRAM_MITSUBISHI_1M, pccard_mitsubishi_mf31m1_lycat01_device)
DECLARE_DEVICE_TYPE(PCCARD_SRAM_CENTENNIAL_1M, pccard_centennial_sl01m_15_11194_device)
DECLARE_DEVICE_TYPE(PCCARD_SRAM_CENTENNIAL_2M, pccard_centennial_sl02m_15_11194_device)
DECLARE_DEVICE_TYPE(PCCARD_SRAM_CENTENNIAL_4M, pccard_centennial_sl04m_15_11194_device)
diff --git a/src/mame/amiga/amiga.cpp b/src/mame/amiga/amiga.cpp
index c3f02ff6020..7fcccce6390 100644
--- a/src/mame/amiga/amiga.cpp
+++ b/src/mame/amiga/amiga.cpp
@@ -1624,6 +1624,7 @@ static void amiga_floppies(device_slot_interface &device)
static void pcmcia_devices(device_slot_interface &device)
{
+ device.option_add("melcard_1m", PCCARD_SRAM_MITSUBISHI_1M);
device.option_add("sram_1m", PCCARD_SRAM_CENTENNIAL_1M);
device.option_add("sram_2m", PCCARD_SRAM_CENTENNIAL_2M);
device.option_add("sram_4m", PCCARD_SRAM_CENTENNIAL_4M);