mirror of
https://github.com/holub/mame
synced 2025-04-29 19:37:17 +03:00
fixed multisession crash when the new cart needed a dynamic buffer/array
larger than the original one. this got introduced when converting from auto_alloc_array to dynamic buffers, because such buffers are not made NULL at reset, but got unnoticed/unreported up to now. many thanks to Trebor for catching it! nw.
This commit is contained in:
parent
af251eb276
commit
69fdbd5872
@ -62,21 +62,18 @@ device_a78_cart_interface::~device_a78_cart_interface ()
|
||||
|
||||
void device_a78_cart_interface::rom_alloc(UINT32 size)
|
||||
{
|
||||
if (m_rom == NULL)
|
||||
{
|
||||
m_rom.resize(size);
|
||||
|
||||
// setup other helpers
|
||||
if ((size / 0x4000) & 1) // compensate for SuperGame carts with 9 x 16K banks (to my knowledge no other cart has m_bank_mask != power of 2)
|
||||
m_bank_mask = (size / 0x4000) - 2;
|
||||
else
|
||||
m_bank_mask = (size / 0x4000) - 1;
|
||||
|
||||
// the rom is mapped to the top of the memory area
|
||||
// so we store the starting point of data to simplify
|
||||
// the access handling
|
||||
m_base_rom = 0x10000 - size;
|
||||
}
|
||||
m_rom.resize(size);
|
||||
|
||||
// setup other helpers
|
||||
if ((size / 0x4000) & 1) // compensate for SuperGame carts with 9 x 16K banks (to my knowledge no other cart has m_bank_mask != power of 2)
|
||||
m_bank_mask = (size / 0x4000) - 2;
|
||||
else
|
||||
m_bank_mask = (size / 0x4000) - 1;
|
||||
|
||||
// the rom is mapped to the top of the memory area
|
||||
// so we store the starting point of data to simplify
|
||||
// the access handling
|
||||
m_base_rom = 0x10000 - size;
|
||||
}
|
||||
|
||||
//-------------------------------------------------
|
||||
@ -85,11 +82,8 @@ void device_a78_cart_interface::rom_alloc(UINT32 size)
|
||||
|
||||
void device_a78_cart_interface::ram_alloc(UINT32 size)
|
||||
{
|
||||
if (m_ram == NULL)
|
||||
{
|
||||
m_ram.resize(size);
|
||||
device().save_item(NAME(m_ram));
|
||||
}
|
||||
m_ram.resize(size);
|
||||
device().save_item(NAME(m_ram));
|
||||
}
|
||||
|
||||
|
||||
@ -99,11 +93,8 @@ void device_a78_cart_interface::ram_alloc(UINT32 size)
|
||||
|
||||
void device_a78_cart_interface::nvram_alloc(UINT32 size)
|
||||
{
|
||||
if (m_nvram == NULL)
|
||||
{
|
||||
m_nvram.resize(size);
|
||||
device().save_item(NAME(m_nvram));
|
||||
}
|
||||
m_nvram.resize(size);
|
||||
device().save_item(NAME(m_nvram));
|
||||
}
|
||||
|
||||
|
||||
@ -120,7 +111,6 @@ a78_cart_slot_device::a78_cart_slot_device(const machine_config &mconfig, const
|
||||
device_image_interface(mconfig, *this),
|
||||
device_slot_interface(mconfig, *this)
|
||||
{
|
||||
m_type = A78_NOCART;
|
||||
}
|
||||
|
||||
|
||||
@ -321,8 +311,7 @@ static const a78_slot slot_list[] =
|
||||
{ A78_TYPE1_POK450, "a78_p450_t1" },
|
||||
{ A78_TYPE6_POK450, "a78_p450_t6" },
|
||||
{ A78_TYPEA_POK450, "a78_p450_ta" },
|
||||
{ A78_VERSA_POK450, "a78_p450_vb" },
|
||||
{ A78_NOCART, "empty" }, // the code should never get here, of course...
|
||||
{ A78_VERSA_POK450, "a78_p450_vb" }
|
||||
};
|
||||
|
||||
static int a78_get_pcb_id(const char *slot)
|
||||
@ -508,7 +497,7 @@ void a78_cart_slot_device::call_unload()
|
||||
|
||||
bool a78_cart_slot_device::call_softlist_load(software_list_device &swlist, const char *swname, const rom_entry *start_entry)
|
||||
{
|
||||
load_software_part_region(*this, swlist, swname, start_entry );
|
||||
load_software_part_region(*this, swlist, swname, start_entry);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
@ -30,8 +30,7 @@ enum
|
||||
A78_TYPE1_POK450 = 0x21,
|
||||
A78_TYPE6_POK450 = 0x24,
|
||||
A78_TYPEA_POK450 = 0x25,
|
||||
A78_VERSA_POK450 = 0x30,
|
||||
A78_NOCART
|
||||
A78_VERSA_POK450 = 0x30
|
||||
};
|
||||
|
||||
|
||||
|
@ -59,13 +59,10 @@ device_a800_cart_interface::~device_a800_cart_interface ()
|
||||
|
||||
void device_a800_cart_interface::rom_alloc(UINT32 size)
|
||||
{
|
||||
if (m_rom == NULL)
|
||||
{
|
||||
m_rom.resize(size);
|
||||
|
||||
// setup other helpers
|
||||
m_bank_mask = (size / 0x2000) - 1; // code for XEGS carts makes use of this to simplify banking
|
||||
}
|
||||
m_rom.resize(size);
|
||||
|
||||
// setup other helpers
|
||||
m_bank_mask = (size / 0x2000) - 1; // code for XEGS carts makes use of this to simplify banking
|
||||
}
|
||||
|
||||
//-------------------------------------------------
|
||||
@ -74,11 +71,8 @@ void device_a800_cart_interface::rom_alloc(UINT32 size)
|
||||
|
||||
void device_a800_cart_interface::ram_alloc(UINT32 size)
|
||||
{
|
||||
if (m_ram == NULL)
|
||||
{
|
||||
m_ram.resize(size);
|
||||
device().save_item(NAME(m_ram));
|
||||
}
|
||||
m_ram.resize(size);
|
||||
device().save_item(NAME(m_ram));
|
||||
}
|
||||
|
||||
|
||||
@ -88,11 +82,8 @@ void device_a800_cart_interface::ram_alloc(UINT32 size)
|
||||
|
||||
void device_a800_cart_interface::nvram_alloc(UINT32 size)
|
||||
{
|
||||
if (m_nvram == NULL)
|
||||
{
|
||||
m_nvram.resize(size);
|
||||
device().save_item(NAME(m_nvram));
|
||||
}
|
||||
m_nvram.resize(size);
|
||||
device().save_item(NAME(m_nvram));
|
||||
}
|
||||
|
||||
|
||||
@ -109,7 +100,6 @@ a800_cart_slot_device::a800_cart_slot_device(const machine_config &mconfig, devi
|
||||
device_image_interface(mconfig, *this),
|
||||
device_slot_interface(mconfig, *this)
|
||||
{
|
||||
m_type = A800_NOCART;
|
||||
}
|
||||
|
||||
a800_cart_slot_device::a800_cart_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
|
||||
@ -117,7 +107,6 @@ a800_cart_slot_device::a800_cart_slot_device(const machine_config &mconfig, cons
|
||||
device_image_interface(mconfig, *this),
|
||||
device_slot_interface(mconfig, *this)
|
||||
{
|
||||
m_type = A800_NOCART;
|
||||
}
|
||||
|
||||
|
||||
@ -215,8 +204,7 @@ static const a800_slot slot_list[] =
|
||||
{ A5200_32K, "a5200" },
|
||||
{ A5200_16K_2CHIPS, "a5200_2chips" },
|
||||
{ A5200_32K, "a5200" },
|
||||
{ A5200_BBSB, "a5200_bbsb" },
|
||||
{ A800_NOCART, "empty" },
|
||||
{ A5200_BBSB, "a5200_bbsb" }
|
||||
};
|
||||
|
||||
|
||||
@ -314,7 +302,7 @@ void a800_cart_slot_device::call_unload()
|
||||
|
||||
bool a800_cart_slot_device::call_softlist_load(software_list_device &swlist, const char *swname, const rom_entry *start_entry)
|
||||
{
|
||||
load_software_part_region(*this, swlist, swname, start_entry );
|
||||
load_software_part_region(*this, swlist, swname, start_entry);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
@ -37,8 +37,7 @@ enum
|
||||
A5200_16K,
|
||||
A5200_32K,
|
||||
A5200_16K_2CHIPS,
|
||||
A5200_BBSB,
|
||||
A800_NOCART
|
||||
A5200_BBSB
|
||||
};
|
||||
|
||||
|
||||
|
@ -57,8 +57,7 @@ device_gb_cart_interface::~device_gb_cart_interface()
|
||||
|
||||
void device_gb_cart_interface::rom_alloc(UINT32 size)
|
||||
{
|
||||
if (m_rom == NULL)
|
||||
m_rom.resize(size);
|
||||
m_rom.resize(size);
|
||||
}
|
||||
|
||||
|
||||
@ -68,11 +67,8 @@ void device_gb_cart_interface::rom_alloc(UINT32 size)
|
||||
|
||||
void device_gb_cart_interface::ram_alloc(UINT32 size)
|
||||
{
|
||||
if (m_ram == NULL)
|
||||
{
|
||||
m_ram.resize(size);
|
||||
device().save_item(NAME(m_ram));
|
||||
}
|
||||
m_ram.resize(size);
|
||||
device().save_item(NAME(m_ram));
|
||||
}
|
||||
|
||||
|
||||
@ -447,7 +443,7 @@ void base_gb_cart_slot_device::setup_ram(UINT8 banks)
|
||||
|
||||
bool base_gb_cart_slot_device::call_softlist_load(software_list_device &swlist, const char *swname, const rom_entry *start_entry)
|
||||
{
|
||||
load_software_part_region(*this, swlist, swname, start_entry );
|
||||
load_software_part_region(*this, swlist, swname, start_entry);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -46,11 +46,8 @@ device_gba_cart_interface::~device_gba_cart_interface()
|
||||
|
||||
void device_gba_cart_interface::nvram_alloc(UINT32 size)
|
||||
{
|
||||
if (m_nvram == NULL)
|
||||
{
|
||||
m_nvram.resize(size/sizeof(UINT32));
|
||||
device().save_item(NAME(m_nvram));
|
||||
}
|
||||
m_nvram.resize(size/sizeof(UINT32));
|
||||
device().save_item(NAME(m_nvram));
|
||||
}
|
||||
|
||||
|
||||
@ -239,7 +236,7 @@ void gba_cart_slot_device::call_unload()
|
||||
|
||||
bool gba_cart_slot_device::call_softlist_load(software_list_device &swlist, const char *swname, const rom_entry *start_entry)
|
||||
{
|
||||
load_software_part_region(*this, swlist, swname, start_entry );
|
||||
load_software_part_region(*this, swlist, swname, start_entry);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
@ -98,11 +98,8 @@ void device_md_cart_interface::rom_alloc(size_t size, const char *tag)
|
||||
|
||||
void device_md_cart_interface::nvram_alloc(size_t size)
|
||||
{
|
||||
if (m_nvram == NULL)
|
||||
{
|
||||
m_nvram.resize(size/sizeof(UINT16));
|
||||
device().save_item(NAME(m_nvram));
|
||||
}
|
||||
m_nvram.resize(size/sizeof(UINT16));
|
||||
device().save_item(NAME(m_nvram));
|
||||
}
|
||||
|
||||
//-------------------------------------------------
|
||||
@ -684,7 +681,7 @@ void base_md_cart_slot_device::setup_nvram()
|
||||
|
||||
bool base_md_cart_slot_device::call_softlist_load(software_list_device &swlist, const char *swname, const rom_entry *start_entry)
|
||||
{
|
||||
load_software_part_region(*this, swlist, swname, start_entry );
|
||||
load_software_part_region(*this, swlist, swname, start_entry);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
@ -78,13 +78,6 @@ enum
|
||||
};
|
||||
|
||||
|
||||
// ======================> md_cart_interface
|
||||
|
||||
struct md_cart_interface
|
||||
{
|
||||
};
|
||||
|
||||
|
||||
// ======================> device_md_cart_interface
|
||||
|
||||
class device_md_cart_interface : public device_slot_card_interface
|
||||
@ -138,7 +131,6 @@ public:
|
||||
// ======================> base_md_cart_slot_device
|
||||
|
||||
class base_md_cart_slot_device : public device_t,
|
||||
public md_cart_interface,
|
||||
public device_image_interface,
|
||||
public device_slot_interface
|
||||
{
|
||||
|
@ -142,98 +142,87 @@ device_nes_cart_interface::~device_nes_cart_interface()
|
||||
|
||||
void device_nes_cart_interface::prg_alloc(size_t size)
|
||||
{
|
||||
if (m_prg == NULL)
|
||||
m_prg.resize(size);
|
||||
m_prg_chunks = size / 0x4000;
|
||||
if (size % 0x2000)
|
||||
{
|
||||
m_prg.resize(size);
|
||||
m_prg_chunks = size / 0x4000;
|
||||
if (size % 0x2000)
|
||||
{
|
||||
// A few pirate carts have PRG made of 32K + 2K or some weird similar config
|
||||
// in this case we treat the banking as if this 'extra' PRG is not present and
|
||||
// the pcb code has to handle it by accessing directly m_prg!
|
||||
printf("Warning! The loaded PRG has size not a multiple of 8KB (0x%X)\n", (UINT32)size);
|
||||
m_prg_chunks--;
|
||||
}
|
||||
|
||||
m_prg_mask = ((m_prg_chunks << 1) - 1);
|
||||
|
||||
// A few pirate carts have PRG made of 32K + 2K or some weird similar config
|
||||
// in this case we treat the banking as if this 'extra' PRG is not present and
|
||||
// the pcb code has to handle it by accessing directly m_prg!
|
||||
printf("Warning! The loaded PRG has size not a multiple of 8KB (0x%X)\n", (UINT32)size);
|
||||
m_prg_chunks--;
|
||||
}
|
||||
|
||||
m_prg_mask = ((m_prg_chunks << 1) - 1);
|
||||
|
||||
// printf("first mask %x!\n", m_prg_mask);
|
||||
if ((m_prg_chunks << 1) & m_prg_mask)
|
||||
{
|
||||
int mask_bits = 0, temp = (m_prg_chunks << 1), mapsize;
|
||||
// contrary to what happens with later systems, like e.g. SNES or MD,
|
||||
// only half a dozen of NES carts have PRG which is not a power of 2
|
||||
// so we use this bank_map only as an exception
|
||||
if ((m_prg_chunks << 1) & m_prg_mask)
|
||||
{
|
||||
int mask_bits = 0, temp = (m_prg_chunks << 1), mapsize;
|
||||
// contrary to what happens with later systems, like e.g. SNES or MD,
|
||||
// only half a dozen of NES carts have PRG which is not a power of 2
|
||||
// so we use this bank_map only as an exception
|
||||
// printf("uneven rom!\n");
|
||||
|
||||
// 1. redefine mask as (next power of 2)-1
|
||||
for (; temp; )
|
||||
{
|
||||
mask_bits++;
|
||||
temp >>= 1;
|
||||
}
|
||||
m_prg_mask = (1 << mask_bits) - 1;
|
||||
|
||||
// 1. redefine mask as (next power of 2)-1
|
||||
for (; temp; )
|
||||
{
|
||||
mask_bits++;
|
||||
temp >>= 1;
|
||||
}
|
||||
m_prg_mask = (1 << mask_bits) - 1;
|
||||
// printf("new mask %x!\n", m_prg_mask);
|
||||
mapsize = (1 << mask_bits)/2;
|
||||
|
||||
// 2. create a bank_map for banks in the range mask/2 -> mask
|
||||
m_prg_bank_map.resize(mapsize);
|
||||
|
||||
// 3. fill the bank_map accounting for mirrors
|
||||
int j;
|
||||
for (j = mapsize; j < (m_prg_chunks << 1); j++)
|
||||
m_prg_bank_map[j - mapsize] = j;
|
||||
|
||||
while (j % mapsize)
|
||||
{
|
||||
int k = 0, repeat_banks;
|
||||
while ((j % (mapsize >> k)) && k < mask_bits)
|
||||
k++;
|
||||
repeat_banks = j % (mapsize >> (k - 1));
|
||||
for (int l = 0; l < repeat_banks; l++)
|
||||
m_prg_bank_map[(j - mapsize) + l] = m_prg_bank_map[(j - mapsize) + l - repeat_banks];
|
||||
j += repeat_banks;
|
||||
}
|
||||
|
||||
// check bank map!
|
||||
mapsize = (1 << mask_bits)/2;
|
||||
|
||||
// 2. create a bank_map for banks in the range mask/2 -> mask
|
||||
m_prg_bank_map.resize(mapsize);
|
||||
|
||||
// 3. fill the bank_map accounting for mirrors
|
||||
int j;
|
||||
for (j = mapsize; j < (m_prg_chunks << 1); j++)
|
||||
m_prg_bank_map[j - mapsize] = j;
|
||||
|
||||
while (j % mapsize)
|
||||
{
|
||||
int k = 0, repeat_banks;
|
||||
while ((j % (mapsize >> k)) && k < mask_bits)
|
||||
k++;
|
||||
repeat_banks = j % (mapsize >> (k - 1));
|
||||
for (int l = 0; l < repeat_banks; l++)
|
||||
m_prg_bank_map[(j - mapsize) + l] = m_prg_bank_map[(j - mapsize) + l - repeat_banks];
|
||||
j += repeat_banks;
|
||||
}
|
||||
|
||||
// check bank map!
|
||||
// for (int i = 0; i < mapsize; i++)
|
||||
// {
|
||||
// printf("bank %3d = %3d\t", i, m_prg_bank_map[i]);
|
||||
// if ((i%8) == 7)
|
||||
// printf("\n");
|
||||
// }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void device_nes_cart_interface::prgram_alloc(size_t size)
|
||||
{
|
||||
if (m_prgram == NULL)
|
||||
m_prgram.resize(size);
|
||||
m_prgram.resize(size);
|
||||
}
|
||||
|
||||
void device_nes_cart_interface::vrom_alloc(size_t size)
|
||||
{
|
||||
if (m_vrom == NULL)
|
||||
{
|
||||
m_vrom.resize(size);
|
||||
m_vrom_chunks = size / 0x2000;
|
||||
}
|
||||
m_vrom.resize(size);
|
||||
m_vrom_chunks = size / 0x2000;
|
||||
}
|
||||
|
||||
void device_nes_cart_interface::vram_alloc(size_t size)
|
||||
{
|
||||
if (m_vram == NULL)
|
||||
{
|
||||
m_vram.resize(size);
|
||||
m_vram_chunks = size / 0x2000;
|
||||
}
|
||||
m_vram.resize(size);
|
||||
m_vram_chunks = size / 0x2000;
|
||||
}
|
||||
|
||||
void device_nes_cart_interface::battery_alloc(size_t size)
|
||||
{
|
||||
if (m_battery == NULL)
|
||||
m_battery.resize(size);
|
||||
m_battery.resize(size);
|
||||
}
|
||||
|
||||
|
||||
@ -905,7 +894,7 @@ void nes_cart_slot_device::call_unload()
|
||||
|
||||
bool nes_cart_slot_device::call_softlist_load(software_list_device &swlist, const char *swname, const rom_entry *start_entry)
|
||||
{
|
||||
load_software_part_region(*this, swlist, swname, start_entry );
|
||||
load_software_part_region(*this, swlist, swname, start_entry);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
@ -44,8 +44,7 @@ device_pce_cart_interface::~device_pce_cart_interface()
|
||||
|
||||
void device_pce_cart_interface::rom_alloc(UINT32 size)
|
||||
{
|
||||
if (m_rom == NULL)
|
||||
m_rom.resize(size);
|
||||
m_rom.resize(size);
|
||||
}
|
||||
|
||||
|
||||
@ -55,11 +54,8 @@ void device_pce_cart_interface::rom_alloc(UINT32 size)
|
||||
|
||||
void device_pce_cart_interface::ram_alloc(UINT32 size)
|
||||
{
|
||||
if (m_ram == NULL)
|
||||
{
|
||||
m_ram.resize(size);
|
||||
device().save_item(NAME(m_ram));
|
||||
}
|
||||
m_ram.resize(size);
|
||||
device().save_item(NAME(m_ram));
|
||||
}
|
||||
|
||||
//-------------------------------------------------
|
||||
@ -69,8 +65,6 @@ void device_pce_cart_interface::ram_alloc(UINT32 size)
|
||||
|
||||
void device_pce_cart_interface::rom_map_setup(UINT32 size)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (size == 0x60000)
|
||||
{
|
||||
// HuCard 384K are mapped with mirrored pieces
|
||||
@ -85,6 +79,8 @@ void device_pce_cart_interface::rom_map_setup(UINT32 size)
|
||||
}
|
||||
else
|
||||
{
|
||||
int i;
|
||||
|
||||
// setup the rom_bank_map array to faster ROM read
|
||||
for (i = 0; i < size / 0x20000 && i < 8; i++)
|
||||
rom_bank_map[i] = i;
|
||||
@ -281,7 +277,7 @@ void pce_cart_slot_device::call_unload()
|
||||
|
||||
bool pce_cart_slot_device::call_softlist_load(software_list_device &swlist, const char *swname, const rom_entry *start_entry)
|
||||
{
|
||||
load_software_part_region(*this, swlist, swname, start_entry );
|
||||
load_software_part_region(*this, swlist, swname, start_entry);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
@ -54,8 +54,7 @@ device_sat_cart_interface::~device_sat_cart_interface()
|
||||
|
||||
void device_sat_cart_interface::rom_alloc(UINT32 size)
|
||||
{
|
||||
if (m_rom == NULL)
|
||||
m_rom.resize(size/sizeof(UINT32));
|
||||
m_rom.resize(size/sizeof(UINT32));
|
||||
}
|
||||
|
||||
|
||||
@ -164,7 +163,7 @@ void sat_cart_slot_device::call_unload()
|
||||
|
||||
bool sat_cart_slot_device::call_softlist_load(software_list_device &swlist, const char *swname, const rom_entry *start_entry)
|
||||
{
|
||||
load_software_part_region(*this, swlist, swname, start_entry );
|
||||
load_software_part_region(*this, swlist, swname, start_entry);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
@ -72,14 +72,11 @@ device_sega8_cart_interface::~device_sega8_cart_interface()
|
||||
|
||||
void device_sega8_cart_interface::rom_alloc(UINT32 size)
|
||||
{
|
||||
if (m_rom == NULL)
|
||||
{
|
||||
m_rom.resize(size);
|
||||
m_rom_page_count = size / 0x4000;
|
||||
if (!m_rom_page_count)
|
||||
m_rom_page_count = 1; // we compute rom pages through (XXX % m_rom_page_count)!
|
||||
late_bank_setup();
|
||||
}
|
||||
m_rom.resize(size);
|
||||
m_rom_page_count = size / 0x4000;
|
||||
if (!m_rom_page_count)
|
||||
m_rom_page_count = 1; // we compute rom pages through (XXX % m_rom_page_count)!
|
||||
late_bank_setup();
|
||||
}
|
||||
|
||||
|
||||
@ -89,11 +86,8 @@ void device_sega8_cart_interface::rom_alloc(UINT32 size)
|
||||
|
||||
void device_sega8_cart_interface::ram_alloc(UINT32 size)
|
||||
{
|
||||
if (m_ram == NULL)
|
||||
{
|
||||
m_ram.resize(size);
|
||||
device().save_item(NAME(m_ram));
|
||||
}
|
||||
m_ram.resize(size);
|
||||
device().save_item(NAME(m_ram));
|
||||
}
|
||||
|
||||
|
||||
|
@ -86,8 +86,7 @@ device_sns_cart_interface::~device_sns_cart_interface()
|
||||
|
||||
void device_sns_cart_interface::rom_alloc(UINT32 size)
|
||||
{
|
||||
if (m_rom == NULL)
|
||||
m_rom.resize(size);
|
||||
m_rom.resize(size);
|
||||
}
|
||||
|
||||
|
||||
@ -97,11 +96,8 @@ void device_sns_cart_interface::rom_alloc(UINT32 size)
|
||||
|
||||
void device_sns_cart_interface::nvram_alloc(UINT32 size)
|
||||
{
|
||||
if (m_nvram == NULL)
|
||||
{
|
||||
m_nvram.resize(size);
|
||||
device().save_item(NAME(m_nvram));
|
||||
}
|
||||
m_nvram.resize(size);
|
||||
device().save_item(NAME(m_nvram));
|
||||
}
|
||||
|
||||
|
||||
@ -114,11 +110,8 @@ void device_sns_cart_interface::nvram_alloc(UINT32 size)
|
||||
|
||||
void device_sns_cart_interface::rtc_ram_alloc(UINT32 size)
|
||||
{
|
||||
if (m_rtc_ram == NULL)
|
||||
{
|
||||
m_rtc_ram.resize(size);
|
||||
device().save_item(NAME(m_rtc_ram));
|
||||
}
|
||||
m_rtc_ram.resize(size);
|
||||
device().save_item(NAME(m_rtc_ram));
|
||||
}
|
||||
|
||||
|
||||
@ -129,8 +122,7 @@ void device_sns_cart_interface::rtc_ram_alloc(UINT32 size)
|
||||
|
||||
void device_sns_cart_interface::addon_bios_alloc(UINT32 size)
|
||||
{
|
||||
if (m_bios == NULL)
|
||||
m_bios.resize(size);
|
||||
m_bios.resize(size);
|
||||
}
|
||||
|
||||
|
||||
|
@ -47,8 +47,7 @@ device_vcs_cart_interface::~device_vcs_cart_interface()
|
||||
|
||||
void device_vcs_cart_interface::rom_alloc(UINT32 size)
|
||||
{
|
||||
if (m_rom == NULL)
|
||||
m_rom.resize(size);
|
||||
m_rom.resize(size);
|
||||
}
|
||||
|
||||
//-------------------------------------------------
|
||||
@ -57,11 +56,8 @@ void device_vcs_cart_interface::rom_alloc(UINT32 size)
|
||||
|
||||
void device_vcs_cart_interface::ram_alloc(UINT32 size)
|
||||
{
|
||||
if (m_ram == NULL)
|
||||
{
|
||||
m_ram.resize(size);
|
||||
device().save_item(NAME(m_ram));
|
||||
}
|
||||
m_ram.resize(size);
|
||||
device().save_item(NAME(m_ram));
|
||||
}
|
||||
|
||||
|
||||
|
@ -1315,7 +1315,7 @@ void a7800_state::machine_start()
|
||||
save_item(NAME(m_maria_flag));
|
||||
|
||||
// install additional handlers, if needed
|
||||
switch (m_cartslot->get_cart_type())
|
||||
switch (m_cartslot->exists() && m_cartslot->get_cart_type())
|
||||
{
|
||||
case A78_HSC:
|
||||
// ROM+NVRAM accesses for HiScore
|
||||
|
@ -1735,7 +1735,7 @@ READ8_MEMBER(a400_state::read_d5xx)
|
||||
|
||||
WRITE8_MEMBER(a400_state::disable_cart)
|
||||
{
|
||||
switch (m_cartslot->get_cart_type())
|
||||
switch (m_cartslot->exists() && m_cartslot->get_cart_type())
|
||||
{
|
||||
case A800_PHOENIX:
|
||||
case A800_BLIZZARD:
|
||||
@ -1834,7 +1834,7 @@ void a400_state::setup_cart(a800_cart_slot_device *slot)
|
||||
m_cart_disabled = 0;
|
||||
m_last_offs = -1;
|
||||
|
||||
switch (slot->get_cart_type())
|
||||
switch (slot->exists() && slot->get_cart_type())
|
||||
{
|
||||
case A800_8K:
|
||||
m_maincpu->space(AS_PROGRAM).install_read_handler(0xa000, 0xbfff, read8_delegate(FUNC(a800_cart_slot_device::read_80xx),(a800_cart_slot_device*)slot));
|
||||
|
Loading…
Reference in New Issue
Block a user