(MESS) a2600.c: fixed mapper 3E support, as used by Boulder Dash

homebrew. Also allowed bankswitch writes to get to the TIA for this and 
mapper 3F. Finally, included a couple of demos in the softlist so to be
able to test the code in future. nw.
This commit is contained in:
Fabio Priuli 2014-09-17 17:24:53 +00:00
parent 3b833b1847
commit 47a2824b57
3 changed files with 53 additions and 16 deletions

View file

@ -18400,4 +18400,34 @@ Info from Atariage and Atarimania
</dataarea>
</part>
</software>
<!-- Since the released cart is undumped, let us include at least these demos to test 3E bankswitch code -->
<software name="bdash">
<description>Boulder Dash (Demo v2)</description>
<year>2014</year>
<publisher>&lt;homebrew&gt;</publisher>
<part name="cart" interface="a2600_cart">
<feature name="slot" value="a26_3e" />
<dataarea name="rom" size="32768">
<rom name="boulder dash (demo 2).bin" size="32768" crc="2f7b6112" sha1="adcb4b38413ad6851a1562cacd376dbf25a4dd00" offset="0" />
</dataarea>
<dataarea name="ram" size="32768">
</dataarea>
</part>
</software>
<software name="bdash1" cloneof="bdash">
<description>Boulder Dash (Demo v1)</description>
<year>2011</year>
<publisher>&lt;homebrew&gt;</publisher>
<part name="cart" interface="a2600_cart">
<feature name="slot" value="a26_3e" />
<dataarea name="rom" size="32768">
<rom name="boulderdash100.bin" size="32768" crc="9ba60c62" sha1="660360ee11ab442d5f9db44848d3c0c99ee61e1c" offset="0" />
</dataarea>
<dataarea name="ram" size="32768">
</dataarea>
</part>
</software>
</softwarelist>

View file

@ -678,41 +678,36 @@ WRITE8_MEMBER(a26_rom_fe_device::write_bank)
READ8_MEMBER(a26_rom_3e_device::read_rom)
{
if (m_ram && m_ram_enable && offset >= 0x400 && offset < 0x600)
{
offset -= 0x400;
return m_ram[offset + (m_ram_bank * 0x200)];
}
if (m_ram && m_ram_enable && offset < 0x400)
return m_ram[offset + (m_ram_bank * 0x400)];
if (offset >= 0x800)
return m_rom[offset + (m_num_bank - 1) * 0x800];
return m_rom[(offset & 0x7ff) + (m_num_bank - 1) * 0x800];
else
return m_rom[offset + m_base_bank * 0x800];
}
WRITE8_MEMBER(a26_rom_3e_device::write_bank)
{
if (offset) // 0x3f
if (offset == 0x3f)
{
m_base_bank = data & (m_num_bank - 1);
m_ram_enable = 0;
}
else // 0x3e
else if (offset == 0x3e)
{
m_ram_bank = data & 0x3f;
m_ram_bank = data & 0x1f;
m_ram_enable = 1;
}
}
WRITE8_MEMBER(a26_rom_3e_device::write_ram)
{
if (m_ram && m_ram_enable && offset >= 0x400 && offset < 0x600)
{
offset -= 0x400;
m_ram[offset + (m_ram_bank * 0x200)] = data;
}
if (m_ram && m_ram_enable && offset >= 0x400 && offset < 0x800)
m_ram[(offset & 0x3ff) + (m_ram_bank * 0x400)] = data;
}
/*-------------------------------------------------
"3F Bankswitch" Carts:
write access to 0x00-0x3f determines the 2K ROM bank

View file

@ -33,6 +33,7 @@ public:
m_joy1(*this, CONTROL1_TAG),
m_joy2(*this, CONTROL2_TAG) ,
m_cartslot(*this, "cartslot"),
m_tia(*this, "tia_video"),
m_maincpu(*this, "maincpu"),
m_screen(*this, "screen") { }
@ -49,6 +50,7 @@ public:
DECLARE_READ8_MEMBER(a2600_get_databus_contents);
DECLARE_WRITE16_MEMBER(a2600_tia_vsync_callback);
DECLARE_WRITE16_MEMBER(a2600_tia_vsync_callback_pal);
DECLARE_WRITE8_MEMBER(cart_over_tia_w);
// investigate how the carts mapped here (Mapper JVP) interact with the RIOT device
DECLARE_READ8_MEMBER(cart_over_riot_r);
DECLARE_WRITE8_MEMBER(cart_over_riot_w);
@ -57,6 +59,7 @@ protected:
required_device<vcs_control_port_device> m_joy1;
required_device<vcs_control_port_device> m_joy2;
required_device<vcs_cart_slot_device> m_cartslot;
required_device<tia_video_device> m_tia;
unsigned long detect_2600controllers();
required_device<m6502_device> m_maincpu;
@ -246,6 +249,15 @@ WRITE8_MEMBER(a2600_state::cart_over_riot_w)
}
WRITE8_MEMBER(a2600_state::cart_over_tia_w)
{
// Both Cart & TIA see these addresses
if (m_cartslot)
m_cartslot->write_bank(space, offset, data);
m_tia->write(space, offset, data);
}
MACHINE_START_MEMBER(a2600_state,a2600)
{
m_current_screen_height = m_screen->height();
@ -279,11 +291,11 @@ MACHINE_START_MEMBER(a2600_state,a2600)
break;
case A26_3E:
m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x1000, 0x1fff, read8_delegate(FUNC(vcs_cart_slot_device::read_rom),(vcs_cart_slot_device*)m_cartslot), write8_delegate(FUNC(vcs_cart_slot_device::write_ram),(vcs_cart_slot_device*)m_cartslot));
m_maincpu->space(AS_PROGRAM).install_write_handler(0x3e, 0x3f, write8_delegate(FUNC(vcs_cart_slot_device::write_bank),(vcs_cart_slot_device*)m_cartslot));
m_maincpu->space(AS_PROGRAM).install_write_handler(0x00, 0x3f, write8_delegate(FUNC(a2600_state::cart_over_tia_w), this));
break;
case A26_3F:
m_maincpu->space(AS_PROGRAM).install_read_handler(0x1000, 0x1fff, read8_delegate(FUNC(vcs_cart_slot_device::read_rom),(vcs_cart_slot_device*)m_cartslot));
m_maincpu->space(AS_PROGRAM).install_write_handler(0x00, 0x3f, write8_delegate(FUNC(vcs_cart_slot_device::write_bank),(vcs_cart_slot_device*)m_cartslot));
m_maincpu->space(AS_PROGRAM).install_write_handler(0x00, 0x3f, write8_delegate(FUNC(a2600_state::cart_over_tia_w), this));
break;
case A26_UA:
m_maincpu->space(AS_PROGRAM).install_read_handler(0x1000, 0x1fff, read8_delegate(FUNC(vcs_cart_slot_device::read_rom),(vcs_cart_slot_device*)m_cartslot));