summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatarGravatar hap <happppp@users.noreply.github.com>2020-08-11 22:42:58 +0200
committerGravatarGravatar hap <happppp@users.noreply.github.com>2020-08-11 22:43:18 +0200
commit9baaf195802b8e145f9bd5da5ba32b58906deddb (patch)
tree58468ae86a9e2f8008d5953d00aa1afea05e878d
parent4da7c01ccf18c732b7ebf6431a9cf64317b729fe (diff)
odyssey2: add support for 16KB bankswitched roms
-rw-r--r--hash/g7400.xml26
-rw-r--r--scripts/src/bus.lua2
-rw-r--r--src/devices/bus/odyssey2/4in1.cpp9
-rw-r--r--src/devices/bus/odyssey2/4in1.h2
-rw-r--r--src/devices/bus/odyssey2/chess.cpp5
-rw-r--r--src/devices/bus/odyssey2/rally.cpp59
-rw-r--r--src/devices/bus/odyssey2/rally.h46
-rw-r--r--src/devices/bus/odyssey2/slot.cpp3
-rw-r--r--src/devices/bus/odyssey2/slot.h1
-rw-r--r--src/devices/bus/odyssey2/voice.cpp4
10 files changed, 133 insertions, 24 deletions
diff --git a/hash/g7400.xml b/hash/g7400.xml
index aab6d87f5c2..0f8a120341f 100644
--- a/hash/g7400.xml
+++ b/hash/g7400.xml
@@ -46,9 +46,10 @@ adds 16K RAM and 16K ROM, that plugs into the G7000.
<publisher>Philips</publisher>
<info name="serial" value="58"/>
<part name="cart" interface="odyssey_cart">
- <feature name="slot" value="o2_rom12" />
- <dataarea name="rom" size="12288">
- <rom name="air battle (europe).bin" size="12288" crc="d94d4109" sha1="66837bbd0b9df12c89215f533a1ec8b5a42d5610"/>
+ <feature name="slot" value="o2_rally" />
+ <dataarea name="rom" size="0x4000">
+ <rom name="air battle (europe).bin" offset="0x0000" size="0x3000" crc="d94d4109" sha1="66837bbd0b9df12c89215f533a1ec8b5a42d5610"/>
+ <rom offset="0x1000" size="0x3000" loadflag="reload" />
</dataarea>
</part>
</software>
@@ -221,9 +222,9 @@ adds 16K RAM and 16K ROM, that plugs into the G7000.
<publisher>Philips</publisher>
<info name="serial" value="59"/>
<part name="cart" interface="odyssey_cart">
- <feature name="slot" value="o2_rom16" />
- <dataarea name="rom" size="16384">
- <rom name="helicopter rescue (europe).bin" size="16384" crc="c4134df8" sha1="7369a2d3fb81ddc4c8086bbcd245c11ea7aaa331"/>
+ <feature name="slot" value="o2_rally" />
+ <dataarea name="rom" size="0x4000">
+ <rom name="helicopter rescue (europe).bin" size="0x4000" crc="c4134df8" sha1="7369a2d3fb81ddc4c8086bbcd245c11ea7aaa331"/>
</dataarea>
</part>
</software>
@@ -294,9 +295,10 @@ adds 16K RAM and 16K ROM, that plugs into the G7000.
<publisher>Philips</publisher>
<info name="serial" value="55"/>
<part name="cart" interface="odyssey_cart">
- <feature name="slot" value="o2_rom12" />
- <dataarea name="rom" size="12288">
- <rom name="neutron star (europe).bin" size="12288" crc="be11157c" sha1="fde3e0791b9cbef91a8462764ebf09a457ffe038"/>
+ <feature name="slot" value="o2_rally" />
+ <dataarea name="rom" size="0x4000">
+ <rom name="neutron star (europe).bin" offset="0x0000" size="0x3000" crc="be11157c" sha1="fde3e0791b9cbef91a8462764ebf09a457ffe038"/>
+ <rom offset="0x1000" size="0x3000" loadflag="reload" />
</dataarea>
</part>
</software>
@@ -405,9 +407,9 @@ adds 16K RAM and 16K ROM, that plugs into the G7000.
<year>198?</year>
<publisher>Philips</publisher>
<part name="cart" interface="odyssey_cart">
- <feature name="slot" value="o2_rom16" />
- <dataarea name="rom" size="16384">
- <rom name="trans american rally (europe).bin" size="16384" crc="0d2d721d" sha1="be8a9f2aa66acb4f5e288d1a77afada9565b530a"/>
+ <feature name="slot" value="o2_rally" />
+ <dataarea name="rom" size="0x4000">
+ <rom name="trans american rally (europe).bin" size="0x4000" crc="0d2d721d" sha1="be8a9f2aa66acb4f5e288d1a77afada9565b530a"/>
</dataarea>
</part>
</software>
diff --git a/scripts/src/bus.lua b/scripts/src/bus.lua
index 9c3c3fe2210..a5ad661c924 100644
--- a/scripts/src/bus.lua
+++ b/scripts/src/bus.lua
@@ -1694,6 +1694,8 @@ if (BUSES["O2"]~=null) then
MAME_DIR .. "src/devices/bus/odyssey2/rom.h",
MAME_DIR .. "src/devices/bus/odyssey2/4in1.cpp",
MAME_DIR .. "src/devices/bus/odyssey2/4in1.h",
+ MAME_DIR .. "src/devices/bus/odyssey2/rally.cpp",
+ MAME_DIR .. "src/devices/bus/odyssey2/rally.h",
MAME_DIR .. "src/devices/bus/odyssey2/chess.cpp",
MAME_DIR .. "src/devices/bus/odyssey2/chess.h",
MAME_DIR .. "src/devices/bus/odyssey2/voice.cpp",
diff --git a/src/devices/bus/odyssey2/4in1.cpp b/src/devices/bus/odyssey2/4in1.cpp
index fac0c1337d1..d458347c076 100644
--- a/src/devices/bus/odyssey2/4in1.cpp
+++ b/src/devices/bus/odyssey2/4in1.cpp
@@ -2,7 +2,7 @@
// copyright-holders:hap
/******************************************************************************
-Videopac 40 cartridge emulation
+Videopac 31/40 cartridge emulation
4KB ROM (program ROM is fixed, data ROM is 'bankswitched' via P11)
@@ -15,14 +15,13 @@ Used in:
#include "emu.h"
#include "4in1.h"
+DEFINE_DEVICE_TYPE(O2_ROM_4IN1, o2_4in1_device, "o2_4in1", "Odyssey 2 Videopac 40")
+
//-------------------------------------------------
// 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)
{ }
@@ -36,7 +35,7 @@ void o2_4in1_device::device_start()
void o2_4in1_device::cart_init()
{
if (m_rom_size != 0x1000)
- fatalerror("o2_4in1_device: Wrong ROM region size\n");
+ fatalerror("o2_4in1_device: ROM size must be 4096\n");
}
diff --git a/src/devices/bus/odyssey2/4in1.h b/src/devices/bus/odyssey2/4in1.h
index 51585ff5dc1..c9a6ed78b2a 100644
--- a/src/devices/bus/odyssey2/4in1.h
+++ b/src/devices/bus/odyssey2/4in1.h
@@ -2,7 +2,7 @@
// copyright-holders:hap
/**********************************************************************
- Videopac 40 cartridge emulation
+ Videopac 31/40 cartridge emulation
**********************************************************************/
diff --git a/src/devices/bus/odyssey2/chess.cpp b/src/devices/bus/odyssey2/chess.cpp
index 068050a7dcd..ec058b9cf48 100644
--- a/src/devices/bus/odyssey2/chess.cpp
+++ b/src/devices/bus/odyssey2/chess.cpp
@@ -16,14 +16,13 @@ Service manual with schematics is available.
#include "emu.h"
#include "chess.h"
+DEFINE_DEVICE_TYPE(O2_ROM_CHESS, o2_chess_device, "o2_chess", "Odyssey 2 Videopac C7010")
+
//-------------------------------------------------
// o2_chess_device - constructor
//-------------------------------------------------
-DEFINE_DEVICE_TYPE(O2_ROM_CHESS, o2_chess_device, "o2_chess", "Odyssey 2 Videopac C7010")
-
-
o2_chess_device::o2_chess_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
o2_rom_device(mconfig, O2_ROM_CHESS, tag, owner, clock),
m_cpu(*this, "subcpu"),
diff --git a/src/devices/bus/odyssey2/rally.cpp b/src/devices/bus/odyssey2/rally.cpp
new file mode 100644
index 00000000000..e965d49b1c8
--- /dev/null
+++ b/src/devices/bus/odyssey2/rally.cpp
@@ -0,0 +1,59 @@
+// license:BSD-3-Clause
+// copyright-holders:hap
+/******************************************************************************
+
+Videopac 55/58/59/60 cartridge emulation
+
+Bankswitched ROM via latch, either 16KB/2*8KB, or 4KB+8KB.
+
+Used in:
+- #55: Neutron Star
+- #58: Air Battle
+- #59: Helicopter Rescue
+- #60: Trans American Rally
+
+******************************************************************************/
+
+#include "emu.h"
+#include "rally.h"
+
+DEFINE_DEVICE_TYPE(O2_ROM_RALLY, o2_rally_device, "o2_rally", "Odyssey 2 Videopac 60")
+
+
+//-------------------------------------------------
+// o2_rally_device - constructor
+//-------------------------------------------------
+
+o2_rally_device::o2_rally_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
+ o2_rom_device(mconfig, O2_ROM_RALLY, tag, owner, clock)
+{ }
+
+void o2_rally_device::device_start()
+{
+ save_item(NAME(m_control));
+ save_item(NAME(m_bank));
+}
+
+void o2_rally_device::cart_init()
+{
+ if (m_rom_size & (m_rom_size - 1) || m_rom_size < 0x800)
+ fatalerror("o2_rally_device: ROM size must be 2^x\n");
+}
+
+
+//-------------------------------------------------
+// mapper specific handlers
+//-------------------------------------------------
+
+u8 o2_rally_device::read_rom04(offs_t offset)
+{
+ // P10 enables latch output
+ u8 bank = (m_control & 1) ? ~0 : m_bank;
+ return m_rom[(offset + bank * 0x800) & (m_rom_size - 1)];
+}
+
+void o2_rally_device::io_write(offs_t offset, u8 data)
+{
+ if (offset & 0x80 && ~m_control & 0x10)
+ m_bank = data;
+}
diff --git a/src/devices/bus/odyssey2/rally.h b/src/devices/bus/odyssey2/rally.h
new file mode 100644
index 00000000000..580d3f1df63
--- /dev/null
+++ b/src/devices/bus/odyssey2/rally.h
@@ -0,0 +1,46 @@
+// license:BSD-3-Clause
+// copyright-holders:hap
+/**********************************************************************
+
+ Videopac 55/58/59/60 cartridge emulation
+
+**********************************************************************/
+
+#ifndef MAME_BUS_ODYSSEY2_RALLY_H
+#define MAME_BUS_ODYSSEY2_RALLY_H
+
+#pragma once
+
+#include "slot.h"
+#include "rom.h"
+
+
+// ======================> o2_rally_device
+
+class o2_rally_device : public o2_rom_device
+{
+public:
+ // construction/destruction
+ o2_rally_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
+
+protected:
+ // device-level overrides
+ virtual void device_start() override;
+
+ virtual void cart_init() override;
+
+ virtual u8 read_rom04(offs_t offset) override;
+ virtual u8 read_rom0c(offs_t offset) override { return read_rom04(offset); }
+
+ virtual void write_p1(u8 data) override { m_control = data; }
+ virtual void io_write(offs_t offset, u8 data) override;
+
+private:
+ u8 m_control = 0;
+ u8 m_bank = 0;
+};
+
+// device type definition
+DECLARE_DEVICE_TYPE(O2_ROM_RALLY, o2_rally_device)
+
+#endif // MAME_BUS_ODYSSEY2_RALLY_H
diff --git a/src/devices/bus/odyssey2/slot.cpp b/src/devices/bus/odyssey2/slot.cpp
index ee814e3cc26..8f5a0fee6d0 100644
--- a/src/devices/bus/odyssey2/slot.cpp
+++ b/src/devices/bus/odyssey2/slot.cpp
@@ -117,6 +117,7 @@ static const o2_slot slot_list[] =
{ O2_ROM12, "o2_rom12" },
{ O2_ROM16, "o2_rom16" },
{ O2_4IN1, "o2_4in1" },
+ { O2_RALLY, "o2_rally" },
{ O2_CHESS, "o2_chess" },
{ O2_VOICE, "o2_voice" }
};
@@ -252,6 +253,7 @@ uint8_t o2_cart_slot_device::io_read(offs_t offset)
#include "bus/odyssey2/rom.h"
#include "bus/odyssey2/4in1.h"
+#include "bus/odyssey2/rally.h"
#include "bus/odyssey2/chess.h"
#include "bus/odyssey2/voice.h"
@@ -261,6 +263,7 @@ void o2_cart(device_slot_interface &device)
device.option_add_internal("o2_rom12", O2_ROM_12K);
device.option_add_internal("o2_rom16", O2_ROM_16K);
device.option_add_internal("o2_4in1", O2_ROM_4IN1);
+ device.option_add_internal("o2_rally", O2_ROM_RALLY);
device.option_add_internal("o2_chess", O2_ROM_CHESS);
device.option_add_internal("o2_voice", O2_ROM_VOICE);
}
diff --git a/src/devices/bus/odyssey2/slot.h b/src/devices/bus/odyssey2/slot.h
index 50119f71085..c9192a8e17f 100644
--- a/src/devices/bus/odyssey2/slot.h
+++ b/src/devices/bus/odyssey2/slot.h
@@ -20,6 +20,7 @@ enum
O2_ROM12,
O2_ROM16,
O2_4IN1,
+ O2_RALLY,
O2_CHESS,
O2_VOICE
};
diff --git a/src/devices/bus/odyssey2/voice.cpp b/src/devices/bus/odyssey2/voice.cpp
index cfcbc1f03be..b23a8abf8a0 100644
--- a/src/devices/bus/odyssey2/voice.cpp
+++ b/src/devices/bus/odyssey2/voice.cpp
@@ -14,14 +14,12 @@ TODO:
#include "voice.h"
#include "speaker.h"
+DEFINE_DEVICE_TYPE(O2_ROM_VOICE, o2_voice_device, "o2_voice", "Odyssey 2 The Voice Passthrough Cart")
//-------------------------------------------------
// o2_voice_device - constructor
//-------------------------------------------------
-DEFINE_DEVICE_TYPE(O2_ROM_VOICE, o2_voice_device, "o2_voice", "Odyssey 2 The Voice Passthrough Cart")
-
-
o2_voice_device::o2_voice_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
o2_rom_device(mconfig, O2_ROM_VOICE, tag, owner, clock),
m_speech(*this, "sp0256_speech"),