summaryrefslogtreecommitdiffstatshomepage
path: root/src/devices/bus/snes/snes_slot.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/devices/bus/snes/snes_slot.h')
-rw-r--r--src/devices/bus/snes/snes_slot.h54
1 files changed, 25 insertions, 29 deletions
diff --git a/src/devices/bus/snes/snes_slot.h b/src/devices/bus/snes/snes_slot.h
index 6c415a596cc..43ea1aeab8e 100644
--- a/src/devices/bus/snes/snes_slot.h
+++ b/src/devices/bus/snes/snes_slot.h
@@ -5,7 +5,7 @@
#pragma once
-#include "softlist_dev.h"
+#include "imagedev/cartrom.h"
/***************************************************************************
@@ -123,7 +123,7 @@ public:
virtual void chip_write(offs_t offset, uint8_t data) { }
virtual void speedup_addon_bios_access() {}
- void rom_alloc(uint32_t size, const char *tag);
+ void rom_alloc(uint32_t size);
void nvram_alloc(uint32_t size);
void rtc_ram_alloc(uint32_t size);
void addon_bios_alloc(uint32_t size);
@@ -143,8 +143,10 @@ public:
protected:
device_sns_cart_interface(const machine_config &mconfig, device_t &device);
- DECLARE_WRITE_LINE_MEMBER(write_irq);
+ void write_irq(int state);
uint8_t read_open_bus();
+ int scanlines_r();
+ offs_t address_r();
// internal state
uint8_t *m_rom;
@@ -162,7 +164,7 @@ protected:
// ======================> base_sns_cart_slot_device
class base_sns_cart_slot_device : public device_t,
- public device_image_interface,
+ public device_cartrom_image_interface,
public device_slot_interface
{
public:
@@ -172,19 +174,16 @@ public:
// configuration
auto irq_callback() { return m_irq_callback.bind(); }
auto open_bus_callback() { return m_open_bus_callback.bind(); }
+ void set_scanlines(int scanlines) { m_scanlines = scanlines; }
+ void set_address(offs_t address) { m_address = address; }
- // 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 true; }
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;
void get_cart_type_addon(const uint8_t *ROM, uint32_t len, int &type, int &addon) const;
@@ -194,8 +193,14 @@ public:
void setup_nvram();
void internal_header_logging(uint8_t *ROM, uint32_t len);
- void save_ram() { if (m_cart && m_cart->get_nvram_size()) m_cart->save_nvram();
- if (m_cart && m_cart->get_rtc_ram_size()) m_cart->save_rtc_ram(); }
+ void save_ram()
+ {
+ save_item(NAME(m_address));
+ if (m_cart && m_cart->get_nvram_size())
+ m_cart->save_nvram();
+ if (m_cart && m_cart->get_rtc_ram_size())
+ m_cart->save_rtc_ram();
+ }
// reading and writing
uint8_t read_l(offs_t offset);
@@ -207,8 +212,10 @@ public:
uint8_t chip_read(offs_t offset);
void chip_write(offs_t offset, uint8_t data);
- DECLARE_WRITE_LINE_MEMBER(write_irq) { m_irq_callback(state); }
+ void write_irq(int state) { m_irq_callback(state); }
uint8_t read_open_bus() { return m_open_bus_callback(); }
+ int scanlines_r() { return m_scanlines; }
+ offs_t address_r() { return m_address; }
// in order to support legacy dumps + add-on CPU dump appended at the end of the file, we
// check if the required data is present and update bank map accordingly
@@ -229,15 +236,14 @@ public:
protected:
base_sns_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(); }
-
private:
devcb_write_line m_irq_callback;
devcb_read8 m_open_bus_callback;
+ int m_scanlines;
+ offs_t m_address;
};
// ======================> sns_cart_slot_device
@@ -278,7 +284,6 @@ public:
sns_sufami_cart_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
virtual const char *image_interface() const noexcept override { return "st_cart"; }
virtual const char *file_extensions() const noexcept override { return "st"; }
- virtual bool must_be_loaded() const noexcept override { return false; }
};
// ======================> sns_sufami_cart_slot_device
@@ -299,7 +304,6 @@ public:
sns_bsx_cart_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
virtual const char *image_interface() const noexcept override { return "bspack"; }
virtual const char *file_extensions() const noexcept override { return "bs"; }
- virtual bool must_be_loaded() const noexcept override { return false; }
};
@@ -308,12 +312,4 @@ DECLARE_DEVICE_TYPE(SNS_CART_SLOT, sns_cart_slot_device)
DECLARE_DEVICE_TYPE(SNS_SUFAMI_CART_SLOT, sns_sufami_cart_slot_device)
DECLARE_DEVICE_TYPE(SNS_BSX_CART_SLOT, sns_bsx_cart_slot_device)
-
-/***************************************************************************
- DEVICE CONFIGURATION MACROS
- ***************************************************************************/
-
-#define SNSSLOT_ROM_REGION_TAG ":cart:rom"
-
-
#endif // MAME_BUS_SNES_SNES_SLOT_H