odyssey2/ktaa: re-add support for 16KB size

This commit is contained in:
hap 2021-01-05 15:26:39 +01:00
parent 2eb9b99446
commit 7b22d972ae
7 changed files with 28 additions and 17 deletions

View File

@ -2646,8 +2646,8 @@ Official VP+ upgaded versions (simply adds a background picture):
<part name="cart" interface="odyssey_cart">
<feature name="slot" value="o2_ktaa" />
<feature name="b_pin" value="1" />
<dataarea name="rom" size="12288">
<rom name="ktaa.bin" size="12288" crc="4e2cc6d3" sha1="42ad0c57bd16b7f24c242f60b5c0e9988d8dfba8" />
<dataarea name="rom" size="0x3000">
<rom name="ktaa.bin" size="0x3000" crc="4e2cc6d3" sha1="42ad0c57bd16b7f24c242f60b5c0e9988d8dfba8" />
</dataarea>
</part>
</software>

View File

@ -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];
}

View File

@ -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;
};

View File

@ -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");
}

View File

@ -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)

View File

@ -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

View File

@ -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