summaryrefslogtreecommitdiffstatshomepage
path: root/src/devices/bus/odyssey2/4in1.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/devices/bus/odyssey2/4in1.cpp')
-rw-r--r--src/devices/bus/odyssey2/4in1.cpp53
1 files changed, 53 insertions, 0 deletions
diff --git a/src/devices/bus/odyssey2/4in1.cpp b/src/devices/bus/odyssey2/4in1.cpp
new file mode 100644
index 00000000000..e1c382e7fe9
--- /dev/null
+++ b/src/devices/bus/odyssey2/4in1.cpp
@@ -0,0 +1,53 @@
+// license:BSD-3-Clause
+// copyright-holders:hap
+/******************************************************************************
+
+Videopac 40 cartridge emulation
+
+3KB program ROM + 1KB bankswitched data ROM
+
+Used in:
+- #31: Musician
+- #40: 4 in 1 Row
+
+******************************************************************************/
+
+#include "emu.h"
+#include "4in1.h"
+
+
+//-------------------------------------------------
+// o2_4in1_device - constructor
+//-------------------------------------------------
+
+DEFINE_DEVICE_TYPE(O2_ROM_4IN1, o2_4in1_device, "o2_4in1", "Odyssey 2 Videopac 40")
+
+
+o2_4in1_device::o2_4in1_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
+ o2_rom_device(mconfig, O2_ROM_4IN1, tag, owner, clock)
+{ }
+
+void o2_4in1_device::device_start()
+{
+ save_item(NAME(m_control));
+ save_item(NAME(m_bank));
+}
+
+void o2_4in1_device::cart_init()
+{
+ if (m_rom_size != 0x1000)
+ fatalerror("o2_4in1_device: Wrong ROM region size\n");
+}
+
+
+//-------------------------------------------------
+// mapper specific handlers
+//-------------------------------------------------
+
+u8 o2_4in1_device::io_read(offs_t offset)
+{
+ if (m_control & 2)
+ return m_rom[m_bank << 8 | offset];
+ else
+ return 0xff;
+}