summaryrefslogtreecommitdiffstatshomepage
path: root/src/devices/bus/sega8
diff options
context:
space:
mode:
author Vas Crabb <vas@vastheman.com>2022-08-20 03:39:36 +1000
committer Vas Crabb <vas@vastheman.com>2022-08-20 03:39:36 +1000
commit27d1b900e2715d67ea2633d6b64f2efbb8c5b7f5 (patch)
tree1265e039f445e78868fdb770585f92ae84ae972d /src/devices/bus/sega8
parent782884c0e20495de2f018992836f6c8e4c0e4497 (diff)
bus: Get rid of some dubious tag manipulation.
The implementation details of how the cartridges allocate storage for memory really shouldn't be part of the interface. Having tags in the headers encourages people to depend on these implementation details. This gets rid of it in most of the headers. A few particularly leaky abstractions (bbc/rom, electron/cart, gba, generic, jakks_gamekey, m5) depend on this, so it can't be removed in those cases without further refactoring to encapsulate the slot devices better. This doesn't change behaviour, it just mechanically removes stuff from the headers and uses device_t::subtag rather than string manipulation on tags. Most of the cartridge devices shouldn't have rom_alloc member functions at all - the region created by the software list loader can be used directly when loading from the software list, and the slot can allocate a region with the same tag when loading loose software. This avoids creating an extra region and copying the data when loading from the software list. See vboy for an example that doesn't allocate a superfluous region.
Diffstat (limited to 'src/devices/bus/sega8')
-rw-r--r--src/devices/bus/sega8/sega8_slot.cpp6
-rw-r--r--src/devices/bus/sega8/sega8_slot.h8
2 files changed, 4 insertions, 10 deletions
diff --git a/src/devices/bus/sega8/sega8_slot.cpp b/src/devices/bus/sega8/sega8_slot.cpp
index fdde1bb9401..f2ac85c896e 100644
--- a/src/devices/bus/sega8/sega8_slot.cpp
+++ b/src/devices/bus/sega8/sega8_slot.cpp
@@ -83,11 +83,11 @@ device_sega8_cart_interface::~device_sega8_cart_interface()
// rom_alloc - alloc the space for the cart
//-------------------------------------------------
-void device_sega8_cart_interface::rom_alloc(uint32_t size, const char *tag)
+void device_sega8_cart_interface::rom_alloc(uint32_t size)
{
if (m_rom == nullptr)
{
- m_rom = device().machine().memory().region_alloc(std::string(tag).append(S8SLOT_ROM_REGION_TAG).c_str(), size, 1, ENDIANNESS_LITTLE)->base();
+ m_rom = device().machine().memory().region_alloc(device().subtag("^cart:rom"), size, 1, ENDIANNESS_LITTLE)->base();
m_rom_size = size;
m_rom_page_count = size / 0x4000;
if (!m_rom_page_count)
@@ -413,7 +413,7 @@ image_init_result sega8_cart_slot_device::call_load()
if (len & 0x3fff)
len = ((len >> 14) + 1) << 14;
- m_cart->rom_alloc(len, tag());
+ m_cart->rom_alloc(len);
ROM = m_cart->get_rom_base();
if (!loaded_through_softlist())
diff --git a/src/devices/bus/sega8/sega8_slot.h b/src/devices/bus/sega8/sega8_slot.h
index 831d0500f0a..01f34842343 100644
--- a/src/devices/bus/sega8/sega8_slot.h
+++ b/src/devices/bus/sega8/sega8_slot.h
@@ -64,7 +64,7 @@ public:
virtual uint8_t read_io(offs_t offset) { return 0xff; }
virtual void write_io(offs_t offset, uint8_t data) { }
- void rom_alloc(uint32_t size, const char *tag);
+ void rom_alloc(uint32_t size);
void ram_alloc(uint32_t size);
virtual void late_bank_setup() { }
@@ -346,12 +346,6 @@ DECLARE_DEVICE_TYPE(GAMEGEAR_CART_SLOT, gamegear_cart_slot_device)
DECLARE_DEVICE_TYPE(SMS_CARD_SLOT, sms_card_slot_device)
DECLARE_DEVICE_TYPE(SG1000_CARD_SLOT, sg1000_card_slot_device)
-/***************************************************************************
- DEVICE CONFIGURATION MACROS
- ***************************************************************************/
-
-#define S8SLOT_ROM_REGION_TAG ":cart:rom"
-
// slot interfaces
void sg1000_cart(device_slot_interface &device);