mirror of
https://github.com/holub/mame
synced 2025-06-02 19:06:43 +03:00
(MESS) added sega cards to smssdisp too and cleaned up the memory handlers. nw.
This commit is contained in:
parent
def5602cca
commit
47b76af436
@ -685,6 +685,23 @@ static MACHINE_CONFIG_START( sms_sdisp, smssdisp_state )
|
||||
MCFG_SMS_CARTRIDGE_ADD("slot15", sms_cart, NULL, NULL)
|
||||
MCFG_SMS_CARTRIDGE_ADD("slot16", sms_cart, NULL, NULL)
|
||||
|
||||
MCFG_SMS_CARD_ADD("slot17", sms_cart, NULL, NULL)
|
||||
MCFG_SMS_CARD_ADD("slot18", sms_cart, NULL, NULL)
|
||||
MCFG_SMS_CARD_ADD("slot19", sms_cart, NULL, NULL)
|
||||
MCFG_SMS_CARD_ADD("slot20", sms_cart, NULL, NULL)
|
||||
MCFG_SMS_CARD_ADD("slot21", sms_cart, NULL, NULL)
|
||||
MCFG_SMS_CARD_ADD("slot22", sms_cart, NULL, NULL)
|
||||
MCFG_SMS_CARD_ADD("slot23", sms_cart, NULL, NULL)
|
||||
MCFG_SMS_CARD_ADD("slot24", sms_cart, NULL, NULL)
|
||||
MCFG_SMS_CARD_ADD("slot25", sms_cart, NULL, NULL)
|
||||
MCFG_SMS_CARD_ADD("slot26", sms_cart, NULL, NULL)
|
||||
MCFG_SMS_CARD_ADD("slot27", sms_cart, NULL, NULL)
|
||||
MCFG_SMS_CARD_ADD("slot28", sms_cart, NULL, NULL)
|
||||
MCFG_SMS_CARD_ADD("slot29", sms_cart, NULL, NULL)
|
||||
MCFG_SMS_CARD_ADD("slot30", sms_cart, NULL, NULL)
|
||||
MCFG_SMS_CARD_ADD("slot31", sms_cart, NULL, NULL)
|
||||
MCFG_SMS_CARD_ADD("slot32", sms_cart, NULL, NULL)
|
||||
|
||||
MCFG_SOFTWARE_LIST_ADD("cart_list","sms")
|
||||
MACHINE_CONFIG_END
|
||||
|
||||
|
@ -54,6 +54,7 @@ public:
|
||||
m_port_persist(*this, "PERSISTENCE"),
|
||||
m_is_gamegear(0),
|
||||
m_is_region_japan(0),
|
||||
m_is_sdisp(0),
|
||||
m_has_bios_0400(0),
|
||||
m_has_bios_2000(0),
|
||||
m_has_bios_full(0),
|
||||
@ -119,6 +120,7 @@ public:
|
||||
// model identifiers
|
||||
UINT8 m_is_gamegear;
|
||||
UINT8 m_is_region_japan;
|
||||
UINT8 m_is_sdisp;
|
||||
UINT8 m_has_bios_0400;
|
||||
UINT8 m_has_bios_2000;
|
||||
UINT8 m_has_bios_full;
|
||||
@ -160,6 +162,8 @@ public:
|
||||
// these are only used by the Store Display unit, but we keep them here temporarily to avoid the need of separate start/reset
|
||||
UINT8 m_store_control;
|
||||
int m_current_cartridge;
|
||||
sega8_cart_slot_device *m_slots[16];
|
||||
sega8_card_slot_device *m_cards[16];
|
||||
|
||||
/* Cartridge slot info */
|
||||
DECLARE_WRITE8_MEMBER(sms_input_write);
|
||||
@ -227,40 +231,10 @@ class smssdisp_state : public sms_state
|
||||
public:
|
||||
smssdisp_state(const machine_config &mconfig, device_type type, const char *tag)
|
||||
: sms_state(mconfig, type, tag),
|
||||
m_control_cpu(*this, "control"),
|
||||
m_slot2(*this, "slot2"),
|
||||
m_slot3(*this, "slot3"),
|
||||
m_slot4(*this, "slot4"),
|
||||
m_slot5(*this, "slot5"),
|
||||
m_slot6(*this, "slot6"),
|
||||
m_slot7(*this, "slot7"),
|
||||
m_slot8(*this, "slot8"),
|
||||
m_slot9(*this, "slot9"),
|
||||
m_slot10(*this, "slot10"),
|
||||
m_slot11(*this, "slot11"),
|
||||
m_slot12(*this, "slot12"),
|
||||
m_slot13(*this, "slot13"),
|
||||
m_slot14(*this, "slot14"),
|
||||
m_slot15(*this, "slot15"),
|
||||
m_slot16(*this, "slot16")
|
||||
m_control_cpu(*this, "control")
|
||||
{ }
|
||||
|
||||
required_device<cpu_device> m_control_cpu;
|
||||
required_device<sega8_cart_slot_device> m_slot2;
|
||||
required_device<sega8_cart_slot_device> m_slot3;
|
||||
required_device<sega8_cart_slot_device> m_slot4;
|
||||
required_device<sega8_cart_slot_device> m_slot5;
|
||||
required_device<sega8_cart_slot_device> m_slot6;
|
||||
required_device<sega8_cart_slot_device> m_slot7;
|
||||
required_device<sega8_cart_slot_device> m_slot8;
|
||||
required_device<sega8_cart_slot_device> m_slot9;
|
||||
required_device<sega8_cart_slot_device> m_slot10;
|
||||
required_device<sega8_cart_slot_device> m_slot11;
|
||||
required_device<sega8_cart_slot_device> m_slot12;
|
||||
required_device<sega8_cart_slot_device> m_slot13;
|
||||
required_device<sega8_cart_slot_device> m_slot14;
|
||||
required_device<sega8_cart_slot_device> m_slot15;
|
||||
required_device<sega8_cart_slot_device> m_slot16;
|
||||
|
||||
DECLARE_READ8_MEMBER(sms_store_cart_select_r);
|
||||
DECLARE_WRITE8_MEMBER(sms_store_cart_select_w);
|
||||
|
@ -806,43 +806,9 @@ READ8_MEMBER(smssdisp_state::store_read_0000)
|
||||
return m_BIOS[(m_bios_page[3] * 0x4000) + (offset & 0x3fff)];
|
||||
}
|
||||
if (m_bank_enabled[3] == ENABLE_CART)
|
||||
{
|
||||
switch (m_current_cartridge)
|
||||
{
|
||||
case 0:
|
||||
return m_cartslot->read_cart(space, offset);
|
||||
case 1:
|
||||
return m_slot2->read_cart(space, offset);
|
||||
case 2:
|
||||
return m_slot3->read_cart(space, offset);
|
||||
case 3:
|
||||
return m_slot4->read_cart(space, offset);
|
||||
case 4:
|
||||
return m_slot5->read_cart(space, offset);
|
||||
case 5:
|
||||
return m_slot6->read_cart(space, offset);
|
||||
case 6:
|
||||
return m_slot7->read_cart(space, offset);
|
||||
case 7:
|
||||
return m_slot8->read_cart(space, offset);
|
||||
case 8:
|
||||
return m_slot9->read_cart(space, offset);
|
||||
case 9:
|
||||
return m_slot10->read_cart(space, offset);
|
||||
case 10:
|
||||
return m_slot11->read_cart(space, offset);
|
||||
case 11:
|
||||
return m_slot12->read_cart(space, offset);
|
||||
case 12:
|
||||
return m_slot13->read_cart(space, offset);
|
||||
case 13:
|
||||
return m_slot14->read_cart(space, offset);
|
||||
case 14:
|
||||
return m_slot15->read_cart(space, offset);
|
||||
case 15:
|
||||
return m_slot16->read_cart(space, offset);
|
||||
}
|
||||
}
|
||||
return m_slots[m_current_cartridge]->read_cart(space, offset);
|
||||
if (m_bank_enabled[3] == ENABLE_CARD)
|
||||
return m_cards[m_current_cartridge]->read_cart(space, offset);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -852,44 +818,11 @@ READ8_MEMBER(smssdisp_state::store_read_0000)
|
||||
return m_BIOS[(m_bios_page[0] * 0x4000) + (offset & 0x3fff)];
|
||||
}
|
||||
if (m_bank_enabled[0] == ENABLE_CART)
|
||||
{
|
||||
switch (m_current_cartridge)
|
||||
{
|
||||
case 0:
|
||||
return m_cartslot->read_cart(space, offset);
|
||||
case 1:
|
||||
return m_slot2->read_cart(space, offset);
|
||||
case 2:
|
||||
return m_slot3->read_cart(space, offset);
|
||||
case 3:
|
||||
return m_slot4->read_cart(space, offset);
|
||||
case 4:
|
||||
return m_slot5->read_cart(space, offset);
|
||||
case 5:
|
||||
return m_slot6->read_cart(space, offset);
|
||||
case 6:
|
||||
return m_slot7->read_cart(space, offset);
|
||||
case 7:
|
||||
return m_slot8->read_cart(space, offset);
|
||||
case 8:
|
||||
return m_slot9->read_cart(space, offset);
|
||||
case 9:
|
||||
return m_slot10->read_cart(space, offset);
|
||||
case 10:
|
||||
return m_slot11->read_cart(space, offset);
|
||||
case 11:
|
||||
return m_slot12->read_cart(space, offset);
|
||||
case 12:
|
||||
return m_slot13->read_cart(space, offset);
|
||||
case 13:
|
||||
return m_slot14->read_cart(space, offset);
|
||||
case 14:
|
||||
return m_slot15->read_cart(space, offset);
|
||||
case 15:
|
||||
return m_slot16->read_cart(space, offset);
|
||||
}
|
||||
}
|
||||
return m_slots[m_current_cartridge]->read_cart(space, offset);
|
||||
if (m_bank_enabled[0] == ENABLE_CARD)
|
||||
return m_cards[m_current_cartridge]->read_cart(space, offset);
|
||||
}
|
||||
|
||||
return m_region_maincpu->base()[offset];
|
||||
}
|
||||
|
||||
@ -900,48 +833,10 @@ READ8_MEMBER(smssdisp_state::store_read_4000)
|
||||
if (m_BIOS)
|
||||
return m_BIOS[(m_bios_page[1] * 0x4000) + (offset & 0x3fff)];
|
||||
}
|
||||
|
||||
if (m_bank_enabled[1] == ENABLE_CART)
|
||||
{
|
||||
offset += 0x4000;
|
||||
|
||||
switch (m_current_cartridge)
|
||||
{
|
||||
case 0:
|
||||
return m_cartslot->read_cart(space, offset);
|
||||
case 1:
|
||||
return m_slot2->read_cart(space, offset);
|
||||
case 2:
|
||||
return m_slot3->read_cart(space, offset);
|
||||
case 3:
|
||||
return m_slot4->read_cart(space, offset);
|
||||
case 4:
|
||||
return m_slot5->read_cart(space, offset);
|
||||
case 5:
|
||||
return m_slot6->read_cart(space, offset);
|
||||
case 6:
|
||||
return m_slot7->read_cart(space, offset);
|
||||
case 7:
|
||||
return m_slot8->read_cart(space, offset);
|
||||
case 8:
|
||||
return m_slot9->read_cart(space, offset);
|
||||
case 9:
|
||||
return m_slot10->read_cart(space, offset);
|
||||
case 10:
|
||||
return m_slot11->read_cart(space, offset);
|
||||
case 11:
|
||||
return m_slot12->read_cart(space, offset);
|
||||
case 12:
|
||||
return m_slot13->read_cart(space, offset);
|
||||
case 13:
|
||||
return m_slot14->read_cart(space, offset);
|
||||
case 14:
|
||||
return m_slot15->read_cart(space, offset);
|
||||
case 15:
|
||||
return m_slot16->read_cart(space, offset);
|
||||
}
|
||||
offset -= 0x4000;
|
||||
}
|
||||
return m_slots[m_current_cartridge]->read_cart(space, offset + 0x4000);
|
||||
if (m_bank_enabled[1] == ENABLE_CARD)
|
||||
return m_cards[m_current_cartridge]->read_cart(space, offset + 0x4000);
|
||||
|
||||
return m_region_maincpu->base()[offset];
|
||||
}
|
||||
@ -952,131 +847,31 @@ READ8_MEMBER(smssdisp_state::store_read_8000)
|
||||
{
|
||||
if (m_BIOS)
|
||||
return m_BIOS[(m_bios_page[2] * 0x4000) + (offset & 0x3fff)];
|
||||
}
|
||||
|
||||
}
|
||||
if (m_bank_enabled[2] == ENABLE_CART)
|
||||
{
|
||||
offset += 0x8000;
|
||||
switch (m_current_cartridge)
|
||||
{
|
||||
case 0:
|
||||
return m_cartslot->read_cart(space, offset);
|
||||
case 1:
|
||||
return m_slot2->read_cart(space, offset);
|
||||
case 2:
|
||||
return m_slot3->read_cart(space, offset);
|
||||
case 3:
|
||||
return m_slot4->read_cart(space, offset);
|
||||
case 4:
|
||||
return m_slot5->read_cart(space, offset);
|
||||
case 5:
|
||||
return m_slot6->read_cart(space, offset);
|
||||
case 6:
|
||||
return m_slot7->read_cart(space, offset);
|
||||
case 7:
|
||||
return m_slot8->read_cart(space, offset);
|
||||
case 8:
|
||||
return m_slot9->read_cart(space, offset);
|
||||
case 9:
|
||||
return m_slot10->read_cart(space, offset);
|
||||
case 10:
|
||||
return m_slot11->read_cart(space, offset);
|
||||
case 11:
|
||||
return m_slot12->read_cart(space, offset);
|
||||
case 12:
|
||||
return m_slot13->read_cart(space, offset);
|
||||
case 13:
|
||||
return m_slot14->read_cart(space, offset);
|
||||
case 14:
|
||||
return m_slot15->read_cart(space, offset);
|
||||
case 15:
|
||||
return m_slot16->read_cart(space, offset);
|
||||
}
|
||||
offset -= 0x8000;
|
||||
}
|
||||
return m_slots[m_current_cartridge]->read_cart(space, offset + 0x8000);
|
||||
if (m_bank_enabled[2] == ENABLE_CARD)
|
||||
return m_cards[m_current_cartridge]->read_cart(space, offset + 0x8000);
|
||||
|
||||
return m_region_maincpu->base()[offset];
|
||||
}
|
||||
|
||||
WRITE8_MEMBER(smssdisp_state::store_write_cart)
|
||||
{
|
||||
switch (m_current_cartridge)
|
||||
{
|
||||
case 0:
|
||||
return m_cartslot->write_cart(space, offset, data);
|
||||
case 1:
|
||||
return m_slot2->write_cart(space, offset, data);
|
||||
case 2:
|
||||
return m_slot3->write_cart(space, offset, data);
|
||||
case 3:
|
||||
return m_slot4->write_cart(space, offset, data);
|
||||
case 4:
|
||||
return m_slot5->write_cart(space, offset, data);
|
||||
case 5:
|
||||
return m_slot6->write_cart(space, offset, data);
|
||||
case 6:
|
||||
return m_slot7->write_cart(space, offset, data);
|
||||
case 7:
|
||||
return m_slot8->write_cart(space, offset, data);
|
||||
case 8:
|
||||
return m_slot9->write_cart(space, offset, data);
|
||||
case 9:
|
||||
return m_slot10->write_cart(space, offset, data);
|
||||
case 10:
|
||||
return m_slot11->write_cart(space, offset, data);
|
||||
case 11:
|
||||
return m_slot12->write_cart(space, offset, data);
|
||||
case 12:
|
||||
return m_slot13->write_cart(space, offset, data);
|
||||
case 13:
|
||||
return m_slot14->write_cart(space, offset, data);
|
||||
case 14:
|
||||
return m_slot15->write_cart(space, offset, data);
|
||||
case 15:
|
||||
return m_slot16->write_cart(space, offset, data);
|
||||
}
|
||||
// this might only work because we are not emulating properly the cart/card selection system
|
||||
// it will have to be reviewed when proper emulation is worked on!
|
||||
if (m_bank_enabled[0] == ENABLE_CART)
|
||||
m_slots[m_current_cartridge]->write_cart(space, offset, data);
|
||||
if (m_bank_enabled[0] == ENABLE_CARD)
|
||||
m_cards[m_current_cartridge]->write_cart(space, offset, data);
|
||||
}
|
||||
|
||||
READ8_MEMBER(smssdisp_state::store_cart_peek)
|
||||
{
|
||||
if (m_bank_enabled[1] == ENABLE_CART)
|
||||
{
|
||||
switch (m_current_cartridge)
|
||||
{
|
||||
case 0:
|
||||
return m_cartslot->read_cart(space, 0x4000 + (offset & 0x1fff));
|
||||
case 1:
|
||||
return m_slot2->read_cart(space, 0x4000 + (offset & 0x1fff));
|
||||
case 2:
|
||||
return m_slot3->read_cart(space, 0x4000 + (offset & 0x1fff));
|
||||
case 3:
|
||||
return m_slot4->read_cart(space, 0x4000 + (offset & 0x1fff));
|
||||
case 4:
|
||||
return m_slot5->read_cart(space, 0x4000 + (offset & 0x1fff));
|
||||
case 5:
|
||||
return m_slot6->read_cart(space, 0x4000 + (offset & 0x1fff));
|
||||
case 6:
|
||||
return m_slot7->read_cart(space, 0x4000 + (offset & 0x1fff));
|
||||
case 7:
|
||||
return m_slot8->read_cart(space, 0x4000 + (offset & 0x1fff));
|
||||
case 8:
|
||||
return m_slot9->read_cart(space, 0x4000 + (offset & 0x1fff));
|
||||
case 9:
|
||||
return m_slot10->read_cart(space, 0x4000 + (offset & 0x1fff));
|
||||
case 10:
|
||||
return m_slot11->read_cart(space, 0x4000 + (offset & 0x1fff));
|
||||
case 11:
|
||||
return m_slot12->read_cart(space, 0x4000 + (offset & 0x1fff));
|
||||
case 12:
|
||||
return m_slot13->read_cart(space, 0x4000 + (offset & 0x1fff));
|
||||
case 13:
|
||||
return m_slot14->read_cart(space, 0x4000 + (offset & 0x1fff));
|
||||
case 14:
|
||||
return m_slot15->read_cart(space, 0x4000 + (offset & 0x1fff));
|
||||
case 15:
|
||||
return m_slot16->read_cart(space, 0x4000 + (offset & 0x1fff));
|
||||
}
|
||||
}
|
||||
return m_slots[m_current_cartridge]->read_cart(space, 0x4000 + (offset & 0x1fff));
|
||||
if (m_bank_enabled[1] == ENABLE_CARD)
|
||||
return m_cards[m_current_cartridge]->read_cart(space, 0x4000 + (offset & 0x1fff));
|
||||
|
||||
return m_region_maincpu->base()[offset];
|
||||
}
|
||||
@ -1238,6 +1033,8 @@ void sms_state::setup_bios()
|
||||
|
||||
MACHINE_START_MEMBER(sms_state,sms)
|
||||
{
|
||||
char str[6];
|
||||
|
||||
m_rapid_fire_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(sms_state::rapid_fire_callback),this));
|
||||
m_rapid_fire_timer->adjust(attotime::from_hz(10), 0, attotime::from_hz(10));
|
||||
|
||||
@ -1294,8 +1091,23 @@ MACHINE_START_MEMBER(sms_state,sms)
|
||||
save_item(NAME(m_sscope_state));
|
||||
save_item(NAME(m_frame_sscope_state));
|
||||
|
||||
save_item(NAME(m_store_control));
|
||||
save_item(NAME(m_current_cartridge));
|
||||
if (m_is_sdisp)
|
||||
{
|
||||
save_item(NAME(m_store_control));
|
||||
save_item(NAME(m_current_cartridge));
|
||||
|
||||
m_slots[0] = m_cartslot;
|
||||
for (int i = 1; i < 16; i++)
|
||||
{
|
||||
sprintf(str,"slot%i",i + 1);
|
||||
m_slots[i] = machine().device<sega8_cart_slot_device>(str);
|
||||
}
|
||||
for (int i = 0; i < 16; i++)
|
||||
{
|
||||
sprintf(str,"slot%i",i + 16 + 1);
|
||||
m_cards[i] = machine().device<sega8_card_slot_device>(str);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
MACHINE_RESET_MEMBER(sms_state,sms)
|
||||
@ -1316,8 +1128,11 @@ MACHINE_RESET_MEMBER(sms_state,sms)
|
||||
m_gg_sio[3] = 0xff;
|
||||
m_gg_sio[4] = 0x00;
|
||||
|
||||
m_store_control = 0;
|
||||
m_current_cartridge = 0;
|
||||
if (m_is_sdisp)
|
||||
{
|
||||
m_store_control = 0;
|
||||
m_current_cartridge = 0;
|
||||
}
|
||||
|
||||
setup_bios();
|
||||
|
||||
@ -1460,6 +1275,7 @@ DRIVER_INIT_MEMBER(sms_state,sms2kr)
|
||||
|
||||
DRIVER_INIT_MEMBER(smssdisp_state,smssdisp)
|
||||
{
|
||||
m_is_sdisp = 1;
|
||||
setup_sms_cart();
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user