image_init_result a800_cart_slot_device::call_load() { if (m_cart) { uint32_t len; if (software_entry() != nullptr) { const char *pcb_name; len = get_software_region_length("rom"); m_cart->rom_alloc(len, tag()); memcpy(m_cart->get_rom_base(), get_software_region("rom"), len); if ((pcb_name = get_feature("slot")) != nullptr) m_type = a800_get_pcb_id(pcb_name); else m_type = A800_8K; } else { len = length(); // check whether there is an header, to identify the cart type if ((len % 0x1000) == 0x10) { uint8_t header[16]; fread(header, 0x10); m_type = identify_cart_type(header); len -= 0x10; // in identify_cart_type the first 0x10 bytes are read, so we need to adjust here } else // otherwise try to guess based on size { if (len == 0x8000) m_type = A5200_32K; if (len == 0x4000) m_type = A800_16K; if (len == 0x2000) m_type = A800_8K; if (len == 0x1000) m_type = A5200_4K; // also make a try with .hsi file (for .a52 files) std::string info; if (hashfile_extrainfo(*this, info) && info.compare("A13MIRRORING")==0) m_type = A5200_16K_2CHIPS; } m_cart->rom_alloc(len, tag()); fread(m_cart->get_rom_base(), len); } if (m_type == A800_TELELINK2) m_cart->nvram_alloc(0x100); logerror("%s loaded cartridge '%s' size %dK\n", machine().system().name, filename(), len/1024); } return image_init_result::PASS; }
bool a800_cart_slot_device::call_load() { if (m_cart) { UINT32 len; if (software_entry() != nullptr) { const char *pcb_name; len = get_software_region_length("rom"); m_cart->rom_alloc(len, tag()); memcpy(m_cart->get_rom_base(), get_software_region("rom"), len); if ((pcb_name = get_feature("slot")) != nullptr) m_type = a800_get_pcb_id(pcb_name); else m_type = A800_8K; } else { len = length(); // check whether there is an header, to identify the cart type if ((len % 0x1000) == 0x10) { UINT8 header[16]; fread(header, 0x10); m_type = identify_cart_type(header); len -= 0x10; // in identify_cart_type the first 0x10 bytes are read, so we need to adjust here } else // otherwise try to guess based on size { if (len == 0x8000) m_type = A5200_32K; if (len == 0x4000) m_type = A800_16K; if (len == 0x2000) m_type = A800_8K; if (len == 0x1000) m_type = A5200_4K; } m_cart->rom_alloc(len, tag()); fread(m_cart->get_rom_base(), len); } if (m_type == A800_TELELINK2) m_cart->nvram_alloc(0x100); printf("%s loaded cartridge '%s' size %dK\n", machine().system().name, filename(), len/1024); } return IMAGE_INIT_PASS; }