From 7b22d972aea2dca442de9b8fb58687504e4444bc Mon Sep 17 00:00:00 2001 From: hap Date: Tue, 5 Jan 2021 15:26:39 +0100 Subject: [PATCH] odyssey2/ktaa: re-add support for 16KB size --- hash/videopac.xml | 4 ++-- src/devices/bus/odyssey2/ktaa.cpp | 30 ++++++++++++++++++++---------- src/devices/bus/odyssey2/ktaa.h | 3 ++- src/devices/bus/odyssey2/rally.cpp | 3 +-- src/devices/bus/odyssey2/slot.cpp | 1 + src/devices/bus/odyssey2/slot.h | 2 +- src/mame/drivers/odyssey2.cpp | 2 +- 7 files changed, 28 insertions(+), 17 deletions(-) diff --git a/hash/videopac.xml b/hash/videopac.xml index 944488d37ee..aeb6b8be9ee 100644 --- a/hash/videopac.xml +++ b/hash/videopac.xml @@ -2646,8 +2646,8 @@ Official VP+ upgaded versions (simply adds a background picture): - - + + diff --git a/src/devices/bus/odyssey2/ktaa.cpp b/src/devices/bus/odyssey2/ktaa.cpp index d968a35ed24..b9cf38bbf95 100644 --- a/src/devices/bus/odyssey2/ktaa.cpp +++ b/src/devices/bus/odyssey2/ktaa.cpp @@ -30,11 +30,25 @@ void o2_ktaa_device::device_start() void o2_ktaa_device::cart_init() { - u32 size = m_rom_size; - if (size != 0xc00 && size != 0xc00*2 && size != 0xc00*4) - fatalerror("o2_ktaa_device: ROM size must be multiple of 3KB\n"); + bool err = false; - m_bank_mask = (size / 0xc00) - 1; + if (m_rom_size & (m_rom_size - 1)) + { + // freely released binary file is 12KB + err = m_rom_size != 0xc00 && m_rom_size != 0xc00*2 && m_rom_size != 0xc00*4; + m_page_size = 0xc00; + } + else + { + // actual ROM is 16KB(27C128), first 1KB of each 4KB block is empty + err = m_rom_size < 0x1000; + m_page_size = 0x1000; + } + + if (err) + fatalerror("o2_ktaa_device: ROM size must be multiple of 3KB or 4KB\n"); + + m_bank_mask = (m_rom_size / m_page_size) - 1; } @@ -44,10 +58,6 @@ void o2_ktaa_device::cart_init() u8 o2_ktaa_device::read_rom04(offs_t offset) { - return m_rom[offset + m_bank * 0xc00]; -} - -u8 o2_ktaa_device::read_rom0c(offs_t offset) -{ - return m_rom[offset + 0x800 + m_bank * 0xc00]; + offset += m_page_size - 0xc00; + return m_rom[offset + m_bank * m_page_size]; } diff --git a/src/devices/bus/odyssey2/ktaa.h b/src/devices/bus/odyssey2/ktaa.h index 53ce2296941..ebb2da83a0b 100644 --- a/src/devices/bus/odyssey2/ktaa.h +++ b/src/devices/bus/odyssey2/ktaa.h @@ -30,11 +30,12 @@ protected: virtual void cart_init() override; virtual u8 read_rom04(offs_t offset) override; - virtual u8 read_rom0c(offs_t offset) override; + virtual u8 read_rom0c(offs_t offset) override { return read_rom04(offset + 0x800); } virtual void write_p1(u8 data) override { m_bank = data & m_bank_mask; } private: + u32 m_page_size = 0; u8 m_bank_mask = 0; u8 m_bank = 0; }; diff --git a/src/devices/bus/odyssey2/rally.cpp b/src/devices/bus/odyssey2/rally.cpp index fc650dfa3ce..e2d9adb135d 100644 --- a/src/devices/bus/odyssey2/rally.cpp +++ b/src/devices/bus/odyssey2/rally.cpp @@ -39,8 +39,7 @@ void o2_rally_device::device_start() void o2_rally_device::cart_init() { - u32 size = m_rom_size; - if (size & (size - 1) || size < 0x800) + if (m_rom_size & (m_rom_size - 1) || m_rom_size < 0x800) fatalerror("o2_rally_device: ROM size must be 2^x\n"); } diff --git a/src/devices/bus/odyssey2/slot.cpp b/src/devices/bus/odyssey2/slot.cpp index 657d07193e1..ddc3e7d5d12 100644 --- a/src/devices/bus/odyssey2/slot.cpp +++ b/src/devices/bus/odyssey2/slot.cpp @@ -49,6 +49,7 @@ device_o2_cart_interface::~device_o2_cart_interface() //------------------------------------------------- // o2_cart_slot_device - constructor //------------------------------------------------- + o2_cart_slot_device::o2_cart_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) : device_t(mconfig, O2_CART_SLOT, tag, owner, clock) , device_image_interface(mconfig, *this) diff --git a/src/devices/bus/odyssey2/slot.h b/src/devices/bus/odyssey2/slot.h index 1ff71cbb7ae..db187b10bc0 100644 --- a/src/devices/bus/odyssey2/slot.h +++ b/src/devices/bus/odyssey2/slot.h @@ -15,7 +15,7 @@ Videopac / Odyssey 2 cartridge pinout: T0 1 A I/O _WR B0 2 B GND B1 3 C GND - B2 4 D VCC + B2 4 D 5V B3 5 E I/O RD B4 6 F _PSEN B5 7 G A0 diff --git a/src/mame/drivers/odyssey2.cpp b/src/mame/drivers/odyssey2.cpp index 7fca5ee411f..fd681c966e6 100644 --- a/src/mame/drivers/odyssey2.cpp +++ b/src/mame/drivers/odyssey2.cpp @@ -615,7 +615,7 @@ static INPUT_PORTS_START( o2 ) PORT_START("CONF") PORT_CONFNAME( 0x01, 0x00, "Color Output" ) PORT_CHANGED_MEMBER(DEVICE_SELF, odyssey2_state, palette_changed, 0) - PORT_CONFSETTING( 0x00, "Composite" ) + PORT_CONFSETTING( 0x00, "RF" ) PORT_CONFSETTING( 0x01, "RGB" ) INPUT_PORTS_END