mirror of
https://github.com/holub/mame
synced 2025-04-22 00:11:58 +03:00
sms.cpp: Further cleanup related to smssdisp (nw)
This commit is contained in:
parent
f8e9b259ab
commit
09960ad4ce
@ -641,41 +641,12 @@ MACHINE_CONFIG_START(smssdisp_state::sms_sdisp)
|
||||
config.device_remove("mycard");
|
||||
config.device_remove("smsexp");
|
||||
|
||||
SMS_CART_SLOT(config, "slot2", sms_cart, nullptr);
|
||||
SMS_CART_SLOT(config, "slot3", sms_cart, nullptr);
|
||||
SMS_CART_SLOT(config, "slot4", sms_cart, nullptr);
|
||||
SMS_CART_SLOT(config, "slot5", sms_cart, nullptr);
|
||||
SMS_CART_SLOT(config, "slot6", sms_cart, nullptr);
|
||||
SMS_CART_SLOT(config, "slot7", sms_cart, nullptr);
|
||||
SMS_CART_SLOT(config, "slot8", sms_cart, nullptr);
|
||||
SMS_CART_SLOT(config, "slot9", sms_cart, nullptr);
|
||||
SMS_CART_SLOT(config, "slot10", sms_cart, nullptr);
|
||||
SMS_CART_SLOT(config, "slot11", sms_cart, nullptr);
|
||||
SMS_CART_SLOT(config, "slot12", sms_cart, nullptr);
|
||||
SMS_CART_SLOT(config, "slot13", sms_cart, nullptr);
|
||||
SMS_CART_SLOT(config, "slot14", sms_cart, nullptr);
|
||||
SMS_CART_SLOT(config, "slot15", sms_cart, nullptr);
|
||||
SMS_CART_SLOT(config, "slot16", sms_cart, nullptr);
|
||||
|
||||
SMS_CARD_SLOT(config, "slot17", sms_cart, nullptr);
|
||||
SMS_CARD_SLOT(config, "slot18", sms_cart, nullptr);
|
||||
SMS_CARD_SLOT(config, "slot19", sms_cart, nullptr);
|
||||
SMS_CARD_SLOT(config, "slot20", sms_cart, nullptr);
|
||||
SMS_CARD_SLOT(config, "slot21", sms_cart, nullptr);
|
||||
SMS_CARD_SLOT(config, "slot22", sms_cart, nullptr);
|
||||
SMS_CARD_SLOT(config, "slot23", sms_cart, nullptr);
|
||||
SMS_CARD_SLOT(config, "slot24", sms_cart, nullptr);
|
||||
SMS_CARD_SLOT(config, "slot25", sms_cart, nullptr);
|
||||
SMS_CARD_SLOT(config, "slot26", sms_cart, nullptr);
|
||||
SMS_CARD_SLOT(config, "slot27", sms_cart, nullptr);
|
||||
SMS_CARD_SLOT(config, "slot28", sms_cart, nullptr);
|
||||
SMS_CARD_SLOT(config, "slot29", sms_cart, nullptr);
|
||||
SMS_CARD_SLOT(config, "slot30", sms_cart, nullptr);
|
||||
SMS_CARD_SLOT(config, "slot31", sms_cart, nullptr);
|
||||
SMS_CARD_SLOT(config, "slot32", sms_cart, nullptr);
|
||||
for (int i = 1; i < 16; i++)
|
||||
SMS_CART_SLOT(config, m_slots[i], sms_cart, nullptr);
|
||||
for (int i = 0; i < 16; i++)
|
||||
SMS_CARD_SLOT(config, m_cards[i], sms_cart, nullptr);
|
||||
|
||||
m_has_bios_full = false;
|
||||
m_is_sdisp = true;
|
||||
m_has_pwr_led = false;
|
||||
MACHINE_CONFIG_END
|
||||
|
||||
|
@ -63,14 +63,12 @@ public:
|
||||
m_is_gamegear(false),
|
||||
m_is_smsj(false),
|
||||
m_is_mark_iii(false),
|
||||
m_is_sdisp(false),
|
||||
m_ioctrl_region_is_japan(false),
|
||||
m_has_bios_0400(false),
|
||||
m_has_bios_2000(false),
|
||||
m_has_bios_full(false),
|
||||
m_has_jpn_sms_cart_slot(false),
|
||||
m_has_pwr_led(false),
|
||||
m_store_cart_selection_data(false)
|
||||
m_has_pwr_led(false)
|
||||
{ }
|
||||
|
||||
void sms_base(machine_config &config);
|
||||
@ -213,7 +211,6 @@ protected:
|
||||
bool m_is_gamegear;
|
||||
bool m_is_smsj;
|
||||
bool m_is_mark_iii;
|
||||
bool m_is_sdisp;
|
||||
bool m_ioctrl_region_is_japan;
|
||||
bool m_has_bios_0400;
|
||||
bool m_has_bios_2000;
|
||||
@ -259,12 +256,6 @@ protected:
|
||||
sega8_card_slot_device *m_cardslot;
|
||||
sms_expansion_slot_device *m_smsexpslot;
|
||||
sg1000_expansion_slot_device *m_sgexpslot;
|
||||
|
||||
// these are only used by the Store Display unit, but we keep them here temporarily to avoid the need of separate start/reset
|
||||
sega8_cart_slot_device *m_slots[16];
|
||||
sega8_card_slot_device *m_cards[16];
|
||||
uint8_t m_store_control;
|
||||
uint8_t m_store_cart_selection_data;
|
||||
};
|
||||
|
||||
class smssdisp_state : public sms_state
|
||||
@ -272,21 +263,36 @@ 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_control_cpu(*this, "control"),
|
||||
m_slots(*this, {"slot", "slot2", "slot3", "slot4", "slot5", "slot6", "slot7", "slot8", "slot9", "slot10", "slot11", "slot12", "slot13", "slot14", "slot15", "slot16"}),
|
||||
m_cards(*this, "slot%u", 17U),
|
||||
m_store_cart_selection_data(0)
|
||||
{ }
|
||||
|
||||
required_device<cpu_device> m_control_cpu;
|
||||
void sms_sdisp(machine_config &config);
|
||||
|
||||
protected:
|
||||
virtual void machine_start() override;
|
||||
virtual void machine_reset() override;
|
||||
virtual void device_post_load() override;
|
||||
|
||||
private:
|
||||
DECLARE_READ8_MEMBER(sms_store_cart_select_r);
|
||||
DECLARE_WRITE8_MEMBER(sms_store_cart_select_w);
|
||||
void store_select_cart(uint8_t data);
|
||||
DECLARE_WRITE8_MEMBER(sms_store_control_w);
|
||||
void init_smssdisp();
|
||||
|
||||
DECLARE_READ8_MEMBER(store_cart_peek);
|
||||
|
||||
DECLARE_WRITE_LINE_MEMBER(sms_store_int_callback);
|
||||
void sms_sdisp(machine_config &config);
|
||||
void sms_store_mem(address_map &map);
|
||||
|
||||
required_device<cpu_device> m_control_cpu;
|
||||
required_device_array<sega8_cart_slot_device, 16> m_slots;
|
||||
required_device_array<sega8_card_slot_device, 16> m_cards;
|
||||
|
||||
uint8_t m_store_control;
|
||||
uint8_t m_store_cart_selection_data;
|
||||
};
|
||||
|
||||
|
||||
|
@ -1033,8 +1033,6 @@ void sms_state::machine_start()
|
||||
m_led_pwr = 1;
|
||||
}
|
||||
|
||||
char str[7];
|
||||
|
||||
m_cartslot = machine().device<sega8_cart_slot_device>("slot");
|
||||
m_cardslot = machine().device<sega8_card_slot_device>("mycard");
|
||||
m_smsexpslot = machine().device<sms_expansion_slot_device>("smsexp");
|
||||
@ -1101,30 +1099,18 @@ void sms_state::machine_start()
|
||||
save_item(NAME(m_gg_sio));
|
||||
}
|
||||
|
||||
if (m_is_sdisp)
|
||||
{
|
||||
machine().save().register_postload(save_prepost_delegate(FUNC(sms_state::store_post_load), this));
|
||||
|
||||
save_item(NAME(m_store_control));
|
||||
save_item(NAME(m_store_cart_selection_data));
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
if (m_cartslot)
|
||||
m_cartslot->save_ram();
|
||||
}
|
||||
|
||||
void smssdisp_state::machine_start()
|
||||
{
|
||||
sms_state::machine_start();
|
||||
|
||||
save_item(NAME(m_store_control));
|
||||
save_item(NAME(m_store_cart_selection_data));
|
||||
}
|
||||
|
||||
void sms_state::machine_reset()
|
||||
{
|
||||
if (m_is_smsj)
|
||||
@ -1166,17 +1152,19 @@ void sms_state::machine_reset()
|
||||
m_gg_sio[4] = 0x00;
|
||||
}
|
||||
|
||||
if (m_is_sdisp)
|
||||
{
|
||||
m_store_control = 0;
|
||||
m_store_cart_selection_data = 0;
|
||||
store_select_cart(m_store_cart_selection_data);
|
||||
}
|
||||
|
||||
setup_bios();
|
||||
setup_media_slots();
|
||||
}
|
||||
|
||||
void smssdisp_state::machine_reset()
|
||||
{
|
||||
sms_state::machine_reset();
|
||||
|
||||
m_store_control = 0;
|
||||
m_store_cart_selection_data = 0;
|
||||
store_select_cart(m_store_cart_selection_data);
|
||||
}
|
||||
|
||||
READ8_MEMBER(smssdisp_state::sms_store_cart_select_r)
|
||||
{
|
||||
return m_store_cart_selection_data;
|
||||
@ -1191,7 +1179,7 @@ WRITE8_MEMBER(smssdisp_state::sms_store_cart_select_w)
|
||||
}
|
||||
|
||||
|
||||
void sms_state::store_post_load()
|
||||
void smssdisp_state::device_post_load()
|
||||
{
|
||||
store_select_cart(m_store_cart_selection_data);
|
||||
}
|
||||
@ -1206,7 +1194,7 @@ void sms_state::store_post_load()
|
||||
// that seems to change the active cart/card slot pair or, for the 4th
|
||||
// game switch onward of the 16-3 model, the active cart slot only.
|
||||
|
||||
void sms_state::store_select_cart(uint8_t data)
|
||||
void smssdisp_state::store_select_cart(uint8_t data)
|
||||
{
|
||||
uint8_t slot = data >> 4;
|
||||
uint8_t slottype = data & 0x08;
|
||||
@ -1214,9 +1202,9 @@ void sms_state::store_select_cart(uint8_t data)
|
||||
// The SMS Store Display Unit only uses the logical cartridge slot to
|
||||
// map the active cartridge or card slot, of its multiple ones.
|
||||
if (slottype == 0)
|
||||
m_cartslot = m_slots[slot];
|
||||
m_cartslot = m_slots[slot].target();
|
||||
else
|
||||
m_cartslot = m_cards[slot];
|
||||
m_cartslot = m_cards[slot].target();
|
||||
|
||||
logerror("switching in part of %s slot #%d\n", slottype ? "card" : "cartridge", slot);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user