diff options
Diffstat (limited to 'src/devices/bus/nubus/nubus.cpp')
-rw-r--r-- | src/devices/bus/nubus/nubus.cpp | 48 |
1 files changed, 20 insertions, 28 deletions
diff --git a/src/devices/bus/nubus/nubus.cpp b/src/devices/bus/nubus/nubus.cpp index 175139f19c2..680e20d501a 100644 --- a/src/devices/bus/nubus/nubus.cpp +++ b/src/devices/bus/nubus/nubus.cpp @@ -26,21 +26,19 @@ const device_type NUBUS_SLOT = &device_creator<nubus_slot_device>; //------------------------------------------------- // nubus_slot_device - constructor //------------------------------------------------- -nubus_slot_device::nubus_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : +nubus_slot_device::nubus_slot_device(const machine_config &mconfig, std::string tag, device_t *owner, UINT32 clock) : device_t(mconfig, NUBUS_SLOT, "NUBUS_SLOT", tag, owner, clock, "nubus_slot", __FILE__), - device_slot_interface(mconfig, *this), - m_nubus_tag(nullptr), - m_nubus_slottag(nullptr) + device_slot_interface(mconfig, *this) { } -nubus_slot_device::nubus_slot_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source) : +nubus_slot_device::nubus_slot_device(const machine_config &mconfig, device_type type, const char *name, std::string tag, device_t *owner, UINT32 clock, const char *shortname, const char *source) : device_t(mconfig, type, name, tag, owner, clock, shortname, source), - device_slot_interface(mconfig, *this), m_nubus_tag(nullptr), m_nubus_slottag(nullptr) + device_slot_interface(mconfig, *this) { } -void nubus_slot_device::static_set_nubus_slot(device_t &device, const char *tag, const char *slottag) +void nubus_slot_device::static_set_nubus_slot(device_t &device, std::string tag, std::string slottag) { nubus_slot_device &nubus_card = dynamic_cast<nubus_slot_device &>(device); nubus_card.m_nubus_tag = tag; @@ -64,7 +62,7 @@ void nubus_slot_device::device_start() const device_type NUBUS = &device_creator<nubus_device>; -void nubus_device::static_set_cputag(device_t &device, const char *tag) +void nubus_device::static_set_cputag(device_t &device, std::string tag) { nubus_device &nubus = downcast<nubus_device &>(device); nubus.m_cputag = tag; @@ -78,25 +76,25 @@ void nubus_device::static_set_cputag(device_t &device, const char *tag) // nubus_device - constructor //------------------------------------------------- -nubus_device::nubus_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : +nubus_device::nubus_device(const machine_config &mconfig, std::string tag, device_t *owner, UINT32 clock) : device_t(mconfig, NUBUS, "NUBUS", tag, owner, clock, "nubus", __FILE__), m_maincpu(nullptr), m_out_irq9_cb(*this), m_out_irqa_cb(*this), m_out_irqb_cb(*this), m_out_irqc_cb(*this), m_out_irqd_cb(*this), - m_out_irqe_cb(*this), m_cputag(nullptr) + m_out_irqe_cb(*this) { } -nubus_device::nubus_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source) : +nubus_device::nubus_device(const machine_config &mconfig, device_type type, const char *name, std::string tag, device_t *owner, UINT32 clock, const char *shortname, const char *source) : device_t(mconfig, type, name, tag, owner, clock, shortname, source), m_maincpu(nullptr), m_out_irq9_cb(*this), m_out_irqa_cb(*this), m_out_irqb_cb(*this), m_out_irqc_cb(*this), m_out_irqd_cb(*this), - m_out_irqe_cb(*this), m_cputag(nullptr) + m_out_irqe_cb(*this) { } //------------------------------------------------- @@ -213,7 +211,7 @@ void nubus_device::install_writeonly_device(offs_t start, offs_t end, write32_de } } -void nubus_device::install_bank(offs_t start, offs_t end, offs_t mask, offs_t mirror, const char *tag, UINT8 *data) +void nubus_device::install_bank(offs_t start, offs_t end, offs_t mask, offs_t mirror, std::string tag, UINT8 *data) { // printf("install_bank: %s @ %x->%x mask %x mirror %x\n", tag, start, end, mask, mirror); m_maincpu = machine().device<cpu_device>(m_cputag); @@ -259,7 +257,7 @@ WRITE_LINE_MEMBER( nubus_device::irqe_w ) { m_out_irqe_cb(state); } device_nubus_card_interface::device_nubus_card_interface(const machine_config &mconfig, device_t &device) : device_slot_card_interface(mconfig, device), m_nubus(nullptr), - m_nubus_tag(nullptr), m_nubus_slottag(nullptr), m_slot(0), m_next(nullptr) + m_slot(0), m_next(nullptr) { } @@ -272,7 +270,7 @@ device_nubus_card_interface::~device_nubus_card_interface() { } -void device_nubus_card_interface::static_set_nubus_tag(device_t &device, const char *tag, const char *slottag) +void device_nubus_card_interface::static_set_nubus_tag(device_t &device, std::string tag, std::string slottag) { device_nubus_card_interface &nubus_card = dynamic_cast<device_nubus_card_interface &>(device); nubus_card.m_nubus_tag = tag; @@ -281,18 +279,18 @@ void device_nubus_card_interface::static_set_nubus_tag(device_t &device, const c void device_nubus_card_interface::set_nubus_device() { - if (!strncmp(m_nubus_slottag, "pds030", 6)) + if (!strncmp(m_nubus_slottag.c_str(), "pds030", 6)) { m_slot = 0x9; // '030 PDS slots phantom slot as NuBus slots $9, $A, and $B } - else if (!strncmp(m_nubus_slottag, "lcpds", 6)) + else if (!strncmp(m_nubus_slottag.c_str(), "lcpds", 6)) { m_slot = 0xe; // LC PDS slots phantom slot as NuBus slot $E } else { // extract the slot number from the last digit of the slot tag - int tlen = strlen(m_nubus_slottag); + int tlen = m_nubus_slottag.length(); if (m_nubus_slottag[tlen-1] == '9') { @@ -313,14 +311,10 @@ void device_nubus_card_interface::set_nubus_device() m_nubus->add_nubus_card(this); } -void device_nubus_card_interface::install_bank(offs_t start, offs_t end, offs_t mask, offs_t mirror, const char *tag, UINT8 *data) +void device_nubus_card_interface::install_bank(offs_t start, offs_t end, offs_t mask, offs_t mirror, std::string tag, UINT8 *data) { - char bank[256]; - - // append an underscore and the slot name to the bank so it's guaranteed unique - strcpy(bank, tag); - strcat(bank, "_"); - strcat(bank, m_nubus_slottag); + // append an underscore and the slot name to the bank so it's guaranteed unique + std::string bank = tag + "_" + m_nubus_slottag; m_nubus->install_bank(start, end, mask, mirror, bank, data); } @@ -461,9 +455,7 @@ void device_nubus_card_interface::install_declaration_rom(device_t *dev, const c // now install the ROM UINT32 addr = get_slotspace() + 0x01000000; - char bankname[128]; - strcpy(bankname, "rom_"); - strcat(bankname, m_nubus_slottag); + std::string bankname = "rom_" + m_nubus_slottag; addr -= romlen; // printf("Installing ROM at %x, length %x\n", addr, romlen); if (mirror_all_mb) // mirror the declaration ROM across all 16 megs of the slot space |