summaryrefslogtreecommitdiffstatshomepage
path: root/src/devices/bus/megadrive/md_slot.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/devices/bus/megadrive/md_slot.h')
-rw-r--r--src/devices/bus/megadrive/md_slot.h62
1 files changed, 25 insertions, 37 deletions
diff --git a/src/devices/bus/megadrive/md_slot.h b/src/devices/bus/megadrive/md_slot.h
index 78504c0e3f4..020ebb0baed 100644
--- a/src/devices/bus/megadrive/md_slot.h
+++ b/src/devices/bus/megadrive/md_slot.h
@@ -5,7 +5,7 @@
#pragma once
-#include "softlist_dev.h"
+#include "imagedev/cartrom.h"
/***************************************************************************
TYPE DEFINITIONS
@@ -27,7 +27,7 @@ enum
// Cart + NVRAM
SEGA_SRAM, SEGA_FRAM,
HARDBALL95, /* Hardball 95 uses different sram start address */
- XINQIG, /* Xin Qigai Wangzi uses different sram start address and has no valid header */
+ XINQIG, /* Xin Qigai Wangzi uses different sram start address and has no valid header */
BEGGARP, /* Beggar Prince uses different sram start address + bankswitch tricks */
WUKONG, /* Legend of Wukong uses different sram start address + bankswitch trick for last 128K of ROM */
STARODYS, /* Star Odyssey */
@@ -35,7 +35,7 @@ enum
// EEPROM
SEGA_EEPROM, /* Wonder Boy V / Evander Holyfield's Boxing / Greatest Heavyweights of the Ring / Sports Talk Baseball / Megaman */
NBA_JAM, /* NBA Jam */
- NBA_JAM_ALT, /* NBA Jam */
+ NBA_JAM_ALT, /* NBA Jam */
NBA_JAM_TE, /* NBA Jam TE / NFL Quarterback Club */
NFL_QB_96, /* NFL Quarterback Club '96 */
C_SLAM, /* College Slam / Frank Thomas Big Hurt Baseball */
@@ -109,15 +109,15 @@ public:
virtual int read_test() { return 0; } // used by Virtua Racing test
// this probably should do more, like make Genesis V2 'die' if the SEGA string is not written promptly
- virtual void write_tmss_bank(offs_t offset, uint16_t data) { device().logerror("Write to TMSS bank: offset %x data %x\n", 0xa14000 + (offset << 1), data); };
+ virtual void write_tmss_bank(offs_t offset, uint16_t data) { device().logerror("Write to TMSS bank: offset %x data %x\n", 0xa14000 + (offset << 1), data); }
- virtual void rom_alloc(size_t size, const char *tag);
+ virtual void rom_alloc(size_t size);
virtual void nvram_alloc(size_t size);
- virtual uint16_t* get_rom_base() { return m_rom; };
- virtual uint16_t* get_nvram_base() { return &m_nvram[0]; };
- virtual uint32_t get_rom_size() { return m_rom_size; };
- virtual uint32_t get_nvram_size() { return m_nvram.size()*sizeof(uint16_t); };
- virtual void set_bank_to_rom(const char *banktag, uint32_t offset) {};
+ virtual uint16_t* get_rom_base() { return m_rom; }
+ virtual uint16_t* get_nvram_base() { return &m_nvram[0]; }
+ virtual uint32_t get_rom_size() { return m_rom_size; }
+ virtual uint32_t get_nvram_size() { return m_nvram.size()*sizeof(uint16_t); }
+ virtual void set_bank_to_rom(const char *banktag, uint32_t offset) {}
void save_nvram() { device().save_item(NAME(m_nvram)); }
@@ -149,36 +149,30 @@ protected:
// ======================> base_md_cart_slot_device
class base_md_cart_slot_device : public device_t,
- public device_image_interface,
+ public device_cartrom_image_interface,
public device_single_card_slot_interface<device_md_cart_interface>
{
public:
// construction/destruction
virtual ~base_md_cart_slot_device();
- // image-level overrides
- virtual image_init_result call_load() override;
+ // device_image_interface implementation
+ virtual std::pair<std::error_condition, std::string> call_load() override;
virtual void call_unload() override;
- virtual iodevice_t image_type() const noexcept override { return IO_CARTSLOT; }
- virtual bool is_readable() const noexcept override { return true; }
- virtual bool is_writeable() const noexcept override { return false; }
- virtual bool is_creatable() const noexcept override { return false; }
- virtual bool must_be_loaded() const noexcept override { return m_must_be_loaded; }
virtual bool is_reset_on_load() const noexcept override { return true; }
- // slot interface overrides
+ // device_slot_interface implementation
virtual std::string get_default_card_software(get_default_card_software_hook &hook) const override;
int get_type() { return m_type; }
- image_init_result load_list();
- image_init_result load_nonlist();
+ std::error_condition load_list();
+ std::error_condition load_nonlist();
static int get_cart_type(const uint8_t *ROM, uint32_t len);
void setup_custom_mappers();
void setup_nvram();
- void set_must_be_loaded(bool _must_be_loaded) { m_must_be_loaded = _must_be_loaded; }
void file_logging(uint8_t *ROM, uint32_t rom_len, uint32_t nvram_len);
void save_nvram() { if (m_cart && m_cart->get_nvram_size()) m_cart->save_nvram(); }
@@ -190,26 +184,21 @@ public:
virtual void write_a13(offs_t offset, uint16_t data);
virtual uint16_t read_a15(offs_t offset);
virtual void write_a15(offs_t offset, uint16_t data);
- virtual void write_tmss_bank(offs_t offset, uint16_t data) { if (m_cart) m_cart->write_tmss_bank(offset, data); };
+ virtual void write_tmss_bank(offs_t offset, uint16_t data) { if (m_cart) m_cart->write_tmss_bank(offset, data); }
virtual int read_test() { if (m_cart) return m_cart->read_test(); else return 0; } // used by Virtua Racing test
-// TODO: this only needs to be public because megasvp copies rom into memory region, so we need to rework that code...
+// TODO: this only needs to be public because megasvp copies ROM into memory region, so we need to rework that code...
//private:
int m_type;
device_md_cart_interface* m_cart;
- bool m_must_be_loaded;
protected:
base_md_cart_slot_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock);
- // device-level overrides
+ // device_t implementation
virtual void device_start() override;
-
- // device_image_interface implementation
- virtual const software_list_loader &get_software_list_loader() const override { return rom_software_list_loader::instance(); }
-
};
// ======================> md_cart_slot_device
@@ -229,6 +218,8 @@ public:
}
md_cart_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
+
+ // device_image_interface implementation
virtual const char *image_interface() const noexcept override { return "megadriv_cart"; }
virtual const char *file_extensions() const noexcept override { return "smd,bin,md,gen"; }
};
@@ -249,6 +240,8 @@ public:
set_fixed(false);
}
pico_cart_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
+
+ // device_image_interface implementation
virtual const char *image_interface() const noexcept override { return "pico_cart"; }
virtual const char *file_extensions() const noexcept override { return "bin,md"; }
};
@@ -269,6 +262,8 @@ public:
set_fixed(false);
}
copera_cart_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
+
+ // device_image_interface implementation
virtual const char *image_interface() const noexcept override { return "copera_cart"; }
virtual const char *file_extensions() const noexcept override { return "bin,md"; }
};
@@ -279,11 +274,4 @@ DECLARE_DEVICE_TYPE(MD_CART_SLOT, md_cart_slot_device)
DECLARE_DEVICE_TYPE(PICO_CART_SLOT, pico_cart_slot_device)
DECLARE_DEVICE_TYPE(COPERA_CART_SLOT, copera_cart_slot_device)
-
-/***************************************************************************
- DEVICE CONFIGURATION MACROS
- ***************************************************************************/
-
-#define MDSLOT_ROM_REGION_TAG ":cart:rom"
-
#endif // MAME_BUS_MEGADRIVE_MD_SLOT_H