mirror of
https://github.com/holub/mame
synced 2025-04-26 18:23:08 +03:00
Fixed Zumwalt banking thru the Multi-Pak.
This commit is contained in:
parent
fee7039a48
commit
cadaf6d17b
@ -100,6 +100,7 @@ namespace
|
||||
virtual void device_add_mconfig(machine_config &config) override;
|
||||
|
||||
virtual uint8_t* get_cart_base() override;
|
||||
virtual uint32_t get_cart_size() override;
|
||||
|
||||
// these are only public so they can be in a MACHINE_CONFIG_START
|
||||
// declaration; don't think about them as publically accessable
|
||||
@ -443,6 +444,16 @@ uint8_t* coco_multipak_device::get_cart_base()
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------
|
||||
// get_cart_size
|
||||
//-------------------------------------------------
|
||||
|
||||
uint32_t coco_multipak_device::get_cart_size()
|
||||
{
|
||||
return active_cts_slot().get_cart_size();
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------
|
||||
// scs_read
|
||||
//-------------------------------------------------
|
||||
|
@ -95,6 +95,15 @@ const tiny_rom_entry *coco_pak_device::device_rom_region() const
|
||||
return ROM_NAME( coco_pak );
|
||||
}
|
||||
|
||||
//-------------------------------------------------
|
||||
// get_cart_size
|
||||
//-------------------------------------------------
|
||||
|
||||
uint32_t coco_pak_device::get_cart_size()
|
||||
{
|
||||
return 0x8000;
|
||||
}
|
||||
|
||||
/*-------------------------------------------------
|
||||
device_reset - device-specific startup
|
||||
-------------------------------------------------*/
|
||||
@ -121,6 +130,17 @@ uint8_t* coco_pak_device::get_cart_base()
|
||||
return memregion(CARTSLOT_TAG)->base();
|
||||
}
|
||||
|
||||
/*-------------------------------------------------
|
||||
get_cart_memregion
|
||||
-------------------------------------------------*/
|
||||
|
||||
memory_region* coco_pak_device::get_cart_memregion()
|
||||
{
|
||||
return memregion(CARTSLOT_TAG);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
BANKED CARTRIDGES
|
||||
***************************************************************************/
|
||||
@ -199,7 +219,7 @@ uint8_t *coco_pak_banked_device::get_cart_base()
|
||||
|
||||
uint32_t coco_pak_banked_device::get_cart_size()
|
||||
{
|
||||
return 0x20000;
|
||||
return 0x4000;
|
||||
}
|
||||
|
||||
//-------------------------------------------------
|
||||
|
@ -26,6 +26,8 @@ public:
|
||||
virtual ioport_constructor device_input_ports() const override;
|
||||
|
||||
virtual uint8_t* get_cart_base() override;
|
||||
virtual uint32_t get_cart_size() override;
|
||||
virtual memory_region* get_cart_memregion() override;
|
||||
|
||||
protected:
|
||||
coco_pak_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock);
|
||||
|
@ -387,9 +387,9 @@ uint32_t cococart_slot_device::get_cart_size()
|
||||
{
|
||||
if (m_cart != nullptr)
|
||||
return m_cart->get_cart_size();
|
||||
return 0;
|
||||
}
|
||||
|
||||
return 0x8000;
|
||||
}
|
||||
|
||||
//-------------------------------------------------
|
||||
// set_cart_base_update
|
||||
@ -410,20 +410,24 @@ image_init_result cococart_slot_device::call_load()
|
||||
{
|
||||
if (m_cart)
|
||||
{
|
||||
offs_t read_length;
|
||||
memory_region *cart_mem = m_cart->get_cart_memregion();
|
||||
uint8_t *base = cart_mem->base();
|
||||
offs_t read_length, cart_legnth = cart_mem->bytes();;
|
||||
|
||||
if (!loaded_through_softlist())
|
||||
{
|
||||
read_length = fread(m_cart->get_cart_base(), m_cart->get_cart_size());
|
||||
read_length = fread(base, cart_legnth);
|
||||
}
|
||||
else
|
||||
{
|
||||
read_length = get_software_region_length("rom");
|
||||
memcpy(m_cart->get_cart_base(), get_software_region("rom"), read_length);
|
||||
memcpy(base, get_software_region("rom"), read_length);
|
||||
}
|
||||
while(read_length < m_cart->get_cart_size())
|
||||
|
||||
while (read_length < cart_legnth)
|
||||
{
|
||||
offs_t len = std::min(read_length, m_cart->get_cart_size() - read_length);
|
||||
memcpy(m_cart->get_cart_base() + read_length, m_cart->get_cart_base(), len);
|
||||
memcpy(base + read_length, base, len);
|
||||
read_length += len;
|
||||
}
|
||||
}
|
||||
@ -565,8 +569,22 @@ void device_cococart_interface::cart_base_changed(void)
|
||||
{
|
||||
if (!m_update.isnull())
|
||||
m_update(get_cart_base());
|
||||
else
|
||||
{
|
||||
// propagate up to host interface
|
||||
device_cococart_interface *host = dynamic_cast<device_cococart_interface*>(m_host);
|
||||
host->cart_base_changed();
|
||||
}
|
||||
}
|
||||
|
||||
/*-------------------------------------------------
|
||||
get_cart_memregion
|
||||
-------------------------------------------------*/
|
||||
|
||||
memory_region* device_cococart_interface::get_cart_memregion()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
//-------------------------------------------------
|
||||
// cartridge_space
|
||||
|
@ -114,7 +114,7 @@ public:
|
||||
|
||||
// cart base
|
||||
uint8_t *get_cart_base();
|
||||
uint32_t get_cart_size();
|
||||
virtual uint32_t get_cart_size();
|
||||
void set_cart_base_update(cococart_base_update_delegate update);
|
||||
|
||||
private:
|
||||
@ -180,6 +180,8 @@ public:
|
||||
virtual uint8_t* get_cart_base();
|
||||
virtual uint32_t get_cart_size();
|
||||
void set_cart_base_update(cococart_base_update_delegate update);
|
||||
virtual memory_region* get_cart_memregion();
|
||||
|
||||
|
||||
virtual void interface_config_complete() override;
|
||||
virtual void interface_pre_start() override;
|
||||
|
Loading…
Reference in New Issue
Block a user