diff options
author | 2020-11-02 12:11:43 +0100 | |
---|---|---|
committer | 2020-11-02 12:12:11 +0100 | |
commit | b8c338858a101d14308c64c87b0f714db4f05326 (patch) | |
tree | a34dca21d603b98f5450d31868ce33a7e4c103b0 /src/devices/bus | |
parent | f4172ded3ec6f3b877ab813f6453d6d1907c1c00 (diff) |
emumem: Simplify memory management. [O. Galibert]
API impact:
- install_ram/rom/writeonly now requires a non-null pointer. If you want
automatically managed ram, add it to a memory map, not in machine_start
- install_*_bank now requires a memory_bank *, not a string
- one can create memory banks outside of memory maps with memory_bank_creator
- one can create memory shares outside of memory maps with memory_share_creator
Memory maps impact:
- ram ranges with overlapping addresses are not shared anymore. Use .share()
- ram ranges touching each other are not merged anymore. Stay in your range
Extra note:
- there is no need to create a bank just to dynamically map some memory/rom.
Just use install_rom/ram/writeonly
Diffstat (limited to 'src/devices/bus')
173 files changed, 357 insertions, 487 deletions
diff --git a/src/devices/bus/a1bus/a1bus.cpp b/src/devices/bus/a1bus/a1bus.cpp index cafc399b00f..43a05b892ab 100644 --- a/src/devices/bus/a1bus/a1bus.cpp +++ b/src/devices/bus/a1bus/a1bus.cpp @@ -129,11 +129,10 @@ void a1bus_device::install_device(offs_t start, offs_t end, read8sm_delegate rha m_space->install_readwrite_handler(start, end, rhandler, whandler); } -void a1bus_device::install_bank(offs_t start, offs_t end, const char *tag, uint8_t *data) +void a1bus_device::install_bank(offs_t start, offs_t end, uint8_t *data) { // printf("install_bank: %s @ %x->%x\n", tag, start, end); - m_space->install_readwrite_bank(start, end, tag); - machine().root_device().membank(siblingtag(tag).c_str())->set_base(data); + m_space->install_ram(start, end, data); } // interrupt request from a1bus card @@ -195,7 +194,7 @@ void device_a1bus_card_interface::install_device(offs_t start, offs_t end, read8 m_a1bus->install_device(start, end, rhandler, whandler); } -void device_a1bus_card_interface::install_bank(offs_t start, offs_t end, const char *tag, uint8_t *data) +void device_a1bus_card_interface::install_bank(offs_t start, offs_t end, uint8_t *data) { - m_a1bus->install_bank(start, end, tag, data); + m_a1bus->install_bank(start, end, data); } diff --git a/src/devices/bus/a1bus/a1bus.h b/src/devices/bus/a1bus/a1bus.h index 8c354b89f43..d1d4860113d 100644 --- a/src/devices/bus/a1bus/a1bus.h +++ b/src/devices/bus/a1bus/a1bus.h @@ -69,7 +69,7 @@ public: void set_nmi_line(int state); void install_device(offs_t start, offs_t end, read8sm_delegate rhandler, write8sm_delegate whandler); - void install_bank(offs_t start, offs_t end, const char *tag, uint8_t *data); + void install_bank(offs_t start, offs_t end, uint8_t *data); DECLARE_WRITE_LINE_MEMBER( irq_w ); DECLARE_WRITE_LINE_MEMBER( nmi_w ); @@ -118,7 +118,7 @@ protected: void lower_slot_nmi() { m_a1bus->set_nmi_line(CLEAR_LINE); } void install_device(offs_t start, offs_t end, read8sm_delegate rhandler, write8sm_delegate whandler); - void install_bank(offs_t start, offs_t end, const char *tag, uint8_t *data); + void install_bank(offs_t start, offs_t end, uint8_t *data); device_a1bus_card_interface(const machine_config &mconfig, device_t &device); diff --git a/src/devices/bus/a1bus/a1cassette.cpp b/src/devices/bus/a1bus/a1cassette.cpp index 9ab13fb755d..f486105c6e5 100644 --- a/src/devices/bus/a1bus/a1cassette.cpp +++ b/src/devices/bus/a1bus/a1cassette.cpp @@ -76,7 +76,7 @@ a1bus_cassette_device::a1bus_cassette_device(const machine_config &mconfig, devi void a1bus_cassette_device::device_start() { install_device(0xc000, 0xc0ff, read8sm_delegate(*this, FUNC(a1bus_cassette_device::cassette_r)), write8sm_delegate(*this, FUNC(a1bus_cassette_device::cassette_w))); - install_bank(0xc100, 0xc1ff, "bank_a1cas", &m_rom[0]); + install_bank(0xc100, 0xc1ff, &m_rom[0]); save_item(NAME(m_cassette_output_flipflop)); } diff --git a/src/devices/bus/a1bus/a1cffa.cpp b/src/devices/bus/a1bus/a1cffa.cpp index 4d7f020c030..5656509a62d 100644 --- a/src/devices/bus/a1bus/a1cffa.cpp +++ b/src/devices/bus/a1bus/a1cffa.cpp @@ -69,7 +69,7 @@ a1bus_cffa_device::a1bus_cffa_device(const machine_config &mconfig, device_type void a1bus_cffa_device::device_start() { install_device(0xafe0, 0xafff, read8sm_delegate(*this, FUNC(a1bus_cffa_device::cffa_r)), write8sm_delegate(*this, FUNC(a1bus_cffa_device::cffa_w))); - install_bank(0x9000, 0xafdf, "bank_cffa1", &m_rom[0]); + install_bank(0x9000, 0xafdf, &m_rom[0]); save_item(NAME(m_lastdata)); save_item(NAME(m_writeprotect)); diff --git a/src/devices/bus/abcbus/ram.cpp b/src/devices/bus/abcbus/ram.cpp index 4886f46defa..563964041c5 100644 --- a/src/devices/bus/abcbus/ram.cpp +++ b/src/devices/bus/abcbus/ram.cpp @@ -30,7 +30,7 @@ DEFINE_DEVICE_TYPE(ABC80_16KB_RAM_CARD, abc80_16kb_ram_card_device, "abc80_16kb" abc80_16kb_ram_card_device::abc80_16kb_ram_card_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : device_t(mconfig, ABC80_16KB_RAM_CARD, tag, owner, clock), device_abcbus_card_interface(mconfig, *this), - m_ram(*this, "ram") + m_ram(*this, "ram", 0x4000, ENDIANNESS_LITTLE) { } @@ -41,7 +41,6 @@ abc80_16kb_ram_card_device::abc80_16kb_ram_card_device(const machine_config &mco void abc80_16kb_ram_card_device::device_start() { - m_ram.allocate(0x4000); } diff --git a/src/devices/bus/abcbus/ram.h b/src/devices/bus/abcbus/ram.h index cddb07182c7..ddb191cd5cf 100644 --- a/src/devices/bus/abcbus/ram.h +++ b/src/devices/bus/abcbus/ram.h @@ -37,7 +37,7 @@ protected: virtual void abcbus_xmemw(offs_t offset, uint8_t data) override; private: - optional_shared_ptr<uint8_t> m_ram; + memory_share_creator<uint8_t> m_ram; }; diff --git a/src/devices/bus/abcbus/ssa.cpp b/src/devices/bus/abcbus/ssa.cpp index 3de6119a3d9..bc15c0852cb 100644 --- a/src/devices/bus/abcbus/ssa.cpp +++ b/src/devices/bus/abcbus/ssa.cpp @@ -121,7 +121,7 @@ abc_super_smartaid_device::abc_super_smartaid_device(const machine_config &mconf m_rom_1(*this, "ssa1"), m_rom_2(*this, "ssa2"), m_prom(*this, "ssa3"), - m_nvram(*this, "nvram"), + m_nvram(*this, "nvram", 0x800, ENDIANNESS_LITTLE), m_rom_bank(0), m_prom_bank(0) { @@ -144,9 +144,6 @@ void abc_super_smartaid_device::device_start() m_rom_2->base()[i] = bitswap<8>(m_rom_2->base()[i], 2, 6, 1, 4, 3, 5, 7, 0); } - // allocate memory - m_nvram.allocate(0x800); - // state saving save_item(NAME(m_rom_bank)); save_item(NAME(m_prom_bank)); diff --git a/src/devices/bus/abcbus/ssa.h b/src/devices/bus/abcbus/ssa.h index 7de5ade5950..2eceb3ad0dd 100644 --- a/src/devices/bus/abcbus/ssa.h +++ b/src/devices/bus/abcbus/ssa.h @@ -41,8 +41,8 @@ protected: // device_nvram_interface overrides virtual void nvram_default() override { } - virtual void nvram_read(emu_file &file) override { if (m_nvram != nullptr) { file.read(m_nvram, m_nvram.bytes()); } } - virtual void nvram_write(emu_file &file) override { if (m_nvram != nullptr) { file.write(m_nvram, m_nvram.bytes()); } } + virtual void nvram_read(emu_file &file) override { if (m_nvram != nullptr) { file.read(m_nvram, m_nvram.share()->bytes()); } } + virtual void nvram_write(emu_file &file) override { if (m_nvram != nullptr) { file.write(m_nvram, m_nvram.share()->bytes()); } } // device_abcbus_interface overrides virtual void abcbus_cs(uint8_t data) override { m_bus->write_cs(data); } @@ -61,7 +61,7 @@ private: required_memory_region m_rom_1; required_memory_region m_rom_2; required_memory_region m_prom; - optional_shared_ptr<uint8_t> m_nvram; + memory_share_creator<uint8_t> m_nvram; uint8_t m_rom_bank; uint8_t m_prom_bank; }; diff --git a/src/devices/bus/acorn/atom/discpack.cpp b/src/devices/bus/acorn/atom/discpack.cpp index dd8d3021301..c7010454e78 100644 --- a/src/devices/bus/acorn/atom/discpack.cpp +++ b/src/devices/bus/acorn/atom/discpack.cpp @@ -85,10 +85,11 @@ void atom_discpack_device::device_start() space.install_device(0x0a00, 0x0a03, *m_fdc, &i8271_device::map); space.install_readwrite_handler(0x0a04, 0x0a04, 0, 0x1f8, 0, read8smo_delegate(*m_fdc, FUNC(i8271_device::data_r)), write8smo_delegate(*m_fdc, FUNC(i8271_device::data_w))); - space.install_ram(0x2000, 0x23ff); - space.install_ram(0x2400, 0x27ff); - space.install_ram(0x3c00, 0x3fff); + space.install_ram(0x2000, 0x27ff, m_ram); + space.install_ram(0x3c00, 0x3fff, m_ram+0x800); space.install_rom(0xe000, 0xefff, m_dos_rom->base()); + + save_item(NAME(m_ram)); } diff --git a/src/devices/bus/acorn/atom/discpack.h b/src/devices/bus/acorn/atom/discpack.h index 3f06870f87c..a55abce3278 100644 --- a/src/devices/bus/acorn/atom/discpack.h +++ b/src/devices/bus/acorn/atom/discpack.h @@ -47,6 +47,8 @@ private: required_memory_region m_dos_rom; required_device<i8271_device> m_fdc; required_device_array<floppy_connector, 2> m_floppy; + + u8 m_ram[0x800 + 0x400]; }; diff --git a/src/devices/bus/acorn/system/32k.cpp b/src/devices/bus/acorn/system/32k.cpp index c74d60cc863..00eb80050e9 100644 --- a/src/devices/bus/acorn/system/32k.cpp +++ b/src/devices/bus/acorn/system/32k.cpp @@ -73,6 +73,7 @@ acorn_32k_device::acorn_32k_device(const machine_config &mconfig, const char *ta void acorn_32k_device::device_start() { + save_item(NAME(m_ram)); } //------------------------------------------------- @@ -85,11 +86,11 @@ void acorn_32k_device::device_reset() if (m_links->read()) { - space.install_ram(0x8000, 0xbfff); + space.install_ram(0x8000, 0xbfff, m_ram); } else { - space.install_ram(0x2000, 0x7fff); - space.install_ram(0xc000, 0xdfff); + space.install_ram(0x2000, 0x7fff, m_ram); + space.install_ram(0xc000, 0xdfff, m_ram + 0x6000); } } diff --git a/src/devices/bus/acorn/system/32k.h b/src/devices/bus/acorn/system/32k.h index 0ef4c10f3c3..f3d3b76be5c 100644 --- a/src/devices/bus/acorn/system/32k.h +++ b/src/devices/bus/acorn/system/32k.h @@ -38,6 +38,7 @@ protected: private: required_ioport m_links; + u8 m_ram[32768]; }; diff --git a/src/devices/bus/acorn/system/8k.cpp b/src/devices/bus/acorn/system/8k.cpp index 97939b7362f..ecbd69c930f 100644 --- a/src/devices/bus/acorn/system/8k.cpp +++ b/src/devices/bus/acorn/system/8k.cpp @@ -98,6 +98,7 @@ acorn_8k_device::acorn_8k_device(const machine_config &mconfig, const char *tag, void acorn_8k_device::device_start() { + save_item(NAME(m_ram)); } //------------------------------------------------- @@ -112,11 +113,11 @@ void acorn_8k_device::device_reset() if (ram_addr == 0x0000) // BLK0 { - space.install_ram(0x1000, 0x1fff); + space.install_ram(0x1000, 0x1fff, m_ram); } else { - space.install_ram(ram_addr, ram_addr + 0x1fff); + space.install_ram(ram_addr, ram_addr + 0x1fff, m_ram); } uint16_t rom_addr = (m_links->read() & 0xf0) << 9; diff --git a/src/devices/bus/acorn/system/8k.h b/src/devices/bus/acorn/system/8k.h index 125b636cd5b..09f089c1563 100644 --- a/src/devices/bus/acorn/system/8k.h +++ b/src/devices/bus/acorn/system/8k.h @@ -47,6 +47,7 @@ private: required_device_array<generic_slot_device, 2> m_rom; required_ioport m_links; + u8 m_ram[8192]; }; diff --git a/src/devices/bus/adam/exp.cpp b/src/devices/bus/adam/exp.cpp index a6c8b777402..59c677144f3 100644 --- a/src/devices/bus/adam/exp.cpp +++ b/src/devices/bus/adam/exp.cpp @@ -36,8 +36,7 @@ DEFINE_DEVICE_TYPE(ADAM_EXPANSION_SLOT, adam_expansion_slot_device, "adam_expans //------------------------------------------------- device_adam_expansion_slot_card_interface::device_adam_expansion_slot_card_interface(const machine_config &mconfig, device_t &device) : - device_interface(device, "adamexp"), - m_rom(*this, "rom") + device_interface(device, "adamexp") { m_slot = dynamic_cast<adam_expansion_slot_device *>(device.owner()); } diff --git a/src/devices/bus/adam/exp.h b/src/devices/bus/adam/exp.h index 69ed921d5d5..ee74bf0396a 100644 --- a/src/devices/bus/adam/exp.h +++ b/src/devices/bus/adam/exp.h @@ -100,7 +100,7 @@ protected: adam_expansion_slot_device *m_slot; - optional_shared_ptr<uint8_t> m_rom; + std::unique_ptr<uint8_t[]> m_rom; }; diff --git a/src/devices/bus/adam/ram.cpp b/src/devices/bus/adam/ram.cpp index a7e79719867..65dc13f2246 100644 --- a/src/devices/bus/adam/ram.cpp +++ b/src/devices/bus/adam/ram.cpp @@ -30,7 +30,7 @@ DEFINE_DEVICE_TYPE(ADAM_RAM, adam_ram_expansion_device, "adam_ram", "Adam 64KB R adam_ram_expansion_device::adam_ram_expansion_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : device_t(mconfig, ADAM_RAM, tag, owner, clock), device_adam_expansion_slot_card_interface(mconfig, *this), - m_ram(*this, "ram") + m_ram(*this, "ram", 0x10000, ENDIANNESS_LITTLE) { } @@ -41,7 +41,6 @@ adam_ram_expansion_device::adam_ram_expansion_device(const machine_config &mconf void adam_ram_expansion_device::device_start() { - m_ram.allocate(0x10000); } diff --git a/src/devices/bus/adam/ram.h b/src/devices/bus/adam/ram.h index 780d51be726..c1997bf77c4 100644 --- a/src/devices/bus/adam/ram.h +++ b/src/devices/bus/adam/ram.h @@ -37,7 +37,7 @@ protected: virtual void adam_bd_w(offs_t offset, uint8_t data, int bmreq, int biorq, int aux_rom_cs, int cas1, int cas2) override; private: - optional_shared_ptr<uint8_t> m_ram; + memory_share_creator<uint8_t> m_ram; }; diff --git a/src/devices/bus/bw2/ramcard.cpp b/src/devices/bus/bw2/ramcard.cpp index b1e0bfe5bcf..33d1fc147d9 100644 --- a/src/devices/bus/bw2/ramcard.cpp +++ b/src/devices/bus/bw2/ramcard.cpp @@ -51,7 +51,7 @@ bw2_ramcard_device::bw2_ramcard_device(const machine_config &mconfig, const char : device_t(mconfig, BW2_RAMCARD, tag, owner, clock), device_bw2_expansion_slot_interface(mconfig, *this), m_rom(*this, "ramcard"), - m_ram(*this, "ram"), + m_ram(*this, "ram", 512*1024, ENDIANNESS_LITTLE), m_en(0), m_bank(0) { @@ -64,9 +64,6 @@ bw2_ramcard_device::bw2_ramcard_device(const machine_config &mconfig, const char void bw2_ramcard_device::device_start() { - // allocate memory - m_ram.allocate(512 * 1024); - // state saving save_item(NAME(m_en)); save_item(NAME(m_bank)); diff --git a/src/devices/bus/bw2/ramcard.h b/src/devices/bus/bw2/ramcard.h index 029d9b91feb..f3cd95f38d4 100644 --- a/src/devices/bus/bw2/ramcard.h +++ b/src/devices/bus/bw2/ramcard.h @@ -43,7 +43,7 @@ protected: private: required_memory_region m_rom; - optional_shared_ptr<uint8_t> m_ram; + memory_share_creator<uint8_t> m_ram; int m_en; uint8_t m_bank; diff --git a/src/devices/bus/c64/c128_partner.cpp b/src/devices/bus/c64/c128_partner.cpp index 91b7cf751ab..808926d8583 100644 --- a/src/devices/bus/c64/c128_partner.cpp +++ b/src/devices/bus/c64/c128_partner.cpp @@ -80,7 +80,8 @@ ioport_constructor c128_partner_cartridge_device::device_input_ports() const c128_partner_cartridge_device::c128_partner_cartridge_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : device_t(mconfig, C128_PARTNER, tag, owner, clock), device_c64_expansion_card_interface(mconfig, *this), - m_ram(*this, "ram"), t_joyb2(nullptr), + m_ram(*this, "ram", 0x2000, ENDIANNESS_LITTLE), + t_joyb2(nullptr), m_ram_a12_a7(0), m_ls74_cd(0), m_ls74_q1(0), @@ -96,9 +97,6 @@ c128_partner_cartridge_device::c128_partner_cartridge_device(const machine_confi void c128_partner_cartridge_device::device_start() { - // allocate memory - m_ram.allocate(0x2000); - // simulate the 16.7ms pulse from CIA1 PB2 that would arrive thru the joystick port dongle t_joyb2 = timer_alloc(); t_joyb2->adjust(attotime::from_msec(16), 0, attotime::from_msec(16)); diff --git a/src/devices/bus/c64/c128_partner.h b/src/devices/bus/c64/c128_partner.h index 1f4402d5b22..da906531122 100644 --- a/src/devices/bus/c64/c128_partner.h +++ b/src/devices/bus/c64/c128_partner.h @@ -49,7 +49,7 @@ protected: virtual void vcs_joy_w(uint8_t data); private: - optional_shared_ptr<uint8_t> m_ram; + memory_share_creator<uint8_t> m_ram; emu_timer *t_joyb2; int m_ram_a12_a7; diff --git a/src/devices/bus/c64/dqbb.cpp b/src/devices/bus/c64/dqbb.cpp index 20adedd9057..6f7e2bf7dab 100644 --- a/src/devices/bus/c64/dqbb.cpp +++ b/src/devices/bus/c64/dqbb.cpp @@ -53,7 +53,8 @@ c64_dqbb_cartridge_device::c64_dqbb_cartridge_device(const machine_config &mconf void c64_dqbb_cartridge_device::device_start() { // allocate memory - m_nvram.allocate(0x4000); + m_nvram = std::make_unique<uint8_t[]>(0x4000); + save_pointer(NAME(m_nvram.get()), 0x4000); // state saving save_item(NAME(m_cs)); diff --git a/src/devices/bus/c64/dqbb.h b/src/devices/bus/c64/dqbb.h index aaa8c0e1bf4..af9460a5bbe 100644 --- a/src/devices/bus/c64/dqbb.h +++ b/src/devices/bus/c64/dqbb.h @@ -38,8 +38,8 @@ protected: // device_nvram_interface overrides virtual void nvram_default() override { } - virtual void nvram_read(emu_file &file) override { if (m_nvram != nullptr) { file.read(m_nvram, m_nvram.bytes()); } } - virtual void nvram_write(emu_file &file) override { if (m_nvram != nullptr) { file.write(m_nvram, m_nvram.bytes()); } } + virtual void nvram_read(emu_file &file) override { if (m_nvram != nullptr) { file.read(m_nvram.get(), 0x4000); } } + virtual void nvram_write(emu_file &file) override { if (m_nvram != nullptr) { file.write(m_nvram.get(), 0x4000); } } // device_c64_expansion_card_interface overrides virtual uint8_t c64_cd_r(offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2) override; diff --git a/src/devices/bus/c64/easyflash.cpp b/src/devices/bus/c64/easyflash.cpp index 38cdf9739c6..eab9ff7930a 100644 --- a/src/devices/bus/c64/easyflash.cpp +++ b/src/devices/bus/c64/easyflash.cpp @@ -77,7 +77,7 @@ c64_easyflash_cartridge_device::c64_easyflash_cartridge_device(const machine_con m_flash_roml(*this, AM29F040_0_TAG), m_flash_romh(*this, AM29F040_1_TAG), m_jp1(*this, "JP1"), - m_ram(*this, "ram"), + m_ram(*this, "ram", 0x100, ENDIANNESS_LITTLE), m_bank(0), m_mode(0) { @@ -90,9 +90,6 @@ c64_easyflash_cartridge_device::c64_easyflash_cartridge_device(const machine_con void c64_easyflash_cartridge_device::device_start() { - // allocate memory - m_ram.allocate(0x100); - // state saving save_item(NAME(m_bank)); save_item(NAME(m_mode)); diff --git a/src/devices/bus/c64/easyflash.h b/src/devices/bus/c64/easyflash.h index 377de25d50d..6c73a14838a 100644 --- a/src/devices/bus/c64/easyflash.h +++ b/src/devices/bus/c64/easyflash.h @@ -49,7 +49,7 @@ private: required_device<amd_29f040_device> m_flash_roml; required_device<amd_29f040_device> m_flash_romh; required_ioport m_jp1; - optional_shared_ptr<uint8_t> m_ram; + memory_share_creator<uint8_t> m_ram; uint8_t m_bank; uint8_t m_mode; diff --git a/src/devices/bus/c64/exp.cpp b/src/devices/bus/c64/exp.cpp index 3c5663db036..8304a7be6b7 100644 --- a/src/devices/bus/c64/exp.cpp +++ b/src/devices/bus/c64/exp.cpp @@ -29,10 +29,6 @@ DEFINE_DEVICE_TYPE(C64_EXPANSION_SLOT, c64_expansion_slot_device, "c64_expansion device_c64_expansion_card_interface::device_c64_expansion_card_interface(const machine_config &mconfig, device_t &device) : device_interface(device, "c64exp"), - m_roml(*this, "roml"), - m_romh(*this, "romh"), - m_romx(*this, "romx"), - m_nvram(*this, "nvram"), m_game(1), m_exrom(1) { @@ -148,11 +144,11 @@ image_init_result c64_expansion_slot_device::call_load() uint8_t *roml = nullptr; uint8_t *romh = nullptr; - m_card->m_roml.allocate(roml_size); - m_card->m_romh.allocate(romh_size); + m_card->m_roml = std::make_unique<uint8_t[]>(roml_size); + m_card->m_romh = std::make_unique<uint8_t[]>(romh_size); - if (roml_size) roml = m_card->m_roml; - if (romh_size) romh = m_card->m_roml; + if (roml_size) roml = m_card->m_roml.get(); + if (romh_size) romh = m_card->m_romh.get(); cbm_crt_read_data(image_core_file(), roml, romh); } diff --git a/src/devices/bus/c64/exp.h b/src/devices/bus/c64/exp.h index 2507227d724..29e79fb1ff8 100644 --- a/src/devices/bus/c64/exp.h +++ b/src/devices/bus/c64/exp.h @@ -148,10 +148,10 @@ public: protected: device_c64_expansion_card_interface(const machine_config &mconfig, device_t &device); - optional_shared_ptr<uint8_t> m_roml; - optional_shared_ptr<uint8_t> m_romh; - optional_shared_ptr<uint8_t> m_romx; - optional_shared_ptr<uint8_t> m_nvram; + std::unique_ptr<uint8_t[]> m_roml; + std::unique_ptr<uint8_t[]> m_romh; + std::unique_ptr<uint8_t[]> m_romx; + std::unique_ptr<uint8_t[]> m_nvram; int m_game; int m_exrom; diff --git a/src/devices/bus/c64/fcc.cpp b/src/devices/bus/c64/fcc.cpp index 405c1761a2e..13b42122a03 100644 --- a/src/devices/bus/c64/fcc.cpp +++ b/src/devices/bus/c64/fcc.cpp @@ -97,6 +97,7 @@ c64_final_chesscard_device::c64_final_chesscard_device(const machine_config &mco void c64_final_chesscard_device::device_start() { + m_nvram = std::make_unique<uint8_t[]>(0x2000); // state saving save_item(NAME(m_bank)); save_item(NAME(m_hidden)); diff --git a/src/devices/bus/c64/fcc.h b/src/devices/bus/c64/fcc.h index 03eac948a73..15a096f5cf5 100644 --- a/src/devices/bus/c64/fcc.h +++ b/src/devices/bus/c64/fcc.h @@ -42,8 +42,8 @@ protected: // device_nvram_interface overrides virtual void nvram_default() override { } - virtual void nvram_read(emu_file &file) override { if (m_nvram != nullptr) { file.read(m_nvram, m_nvram.bytes()); } } - virtual void nvram_write(emu_file &file) override { if (m_nvram != nullptr) { file.write(m_nvram, m_nvram.bytes()); } } + virtual void nvram_read(emu_file &file) override { if (m_nvram != nullptr) { file.read(m_nvram.get(), 0x2000); } } + virtual void nvram_write(emu_file &file) override { if (m_nvram != nullptr) { file.write(m_nvram.get(), 0x2000); } } // device_c64_expansion_card_interface overrides virtual uint8_t c64_cd_r(offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2) override; @@ -59,8 +59,8 @@ private: DECLARE_WRITE_LINE_MEMBER(mainlatch_int) { m_slot->nmi_w(state); } uint8_t rom_r(offs_t offset) { return m_romx[offset]; } // cartridge cpu rom - uint8_t nvram_r(offs_t offset) { return m_nvram[offset & m_nvram.mask()]; } - void nvram_w(offs_t offset, uint8_t data) { m_nvram[offset & m_nvram.mask()] = data; } + uint8_t nvram_r(offs_t offset) { return m_nvram[offset & 0x1fff]; } + void nvram_w(offs_t offset, uint8_t data) { m_nvram[offset & 0x1fff] = data; } void c64_fcc_map(address_map &map); }; diff --git a/src/devices/bus/c64/georam.cpp b/src/devices/bus/c64/georam.cpp index 6bf8a16a1d8..377bc10a391 100644 --- a/src/devices/bus/c64/georam.cpp +++ b/src/devices/bus/c64/georam.cpp @@ -30,7 +30,7 @@ DEFINE_DEVICE_TYPE(C64_GEORAM, c64_georam_cartridge_device, "c64_georam", "C64 G c64_georam_cartridge_device::c64_georam_cartridge_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : device_t(mconfig, C64_GEORAM, tag, owner, clock), device_c64_expansion_card_interface(mconfig, *this), - m_ram(*this, "ram"), + m_ram(*this, "ram", 0x80000, ENDIANNESS_LITTLE), m_bank(0) { } @@ -42,9 +42,6 @@ c64_georam_cartridge_device::c64_georam_cartridge_device(const machine_config &m void c64_georam_cartridge_device::device_start() { - // allocate memory - m_ram.allocate(0x80000); - // state saving save_item(NAME(m_bank)); } diff --git a/src/devices/bus/c64/georam.h b/src/devices/bus/c64/georam.h index 03967625c23..41b7fd82379 100644 --- a/src/devices/bus/c64/georam.h +++ b/src/devices/bus/c64/georam.h @@ -39,7 +39,7 @@ protected: virtual void c64_cd_w(offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2) override; private: - optional_shared_ptr<uint8_t> m_ram; + memory_share_creator<uint8_t> m_ram; uint16_t m_bank; }; diff --git a/src/devices/bus/c64/ide64.cpp b/src/devices/bus/c64/ide64.cpp index 73e14ea6b99..830f38c3993 100644 --- a/src/devices/bus/c64/ide64.cpp +++ b/src/devices/bus/c64/ide64.cpp @@ -93,7 +93,8 @@ c64_ide64_cartridge_device::c64_ide64_cartridge_device(const machine_config &mco m_rtc(*this, DS1302_TAG), m_ata(*this, ATA_TAG), m_jp1(*this, "JP1"), - m_ram(*this, "ram"), m_bank(0), m_ata_data(0), m_wp(0), m_enable(0) + m_ram(*this, "ram", 0x8000, ENDIANNESS_LITTLE), + m_bank(0), m_ata_data(0), m_wp(0), m_enable(0) { } @@ -104,9 +105,6 @@ c64_ide64_cartridge_device::c64_ide64_cartridge_device(const machine_config &mco void c64_ide64_cartridge_device::device_start() { - // allocate memory - m_ram.allocate(0x8000); - // state saving save_item(NAME(m_bank)); save_item(NAME(m_ata_data)); diff --git a/src/devices/bus/c64/ide64.h b/src/devices/bus/c64/ide64.h index 366357868b9..9438e3a1ed0 100644 --- a/src/devices/bus/c64/ide64.h +++ b/src/devices/bus/c64/ide64.h @@ -53,7 +53,7 @@ private: required_device<ds1302_device> m_rtc; required_device<ata_interface_device> m_ata; required_ioport m_jp1; - optional_shared_ptr<uint8_t> m_ram; + memory_share_creator<uint8_t> m_ram; uint8_t m_bank; uint16_t m_ata_data; diff --git a/src/devices/bus/c64/magic_formel.cpp b/src/devices/bus/c64/magic_formel.cpp index 8d43fd05810..1e6c38d1685 100644 --- a/src/devices/bus/c64/magic_formel.cpp +++ b/src/devices/bus/c64/magic_formel.cpp @@ -157,7 +157,7 @@ c64_magic_formel_cartridge_device::c64_magic_formel_cartridge_device(const machi device_t(mconfig, C64_MAGIC_FORMEL, tag, owner, clock), device_c64_expansion_card_interface(mconfig, *this), m_pia(*this, MC6821_TAG), - m_ram(*this, "ram"), + m_ram(*this, "ram", 0x2000, ENDIANNESS_LITTLE), m_rom_bank(0), m_ram_bank(0), m_ram_oe(0), @@ -174,9 +174,6 @@ c64_magic_formel_cartridge_device::c64_magic_formel_cartridge_device(const machi void c64_magic_formel_cartridge_device::device_start() { - // allocate memory - m_ram.allocate(0x2000); - // state saving save_item(NAME(m_rom_bank)); save_item(NAME(m_ram_bank)); diff --git a/src/devices/bus/c64/magic_formel.h b/src/devices/bus/c64/magic_formel.h index 43fb7c69fe5..ab16d4a0e34 100644 --- a/src/devices/bus/c64/magic_formel.h +++ b/src/devices/bus/c64/magic_formel.h @@ -51,7 +51,7 @@ private: DECLARE_WRITE_LINE_MEMBER( pia_cb2_w ); required_device<pia6821_device> m_pia; - optional_shared_ptr<uint8_t> m_ram; + memory_share_creator<uint8_t> m_ram; uint8_t m_rom_bank; uint8_t m_ram_bank; diff --git a/src/devices/bus/c64/neoram.cpp b/src/devices/bus/c64/neoram.cpp index 4cb34cbbb57..c0f292da161 100644 --- a/src/devices/bus/c64/neoram.cpp +++ b/src/devices/bus/c64/neoram.cpp @@ -43,7 +43,7 @@ c64_neoram_cartridge_device::c64_neoram_cartridge_device(const machine_config &m void c64_neoram_cartridge_device::device_start() { // allocate memory - m_nvram.allocate(0x200000); + m_nvram = std::make_unique<uint8_t[]>(0x200000); // state saving save_item(NAME(m_bank)); diff --git a/src/devices/bus/c64/neoram.h b/src/devices/bus/c64/neoram.h index d5058b878b7..b6729ec08d4 100644 --- a/src/devices/bus/c64/neoram.h +++ b/src/devices/bus/c64/neoram.h @@ -37,8 +37,8 @@ protected: // device_nvram_interface overrides virtual void nvram_default() override { } - virtual void nvram_read(emu_file &file) override { if (m_nvram != nullptr) { file.read(m_nvram, m_nvram.bytes()); } } - virtual void nvram_write(emu_file &file) override { if (m_nvram != nullptr) { file.write(m_nvram, m_nvram.bytes()); } } + virtual void nvram_read(emu_file &file) override { if (m_nvram != nullptr) { file.read(m_nvram.get(), 0x200000); } } + virtual void nvram_write(emu_file &file) override { if (m_nvram != nullptr) { file.write(m_nvram.get(), 0x200000); } } // device_c64_expansion_card_interface overrides virtual uint8_t c64_cd_r(offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2) override; diff --git a/src/devices/bus/c64/ocean.cpp b/src/devices/bus/c64/ocean.cpp index 92b18de6a51..d267a9912fa 100644 --- a/src/devices/bus/c64/ocean.cpp +++ b/src/devices/bus/c64/ocean.cpp @@ -84,15 +84,15 @@ void c64_ocean_cartridge_device::device_reset() uint8_t c64_ocean_cartridge_device::c64_cd_r(offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2) { - if (!roml && m_roml.bytes()) + if (!roml && m_roml) { offs_t addr = (m_bank << 13) | (offset & 0x1fff); - data = m_roml[addr & m_roml.mask()]; + data = m_roml[addr]; } - else if (!romh && m_romh.bytes()) + else if (!romh && m_romh) { offs_t addr = (m_bank << 13) | (offset & 0x1fff); - data = m_romh[addr & m_romh.mask()]; + data = m_romh[addr]; } else if (!io1) { diff --git a/src/devices/bus/c64/pagefox.cpp b/src/devices/bus/c64/pagefox.cpp index 80264aab13b..e33bb4d3d7b 100644 --- a/src/devices/bus/c64/pagefox.cpp +++ b/src/devices/bus/c64/pagefox.cpp @@ -52,7 +52,8 @@ DEFINE_DEVICE_TYPE(C64_PAGEFOX, c64_pagefox_cartridge_device, "c64_pagefox", "C6 c64_pagefox_cartridge_device::c64_pagefox_cartridge_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : device_t(mconfig, C64_PAGEFOX, tag, owner, clock), device_c64_expansion_card_interface(mconfig, *this), - m_ram(*this, "ram"), m_bank(0) + m_ram(*this, "ram", 0x8000, ENDIANNESS_LITTLE), + m_bank(0) { } @@ -63,9 +64,6 @@ c64_pagefox_cartridge_device::c64_pagefox_cartridge_device(const machine_config void c64_pagefox_cartridge_device::device_start() { - // allocate memory - m_ram.allocate(0x8000); - // state saving save_item(NAME(m_bank)); } diff --git a/src/devices/bus/c64/pagefox.h b/src/devices/bus/c64/pagefox.h index 74ed5a4edf0..b0295eb9d0d 100644 --- a/src/devices/bus/c64/pagefox.h +++ b/src/devices/bus/c64/pagefox.h @@ -39,7 +39,7 @@ protected: virtual void c64_cd_w(offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2) override; private: - optional_shared_ptr<uint8_t> m_ram; + memory_share_creator<uint8_t> m_ram; uint8_t m_bank; }; diff --git a/src/devices/bus/c64/partner.cpp b/src/devices/bus/c64/partner.cpp index 55e4d07f3e1..b77cf610d17 100644 --- a/src/devices/bus/c64/partner.cpp +++ b/src/devices/bus/c64/partner.cpp @@ -80,7 +80,7 @@ ioport_constructor c64_partner_cartridge_device::device_input_ports() const c64_partner_cartridge_device::c64_partner_cartridge_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : device_t(mconfig, C64_PARTNER, tag, owner, clock), device_c64_expansion_card_interface(mconfig, *this), - m_ram(*this, "ram"), + m_ram(*this, "ram", 0x2000, ENDIANNESS_LITTLE), m_a0(1), m_a6(1), m_nmi(0) @@ -94,8 +94,6 @@ c64_partner_cartridge_device::c64_partner_cartridge_device(const machine_config void c64_partner_cartridge_device::device_start() { - // allocate memory - m_ram.allocate(0x2000); } diff --git a/src/devices/bus/c64/partner.h b/src/devices/bus/c64/partner.h index 6ecf4503a91..4dd71542571 100644 --- a/src/devices/bus/c64/partner.h +++ b/src/devices/bus/c64/partner.h @@ -44,7 +44,7 @@ protected: virtual int c64_game_r(offs_t offset, int sphi2, int ba, int rw) override; private: - optional_shared_ptr<uint8_t> m_ram; + memory_share_creator<uint8_t> m_ram; int m_a0; int m_a6; diff --git a/src/devices/bus/c64/reu.cpp b/src/devices/bus/c64/reu.cpp index cc51b99e096..0d24a1967fa 100644 --- a/src/devices/bus/c64/reu.cpp +++ b/src/devices/bus/c64/reu.cpp @@ -53,7 +53,7 @@ c64_reu_cartridge_device::c64_reu_cartridge_device(const machine_config &mconfig device_c64_expansion_card_interface(mconfig, *this), m_dmac(*this, MOS8726R1_TAG), m_eprom(*this, "rom"), - m_ram(*this, "ram"), + m_ram(*this, "ram", ram_size, ENDIANNESS_LITTLE), m_variant(variant), m_jp1(jp1), m_ram_size(ram_size) @@ -76,9 +76,6 @@ c64_reu1764_cartridge_device::c64_reu1764_cartridge_device(const machine_config void c64_reu_cartridge_device::device_start() { - // allocate memory - m_ram.allocate(m_ram_size); - // setup DMA controller m_dmac->set_unscaled_clock(m_slot->phi2()); m_dmac->bs_w(m_jp1); diff --git a/src/devices/bus/c64/reu.h b/src/devices/bus/c64/reu.h index 0cbb67d9576..eaa662f38a1 100644 --- a/src/devices/bus/c64/reu.h +++ b/src/devices/bus/c64/reu.h @@ -52,7 +52,7 @@ protected: required_device<mos8726_device> m_dmac; required_device<generic_slot_device> m_eprom; - optional_shared_ptr<uint8_t> m_ram; + memory_share_creator<uint8_t> m_ram; int m_variant; int m_jp1; diff --git a/src/devices/bus/c64/ross.cpp b/src/devices/bus/c64/ross.cpp index 25c1a996df8..e8703a33bcc 100644 --- a/src/devices/bus/c64/ross.cpp +++ b/src/devices/bus/c64/ross.cpp @@ -68,7 +68,7 @@ uint8_t c64_ross_cartridge_device::c64_cd_r(offs_t offset, uint8_t data, int sph { offs_t addr = (m_bank << 14) | (offset & 0x3fff); - data = m_roml[addr & m_roml.mask()]; + data = m_roml[addr]; } return data; diff --git a/src/devices/bus/c64/std.cpp b/src/devices/bus/c64/std.cpp index 08f4c1d65e0..95d472bfbfd 100644 --- a/src/devices/bus/c64/std.cpp +++ b/src/devices/bus/c64/std.cpp @@ -49,19 +49,19 @@ void c64_standard_cartridge_device::device_start() uint8_t c64_standard_cartridge_device::c64_cd_r(offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2) { - if (!roml && m_roml.bytes()) + if (!roml && m_roml) { - data = m_roml[offset & m_roml.mask()]; + data = m_roml[offset]; } else if (!romh) { - if (m_romh.bytes()) + if (m_romh) { - data = m_romh[offset & m_romh.mask()]; + data = m_romh[offset]; } - else if (m_roml.mask() == 0x3fff) + else if (m_roml) { - data = m_roml[offset & m_roml.mask()]; + data = m_roml[offset]; } } diff --git a/src/devices/bus/c64/westermann.cpp b/src/devices/bus/c64/westermann.cpp index ac254733f01..33b22c06942 100644 --- a/src/devices/bus/c64/westermann.cpp +++ b/src/devices/bus/c64/westermann.cpp @@ -61,17 +61,17 @@ uint8_t c64_westermann_cartridge_device::c64_cd_r(offs_t offset, uint8_t data, i { if (!roml) { - data = m_roml[offset & m_roml.mask()]; + data = m_roml[offset]; } else if (!romh) { - if (m_romh.bytes()) + if (m_romh) { - data = m_romh[offset & m_romh.mask()]; + data = m_romh[offset]; } else { - data = m_roml[offset & m_roml.mask()]; + data = m_roml[offset]; } } else if (!io2) diff --git a/src/devices/bus/c64/xl80.cpp b/src/devices/bus/c64/xl80.cpp index 6bfa6e9d8cd..346fb7c0947 100644 --- a/src/devices/bus/c64/xl80.cpp +++ b/src/devices/bus/c64/xl80.cpp @@ -157,7 +157,7 @@ c64_xl80_device::c64_xl80_device(const machine_config &mconfig, const char *tag, m_crtc(*this, HD46505SP_TAG), m_palette(*this, "palette"), m_char_rom(*this, HD46505SP_TAG), - m_ram(*this, "ram") + m_ram(*this, "ram", RAM_SIZE, ENDIANNESS_LITTLE) { } @@ -168,8 +168,6 @@ c64_xl80_device::c64_xl80_device(const machine_config &mconfig, const char *tag, void c64_xl80_device::device_start() { - // allocate memory - m_ram.allocate(RAM_SIZE); } diff --git a/src/devices/bus/c64/xl80.h b/src/devices/bus/c64/xl80.h index 70a9b1cba9d..762b8ed39eb 100644 --- a/src/devices/bus/c64/xl80.h +++ b/src/devices/bus/c64/xl80.h @@ -52,7 +52,7 @@ private: required_device<hd6845s_device> m_crtc; required_device<palette_device> m_palette; required_memory_region m_char_rom; - optional_shared_ptr<uint8_t> m_ram; + memory_share_creator<uint8_t> m_ram; }; diff --git a/src/devices/bus/cbm2/24k.cpp b/src/devices/bus/cbm2/24k.cpp index c212b2fef83..c56474c7be9 100644 --- a/src/devices/bus/cbm2/24k.cpp +++ b/src/devices/bus/cbm2/24k.cpp @@ -30,7 +30,7 @@ DEFINE_DEVICE_TYPE(CBM2_24K, cbm2_24k_cartridge_device, "cbm2_24k", "CBM-II 24K cbm2_24k_cartridge_device::cbm2_24k_cartridge_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : device_t(mconfig, CBM2_24K, tag, owner, clock), device_cbm2_expansion_card_interface(mconfig, *this), - m_ram(*this, "ram") + m_ram(*this, "ram", 0x6000, ENDIANNESS_LITTLE) { } @@ -41,7 +41,6 @@ cbm2_24k_cartridge_device::cbm2_24k_cartridge_device(const machine_config &mconf void cbm2_24k_cartridge_device::device_start() { - m_ram.allocate(0x6000); } diff --git a/src/devices/bus/cbm2/24k.h b/src/devices/bus/cbm2/24k.h index b1c029c5254..554ba721444 100644 --- a/src/devices/bus/cbm2/24k.h +++ b/src/devices/bus/cbm2/24k.h @@ -36,7 +36,7 @@ protected: virtual uint8_t cbm2_bd_r(offs_t offset, uint8_t data, int csbank1, int csbank2, int csbank3) override; virtual void cbm2_bd_w(offs_t offset, uint8_t data, int csbank1, int csbank2, int csbank3) override; - optional_shared_ptr<uint8_t> m_ram; + memory_share_creator<uint8_t> m_ram; }; diff --git a/src/devices/bus/cbm2/exp.cpp b/src/devices/bus/cbm2/exp.cpp index 92c865006f7..7bc35f33120 100644 --- a/src/devices/bus/cbm2/exp.cpp +++ b/src/devices/bus/cbm2/exp.cpp @@ -36,10 +36,7 @@ DEFINE_DEVICE_TYPE(CBM2_EXPANSION_SLOT, cbm2_expansion_slot_device, "cbm2_expans //------------------------------------------------- device_cbm2_expansion_card_interface::device_cbm2_expansion_card_interface(const machine_config &mconfig, device_t &device) : - device_interface(device, "cbm2exp"), - m_bank1(*this, "bank1"), - m_bank2(*this, "bank2"), - m_bank3(*this, "bank3") + device_interface(device, "cbm2exp") { m_slot = dynamic_cast<cbm2_expansion_slot_device *>(device.owner()); } @@ -107,17 +104,17 @@ image_init_result cbm2_expansion_slot_device::call_load() if (is_filetype("20")) { - m_card->m_bank1.allocate(size); + m_card->m_bank1 = std::make_unique<uint8_t[]>(size); fread(m_card->m_bank1, size); } else if (is_filetype("40")) { - m_card->m_bank2.allocate(size); + m_card->m_bank2 = std::make_unique<uint8_t[]>(size); fread(m_card->m_bank2, size); } else if (is_filetype("60")) { - m_card->m_bank3.allocate(size); + m_card->m_bank3 = std::make_unique<uint8_t[]>(size); fread(m_card->m_bank3, size); } } diff --git a/src/devices/bus/cbm2/exp.h b/src/devices/bus/cbm2/exp.h index d07035614a8..9781e4ac05a 100644 --- a/src/devices/bus/cbm2/exp.h +++ b/src/devices/bus/cbm2/exp.h @@ -113,9 +113,9 @@ public: protected: device_cbm2_expansion_card_interface(const machine_config &mconfig, device_t &device); - optional_shared_ptr<uint8_t> m_bank1; - optional_shared_ptr<uint8_t> m_bank2; - optional_shared_ptr<uint8_t> m_bank3; + std::unique_ptr<uint8_t[]> m_bank1; + std::unique_ptr<uint8_t[]> m_bank2; + std::unique_ptr<uint8_t[]> m_bank3; cbm2_expansion_slot_device *m_slot; }; diff --git a/src/devices/bus/cbm2/std.cpp b/src/devices/bus/cbm2/std.cpp index f56226028ee..51653c72755 100644 --- a/src/devices/bus/cbm2/std.cpp +++ b/src/devices/bus/cbm2/std.cpp @@ -49,17 +49,17 @@ void cbm2_standard_cartridge_device::device_start() uint8_t cbm2_standard_cartridge_device::cbm2_bd_r(offs_t offset, uint8_t data, int csbank1, int csbank2, int csbank3) { - if (!csbank1 && m_bank1.bytes()) + if (!csbank1 && m_bank1) { - data = m_bank1[offset & m_bank1.mask()]; + data = m_bank1[offset]; } - else if (!csbank2 && m_bank2.bytes()) + else if (!csbank2 && m_bank2) { - data = m_bank2[offset & m_bank2.mask()]; + data = m_bank2[offset]; } - else if (!csbank3 && m_bank3.bytes()) + else if (!csbank3 && m_bank3) { - data = m_bank3[offset & m_bank3.mask()]; + data = m_bank3[offset]; } return data; diff --git a/src/devices/bus/comx35/clm.cpp b/src/devices/bus/comx35/clm.cpp index 192e5989a36..d32b4a694f8 100644 --- a/src/devices/bus/comx35/clm.cpp +++ b/src/devices/bus/comx35/clm.cpp @@ -173,7 +173,7 @@ comx_clm_device::comx_clm_device(const machine_config &mconfig, const char *tag, m_palette(*this, "palette"), m_rom(*this, "c000"), m_char_rom(*this, MC6845_TAG), - m_video_ram(*this, "video_ram") + m_video_ram(*this, "video_ram", VIDEORAM_SIZE, ENDIANNESS_LITTLE) { } @@ -184,9 +184,6 @@ comx_clm_device::comx_clm_device(const machine_config &mconfig, const char *tag, void comx_clm_device::device_start() { - // allocate memory - m_video_ram.allocate(VIDEORAM_SIZE); - // state saving save_item(NAME(m_ds)); } diff --git a/src/devices/bus/comx35/clm.h b/src/devices/bus/comx35/clm.h index 9c4845cbbe0..de86ff28b7f 100644 --- a/src/devices/bus/comx35/clm.h +++ b/src/devices/bus/comx35/clm.h @@ -52,7 +52,7 @@ private: required_device<palette_device> m_palette; required_memory_region m_rom; required_memory_region m_char_rom; - optional_shared_ptr<uint8_t> m_video_ram; + memory_share_creator<uint8_t> m_video_ram; }; diff --git a/src/devices/bus/comx35/ram.cpp b/src/devices/bus/comx35/ram.cpp index b468b6366ff..0f11dfdb194 100644 --- a/src/devices/bus/comx35/ram.cpp +++ b/src/devices/bus/comx35/ram.cpp @@ -37,7 +37,7 @@ DEFINE_DEVICE_TYPE(COMX_RAM, comx_ram_device, "comx_ram", "COMX-35 RAM Card") comx_ram_device::comx_ram_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : device_t(mconfig, COMX_RAM, tag, owner, clock), device_comx_expansion_card_interface(mconfig, *this), - m_ram(*this, "ram"), + m_ram(*this, "ram", RAM_SIZE, ENDIANNESS_LITTLE), m_bank(0) { } @@ -49,7 +49,6 @@ comx_ram_device::comx_ram_device(const machine_config &mconfig, const char *tag, void comx_ram_device::device_start() { - m_ram.allocate(RAM_SIZE); } diff --git a/src/devices/bus/comx35/ram.h b/src/devices/bus/comx35/ram.h index 3a75e208eb6..8ab8703d195 100644 --- a/src/devices/bus/comx35/ram.h +++ b/src/devices/bus/comx35/ram.h @@ -39,7 +39,7 @@ protected: virtual void comx_io_w(offs_t offset, uint8_t data) override; private: - optional_shared_ptr<uint8_t> m_ram; + memory_share_creator<uint8_t> m_ram; int m_bank; }; diff --git a/src/devices/bus/cpc/cpc_rom.cpp b/src/devices/bus/cpc/cpc_rom.cpp index 69bd7f80035..ff60f024f39 100644 --- a/src/devices/bus/cpc/cpc_rom.cpp +++ b/src/devices/bus/cpc/cpc_rom.cpp @@ -109,12 +109,12 @@ image_init_result cpc_rom_image_device::call_load() m_base = std::make_unique<uint8_t[]>(16384); if(size <= 16384) { - image->fread(m_base.get(),size); + image->fread(m_base,size); } else { image->fseek(size-16384,SEEK_SET); - image->fread(m_base.get(),16384); + image->fread(m_base,16384); } return image_init_result::PASS; diff --git a/src/devices/bus/ecbbus/grip.cpp b/src/devices/bus/ecbbus/grip.cpp index 659bab524ad..b4a09f78523 100644 --- a/src/devices/bus/ecbbus/grip.cpp +++ b/src/devices/bus/ecbbus/grip.cpp @@ -567,7 +567,7 @@ ecb_grip21_device::ecb_grip21_device(const machine_config &mconfig, const char * m_centronics(*this, CENTRONICS_TAG), m_palette(*this, "palette"), m_speaker(*this, "speaker"), - m_video_ram(*this, "video_ram"), + m_video_ram(*this, "video_ram", VIDEORAM_SIZE, ENDIANNESS_LITTLE), m_j3a(*this, "J3A"), m_j3b(*this, "J3B"), m_j7(*this, "J7"), @@ -581,9 +581,6 @@ ecb_grip21_device::ecb_grip21_device(const machine_config &mconfig, const char * void ecb_grip21_device::device_start() { - // allocate video RAM - m_video_ram.allocate(VIDEORAM_SIZE); - // setup GRIP memory banking membank("videoram")->configure_entries(0, 2, m_video_ram, 0x8000); membank("videoram")->set_entry(0); diff --git a/src/devices/bus/ecbbus/grip.h b/src/devices/bus/ecbbus/grip.h index 076a61880d9..a0914f28137 100644 --- a/src/devices/bus/ecbbus/grip.h +++ b/src/devices/bus/ecbbus/grip.h @@ -72,7 +72,7 @@ private: required_device<centronics_device> m_centronics; required_device<palette_device> m_palette; required_device<speaker_sound_device> m_speaker; - optional_shared_ptr<uint8_t> m_video_ram; + memory_share_creator<uint8_t> m_video_ram; required_ioport m_j3a; required_ioport m_j3b; required_ioport m_j7; diff --git a/src/devices/bus/hp_dio/hp_dio.cpp b/src/devices/bus/hp_dio/hp_dio.cpp index aa777e3e5dd..50cad490dc0 100644 --- a/src/devices/bus/hp_dio/hp_dio.cpp +++ b/src/devices/bus/hp_dio/hp_dio.cpp @@ -273,10 +273,9 @@ template void dio16_device::install_memory<read16_delegate, write16_delegate template void dio16_device::install_memory<read16s_delegate, write16s_delegate >(offs_t start, offs_t end, read16s_delegate rhandler, write16s_delegate whandler); template void dio16_device::install_memory<read16sm_delegate, write16sm_delegate >(offs_t start, offs_t end, read16sm_delegate rhandler, write16sm_delegate whandler); -void dio16_device::install_bank(offs_t start, offs_t end, const char *tag, uint8_t *data) +void dio16_device::install_bank(offs_t start, offs_t end, uint8_t *data) { - m_prgspace->install_readwrite_bank(start, end, 0, tag); - machine().root_device().membank(m_prgspace->device().siblingtag(tag).c_str())->set_base(data); + m_prgspace->install_ram(start, end, data); } void dio16_device::unmap_bank(offs_t start, offs_t end) @@ -284,10 +283,9 @@ void dio16_device::unmap_bank(offs_t start, offs_t end) m_prgspace->unmap_readwrite(start, end); } -void dio16_device::install_rom(offs_t start, offs_t end, const char *tag, uint8_t *data) +void dio16_device::install_rom(offs_t start, offs_t end, uint8_t *data) { - m_prgspace->install_read_bank(start, end, 0, tag); - machine().root_device().membank(m_prgspace->device().siblingtag(tag).c_str())->set_base(data); + m_prgspace->install_rom(start, end, data); } void dio16_device::unmap_rom(offs_t start, offs_t end) diff --git a/src/devices/bus/hp_dio/hp_dio.h b/src/devices/bus/hp_dio/hp_dio.h index 11738a5fc26..71d71e67106 100644 --- a/src/devices/bus/hp_dio/hp_dio.h +++ b/src/devices/bus/hp_dio/hp_dio.h @@ -83,8 +83,8 @@ public: // due to the varying bus widths. Using all install_memory() shields you from this problem. // Either know what you're doing (m_prgwidth is available to cards for this purpose) or // only use these for 32-bit DIO-II cards. - void install_bank(offs_t start, offs_t end, const char *tag, uint8_t *data); - void install_rom(offs_t start, offs_t end, const char *tag, uint8_t *data); + void install_bank(offs_t start, offs_t end, uint8_t *data); + void install_rom(offs_t start, offs_t end, uint8_t *data); void unmap_bank(offs_t start, offs_t end); void unmap_rom(offs_t start, offs_t end); diff --git a/src/devices/bus/interpro/sr/sr.h b/src/devices/bus/interpro/sr/sr.h index ef9d01d2f29..0d30905943b 100644 --- a/src/devices/bus/interpro/sr/sr.h +++ b/src/devices/bus/interpro/sr/sr.h @@ -75,7 +75,7 @@ public: offs_t end = start + (CBUS_SIZE - 1); // install the idprom region - read32_delegate idprom_r(*this, [idprom] (address_space &space, offs_t offset, u32 mem_mask) { return idprom->as_u32(offset); }, idprom->name()); + read32sm_delegate idprom_r(*this, [idprom] (offs_t offset) { return idprom->as_u32(offset); }, idprom->name().c_str()); m_main_space->install_read_handler(start, start | 0x7f, idprom_r); m_io_space->install_read_handler(start, start | 0x7f, idprom_r); @@ -171,7 +171,7 @@ public: offs_t end = start + (SRX_SIZE - 1); // install the idprom region - read32_delegate idprom_r(*this, [idprom] (address_space &space, offs_t offset, u32 mem_mask) { return idprom->as_u32(offset); }, idprom->name()); + read32sm_delegate idprom_r(*this, [idprom] (offs_t offset) { return idprom->as_u32(offset); }, idprom->name().c_str()); m_main_space->install_read_handler(start | 0x7f80, start | 0x7fff, idprom_r); m_io_space->install_read_handler(start | 0x7f80, start | 0x7fff, idprom_r); diff --git a/src/devices/bus/isa/3c503.cpp b/src/devices/bus/isa/3c503.cpp index de7363ceb26..92da79a906e 100644 --- a/src/devices/bus/isa/3c503.cpp +++ b/src/devices/bus/isa/3c503.cpp @@ -55,7 +55,7 @@ void el2_3c503_device::device_reset() { m_regs.ctrl = 0x0a; m_irq_state = CLEAR_LINE; m_isa->unmap_bank(SADDR, SADDR + 0x1fff); - m_isa->install_bank(SADDR, SADDR + 0x1fff, "3c503 rom", m_rom); + m_isa->install_bank(SADDR, SADDR + 0x1fff, m_rom); } void el2_3c503_device::set_irq(int state) { @@ -191,13 +191,13 @@ void el2_3c503_device::el2_3c503_hiport_w(offs_t offset, uint8_t data) { m_isa->unmap_bank(SADDR, SADDR + 0x1fff); switch(data & 0xf) { case 0: - m_isa->install_bank(SADDR, SADDR + 0x1fff, "3c503 rom", m_rom); + m_isa->install_bank(SADDR, SADDR + 0x1fff, m_rom); break; case 9: - m_isa->install_bank(SADDR, SADDR + 0x1fff, "3c503 ram", m_board_ram); + m_isa->install_bank(SADDR, SADDR + 0x1fff, m_board_ram); break; default: - m_isa->install_bank(SADDR, SADDR + 0x1fff, "3c503 no map", m_rom); + m_isa->install_bank(SADDR, SADDR + 0x1fff, m_rom); break; } } diff --git a/src/devices/bus/isa/3c505.cpp b/src/devices/bus/isa/3c505.cpp index c45f3e9b78a..55f853acc42 100644 --- a/src/devices/bus/isa/3c505.cpp +++ b/src/devices/bus/isa/3c505.cpp @@ -280,7 +280,7 @@ void isa16_3c505_device::device_reset() offs_t const rom_base = (m_romopts->read() & 0xfe) << 12; if (m_isa->is_option_rom_space_available(rom_base, 0x2000)) - m_isa->install_rom(this, rom_base, rom_base | 0x01fff, "host", "host"); + m_isa->install_rom(this, rom_base, rom_base | 0x01fff, "host"); } m_isa->set_dma_channel(m_isa_drq, this, true); diff --git a/src/devices/bus/isa/aha1542c.cpp b/src/devices/bus/isa/aha1542c.cpp index de8e2f1fb65..34e716647ac 100644 --- a/src/devices/bus/isa/aha1542c.cpp +++ b/src/devices/bus/isa/aha1542c.cpp @@ -383,7 +383,7 @@ aha1542cp_device::aha1542cp_device(const machine_config &mconfig, const char *ta void aha1542c_device::device_start() { set_isa_device(); - m_isa->install_rom(this, 0xdc000, 0xdffff, "aha1542", "aha1542"); + m_isa->install_rom(this, 0xdc000, 0xdffff, "aha1542"); m_isa->install_device(0x330, 0x333, read8sm_delegate(*this, FUNC(aha1542cf_device::aha1542_r)), write8sm_delegate(*this, FUNC(aha1542cf_device::aha1542_w))); diff --git a/src/devices/bus/isa/asc88.cpp b/src/devices/bus/isa/asc88.cpp index 8843aad29a1..be80911d399 100644 --- a/src/devices/bus/isa/asc88.cpp +++ b/src/devices/bus/isa/asc88.cpp @@ -50,8 +50,8 @@ void asc88_device::device_start() void asc88_device::device_reset() { const offs_t baseaddr = 0xc0000 | (u32(m_baseaddr->read()) << 14); - m_isa->install_rom(this, baseaddr, baseaddr | 0x37ff, "asc88", "bios"); - m_isa->install_bank(baseaddr | 0x3800, baseaddr | 0x3fef, "ascram", m_ram.get()); + m_isa->install_rom(this, baseaddr, baseaddr | 0x37ff, "bios"); + m_isa->install_bank(baseaddr | 0x3800, baseaddr | 0x3fef, m_ram.get()); m_isa->install_memory(baseaddr | 0x3ff0, baseaddr | 0x3ff7, read8sm_delegate(*m_scsic, FUNC(ncr5380n_device::read)), write8sm_delegate(*m_scsic, FUNC(ncr5380n_device::write))); diff --git a/src/devices/bus/isa/cga.cpp b/src/devices/bus/isa/cga.cpp index 52a0407f065..410231822a7 100644 --- a/src/devices/bus/isa/cga.cpp +++ b/src/devices/bus/isa/cga.cpp @@ -332,9 +332,9 @@ void isa8_cga_device::device_start() set_isa_device(); m_vram.resize(m_vram_size); m_isa->install_device(0x3d0, 0x3df, read8sm_delegate(*this, FUNC(isa8_cga_device::io_read)), write8sm_delegate(*this, FUNC(isa8_cga_device::io_write))); - m_isa->install_bank(0xb8000, 0xb8000 + (std::min<size_t>)(0x8000, m_vram_size) - 1, "bank_cga", &m_vram[0]); + m_isa->install_bank(0xb8000, 0xb8000 + (std::min<size_t>)(0x8000, m_vram_size) - 1, &m_vram[0]); if(m_vram_size == 0x4000) - m_isa->install_bank(0xbc000, 0xbffff, "bank_cga", &m_vram[0]); + m_isa->install_bank(0xbc000, 0xbffff, &m_vram[0]); /* Initialise the cga palette */ int i; @@ -1341,7 +1341,7 @@ void isa8_cga_pc1512_device::device_start() isa8_cga_device::device_start(); m_isa->install_device(0x3d0, 0x3df, read8sm_delegate(*this, FUNC(isa8_cga_pc1512_device::io_read)), write8sm_delegate(*this, FUNC(isa8_cga_pc1512_device::io_write))); - m_isa->install_bank(0xb8000, 0xbbfff, "bank1", &m_vram[0]); + m_isa->install_bank(0xb8000, 0xbbfff, &m_vram[0]); address_space &space = m_isa->memspace(); @@ -1480,8 +1480,8 @@ void isa8_wyse700_device::device_start() isa8_cga_device::device_start(); m_isa->install_device(0x3d0, 0x3df, read8sm_delegate(*this, FUNC(isa8_wyse700_device::io_read)), write8sm_delegate(*this, FUNC(isa8_wyse700_device::io_write))); - m_isa->install_bank(0xa0000, 0xaffff, "bank_wy1", &m_vram[0x00000]); - m_isa->install_bank(0xb0000, 0xbffff, "bank_cga", &m_vram[0x10000]); + m_isa->install_bank(0xa0000, 0xaffff, &m_vram[0x00000]); + m_isa->install_bank(0xb0000, 0xbffff, &m_vram[0x10000]); } void isa8_wyse700_device::device_reset() @@ -1588,9 +1588,9 @@ void isa8_ec1841_0002_device::io_write(offs_t offset, uint8_t data) read8sm_delegate( *this, FUNC(isa8_ec1841_0002_device::char_ram_read)), write8sm_delegate(*this, FUNC(isa8_ec1841_0002_device::char_ram_write))); } else { - m_isa->install_bank(0xb8000, 0xb8000 + (std::min<size_t>)(0x8000, m_vram_size) - 1, "bank_cga", &m_vram[0]); + m_isa->install_bank(0xb8000, 0xb8000 + (std::min<size_t>)(0x8000, m_vram_size) - 1, &m_vram[0]); if(m_vram_size == 0x4000) - m_isa->install_bank(0xbc000, 0xbffff, "bank_cga", &m_vram[0]); + m_isa->install_bank(0xbc000, 0xbffff, &m_vram[0]); } break; default: @@ -1985,6 +1985,6 @@ void isa8_cga_cportiii_device::port_23c6_w(uint8_t data) if(BIT(data, 3)) m_isa->install_memory(0xb8000, 0xb9fff, read8sm_delegate(*this, FUNC(isa8_cga_cportiii_device::char_ram_read)), write8sm_delegate(*this, FUNC(isa8_cga_cportiii_device::char_ram_write))); else - m_isa->install_bank(0xb8000, 0xb8000 + 0x8000 - 1, "bank_cga", &m_vram[0]); + m_isa->install_bank(0xb8000, 0xb8000 + 0x8000 - 1, &m_vram[0]); } diff --git a/src/devices/bus/isa/chessmsr.cpp b/src/devices/bus/isa/chessmsr.cpp index 7b2dab6e286..e182ad993d3 100644 --- a/src/devices/bus/isa/chessmsr.cpp +++ b/src/devices/bus/isa/chessmsr.cpp @@ -32,8 +32,7 @@ isa8_chessmsr_device::isa8_chessmsr_device(const machine_config &mconfig, const device_isa8_card_interface(mconfig, *this), m_maincpu(*this, "maincpu"), m_mainlatch(*this, "mainlatch"), - m_sublatch(*this, "sublatch"), - m_ram(*this, "ram") + m_sublatch(*this, "sublatch") { } @@ -70,8 +69,9 @@ void isa8_chessmsr_device::device_reset() // install RAM u32 ramsize = 1 << ioport("RAM")->read(); - m_ram.allocate(ramsize / 4); - m_maincpu->space(AS_PROGRAM).install_ram(0, ramsize - 1, m_ram); + m_ram = std::make_unique<u32[]>(ramsize / 4); + save_pointer(NAME(m_ram.get()), ramsize/4); + m_maincpu->space(AS_PROGRAM).install_ram(0, ramsize - 1, m_ram.get()); m_installed = true; } diff --git a/src/devices/bus/isa/chessmsr.h b/src/devices/bus/isa/chessmsr.h index 9144db455dd..6d4becc4b64 100644 --- a/src/devices/bus/isa/chessmsr.h +++ b/src/devices/bus/isa/chessmsr.h @@ -37,7 +37,7 @@ private: required_device<arm_cpu_device> m_maincpu; required_device<generic_latch_8_device> m_mainlatch; required_device<generic_latch_8_device> m_sublatch; - optional_shared_ptr<u32> m_ram; + std::unique_ptr<u32[]> m_ram; u8 m_ram_offset; bool m_suspended; diff --git a/src/devices/bus/isa/ega.cpp b/src/devices/bus/isa/ega.cpp index 45d169f3dff..71665cd62dd 100644 --- a/src/devices/bus/isa/ega.cpp +++ b/src/devices/bus/isa/ega.cpp @@ -636,7 +636,7 @@ void isa8_ega_device::device_start() m_plane[2] = m_videoram + 0x20000; m_plane[3] = m_videoram + 0x30000; - m_isa->install_rom(this, 0xc0000, 0xc3fff, "ega", "user2"); + m_isa->install_rom(this, 0xc0000, 0xc3fff, "user2"); m_isa->install_device(0x3b0, 0x3bf, read8sm_delegate(*this, FUNC(isa8_ega_device::pc_ega8_3b0_r)), write8sm_delegate(*this, FUNC(isa8_ega_device::pc_ega8_3b0_w))); m_isa->install_device(0x3c0, 0x3cf, read8sm_delegate(*this, FUNC(isa8_ega_device::pc_ega8_3c0_r)), write8sm_delegate(*this, FUNC(isa8_ega_device::pc_ega8_3c0_w))); m_isa->install_device(0x3d0, 0x3df, read8sm_delegate(*this, FUNC(isa8_ega_device::pc_ega8_3d0_r)), write8sm_delegate(*this, FUNC(isa8_ega_device::pc_ega8_3d0_w))); diff --git a/src/devices/bus/isa/eis_hgb107x.cpp b/src/devices/bus/isa/eis_hgb107x.cpp index 25b16a38fe3..ed3100c3e97 100644 --- a/src/devices/bus/isa/eis_hgb107x.cpp +++ b/src/devices/bus/isa/eis_hgb107x.cpp @@ -243,13 +243,13 @@ void isa8_epc_mda_device::device_reset() if (m_installed == false) { m_isa->install_device(0x3b0, 0x3bf, read8sm_delegate(*this, FUNC(isa8_epc_mda_device::io_read)), write8sm_delegate(*this, FUNC(isa8_epc_mda_device::io_write))); - m_isa->install_bank(0xb0000, 0xb7fff, "bank_epc", &m_videoram[0]); // Monochrome emulation mode VRAM address + m_isa->install_bank(0xb0000, 0xb7fff, &m_videoram[0]); // Monochrome emulation mode VRAM address // This check allows a color monitor adapter to be installed at this address range if color emulation is disabled if (m_color_mode & 1) { m_isa->install_device(0x3d0, 0x3df, read8sm_delegate(*this, FUNC(isa8_epc_mda_device::io_read)), write8sm_delegate(*this, FUNC(isa8_epc_mda_device::io_write))); - m_isa->install_bank(0xb8000, 0xbffff, "bank_epc", &m_videoram[0]); // Color emulation mode VRAM address, but same 32KB areas as there are only this amount on the board + m_isa->install_bank(0xb8000, 0xbffff, &m_videoram[0]); // Color emulation mode VRAM address, but same 32KB areas as there are only this amount on the board } m_installed = true; } diff --git a/src/devices/bus/isa/hdc.cpp b/src/devices/bus/isa/hdc.cpp index 06d18b3c600..3a890ebd93c 100644 --- a/src/devices/bus/isa/hdc.cpp +++ b/src/devices/bus/isa/hdc.cpp @@ -1000,7 +1000,7 @@ void isa8_hdc_device::device_reset() dip = ioport("HDD")->read(); if (ioport("ROM")->read() == 1 && m_hdc->install_rom()) - m_isa->install_rom(this, 0xc8000, 0xc9fff, "hdc", "hdc"); + m_isa->install_rom(this, 0xc8000, 0xc9fff, "hdc"); } /************************************************************************* diff --git a/src/devices/bus/isa/isa.cpp b/src/devices/bus/isa/isa.cpp index bc653258375..8a25218d2bd 100644 --- a/src/devices/bus/isa/isa.cpp +++ b/src/devices/bus/isa/isa.cpp @@ -356,10 +356,9 @@ template void isa8_device::install_space<read8smo_delegate, write8sm_delegate >( template void isa8_device::install_space<read8smo_delegate, write8mo_delegate >(int spacenum, offs_t start, offs_t end, read8smo_delegate rhandler, write8mo_delegate whandler); template void isa8_device::install_space<read8smo_delegate, write8smo_delegate>(int spacenum, offs_t start, offs_t end, read8smo_delegate rhandler, write8smo_delegate whandler); -void isa8_device::install_bank(offs_t start, offs_t end, const char *tag, uint8_t *data) +void isa8_device::install_bank(offs_t start, offs_t end, uint8_t *data) { - m_memspace->install_readwrite_bank(start, end, 0, tag ); - machine().root_device().membank(m_memspace->device().siblingtag(tag).c_str())->set_base(data); + m_memspace->install_ram(start, end, data); } void isa8_device::unmap_bank(offs_t start, offs_t end) @@ -367,16 +366,15 @@ void isa8_device::unmap_bank(offs_t start, offs_t end) m_memspace->unmap_readwrite(start, end); } -void isa8_device::install_rom(device_t *dev, offs_t start, offs_t end, const char *tag, const char *region) +void isa8_device::install_rom(device_t *dev, offs_t start, offs_t end, const char *region) { if (machine().root_device().memregion("isa")) { uint8_t *src = dev->memregion(region)->base(); uint8_t *dest = machine().root_device().memregion("isa")->base() + start - 0xc0000; memcpy(dest,src, end - start + 1); } else { - m_memspace->install_read_bank(start, end, 0, tag); + m_memspace->install_rom(start, end, machine().root_device().memregion(dev->subtag(region).c_str())->base()); m_memspace->unmap_write(start, end); - machine().root_device().membank(m_memspace->device().siblingtag(tag).c_str())->set_base(machine().root_device().memregion(dev->subtag(region).c_str())->base()); } } diff --git a/src/devices/bus/isa/isa.h b/src/devices/bus/isa/isa.h index 696d825a55e..1e9fdaeddfe 100644 --- a/src/devices/bus/isa/isa.h +++ b/src/devices/bus/isa/isa.h @@ -151,8 +151,8 @@ public: { m_iospace->install_device(addrstart, addrend, device, map, unitmask); } - void install_bank(offs_t start, offs_t end, const char *tag, uint8_t *data); - void install_rom(device_t *dev, offs_t start, offs_t end, const char *tag, const char *region); + void install_bank(offs_t start, offs_t end, uint8_t *data); + void install_rom(device_t *dev, offs_t start, offs_t end, const char *region); template<typename R, typename W> void install_memory(offs_t start, offs_t end, R rhandler, W whandler) { install_space(AS_ISA_MEM, start, end, rhandler, whandler); diff --git a/src/devices/bus/isa/lbaenhancer.cpp b/src/devices/bus/isa/lbaenhancer.cpp index f8ebedb130c..242f1f47afe 100644 --- a/src/devices/bus/isa/lbaenhancer.cpp +++ b/src/devices/bus/isa/lbaenhancer.cpp @@ -133,7 +133,7 @@ void lba_enhancer_device::device_reset() m_current_rom_start = 0xc8000 + (ioport("ROM_ADDRESS")->read()* 0x4000); uint32_t current_rom_end = m_current_rom_start + 0x04000 - 1; - m_isa->install_rom(this, m_current_rom_start, current_rom_end, "lbabios", "lbabios"); + m_isa->install_rom(this, m_current_rom_start, current_rom_end, "lbabios"); logerror("LBA enhancer (for 28 bit LBA) located at BIOS address %x - %x\n", m_current_rom_start, current_rom_end); } diff --git a/src/devices/bus/isa/mc1502_rom.cpp b/src/devices/bus/isa/mc1502_rom.cpp index 7e612c10832..f3a78cb93a6 100644 --- a/src/devices/bus/isa/mc1502_rom.cpp +++ b/src/devices/bus/isa/mc1502_rom.cpp @@ -59,7 +59,7 @@ mc1502_rom_device::mc1502_rom_device(const machine_config &mconfig, const char * void mc1502_rom_device::device_start() { set_isa_device(); - m_isa->install_rom(this, 0xe8000, 0xeffff, "XXX", "mc1502_rom"); + m_isa->install_rom(this, 0xe8000, 0xeffff, "mc1502_rom"); } diff --git a/src/devices/bus/isa/mda.cpp b/src/devices/bus/isa/mda.cpp index ae61e78e116..e3ff8e90f99 100644 --- a/src/devices/bus/isa/mda.cpp +++ b/src/devices/bus/isa/mda.cpp @@ -183,14 +183,14 @@ void isa8_mda_device::device_start() set_isa_device(); m_videoram.resize(0x1000); m_isa->install_device(0x3b0, 0x3bf, read8sm_delegate(*this, FUNC(isa8_mda_device::io_read)), write8sm_delegate(*this, FUNC(isa8_mda_device::io_write))); - m_isa->install_bank(0xb0000, 0xb0fff, "bank_mda", &m_videoram[0]); - m_isa->install_bank(0xb1000, 0xb1fff, "bank_mda", &m_videoram[0]); - m_isa->install_bank(0xb2000, 0xb2fff, "bank_mda", &m_videoram[0]); - m_isa->install_bank(0xb3000, 0xb3fff, "bank_mda", &m_videoram[0]); - m_isa->install_bank(0xb4000, 0xb4fff, "bank_mda", &m_videoram[0]); - m_isa->install_bank(0xb5000, 0xb5fff, "bank_mda", &m_videoram[0]); - m_isa->install_bank(0xb6000, 0xb6fff, "bank_mda", &m_videoram[0]); - m_isa->install_bank(0xb7000, 0xb7fff, "bank_mda", &m_videoram[0]); + m_isa->install_bank(0xb0000, 0xb0fff, &m_videoram[0]); + m_isa->install_bank(0xb1000, 0xb1fff, &m_videoram[0]); + m_isa->install_bank(0xb2000, 0xb2fff, &m_videoram[0]); + m_isa->install_bank(0xb3000, 0xb3fff, &m_videoram[0]); + m_isa->install_bank(0xb4000, 0xb4fff, &m_videoram[0]); + m_isa->install_bank(0xb5000, 0xb5fff, &m_videoram[0]); + m_isa->install_bank(0xb6000, 0xb6fff, &m_videoram[0]); + m_isa->install_bank(0xb7000, 0xb7fff, &m_videoram[0]); /* Initialise the mda palette */ for (int i = 0; i < 4; i++) @@ -601,7 +601,7 @@ void isa8_hercules_device::device_start() m_videoram.resize(0x10000); set_isa_device(); m_isa->install_device(0x3b0, 0x3bf, read8sm_delegate(*this, FUNC(isa8_hercules_device::io_read)), write8sm_delegate(*this, FUNC(isa8_hercules_device::io_write))); - m_isa->install_bank(0xb0000, 0xbffff, "bank_hercules", &m_videoram[0]); + m_isa->install_bank(0xb0000, 0xbffff, &m_videoram[0]); /* Initialise the mda palette */ for(int i = 0; i < (sizeof(mda_palette) / 3); i++) @@ -797,8 +797,8 @@ void isa8_ec1840_0002_device::device_start() isa8_mda_device::device_start(); m_soft_chr_gen = std::make_unique<uint8_t[]>(0x2000); - m_isa->install_bank(0xdc000, 0xddfff, "bank_chargen", m_soft_chr_gen.get()); - m_isa->install_bank(0xde000, 0xdffff, "bank_chargen", m_soft_chr_gen.get()); + m_isa->install_bank(0xdc000, 0xddfff, m_soft_chr_gen.get()); + m_isa->install_bank(0xde000, 0xdffff, m_soft_chr_gen.get()); } void isa8_ec1840_0002_device::device_reset() diff --git a/src/devices/bus/isa/mufdc.cpp b/src/devices/bus/isa/mufdc.cpp index 58408d191e7..652090d7c1d 100644 --- a/src/devices/bus/isa/mufdc.cpp +++ b/src/devices/bus/isa/mufdc.cpp @@ -160,7 +160,7 @@ void mufdc_device::device_start() void mufdc_device::device_reset() { - m_isa->install_rom(this, 0xc8000, 0xc9fff, shortname(), "option"); + m_isa->install_rom(this, 0xc8000, 0xc9fff, "option"); m_isa->install_device(0x3f0, 0x3f7, *m_fdc, &mcs3201_device::map); m_isa->set_dma_channel(2, this, true); } diff --git a/src/devices/bus/isa/p1_fdc.cpp b/src/devices/bus/isa/p1_fdc.cpp index c1671279b08..92915dc3d9b 100644 --- a/src/devices/bus/isa/p1_fdc.cpp +++ b/src/devices/bus/isa/p1_fdc.cpp @@ -172,7 +172,7 @@ p1_fdc_device::p1_fdc_device(const machine_config &mconfig, const char *tag, dev void p1_fdc_device::device_start() { set_isa_device(); - m_isa->install_rom(this, 0xe0000, 0xe07ff, "XXX", "p1_fdc"); + m_isa->install_rom(this, 0xe0000, 0xe07ff, "p1_fdc"); m_isa->install_device(0x00c0, 0x00c3, read8sm_delegate(*m_fdc, FUNC(fd1793_device::read)), write8sm_delegate(*m_fdc, FUNC(fd1793_device::write))); m_isa->install_device(0x00c4, 0x00c7, read8sm_delegate(*this, FUNC(p1_fdc_device::p1_fdc_r)), write8sm_delegate(*this, FUNC(p1_fdc_device::p1_fdc_w))); } diff --git a/src/devices/bus/isa/p1_hdc.cpp b/src/devices/bus/isa/p1_hdc.cpp index b9b3aad2981..9ee84ece875 100644 --- a/src/devices/bus/isa/p1_hdc.cpp +++ b/src/devices/bus/isa/p1_hdc.cpp @@ -126,7 +126,7 @@ p1_hdc_device::p1_hdc_device(const machine_config &mconfig, const char *tag, dev void p1_hdc_device::device_start() { set_isa_device(); - m_isa->install_rom(this, 0xe2000, 0xe27ff, "XXX", "p1_hdc"); + m_isa->install_rom(this, 0xe2000, 0xe27ff, "p1_hdc"); m_isa->install_memory(0xd0000, 0xd0fff, read8sm_delegate(*this, FUNC(p1_hdc_device::p1_HDC_r)), write8sm_delegate(*this, FUNC(p1_hdc_device::p1_HDC_w))); } diff --git a/src/devices/bus/isa/p1_rom.cpp b/src/devices/bus/isa/p1_rom.cpp index 22faf40df01..76013aca719 100644 --- a/src/devices/bus/isa/p1_rom.cpp +++ b/src/devices/bus/isa/p1_rom.cpp @@ -64,7 +64,7 @@ p1_rom_device::p1_rom_device(const machine_config &mconfig, const char *tag, dev void p1_rom_device::device_start() { set_isa_device(); - m_isa->install_rom(this, 0xc0000, 0xc1fff, "XXX", "p1_rom"); + m_isa->install_rom(this, 0xc0000, 0xc1fff, "p1_rom"); } diff --git a/src/devices/bus/isa/pc1640_iga.cpp b/src/devices/bus/isa/pc1640_iga.cpp index 4c9b2719b7c..96ae2da109b 100644 --- a/src/devices/bus/isa/pc1640_iga.cpp +++ b/src/devices/bus/isa/pc1640_iga.cpp @@ -101,7 +101,7 @@ void isa8_pc1640_iga_device::device_start() m_plane[2] = m_videoram + 0x20000; m_plane[3] = m_videoram + 0x30000; - m_isa->install_rom(this, 0xc0000, 0xc7fff, "ega", "iga"); + m_isa->install_rom(this, 0xc0000, 0xc7fff, "iga"); m_isa->install_device(0x3b0, 0x3bf, read8sm_delegate(*this, FUNC(isa8_ega_device::pc_ega8_3b0_r)), write8sm_delegate(*this, FUNC(isa8_ega_device::pc_ega8_3b0_w))); m_isa->install_device(0x3c0, 0x3cf, read8sm_delegate(*this, FUNC(isa8_ega_device::pc_ega8_3c0_r)), write8sm_delegate(*this, FUNC(isa8_ega_device::pc_ega8_3c0_w))); m_isa->install_device(0x3d0, 0x3df, read8sm_delegate(*this, FUNC(isa8_ega_device::pc_ega8_3d0_r)), write8sm_delegate(*this, FUNC(isa8_ega_device::pc_ega8_3d0_w))); diff --git a/src/devices/bus/isa/pgc.cpp b/src/devices/bus/isa/pgc.cpp index f204333f9f2..4b51ebcd0de 100644 --- a/src/devices/bus/isa/pgc.cpp +++ b/src/devices/bus/isa/pgc.cpp @@ -71,8 +71,6 @@ ROM_START( pgc ) ROMX_LOAD("pgc_u44.bin", 0x00000, 0x8000, CRC(71280241) SHA1(7042ccd4ebd03f576a256a433b8aa38d1b4fefa8), ROM_BIOS(1)) ROMX_LOAD("pgc_u43.bin", 0x08000, 0x8000, CRC(923f5ea3) SHA1(2b2a55d64b20d3a613b00c51443105aa03eca5d6), ROM_BIOS(1)) - ROM_REGION(0x800, "commarea", ROMREGION_ERASE00) - ROM_REGION(0x1000, "chargen", 0) ROM_LOAD("pgc_u27.bin", 0x0000, 0x1000, CRC(6be256cc) SHA1(deb1195886268dcddce10459911e020f7a9f74f7)) ROM_END @@ -113,7 +111,7 @@ void isa8_pgc_device::pgc_map(address_map &map) map(0x08000, 0x0ffff).rom().region("maincpu", 0x8000); map(0x10000, 0x1001f).rw(FUNC(isa8_pgc_device::stateparam_r), FUNC(isa8_pgc_device::stateparam_w)); // map(0x18000, 0x18fff).ram(); // ?? - map(0x28000, 0x287ff).ram().region("commarea", 0).mirror(0x800); + map(0x28000, 0x287ff).ram().share("commarea").mirror(0x800); map(0x32001, 0x32001).nopw(); map(0x32020, 0x3203f).w(FUNC(isa8_pgc_device::accel_w)); map(0x3c000, 0x3c001).r(FUNC(isa8_pgc_device::init_r)); @@ -210,7 +208,8 @@ isa8_pgc_device::isa8_pgc_device(const machine_config &mconfig, device_type type m_cpu(*this, "maincpu"), m_screen(*this, PGC_SCREEN_NAME), m_palette(*this, "palette"), - m_commarea(nullptr), m_vram(nullptr), m_eram(nullptr) + m_commarea(*this, "commarea"), + m_vram(nullptr), m_eram(nullptr) { } @@ -246,11 +245,10 @@ void isa8_pgc_device::device_reset() memset(m_lut, 0, sizeof(m_lut)); m_accel = 0; - m_commarea = memregion("commarea")->base(); if (BIT(ioport("DSW")->read(), 1)) - m_isa->install_bank(0xc6400, 0xc67ff, "commarea", m_commarea); + m_isa->install_bank(0xc6400, 0xc67ff, m_commarea); else - m_isa->install_bank(0xc6000, 0xc63ff, "commarea", m_commarea); + m_isa->install_bank(0xc6000, 0xc63ff, m_commarea); } // @@ -389,8 +387,7 @@ uint8_t isa8_pgc_device::init_r() space.unmap_read(0xf8000, 0xfffff); LOG("INIT: mapping emulator RAM\n"); - space.install_readwrite_bank(0xf8000, 0xfffff, "eram"); - membank("eram")->set_base(m_eram.get()); + space.install_ram(0xf8000, 0xfffff, m_eram.get()); LOG("INIT: mapping LUT\n"); space.install_write_handler(0xf8400, 0xf85ff, write8sm_delegate(*this, FUNC(isa8_pgc_device::lut_w))); diff --git a/src/devices/bus/isa/pgc.h b/src/devices/bus/isa/pgc.h index b14ea6e5797..d560dbdda09 100644 --- a/src/devices/bus/isa/pgc.h +++ b/src/devices/bus/isa/pgc.h @@ -60,8 +60,8 @@ private: required_device<i8088_cpu_device> m_cpu; required_device<screen_device> m_screen; required_device<palette_device> m_palette; + required_shared_ptr<uint8_t> m_commarea; - uint8_t *m_commarea; std::unique_ptr<uint8_t[]> m_vram; std::unique_ptr<uint8_t[]> m_eram; uint8_t m_stateparam[16]; diff --git a/src/devices/bus/isa/side116.cpp b/src/devices/bus/isa/side116.cpp index e45d66b26bd..bad6645bf5a 100644 --- a/src/devices/bus/isa/side116.cpp +++ b/src/devices/bus/isa/side116.cpp @@ -112,10 +112,10 @@ void side116_device::device_reset() { switch ((m_config->read() >> 1) & 0x03) { - case 0: m_isa->install_rom(this, 0xc8000, 0xc9fff, "side116", "option"); break; - case 1: m_isa->install_rom(this, 0xd8000, 0xd9fff, "side116", "option"); break; - case 2: m_isa->install_rom(this, 0xcc000, 0xcdfff, "side116", "option"); break; - case 3: m_isa->install_rom(this, 0xdc000, 0xddfff, "side116", "option"); break; + case 0: m_isa->install_rom(this, 0xc8000, 0xc9fff, "option"); break; + case 1: m_isa->install_rom(this, 0xd8000, 0xd9fff, "option"); break; + case 2: m_isa->install_rom(this, 0xcc000, 0xcdfff, "option"); break; + case 3: m_isa->install_rom(this, 0xdc000, 0xddfff, "option"); break; } } diff --git a/src/devices/bus/isa/svga_cirrus.cpp b/src/devices/bus/isa/svga_cirrus.cpp index e1cebaf9a32..943606e9be4 100644 --- a/src/devices/bus/isa/svga_cirrus.cpp +++ b/src/devices/bus/isa/svga_cirrus.cpp @@ -72,7 +72,7 @@ void isa16_svga_cirrus_device::device_start() { set_isa_device(); - m_isa->install_rom(this, 0xc0000, 0xc7fff, "svga", "dm_clgd5430"); + m_isa->install_rom(this, 0xc0000, 0xc7fff, "dm_clgd5430"); m_isa->install_device(0x03b0, 0x03bf, read8sm_delegate(*m_vga, FUNC(cirrus_gd5430_device::port_03b0_r)), write8sm_delegate(*m_vga, FUNC(cirrus_gd5430_device::port_03b0_w))); m_isa->install_device(0x03c0, 0x03cf, read8sm_delegate(*m_vga, FUNC(cirrus_gd5430_device::port_03c0_r)), write8sm_delegate(*m_vga, FUNC(cirrus_gd5430_device::port_03c0_w))); @@ -150,7 +150,7 @@ void isa16_svga_cirrus_gd542x_device::device_start() { set_isa_device(); - m_isa->install_rom(this, 0xc0000, 0xc7fff, "svga", "clgd542x"); + m_isa->install_rom(this, 0xc0000, 0xc7fff, "clgd542x"); m_isa->install_device(0x03b0, 0x03bf, read8sm_delegate(*m_vga, FUNC(cirrus_gd5428_device::port_03b0_r)), write8sm_delegate(*m_vga, FUNC(cirrus_gd5428_device::port_03b0_w))); m_isa->install_device(0x03c0, 0x03cf, read8sm_delegate(*m_vga, FUNC(cirrus_gd5428_device::port_03c0_r)), write8sm_delegate(*m_vga, FUNC(cirrus_gd5428_device::port_03c0_w))); diff --git a/src/devices/bus/isa/svga_s3.cpp b/src/devices/bus/isa/svga_s3.cpp index a50c3a8d0fb..b4334f269ef 100644 --- a/src/devices/bus/isa/svga_s3.cpp +++ b/src/devices/bus/isa/svga_s3.cpp @@ -82,7 +82,7 @@ void isa16_svga_s3_device::device_start() { set_isa_device(); - m_isa->install_rom(this, 0xc0000, 0xc7fff, "svga", "s3_764"); + m_isa->install_rom(this, 0xc0000, 0xc7fff, "s3_764"); m_isa->install_device(0x03b0, 0x03bf, read8sm_delegate(*m_vga, FUNC(s3_vga_device::port_03b0_r)), write8sm_delegate(*m_vga, FUNC(s3_vga_device::port_03b0_w))); m_isa->install_device(0x03c0, 0x03cf, read8sm_delegate(*m_vga, FUNC(s3_vga_device::port_03c0_r)), write8sm_delegate(*m_vga, FUNC(s3_vga_device::port_03c0_w))); @@ -196,7 +196,7 @@ void isa16_s3virge_device::device_start() { set_isa_device(); - m_isa->install_rom(this, 0xc0000, 0xc7fff, "svga", "s3virge"); + m_isa->install_rom(this, 0xc0000, 0xc7fff, "s3virge"); m_isa->install_device(0x03b0, 0x03bf, read8sm_delegate(*m_vga, FUNC(s3virge_vga_device::port_03b0_r)), write8sm_delegate(*m_vga, FUNC(s3virge_vga_device::port_03b0_w))); m_isa->install_device(0x03c0, 0x03cf, read8sm_delegate(*m_vga, FUNC(s3virge_vga_device::port_03c0_r)), write8sm_delegate(*m_vga, FUNC(s3virge_vga_device::port_03c0_w))); @@ -302,7 +302,7 @@ void isa16_s3virgedx_device::device_start() { set_isa_device(); - m_isa->install_rom(this, 0xc0000, 0xc7fff, "svga", "s3virgedx"); + m_isa->install_rom(this, 0xc0000, 0xc7fff, "s3virgedx"); m_isa->install_device(0x03b0, 0x03bf, read8sm_delegate(*m_vga, FUNC(s3virge_vga_device::port_03b0_r)), write8sm_delegate(*m_vga, FUNC(s3virge_vga_device::port_03b0_w))); m_isa->install_device(0x03c0, 0x03cf, read8sm_delegate(*m_vga, FUNC(s3virge_vga_device::port_03c0_r)), write8sm_delegate(*m_vga, FUNC(s3virge_vga_device::port_03c0_w))); @@ -400,7 +400,7 @@ void isa16_stealth3d2kpro_device::device_start() { set_isa_device(); - m_isa->install_rom(this, 0xc0000, 0xc7fff, "svga", "stealth3d"); + m_isa->install_rom(this, 0xc0000, 0xc7fff, "stealth3d"); m_isa->install_device(0x03b0, 0x03bf, read8sm_delegate(*m_vga, FUNC(s3virge_vga_device::port_03b0_r)), write8sm_delegate(*m_vga, FUNC(s3virge_vga_device::port_03b0_w))); m_isa->install_device(0x03c0, 0x03cf, read8sm_delegate(*m_vga, FUNC(s3virge_vga_device::port_03c0_r)), write8sm_delegate(*m_vga, FUNC(s3virge_vga_device::port_03c0_w))); diff --git a/src/devices/bus/isa/svga_trident.cpp b/src/devices/bus/isa/svga_trident.cpp index 5c934e99bf0..7eda60d2446 100644 --- a/src/devices/bus/isa/svga_trident.cpp +++ b/src/devices/bus/isa/svga_trident.cpp @@ -72,7 +72,7 @@ void isa16_svga_tgui9680_device::device_start() { set_isa_device(); - m_isa->install_rom(this, 0xc0000, 0xc7fff, "tgui9680", "tgui9680"); + m_isa->install_rom(this, 0xc0000, 0xc7fff, "tgui9680"); m_isa->install_device(0x3b0, 0x3bf, read8sm_delegate(*m_vga, FUNC(trident_vga_device::port_03b0_r)), write8sm_delegate(*m_vga, FUNC(trident_vga_device::port_03b0_w))); m_isa->install_device(0x3c0, 0x3cf, read8sm_delegate(*m_vga, FUNC(trident_vga_device::port_03c0_r)), write8sm_delegate(*m_vga, FUNC(trident_vga_device::port_03c0_w))); diff --git a/src/devices/bus/isa/svga_tseng.cpp b/src/devices/bus/isa/svga_tseng.cpp index 48ee7324b2e..ab5bbb755f0 100644 --- a/src/devices/bus/isa/svga_tseng.cpp +++ b/src/devices/bus/isa/svga_tseng.cpp @@ -114,5 +114,5 @@ void isa8_svga_et4k_device::map_ram() void isa8_svga_et4k_device::map_rom() { - m_isa->install_rom(this, 0xc0000, 0xc7fff, "et4000", "et4000"); + m_isa->install_rom(this, 0xc0000, 0xc7fff, "et4000"); } diff --git a/src/devices/bus/isa/vga.cpp b/src/devices/bus/isa/vga.cpp index 9772690c46e..11d94d7fbdd 100644 --- a/src/devices/bus/isa/vga.cpp +++ b/src/devices/bus/isa/vga.cpp @@ -69,7 +69,7 @@ void isa8_vga_device::device_start() { set_isa_device(); - m_isa->install_rom(this, 0xc0000, 0xc7fff, "ibm_vga", "ibm_vga"); + m_isa->install_rom(this, 0xc0000, 0xc7fff, "ibm_vga"); m_isa->install_device(0x3b0, 0x3bf, read8sm_delegate(*m_vga, FUNC(vga_device::port_03b0_r)), write8sm_delegate(*m_vga, FUNC(vga_device::port_03b0_w))); m_isa->install_device(0x3c0, 0x3cf, read8sm_delegate(*m_vga, FUNC(vga_device::port_03c0_r)), write8sm_delegate(*m_vga, FUNC(vga_device::port_03c0_w))); diff --git a/src/devices/bus/isa/vga_ati.cpp b/src/devices/bus/isa/vga_ati.cpp index 177e30f14c7..d6ce586a9fd 100644 --- a/src/devices/bus/isa/vga_ati.cpp +++ b/src/devices/bus/isa/vga_ati.cpp @@ -163,7 +163,7 @@ void isa16_vga_gfxultra_device::device_start() { set_isa_device(); - m_isa->install_rom(this, 0xc0000, 0xc7fff, "vga", "gfxultra"); + m_isa->install_rom(this, 0xc0000, 0xc7fff, "gfxultra"); m_isa->install_device(0x1ce, 0x1cf, read8sm_delegate(*m_vga, FUNC(ati_vga_device::ati_port_ext_r)), write8sm_delegate(*m_vga, FUNC(ati_vga_device::ati_port_ext_w))); m_isa->install_device(0x2e8, 0x2ef, read8sm_delegate(*m_8514, FUNC(mach8_device::ibm8514_status_r)), write8sm_delegate(*m_8514, FUNC(mach8_device::ibm8514_htotal_w))); @@ -224,7 +224,7 @@ void isa16_vga_gfxultrapro_device::device_start() { set_isa_device(); - m_isa->install_rom(this, 0xc0000, 0xc7fff, "vga", "gfxultrapro"); + m_isa->install_rom(this, 0xc0000, 0xc7fff, "gfxultrapro"); m_isa->install_device(0x1ce, 0x1cf, read8sm_delegate(*m_vga, FUNC(mach32_device::ati_port_ext_r)), write8sm_delegate(*m_vga, FUNC(mach32_device::ati_port_ext_w))); m_isa->install_device(0x2e8, 0x2ef, read8sm_delegate(*m_vga, FUNC(mach32_device::mach32_status_r)), write8sm_delegate(*m_vga, FUNC(mach32_device::ibm8514_htotal_w))); @@ -293,7 +293,7 @@ void isa16_vga_mach64_device::device_start() { set_isa_device(); - m_isa->install_rom(this, 0xc0000, 0xc7fff, "vga", "mach64"); + m_isa->install_rom(this, 0xc0000, 0xc7fff, "mach64"); m_isa->install_device(0x1ce, 0x1cf, read8sm_delegate(*m_vga, FUNC(mach64_device::ati_port_ext_r)), write8sm_delegate(*m_vga, FUNC(mach64_device::ati_port_ext_w))); m_isa->install_device(0x2e8, 0x2ef, read8sm_delegate(*m_vga, FUNC(mach64_device::mach32_status_r)), write8sm_delegate(*m_vga, FUNC(mach64_device::ibm8514_htotal_w))); diff --git a/src/devices/bus/isa/wdxt_gen.cpp b/src/devices/bus/isa/wdxt_gen.cpp index b86188d3249..fb2a8fd1965 100644 --- a/src/devices/bus/isa/wdxt_gen.cpp +++ b/src/devices/bus/isa/wdxt_gen.cpp @@ -199,7 +199,7 @@ wdxt_gen_device::wdxt_gen_device(const machine_config &mconfig, const char *tag, void wdxt_gen_device::device_start() { set_isa_device(); - m_isa->install_rom(this, 0xc8000, 0xc9fff, "hdc", "hdc"); + m_isa->install_rom(this, 0xc8000, 0xc9fff, "hdc"); m_isa->install_device(0x0320, 0x0323, read8sm_delegate(*m_host, FUNC(wd11c00_17_device::io_r)), write8sm_delegate(*m_host, FUNC(wd11c00_17_device::io_w))); m_isa->set_dma_channel(3, this, false); } diff --git a/src/devices/bus/lpci/northbridge.cpp b/src/devices/bus/lpci/northbridge.cpp index 57c802a9e20..0384a9637e4 100644 --- a/src/devices/bus/lpci/northbridge.cpp +++ b/src/devices/bus/lpci/northbridge.cpp @@ -33,9 +33,7 @@ void northbridge_device::device_start() if (m_ram->size() > 0x100000) { offs_t ram_limit = 0x100000 + m_ram->size() - 0x100000; - space.install_read_bank (0x100000, ram_limit - 1, "bank1"); - space.install_write_bank(0x100000, ram_limit - 1, "bank1"); - machine().root_device().membank("bank1")->set_base(m_ram->pointer() + 0x100000); + space.install_ram(0x100000, ram_limit - 1, m_ram->pointer() + 0x100000); } } diff --git a/src/devices/bus/macpds/macpds.cpp b/src/devices/bus/macpds/macpds.cpp index 3a7a87f85d2..9f17df8cb6d 100644 --- a/src/devices/bus/macpds/macpds.cpp +++ b/src/devices/bus/macpds/macpds.cpp @@ -111,13 +111,12 @@ template void macpds_device::install_device<read16s_delegate, write16s_delegat template void macpds_device::install_device<read16sm_delegate, write16sm_delegate >(offs_t start, offs_t end, read16sm_delegate rhandler, write16sm_delegate whandler, uint32_t mask); template void macpds_device::install_device<read16smo_delegate, write16smo_delegate>(offs_t start, offs_t end, read16smo_delegate rhandler, write16smo_delegate whandler, uint32_t mask); -void macpds_device::install_bank(offs_t start, offs_t end, const char *tag, uint8_t *data) +void macpds_device::install_bank(offs_t start, offs_t end, uint8_t *data) { // printf("install_bank: %s @ %x->%x\n", tag, start, end); m_maincpu = machine().device<cpu_device>(m_cputag); address_space &space = m_maincpu->space(AS_PROGRAM); - space.install_readwrite_bank(start, end, 0, tag ); - machine().root_device().membank(siblingtag(tag).c_str())->set_base(data); + space.install_ram(start, end, data); } void macpds_device::set_irq_line(int line, int state) @@ -160,22 +159,15 @@ void device_macpds_card_interface::set_macpds_device() m_macpds->add_macpds_card(this); } -void device_macpds_card_interface::install_bank(offs_t start, offs_t end, const char *tag, uint8_t *data) +void device_macpds_card_interface::install_bank(offs_t start, offs_t end, uint8_t *data) { - char bank[256]; - - // append an underscore and the slot name to the bank so it's guaranteed unique - snprintf(bank, sizeof(bank), "%s_%s", tag, m_macpds_slottag); - - m_macpds->install_bank(start, end, bank, data); + m_macpds->install_bank(start, end, data); } void device_macpds_card_interface::install_rom(device_t *dev, const char *romregion, uint32_t addr) { uint8_t *rom = device().machine().root_device().memregion(dev->subtag(romregion).c_str())->base(); uint32_t romlen = device().machine().root_device().memregion(dev->subtag(romregion).c_str())->bytes(); - char bankname[128]; - sprintf(bankname, "rom_%x", addr); - m_macpds->install_bank(addr, addr+romlen-1, bankname, rom); + m_macpds->install_bank(addr, addr+romlen-1, rom); } diff --git a/src/devices/bus/macpds/macpds.h b/src/devices/bus/macpds/macpds.h index 1977447a87b..cd3f84659d0 100644 --- a/src/devices/bus/macpds/macpds.h +++ b/src/devices/bus/macpds/macpds.h @@ -74,7 +74,7 @@ public: void add_macpds_card(device_macpds_card_interface *card); template<typename R, typename W> void install_device(offs_t start, offs_t end, R rhandler, W whandler, uint32_t mask=0xffffffff); - void install_bank(offs_t start, offs_t end, const char *tag, uint8_t *data); + void install_bank(offs_t start, offs_t end, uint8_t *data); void set_irq_line(int line, int state); protected: @@ -111,7 +111,7 @@ public: void set_macpds_device(); // helper functions for card devices - void install_bank(offs_t start, offs_t end, const char *tag, uint8_t *data); + void install_bank(offs_t start, offs_t end, uint8_t *data); void install_rom(device_t *dev, const char *romregion, uint32_t addr); // inline configuration diff --git a/src/devices/bus/macpds/pds_tpdfpd.cpp b/src/devices/bus/macpds/pds_tpdfpd.cpp index 6d9dd93b4ed..2b0ca60c281 100644 --- a/src/devices/bus/macpds/pds_tpdfpd.cpp +++ b/src/devices/bus/macpds/pds_tpdfpd.cpp @@ -109,8 +109,7 @@ void macpds_sedisplay_device::device_start() m_vram = std::make_unique<uint8_t[]>(VRAM_SIZE); - static const char bankname[] = { "radpds_ram" }; - m_macpds->install_bank(0xc40000, 0xc40000+VRAM_SIZE-1, bankname, m_vram.get()); + m_macpds->install_bank(0xc40000, 0xc40000+VRAM_SIZE-1, m_vram.get()); m_macpds->install_device(0x770000, 0x77000f, read16s_delegate(*this, FUNC(macpds_sedisplay_device::ramdac_r)), write16s_delegate(*this, FUNC(macpds_sedisplay_device::ramdac_w))); m_macpds->install_device(0xc10000, 0xc2ffff, read16sm_delegate(*this, FUNC(macpds_sedisplay_device::sedisplay_r)), write16sm_delegate(*this, FUNC(macpds_sedisplay_device::sedisplay_w))); diff --git a/src/devices/bus/msx_slot/bunsetsu.cpp b/src/devices/bus/msx_slot/bunsetsu.cpp index 79a07b2e53a..9c73a37dbd8 100644 --- a/src/devices/bus/msx_slot/bunsetsu.cpp +++ b/src/devices/bus/msx_slot/bunsetsu.cpp @@ -13,7 +13,7 @@ DEFINE_DEVICE_TYPE(MSX_SLOT_BUNSETSU, msx_slot_bunsetsu_device, "msx_slot_bunset msx_slot_bunsetsu_device::msx_slot_bunsetsu_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : msx_slot_rom_device(mconfig, MSX_SLOT_BUNSETSU, tag, owner, clock) - , m_bunsetsu_region(*this, finder_base::DUMMY_TAG, 0x20000) + , m_bunsetsu_region(*this, finder_base::DUMMY_TAG) , m_bunsetsu_address(0) { } diff --git a/src/devices/bus/nubus/laserview.cpp b/src/devices/bus/nubus/laserview.cpp index 7e802b58988..bd9647c9e72 100644 --- a/src/devices/bus/nubus/laserview.cpp +++ b/src/devices/bus/nubus/laserview.cpp @@ -88,8 +88,8 @@ void nubus_laserview_device::device_start() // printf("[laserview %p] slotspace = %x\n", this, slotspace); m_vram.resize(VRAM_SIZE); - install_bank(slotspace, slotspace+VRAM_SIZE-1, "bank_laserview", &m_vram[0]); - install_bank(slotspace+0x900000, slotspace+0x900000+VRAM_SIZE-1, "bank_laserview2", &m_vram[0]); + install_bank(slotspace, slotspace+VRAM_SIZE-1, &m_vram[0]); + install_bank(slotspace+0x900000, slotspace+0x900000+VRAM_SIZE-1, &m_vram[0]); nubus().install_device(slotspace+0xB0000, slotspace+0xBFFFF, read32s_delegate(*this, FUNC(nubus_laserview_device::regs_r)), write32s_delegate(*this, FUNC(nubus_laserview_device::regs_w))); } diff --git a/src/devices/bus/nubus/nubus.cpp b/src/devices/bus/nubus/nubus.cpp index 64c48a9bb1d..bbc63a23ada 100644 --- a/src/devices/bus/nubus/nubus.cpp +++ b/src/devices/bus/nubus/nubus.cpp @@ -185,11 +185,10 @@ 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, const char *tag, uint8_t *data) +void nubus_device::install_bank(offs_t start, offs_t end, uint8_t *data) { // printf("install_bank: %s @ %x->%x\n", tag, start, end); - m_space->install_readwrite_bank(start, end, 0, tag); - machine().root_device().membank(siblingtag(tag).c_str())->set_base(data); + m_space->install_rom(start, end, data); } void nubus_device::set_irq_line(int slot, int state) @@ -278,14 +277,9 @@ void device_nubus_card_interface::interface_pre_start() } } -void device_nubus_card_interface::install_bank(offs_t start, offs_t end, const char *tag, uint8_t *data) +void device_nubus_card_interface::install_bank(offs_t start, offs_t end, uint8_t *data) { - char bank[256]; - - // append an underscore and the slot name to the bank so it's guaranteed unique - snprintf(bank, sizeof(bank), "%s_%s", tag, m_nubus_slottag); - - nubus().install_bank(start, end, bank, data); + nubus().install_bank(start, end, data); } void device_nubus_card_interface::install_declaration_rom(device_t *dev, const char *romregion, bool mirror_all_mb, bool reverse_rom) @@ -424,20 +418,18 @@ void device_nubus_card_interface::install_declaration_rom(device_t *dev, const c // now install the ROM uint32_t addr = get_slotspace() + 0x01000000; - char bankname[128]; - snprintf(bankname, sizeof(bankname), "rom_%s", 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 { uint32_t off = 0; while(off < 0x1000000) { - nubus().install_bank(addr + off, addr+off+romlen-1, bankname, &m_declaration_rom[0]); + nubus().install_bank(addr + off, addr+off+romlen-1, &m_declaration_rom[0]); off += romlen; } } else { - nubus().install_bank(addr, addr+romlen-1, bankname, &m_declaration_rom[0]); + nubus().install_bank(addr, addr+romlen-1, &m_declaration_rom[0]); } } diff --git a/src/devices/bus/nubus/nubus.h b/src/devices/bus/nubus/nubus.h index 2fc5f048e67..0b07b04b381 100644 --- a/src/devices/bus/nubus/nubus.h +++ b/src/devices/bus/nubus/nubus.h @@ -37,7 +37,7 @@ public: // helper functions for card devices void install_declaration_rom(device_t *dev, const char *romregion, bool mirror_all_mb = false, bool reverse_rom = false); - void install_bank(offs_t start, offs_t end, const char *tag, uint8_t *data); + void install_bank(offs_t start, offs_t end, uint8_t *data); uint32_t get_slotspace() { return 0xf0000000 | (m_slot<<24); } uint32_t get_super_slotspace() { return m_slot<<28; } @@ -125,7 +125,7 @@ public: template<typename R, typename W> void install_device(offs_t start, offs_t end, R rhandler, W whandler, uint32_t mask=0xffffffff); void install_readonly_device(offs_t start, offs_t end, read32_delegate rhandler, uint32_t mask=0xffffffff); void install_writeonly_device(offs_t start, offs_t end, write32_delegate whandler, uint32_t mask=0xffffffff); - void install_bank(offs_t start, offs_t end, const char *tag, uint8_t *data); + void install_bank(offs_t start, offs_t end, uint8_t *data); void set_irq_line(int slot, int state); DECLARE_WRITE_LINE_MEMBER( irq9_w ); diff --git a/src/devices/bus/nubus/nubus_48gc.cpp b/src/devices/bus/nubus/nubus_48gc.cpp index b9b831c6de2..58875e591b6 100644 --- a/src/devices/bus/nubus/nubus_48gc.cpp +++ b/src/devices/bus/nubus/nubus_48gc.cpp @@ -110,7 +110,7 @@ void jmfb_device::device_start() // printf("[JMFB %p] slotspace = %x\n", this, slotspace); m_vram.resize(VRAM_SIZE); - install_bank(slotspace, slotspace+VRAM_SIZE-1, "bank_48gc", &m_vram[0]); + install_bank(slotspace, slotspace+VRAM_SIZE-1, &m_vram[0]); nubus().install_device(slotspace+0x200000, slotspace+0x2003ff, read32s_delegate(*this, FUNC(jmfb_device::mac_48gc_r)), write32s_delegate(*this, FUNC(jmfb_device::mac_48gc_w))); diff --git a/src/devices/bus/nubus/nubus_cb264.cpp b/src/devices/bus/nubus/nubus_cb264.cpp index db1fd821a11..b3af9d82fba 100644 --- a/src/devices/bus/nubus/nubus_cb264.cpp +++ b/src/devices/bus/nubus/nubus_cb264.cpp @@ -96,7 +96,7 @@ void nubus_cb264_device::device_start() // printf("[cb264 %p] slotspace = %x\n", this, slotspace); m_vram.resize(VRAM_SIZE); - install_bank(slotspace, slotspace+VRAM_SIZE-1, "bank_cb264", &m_vram[0]); + install_bank(slotspace, slotspace+VRAM_SIZE-1, &m_vram[0]); nubus().install_device(slotspace+0xff6000, slotspace+0xff60ff, read32s_delegate(*this, FUNC(nubus_cb264_device::cb264_r)), write32s_delegate(*this, FUNC(nubus_cb264_device::cb264_w))); nubus().install_device(slotspace+0xff7000, slotspace+0xff70ff, read32sm_delegate(*this, FUNC(nubus_cb264_device::cb264_ramdac_r)), write32sm_delegate(*this, FUNC(nubus_cb264_device::cb264_ramdac_w))); diff --git a/src/devices/bus/nubus/nubus_image.cpp b/src/devices/bus/nubus/nubus_image.cpp index 32b1d33100a..aa54fe51c7a 100644 --- a/src/devices/bus/nubus/nubus_image.cpp +++ b/src/devices/bus/nubus/nubus_image.cpp @@ -89,9 +89,8 @@ image_init_result nubus_image_device::messimg_disk_image_device::call_load() return image_init_result::FAIL; } - m_data = make_unique_clear<uint8_t[]>(m_size); fseek(0, SEEK_SET); - fread(m_data.get(), m_size); + fread(m_data, m_size); m_ejected = false; return image_init_result::PASS; diff --git a/src/devices/bus/nubus/nubus_vikbw.cpp b/src/devices/bus/nubus/nubus_vikbw.cpp index 18c94f9ba5b..d05495afe54 100644 --- a/src/devices/bus/nubus/nubus_vikbw.cpp +++ b/src/devices/bus/nubus/nubus_vikbw.cpp @@ -89,8 +89,8 @@ void nubus_vikbw_device::device_start() // printf("[vikbw %p] slotspace = %x\n", this, slotspace); m_vram.resize(VRAM_SIZE); - install_bank(slotspace+0x40000, slotspace+0x40000+VRAM_SIZE-1, "bank_vikbw", &m_vram[0]); - install_bank(slotspace+0x940000, slotspace+0x940000+VRAM_SIZE-1, "bank_vikbw2", &m_vram[0]); + install_bank(slotspace+0x40000, slotspace+0x40000+VRAM_SIZE-1, &m_vram[0]); + install_bank(slotspace+0x940000, slotspace+0x940000+VRAM_SIZE-1, &m_vram[0]); nubus().install_device(slotspace, slotspace+3, read32smo_delegate(*this, FUNC(nubus_vikbw_device::viking_enable_r)), write32smo_delegate(*this, FUNC(nubus_vikbw_device::viking_disable_w))); nubus().install_device(slotspace+0x80000, slotspace+0x80000+3, read32smo_delegate(*this, FUNC(nubus_vikbw_device::viking_ack_r)), write32smo_delegate(*this, FUNC(nubus_vikbw_device::viking_ack_w))); diff --git a/src/devices/bus/odyssey2/4in1.cpp b/src/devices/bus/odyssey2/4in1.cpp index dfadbf2c1ab..ad9b685b54e 100644 --- a/src/devices/bus/odyssey2/4in1.cpp +++ b/src/devices/bus/odyssey2/4in1.cpp @@ -35,7 +35,7 @@ void o2_4in1_device::device_start() void o2_4in1_device::cart_init() { - if (m_rom.bytes() != 0x1000) + if (m_rom_size != 0x1000) fatalerror("o2_4in1_device: ROM size must be 4KB\n"); } diff --git a/src/devices/bus/odyssey2/chess.cpp b/src/devices/bus/odyssey2/chess.cpp index 6ff1ff76dd2..9f687c72cd6 100644 --- a/src/devices/bus/odyssey2/chess.cpp +++ b/src/devices/bus/odyssey2/chess.cpp @@ -35,7 +35,7 @@ void o2_chess_device::device_start() void o2_chess_device::cart_init() { - if (m_rom.bytes() != 0x800 || !m_exrom || m_exrom.bytes() != 0x2000) + if (m_rom_size != 0x800 || m_exrom_size != 0x2000) fatalerror("o2_chess_device: Wrong ROM region size\n"); } diff --git a/src/devices/bus/odyssey2/homecomp.cpp b/src/devices/bus/odyssey2/homecomp.cpp index 23c6f6c31f7..363a1ab024f 100644 --- a/src/devices/bus/odyssey2/homecomp.cpp +++ b/src/devices/bus/odyssey2/homecomp.cpp @@ -45,7 +45,7 @@ void o2_homecomp_device::device_start() void o2_homecomp_device::cart_init() { - if (m_rom.bytes() != 0x800 || !m_exrom || m_exrom.bytes() != 0x4000) + if (m_rom_size != 0x800 || m_exrom_size != 0x4000) fatalerror("o2_homecomp_device: Wrong ROM region size\n"); } diff --git a/src/devices/bus/odyssey2/ktaa.cpp b/src/devices/bus/odyssey2/ktaa.cpp index 4f1fba25153..1bb550685c4 100644 --- a/src/devices/bus/odyssey2/ktaa.cpp +++ b/src/devices/bus/odyssey2/ktaa.cpp @@ -30,7 +30,7 @@ void o2_ktaa_device::device_start() void o2_ktaa_device::cart_init() { - u32 size = m_rom.bytes(); + u32 size = m_rom_size; if (size != 0xc00 && size != 0xc00*2 && size != 0xc00*4) fatalerror("o2_ktaa_device: ROM size must be multiple of 3KB\n"); diff --git a/src/devices/bus/odyssey2/rally.cpp b/src/devices/bus/odyssey2/rally.cpp index 42dcdc0b26f..00205028fa6 100644 --- a/src/devices/bus/odyssey2/rally.cpp +++ b/src/devices/bus/odyssey2/rally.cpp @@ -39,7 +39,7 @@ void o2_rally_device::device_start() void o2_rally_device::cart_init() { - u32 size = m_rom.bytes(); + u32 size = m_rom_size; if (size & (size - 1) || size < 0x800) fatalerror("o2_rally_device: ROM size must be 2^x\n"); } @@ -53,7 +53,7 @@ u8 o2_rally_device::read_rom04(offs_t offset) { // P10 enables latch output u8 bank = (m_control & 1) ? ~0 : m_bank; - return m_rom[(offset + bank * 0x800) & (m_rom.bytes() - 1)]; + return m_rom[(offset + bank * 0x800) & (m_rom_size - 1)]; } void o2_rally_device::io_write(offs_t offset, u8 data) diff --git a/src/devices/bus/odyssey2/rom.cpp b/src/devices/bus/odyssey2/rom.cpp index 12f8fa9b128..cd8d15b15bc 100644 --- a/src/devices/bus/odyssey2/rom.cpp +++ b/src/devices/bus/odyssey2/rom.cpp @@ -28,7 +28,7 @@ void o2_rom_device::device_start() void o2_rom_device::cart_init() { - m_cart_mask = (1 << (31 - count_leading_zeros(m_rom.bytes()))) - 1; + m_cart_mask = (1 << (31 - count_leading_zeros(m_rom_size))) - 1; } @@ -39,5 +39,5 @@ void o2_rom_device::cart_init() u8 o2_rom_device::read_rom04(offs_t offset) { offset = (offset + m_bank * 0x800) & m_cart_mask; - return (offset < m_rom.bytes()) ? m_rom[offset] : 0xff; + return (offset < m_rom_size) ? m_rom[offset] : 0xff; } diff --git a/src/devices/bus/odyssey2/slot.cpp b/src/devices/bus/odyssey2/slot.cpp index 5f0f30e2f35..50bc7ce20c3 100644 --- a/src/devices/bus/odyssey2/slot.cpp +++ b/src/devices/bus/odyssey2/slot.cpp @@ -27,9 +27,9 @@ DEFINE_DEVICE_TYPE(O2_CART_SLOT, o2_cart_slot_device, "o2_cart_slot", "Odyssey 2 device_o2_cart_interface::device_o2_cart_interface(const machine_config &mconfig, device_t &device) : device_interface(device, "odyssey2cart") - , m_rom(*this, "rom") - , m_exrom(*this, "exrom") - , m_voice(*this, "voice") + , m_rom_size(0) + , m_exrom_size(0) + , m_voice_size(0) { } @@ -138,6 +138,9 @@ image_init_result o2_cart_slot_device::call_load() load_software_region("rom", m_cart->m_rom); load_software_region("exrom", m_cart->m_exrom); load_software_region("voice", m_cart->m_voice); + m_cart->m_rom_size = get_software_region_length("rom"); + m_cart->m_exrom_size = get_software_region_length("exrom"); + m_cart->m_voice_size = get_software_region_length("voice"); m_type = o2_get_pcb_id(get_feature("slot")); diff --git a/src/devices/bus/odyssey2/slot.h b/src/devices/bus/odyssey2/slot.h index 4c65fafe01e..d998d5f1999 100644 --- a/src/devices/bus/odyssey2/slot.h +++ b/src/devices/bus/odyssey2/slot.h @@ -49,18 +49,21 @@ public: virtual void cart_init() { } // called after loading ROM - u8* get_rom_base() { return m_rom ? &m_rom[0] : nullptr; } - u32 get_rom_size() { return m_rom ? m_rom.bytes() : 0; } + u8* get_rom_base() { return m_rom ? m_rom.get() : nullptr; } + u32 get_rom_size() { return m_rom_size; } - u8* get_voice_base() { return m_voice ? &m_voice[0] : nullptr; } - u32 get_voice_size() { return m_voice ? m_voice.bytes() : 0; } + u8* get_voice_base() { return m_voice ? m_voice.get() : nullptr; } + u32 get_voice_size() { return m_voice_size; } protected: device_o2_cart_interface(const machine_config &mconfig, device_t &device); - optional_shared_ptr<u8> m_rom; - optional_shared_ptr<u8> m_exrom; - optional_shared_ptr<u8> m_voice; + std::unique_ptr<uint8_t[]> m_rom; + std::unique_ptr<uint8_t[]> m_exrom; + std::unique_ptr<uint8_t[]> m_voice; + u32 m_rom_size; + u32 m_exrom_size; + u32 m_voice_size; }; diff --git a/src/devices/bus/pet/64k.cpp b/src/devices/bus/pet/64k.cpp index 85f91114386..7e335ba97ff 100644 --- a/src/devices/bus/pet/64k.cpp +++ b/src/devices/bus/pet/64k.cpp @@ -79,7 +79,7 @@ inline void pet_64k_expansion_device::write_ram(offs_t offset, uint8_t data) pet_64k_expansion_device::pet_64k_expansion_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : device_t(mconfig, PET_64K, tag, owner, clock), device_pet_expansion_card_interface(mconfig, *this), - m_ram(*this, "ram"), + m_ram(*this, "ram", 0x10000, ENDIANNESS_LITTLE), m_ctrl(0) { } @@ -91,9 +91,6 @@ pet_64k_expansion_device::pet_64k_expansion_device(const machine_config &mconfig void pet_64k_expansion_device::device_start() { - // allocate memory - m_ram.allocate(0x10000); - // state saving save_item(NAME(m_ctrl)); } diff --git a/src/devices/bus/pet/64k.h b/src/devices/bus/pet/64k.h index 7cf03cd621b..6b55cc3098e 100644 --- a/src/devices/bus/pet/64k.h +++ b/src/devices/bus/pet/64k.h @@ -41,7 +41,7 @@ private: inline uint8_t read_ram(offs_t offset); inline void write_ram(offs_t offset, uint8_t data); - optional_shared_ptr<uint8_t> m_ram; + memory_share_creator<uint8_t> m_ram; uint8_t m_ctrl; }; diff --git a/src/devices/bus/pet/superpet.cpp b/src/devices/bus/pet/superpet.cpp index 77ec57b5c46..df5c0071600 100644 --- a/src/devices/bus/pet/superpet.cpp +++ b/src/devices/bus/pet/superpet.cpp @@ -173,7 +173,7 @@ superpet_device::superpet_device(const machine_config &mconfig, const char *tag, m_acia(*this, MOS6551_TAG), m_dongle(*this, MOS6702_TAG), m_rom(*this, M6809_TAG), - m_ram(*this, "ram"), + m_ram(*this, "ram", 0x10000, ENDIANNESS_LITTLE), m_io_sw1(*this, "SW1"), m_io_sw2(*this, "SW2"), m_system(0), @@ -191,9 +191,6 @@ superpet_device::superpet_device(const machine_config &mconfig, const char *tag, void superpet_device::device_start() { - // allocate memory - m_ram.allocate(0x10000); - // state saving save_item(NAME(m_system)); save_item(NAME(m_bank)); diff --git a/src/devices/bus/pet/superpet.h b/src/devices/bus/pet/superpet.h index 097a4b45cd4..56c07df525f 100644 --- a/src/devices/bus/pet/superpet.h +++ b/src/devices/bus/pet/superpet.h @@ -59,7 +59,7 @@ private: required_device<mos6551_device> m_acia; required_device<mos6702_device> m_dongle; required_memory_region m_rom; - optional_shared_ptr<uint8_t> m_ram; + memory_share_creator<uint8_t> m_ram; required_ioport m_io_sw1; required_ioport m_io_sw2; diff --git a/src/devices/bus/plus4/exp.cpp b/src/devices/bus/plus4/exp.cpp index 5ca28efd81d..c1184f16922 100644 --- a/src/devices/bus/plus4/exp.cpp +++ b/src/devices/bus/plus4/exp.cpp @@ -37,10 +37,6 @@ DEFINE_DEVICE_TYPE(PLUS4_EXPANSION_SLOT, plus4_expansion_slot_device, "plus4_exp device_plus4_expansion_card_interface::device_plus4_expansion_card_interface(const machine_config &mconfig, device_t &device) : device_interface(device, "plus4exp"), - m_c1l(*this, "c1l"), - m_c1h(*this, "c1h"), - m_c2l(*this, "c2l"), - m_c2h(*this, "c2h"), m_c1l_mask(0), m_c1h_mask(0), m_c2l_mask(0), diff --git a/src/devices/bus/plus4/exp.h b/src/devices/bus/plus4/exp.h index 369480281b3..37691a319d5 100644 --- a/src/devices/bus/plus4/exp.h +++ b/src/devices/bus/plus4/exp.h @@ -137,10 +137,10 @@ public: protected: device_plus4_expansion_card_interface(const machine_config &mconfig, device_t &device); - optional_shared_ptr<uint8_t> m_c1l; - optional_shared_ptr<uint8_t> m_c1h; - optional_shared_ptr<uint8_t> m_c2l; - optional_shared_ptr<uint8_t> m_c2h; + std::unique_ptr<uint8_t[]> m_c1l; + std::unique_ptr<uint8_t[]> m_c1h; + std::unique_ptr<uint8_t[]> m_c2l; + std::unique_ptr<uint8_t[]> m_c2h; size_t m_c1l_mask; size_t m_c1h_mask; diff --git a/src/devices/bus/plus4/std.cpp b/src/devices/bus/plus4/std.cpp index c8efe4b679f..2a050999680 100644 --- a/src/devices/bus/plus4/std.cpp +++ b/src/devices/bus/plus4/std.cpp @@ -49,21 +49,21 @@ void plus4_standard_cartridge_device::device_start() uint8_t plus4_standard_cartridge_device::plus4_cd_r(offs_t offset, uint8_t data, int ba, int cs0, int c1l, int c2l, int cs1, int c1h, int c2h) { - if (!c1l && m_c1l.bytes()) + if (!c1l && m_c1l) { - data = m_c1l[offset & m_c1l.mask()]; + data = m_c1l[offset]; } - else if (!c1h && m_c1h.bytes()) + else if (!c1h && m_c1h) { - data = m_c1h[offset & m_c1h.mask()]; + data = m_c1h[offset]; } - else if (!c2l && m_c2l.bytes()) + else if (!c2l && m_c2l) { - data = m_c2l[offset & m_c2l.mask()]; + data = m_c2l[offset]; } - else if (!c2h && m_c2h.bytes()) + else if (!c2h && m_c2h) { - data = m_c2h[offset & m_c2h.mask()]; + data = m_c2h[offset]; } return data; diff --git a/src/devices/bus/pofo/ccm.cpp b/src/devices/bus/pofo/ccm.cpp index 11e90cc852c..b5790a14a3b 100644 --- a/src/devices/bus/pofo/ccm.cpp +++ b/src/devices/bus/pofo/ccm.cpp @@ -28,9 +28,7 @@ DEFINE_DEVICE_TYPE(PORTFOLIO_MEMORY_CARD_SLOT, portfolio_memory_card_slot_device //------------------------------------------------- device_portfolio_memory_card_slot_interface::device_portfolio_memory_card_slot_interface(const machine_config &mconfig, device_t &device) : - device_interface(device, "pofoccm"), - m_rom(*this, "rom"), - m_nvram(*this, "nvram") + device_interface(device, "pofoccm") { m_slot = dynamic_cast<portfolio_memory_card_slot_device *>(device.owner()); } @@ -73,7 +71,9 @@ image_init_result portfolio_memory_card_slot_device::call_load() if (m_card) { if (!loaded_through_softlist()) + { fread(m_card->m_rom, length()); + } else load_software_region("rom", m_card->m_rom); } diff --git a/src/devices/bus/pofo/ccm.h b/src/devices/bus/pofo/ccm.h index 74175a7dc56..7dc0698453f 100644 --- a/src/devices/bus/pofo/ccm.h +++ b/src/devices/bus/pofo/ccm.h @@ -82,8 +82,7 @@ protected: // construction/destruction device_portfolio_memory_card_slot_interface(const machine_config &mconfig, device_t &device); - optional_shared_ptr<uint8_t> m_rom; - optional_shared_ptr<uint8_t> m_nvram; + std::unique_ptr<uint8_t[]> m_rom; portfolio_memory_card_slot_device *m_slot; }; diff --git a/src/devices/bus/pofo/hpc104.cpp b/src/devices/bus/pofo/hpc104.cpp index a6e66f13da8..11744206c7e 100644 --- a/src/devices/bus/pofo/hpc104.cpp +++ b/src/devices/bus/pofo/hpc104.cpp @@ -101,7 +101,7 @@ pofo_hpc104_device::pofo_hpc104_device(const machine_config &mconfig, device_typ device_nvram_interface(mconfig, *this), m_ccm(*this, PORTFOLIO_MEMORY_CARD_SLOT_B_TAG), m_exp(*this, PORTFOLIO_EXPANSION_SLOT_TAG), - m_nvram(*this, "nvram"), + m_nvram(*this, "nvram", 0x40000, ENDIANNESS_LITTLE), m_io_sw1(*this, "SW1") { } @@ -128,8 +128,6 @@ pofo_hpc104_2_device::pofo_hpc104_2_device(const machine_config &mconfig, const void pofo_hpc104_device::device_start() { - // allocate memory - m_nvram.allocate(0x40000); } diff --git a/src/devices/bus/pofo/hpc104.h b/src/devices/bus/pofo/hpc104.h index 042bece210e..6afae6dd5ec 100644 --- a/src/devices/bus/pofo/hpc104.h +++ b/src/devices/bus/pofo/hpc104.h @@ -44,8 +44,8 @@ protected: // device_nvram_interface overrides virtual void nvram_default() override { } - virtual void nvram_read(emu_file &file) override { if (m_nvram != nullptr) { file.read(m_nvram, m_nvram.bytes()); } } - virtual void nvram_write(emu_file &file) override { if (m_nvram != nullptr) { file.write(m_nvram, m_nvram.bytes()); } } + virtual void nvram_read(emu_file &file) override { if (m_nvram != nullptr) { file.read(m_nvram, 0x40000); } } + virtual void nvram_write(emu_file &file) override { if (m_nvram != nullptr) { file.write(m_nvram, 0x40000); } } // device_portfolio_expansion_slot_interface overrides virtual bool nmd1() override { return m_ccm->cdet_r(); } @@ -58,7 +58,7 @@ protected: private: required_device<portfolio_memory_card_slot_device> m_ccm; required_device<portfolio_expansion_slot_device> m_exp; - optional_shared_ptr<uint8_t> m_nvram; + memory_share_creator<uint8_t> m_nvram; required_ioport m_io_sw1; bool m_sw1; diff --git a/src/devices/bus/pofo/ram.cpp b/src/devices/bus/pofo/ram.cpp index 5498a9b8c32..7f1298b8b95 100644 --- a/src/devices/bus/pofo/ram.cpp +++ b/src/devices/bus/pofo/ram.cpp @@ -29,7 +29,8 @@ DEFINE_DEVICE_TYPE(PORTFOLIO_RAM_CARD, portfolio_ram_card_device, "portfolio_ram portfolio_ram_card_device::portfolio_ram_card_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : device_t(mconfig, PORTFOLIO_RAM_CARD, tag, owner, clock), device_portfolio_memory_card_slot_interface(mconfig, *this), - device_nvram_interface(mconfig, *this) + device_nvram_interface(mconfig, *this), + m_nvram(*this, "nvram", 0x20000, ENDIANNESS_LITTLE) { } @@ -40,7 +41,6 @@ portfolio_ram_card_device::portfolio_ram_card_device(const machine_config &mconf void portfolio_ram_card_device::device_start() { - m_nvram.allocate(0x20000); } diff --git a/src/devices/bus/pofo/ram.h b/src/devices/bus/pofo/ram.h index 2c19f807816..c3eee30910d 100644 --- a/src/devices/bus/pofo/ram.h +++ b/src/devices/bus/pofo/ram.h @@ -36,14 +36,16 @@ protected: // device_nvram_interface overrides virtual void nvram_default() override { } - virtual void nvram_read(emu_file &file) override { if (m_nvram != nullptr) { file.read(m_nvram, m_nvram.bytes()); } } - virtual void nvram_write(emu_file &file) override { if (m_nvram != nullptr) { file.write(m_nvram, m_nvram.bytes()); } } + virtual void nvram_read(emu_file &file) override { if (m_nvram != nullptr) { file.read(m_nvram, m_nvram.share()->bytes()); } } + virtual void nvram_write(emu_file &file) override { if (m_nvram != nullptr) { file.write(m_nvram, m_nvram.share()->bytes()); } } // device_portfolio_memory_card_slot_interface overrides virtual bool cdet() override { return 0; } virtual uint8_t nrdi_r(offs_t offset) override; virtual void nwri_w(offs_t offset, uint8_t data) override; + + memory_share_creator<uint8_t> m_nvram; }; diff --git a/src/devices/bus/ql/rom.cpp b/src/devices/bus/ql/rom.cpp index 0c84eadd6b6..f6b54fdc907 100644 --- a/src/devices/bus/ql/rom.cpp +++ b/src/devices/bus/ql/rom.cpp @@ -29,7 +29,6 @@ DEFINE_DEVICE_TYPE(QL_ROM_CARTRIDGE_SLOT, ql_rom_cartridge_slot_device, "ql_rom_ device_ql_rom_cartridge_card_interface::device_ql_rom_cartridge_card_interface(const machine_config &mconfig, device_t &device) : device_interface(device, "qlrom"), - m_rom(*this, "rom"), m_slot(dynamic_cast<ql_rom_cartridge_slot_device *>(device.owner())), m_romoeh(0) { @@ -89,14 +88,9 @@ image_init_result ql_rom_cartridge_slot_device::call_load() { if (m_card) { - size_t size; - if (!loaded_through_softlist()) { - size = length(); - - m_card->m_rom.allocate(size); - fread(m_card->m_rom, size); + fread(m_card->m_rom, length()); } else { diff --git a/src/devices/bus/ql/rom.h b/src/devices/bus/ql/rom.h index 4b79406aca9..bfd06793d8c 100644 --- a/src/devices/bus/ql/rom.h +++ b/src/devices/bus/ql/rom.h @@ -58,7 +58,7 @@ protected: virtual void interface_post_start() override; - optional_shared_ptr<uint8_t> m_rom; + std::unique_ptr<uint8_t[]> m_rom; ql_rom_cartridge_slot_device *const m_slot; diff --git a/src/devices/bus/ql/sandy_superqboard.cpp b/src/devices/bus/ql/sandy_superqboard.cpp index 9fbd2f49c77..4d4a712b010 100644 --- a/src/devices/bus/ql/sandy_superqboard.cpp +++ b/src/devices/bus/ql/sandy_superqboard.cpp @@ -219,7 +219,7 @@ sandy_superqboard_device::sandy_superqboard_device(const machine_config &mconfig m_centronics(*this, CENTRONICS_TAG), m_latch(*this, TTL74273_TAG), m_rom(*this, "rom"), - m_ram(*this, "ram"), + m_ram(*this, "ram", ram_size, ENDIANNESS_BIG), m_buttons(*this, "mouse_buttons"), m_ram_size(ram_size), m_fd6(0), @@ -250,9 +250,6 @@ sandy_superqmouse_512k_device::sandy_superqmouse_512k_device(const machine_confi void sandy_superqboard_device::device_start() { - // allocate memory - m_ram.allocate(m_ram_size); - // state saving save_item(NAME(m_fd6)); save_item(NAME(m_fd7)); diff --git a/src/devices/bus/ql/sandy_superqboard.h b/src/devices/bus/ql/sandy_superqboard.h index 94bfe0c7dad..347703673de 100644 --- a/src/devices/bus/ql/sandy_superqboard.h +++ b/src/devices/bus/ql/sandy_superqboard.h @@ -74,7 +74,7 @@ private: required_device<centronics_device> m_centronics; required_device<output_latch_device> m_latch; required_memory_region m_rom; - optional_shared_ptr<uint8_t> m_ram; + memory_share_creator<uint8_t> m_ram; optional_ioport m_buttons; int m_ram_size; diff --git a/src/devices/bus/ql/std.cpp b/src/devices/bus/ql/std.cpp index b1171c46336..7524cc1693d 100644 --- a/src/devices/bus/ql/std.cpp +++ b/src/devices/bus/ql/std.cpp @@ -49,9 +49,9 @@ void ql_standard_rom_cartridge_device::device_start() uint8_t ql_standard_rom_cartridge_device::read(offs_t offset, uint8_t data) { - if (m_romoeh && m_rom.bytes()) + if (m_romoeh && m_rom) { - data = m_rom[offset & m_rom.mask()]; + data = m_rom[offset]; } return data; diff --git a/src/devices/bus/ql/trumpcard.cpp b/src/devices/bus/ql/trumpcard.cpp index 473fc9bb78e..da5fece8726 100644 --- a/src/devices/bus/ql/trumpcard.cpp +++ b/src/devices/bus/ql/trumpcard.cpp @@ -114,7 +114,7 @@ ql_trump_card_device::ql_trump_card_device(const machine_config &mconfig, device m_floppy0(*this, WD1772_TAG":0"), m_floppy1(*this, WD1772_TAG":1"), m_rom(*this, "rom"), - m_ram(*this, "ram"), + m_ram(*this, "ram", ram_size, ENDIANNESS_BIG), m_ram_size(ram_size), m_rom_en(false) { @@ -142,9 +142,6 @@ ql_trump_card_768k_device::ql_trump_card_768k_device(const machine_config &mconf void ql_trump_card_device::device_start() { - // allocate memory - m_ram.allocate(m_ram_size); - // state saving save_item(NAME(m_rom_en)); } diff --git a/src/devices/bus/ql/trumpcard.h b/src/devices/bus/ql/trumpcard.h index d9926160928..ee27efc4792 100644 --- a/src/devices/bus/ql/trumpcard.h +++ b/src/devices/bus/ql/trumpcard.h @@ -53,7 +53,7 @@ private: required_device<floppy_connector> m_floppy0; required_device<floppy_connector> m_floppy1; required_memory_region m_rom; - optional_shared_ptr<uint8_t> m_ram; + memory_share_creator<uint8_t> m_ram; int m_ram_size; bool m_rom_en; diff --git a/src/devices/bus/s100/dj2db.cpp b/src/devices/bus/s100/dj2db.cpp index 3bc8607077d..03acd63437c 100644 --- a/src/devices/bus/s100/dj2db.cpp +++ b/src/devices/bus/s100/dj2db.cpp @@ -254,7 +254,7 @@ s100_dj2db_device::s100_dj2db_device(const machine_config &mconfig, const char * m_floppy3(*this, MB8866_TAG":3"), m_floppy(nullptr), m_rom(*this, "dj2db"), - m_ram(*this, "ram"), + m_ram(*this, "ram", 0x400, ENDIANNESS_LITTLE), m_j1a(*this, "J1A"), m_j3a(*this, "J3A"), m_j4(*this, "J4"), @@ -275,9 +275,6 @@ s100_dj2db_device::s100_dj2db_device(const machine_config &mconfig, const char * void s100_dj2db_device::device_start() { - // allocate memory - m_ram.allocate(0x400); - // state saving save_item(NAME(m_drive)); save_item(NAME(m_head)); diff --git a/src/devices/bus/s100/dj2db.h b/src/devices/bus/s100/dj2db.h index dccb5bfbadb..e285ab43f42 100644 --- a/src/devices/bus/s100/dj2db.h +++ b/src/devices/bus/s100/dj2db.h @@ -63,7 +63,7 @@ private: required_device<floppy_connector> m_floppy3; floppy_image_device *m_floppy; required_memory_region m_rom; - optional_shared_ptr<uint8_t> m_ram; + memory_share_creator<uint8_t> m_ram; required_ioport m_j1a; required_ioport m_j3a; required_ioport m_j4; diff --git a/src/devices/bus/s100/mm65k16s.cpp b/src/devices/bus/s100/mm65k16s.cpp index ae098a2e29c..5f64ce67aa4 100644 --- a/src/devices/bus/s100/mm65k16s.cpp +++ b/src/devices/bus/s100/mm65k16s.cpp @@ -205,7 +205,7 @@ ioport_constructor s100_mm65k16s_device::device_input_ports() const s100_mm65k16s_device::s100_mm65k16s_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : device_t(mconfig, S100_MM65K16S, tag, owner, clock), device_s100_card_interface(mconfig, *this), - m_ram(*this, "ram") + m_ram(*this, "ram", 0x10000, ENDIANNESS_LITTLE) { } @@ -216,7 +216,6 @@ s100_mm65k16s_device::s100_mm65k16s_device(const machine_config &mconfig, const void s100_mm65k16s_device::device_start() { - m_ram.allocate(0x10000); } diff --git a/src/devices/bus/s100/mm65k16s.h b/src/devices/bus/s100/mm65k16s.h index 10fa1daff7a..706d7e697b6 100644 --- a/src/devices/bus/s100/mm65k16s.h +++ b/src/devices/bus/s100/mm65k16s.h @@ -43,7 +43,7 @@ protected: virtual void s100_phantom_w(int state) override; private: - optional_shared_ptr<uint8_t> m_ram; + memory_share_creator<uint8_t> m_ram; }; diff --git a/src/devices/bus/snes/event.cpp b/src/devices/bus/snes/event.cpp index 3591a2a679a..d6e8000eab3 100644 --- a/src/devices/bus/snes/event.cpp +++ b/src/devices/bus/snes/event.cpp @@ -173,10 +173,8 @@ inline uint16_t get_data(uint8_t *CPU, uint32_t addr) void sns_pfest94_device::speedup_addon_bios_access() { - m_upd7725->space(AS_PROGRAM).install_read_bank(0x0000, 0x07ff, "dsp_prg"); - m_upd7725->space(AS_DATA).install_read_bank(0x0000, 0x03ff, "dsp_data"); - membank("dsp_prg")->set_base(&m_dsp_prg[0]); - membank("dsp_data")->set_base(&m_dsp_data[0]); + m_upd7725->space(AS_PROGRAM).install_rom(0x0000, 0x07ff, &m_dsp_prg[0]); + m_upd7725->space(AS_DATA).install_rom(0x0000, 0x03ff, &m_dsp_data[0]); // copy data in the correct format for (int x = 0; x < 0x800; x++) m_dsp_prg[x] = (m_bios[x * 4] << 24) | (m_bios[x * 4 + 1] << 16) | (m_bios[x * 4 + 2] << 8) | 0x00; diff --git a/src/devices/bus/snes/upd.cpp b/src/devices/bus/snes/upd.cpp index 70396938e89..476a1b42544 100644 --- a/src/devices/bus/snes/upd.cpp +++ b/src/devices/bus/snes/upd.cpp @@ -322,10 +322,8 @@ void sns_rom_seta11dsp_device::device_add_mconfig(machine_config &config) void sns_rom20_necdsp_device::speedup_addon_bios_access() { - m_upd7725->space(AS_PROGRAM).install_read_bank(0x0000, 0x07ff, "dsp_prg"); - m_upd7725->space(AS_DATA).install_read_bank(0x0000, 0x03ff, "dsp_data"); - membank("dsp_prg")->set_base(&m_dsp_prg[0]); - membank("dsp_data")->set_base(&m_dsp_data[0]); + m_upd7725->space(AS_PROGRAM).install_rom(0x0000, 0x07ff, &m_dsp_prg[0]); + m_upd7725->space(AS_DATA).install_rom(0x0000, 0x03ff, &m_dsp_data[0]); // copy data in the correct format for (int x = 0; x < 0x800; x++) m_dsp_prg[x] = (m_bios[x * 4] << 24) | (m_bios[x * 4 + 1] << 16) | (m_bios[x * 4 + 2] << 8) | 0x00; @@ -335,10 +333,8 @@ void sns_rom20_necdsp_device::speedup_addon_bios_access() void sns_rom21_necdsp_device::speedup_addon_bios_access() { - m_upd7725->space(AS_PROGRAM).install_read_bank(0x0000, 0x07ff, "dsp_prg"); - m_upd7725->space(AS_DATA).install_read_bank(0x0000, 0x03ff, "dsp_data"); - membank("dsp_prg")->set_base(&m_dsp_prg[0]); - membank("dsp_data")->set_base(&m_dsp_data[0]); + m_upd7725->space(AS_PROGRAM).install_rom(0x0000, 0x07ff, &m_dsp_prg[0]); + m_upd7725->space(AS_DATA).install_rom(0x0000, 0x03ff, &m_dsp_data[0]); // copy data in the correct format for (int x = 0; x < 0x800; x++) m_dsp_prg[x] = (m_bios[x * 4] << 24) | (m_bios[x * 4 + 1] << 16) | (m_bios[x * 4 + 2] << 8) | 0x00; @@ -348,10 +344,8 @@ void sns_rom21_necdsp_device::speedup_addon_bios_access() void sns_rom_setadsp_device::speedup_addon_bios_access() { - m_upd96050->space(AS_PROGRAM).install_read_bank(0x0000, 0x3fff, "dsp_prg"); - m_upd96050->space(AS_DATA).install_read_bank(0x0000, 0x07ff, "dsp_data"); - membank("dsp_prg")->set_base(&m_dsp_prg[0]); - membank("dsp_data")->set_base(&m_dsp_data[0]); + m_upd96050->space(AS_PROGRAM).install_rom(0x0000, 0x3fff, &m_dsp_prg[0]); + m_upd96050->space(AS_DATA).install_rom(0x0000, 0x07ff, &m_dsp_data[0]); // copy data in the correct format for (int x = 0; x < 0x4000; x++) m_dsp_prg[x] = (m_bios[x * 4] << 24) | (m_bios[x * 4 + 1] << 16) | (m_bios[x * 4 + 2] << 8) | 0x00; diff --git a/src/devices/bus/vic10/exp.cpp b/src/devices/bus/vic10/exp.cpp index a4f677c4ff1..69c33da6a1d 100644 --- a/src/devices/bus/vic10/exp.cpp +++ b/src/devices/bus/vic10/exp.cpp @@ -29,10 +29,7 @@ DEFINE_DEVICE_TYPE(VIC10_EXPANSION_SLOT, vic10_expansion_slot_device, "vic10_exp //------------------------------------------------- device_vic10_expansion_card_interface::device_vic10_expansion_card_interface(const machine_config &mconfig, device_t &device) : - device_interface(device, "vic10exp"), - m_lorom(*this, "lorom"), - m_exram(*this, "exram"), - m_uprom(*this, "uprom") + device_interface(device, "vic10exp") { m_slot = dynamic_cast<vic10_expansion_slot_device *>(device.owner()); } @@ -133,11 +130,11 @@ image_init_result vic10_expansion_slot_device::call_load() uint8_t *roml = nullptr; uint8_t *romh = nullptr; - m_card->m_lorom.allocate(roml_size); - m_card->m_uprom.allocate(romh_size); + m_card->m_lorom = std::make_unique<uint8_t[]>(roml_size); + m_card->m_uprom = std::make_unique<uint8_t[]>(romh_size); - if (roml_size) roml = m_card->m_lorom; - if (romh_size) romh = m_card->m_lorom; + if (roml_size) roml = m_card->m_lorom.get(); + if (romh_size) romh = m_card->m_lorom.get(); cbm_crt_read_data(image_core_file(), roml, romh); } diff --git a/src/devices/bus/vic10/exp.h b/src/devices/bus/vic10/exp.h index 8dd977550ac..20d21f99e1c 100644 --- a/src/devices/bus/vic10/exp.h +++ b/src/devices/bus/vic10/exp.h @@ -141,9 +141,9 @@ public: protected: device_vic10_expansion_card_interface(const machine_config &mconfig, device_t &device); - optional_shared_ptr<uint8_t> m_lorom; - optional_shared_ptr<uint8_t> m_exram; - optional_shared_ptr<uint8_t> m_uprom; + std::unique_ptr<uint8_t[]> m_lorom; + std::unique_ptr<uint8_t[]> m_exram; + std::unique_ptr<uint8_t[]> m_uprom; vic10_expansion_slot_device *m_slot; }; diff --git a/src/devices/bus/vic10/std.cpp b/src/devices/bus/vic10/std.cpp index de4ba6ff8b6..3ffda30fcd9 100644 --- a/src/devices/bus/vic10/std.cpp +++ b/src/devices/bus/vic10/std.cpp @@ -48,17 +48,17 @@ void vic10_standard_cartridge_device::device_start() uint8_t vic10_standard_cartridge_device::vic10_cd_r(offs_t offset, uint8_t data, int lorom, int uprom, int exram) { - if (!lorom && m_lorom.bytes()) + if (!lorom && m_lorom) { - data = m_lorom[offset & m_lorom.mask()]; + data = m_lorom[offset]; } - else if (!exram && m_exram.bytes()) + else if (!exram && m_exram) { - data = m_exram[offset & m_exram.mask()]; + data = m_exram[offset]; } - else if (!uprom && m_uprom.bytes()) + else if (!uprom && m_uprom) { - data = m_uprom[offset & m_uprom.mask()]; + data = m_uprom[offset]; } return data; @@ -71,8 +71,8 @@ uint8_t vic10_standard_cartridge_device::vic10_cd_r(offs_t offset, uint8_t data, void vic10_standard_cartridge_device::vic10_cd_w(offs_t offset, uint8_t data, int lorom, int uprom, int exram) { - if (!exram && m_exram.bytes()) + if (!exram && m_exram) { - m_exram[offset & m_exram.mask()] = data; + m_exram[offset] = data; } } diff --git a/src/devices/bus/vic20/exp.cpp b/src/devices/bus/vic20/exp.cpp index 7751ff4bc81..c7f0120b25f 100644 --- a/src/devices/bus/vic20/exp.cpp +++ b/src/devices/bus/vic20/exp.cpp @@ -28,12 +28,7 @@ DEFINE_DEVICE_TYPE(VIC20_EXPANSION_SLOT, vic20_expansion_slot_device, "vic20_exp //------------------------------------------------- device_vic20_expansion_card_interface::device_vic20_expansion_card_interface(const machine_config &mconfig, device_t &device) - : device_interface(device, "vic20exp"), - m_blk1(*this, "blk1"), - m_blk2(*this, "blk2"), - m_blk3(*this, "blk3"), - m_blk5(*this, "blk5"), - m_nvram(*this, "nvram") + : device_interface(device, "vic20exp") { m_slot = dynamic_cast<vic20_expansion_slot_device *>(device.owner()); } diff --git a/src/devices/bus/vic20/exp.h b/src/devices/bus/vic20/exp.h index b643c9089b2..96583a29577 100644 --- a/src/devices/bus/vic20/exp.h +++ b/src/devices/bus/vic20/exp.h @@ -134,11 +134,10 @@ public: protected: device_vic20_expansion_card_interface(const machine_config &mconfig, device_t &device); - optional_shared_ptr<uint8_t> m_blk1; - optional_shared_ptr<uint8_t> m_blk2; - optional_shared_ptr<uint8_t> m_blk3; - optional_shared_ptr<uint8_t> m_blk5; - optional_shared_ptr<uint8_t> m_nvram; + std::unique_ptr<uint8_t[]> m_blk1; + std::unique_ptr<uint8_t[]> m_blk2; + std::unique_ptr<uint8_t[]> m_blk3; + std::unique_ptr<uint8_t[]> m_blk5; vic20_expansion_slot_device *m_slot; }; diff --git a/src/devices/bus/vic20/fe3.cpp b/src/devices/bus/vic20/fe3.cpp index f008bec3cb8..230dc076bb4 100644 --- a/src/devices/bus/vic20/fe3.cpp +++ b/src/devices/bus/vic20/fe3.cpp @@ -105,7 +105,7 @@ vic20_final_expansion_3_device::vic20_final_expansion_3_device(const machine_con device_t(mconfig, VIC20_FE3, tag, owner, clock), device_vic20_expansion_card_interface(mconfig, *this), m_flash_rom(*this, AM29F040_TAG), - m_ram(*this, "sram"), m_reg1(0), m_reg2(0), m_lockbit(0) + m_ram(*this, "sram", 0x80000, ENDIANNESS_LITTLE), m_reg1(0), m_reg2(0), m_lockbit(0) { } @@ -116,8 +116,6 @@ vic20_final_expansion_3_device::vic20_final_expansion_3_device(const machine_con void vic20_final_expansion_3_device::device_start() { - m_ram.allocate(0x80000); - // state saving save_item(NAME(m_reg1)); save_item(NAME(m_reg2)); diff --git a/src/devices/bus/vic20/fe3.h b/src/devices/bus/vic20/fe3.h index 018ef2617b6..c82fff2f7ee 100644 --- a/src/devices/bus/vic20/fe3.h +++ b/src/devices/bus/vic20/fe3.h @@ -77,7 +77,7 @@ private: void write_register(offs_t offset, uint8_t data); required_device<amd_29f040_device> m_flash_rom; - optional_shared_ptr<uint8_t> m_ram; + memory_share_creator<uint8_t> m_ram; uint8_t m_reg1; uint8_t m_reg2; diff --git a/src/devices/bus/vic20/megacart.cpp b/src/devices/bus/vic20/megacart.cpp index 8094adfba2b..21171bf4343 100644 --- a/src/devices/bus/vic20/megacart.cpp +++ b/src/devices/bus/vic20/megacart.cpp @@ -39,6 +39,7 @@ vic20_megacart_device::vic20_megacart_device(const machine_config &mconfig, cons : device_t(mconfig, VIC20_MEGACART, tag, owner, clock) , device_vic20_expansion_card_interface(mconfig, *this) , device_nvram_interface(mconfig, *this) + , m_nvram(*this, "nvram", 0x2000, ENDIANNESS_LITTLE) , m_nvram_en(0) { } @@ -50,8 +51,6 @@ vic20_megacart_device::vic20_megacart_device(const machine_config &mconfig, cons void vic20_megacart_device::device_start() { - m_nvram.allocate(0x2000); - // state saving save_item(NAME(m_nvram_en)); } diff --git a/src/devices/bus/vic20/megacart.h b/src/devices/bus/vic20/megacart.h index 52f5182fc3c..08e3ef0a59b 100644 --- a/src/devices/bus/vic20/megacart.h +++ b/src/devices/bus/vic20/megacart.h @@ -39,14 +39,15 @@ protected: // device_nvram_interface overrides virtual void nvram_default() override { } - virtual void nvram_read(emu_file &file) override { file.read(m_nvram, m_nvram.bytes()); } - virtual void nvram_write(emu_file &file) override { file.write(m_nvram, m_nvram.bytes()); } + virtual void nvram_read(emu_file &file) override { file.read(m_nvram, 0x2000); } + virtual void nvram_write(emu_file &file) override { file.write(m_nvram, 0x2000); } // device_vic20_expansion_card_interface overrides virtual uint8_t vic20_cd_r(offs_t offset, uint8_t data, int ram1, int ram2, int ram3, int blk1, int blk2, int blk3, int blk5, int io2, int io3) override; virtual void vic20_cd_w(offs_t offset, uint8_t data, int ram1, int ram2, int ram3, int blk1, int blk2, int blk3, int blk5, int io2, int io3) override; private: + memory_share_creator<uint8_t> m_nvram; int m_nvram_en; }; diff --git a/src/devices/bus/vic20/vic1110.cpp b/src/devices/bus/vic20/vic1110.cpp index 9b2d0c192d9..f9ee69fd8b1 100644 --- a/src/devices/bus/vic20/vic1110.cpp +++ b/src/devices/bus/vic20/vic1110.cpp @@ -69,7 +69,7 @@ ioport_constructor vic1110_device::device_input_ports() const vic1110_device::vic1110_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : device_t(mconfig, VIC1110, tag, owner, clock) , device_vic20_expansion_card_interface(mconfig, *this) - , m_ram(*this, "ram") + , m_ram(*this, "ram", 0x2000, ENDIANNESS_LITTLE) , m_sw(*this, "SW") { } @@ -81,8 +81,6 @@ vic1110_device::vic1110_device(const machine_config &mconfig, const char *tag, d void vic1110_device::device_start() { - // allocate memory - m_ram.allocate(0x2000); } diff --git a/src/devices/bus/vic20/vic1110.h b/src/devices/bus/vic20/vic1110.h index 9ec1ea2791a..831bc478bf4 100644 --- a/src/devices/bus/vic20/vic1110.h +++ b/src/devices/bus/vic20/vic1110.h @@ -40,7 +40,7 @@ protected: virtual void vic20_cd_w(offs_t offset, uint8_t data, int ram1, int ram2, int ram3, int blk1, int blk2, int blk3, int blk5, int io2, int io3) override; private: - optional_shared_ptr<uint8_t> m_ram; + memory_share_creator<uint8_t> m_ram; required_ioport m_sw; }; diff --git a/src/devices/bus/vic20/vic1111.cpp b/src/devices/bus/vic20/vic1111.cpp index 1f8fa215078..4bb3a492ef2 100644 --- a/src/devices/bus/vic20/vic1111.cpp +++ b/src/devices/bus/vic20/vic1111.cpp @@ -30,7 +30,7 @@ DEFINE_DEVICE_TYPE(VIC1111, vic1111_device, "vic1111", "VIC-1111 16K RAM Expansi vic1111_device::vic1111_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : device_t(mconfig, VIC1111, tag, owner, clock) , device_vic20_expansion_card_interface(mconfig, *this) - , m_ram(*this, "ram") + , m_ram(*this, "ram", 0x4000, ENDIANNESS_LITTLE) { } @@ -41,8 +41,6 @@ vic1111_device::vic1111_device(const machine_config &mconfig, const char *tag, d void vic1111_device::device_start() { - // allocate memory - m_ram.allocate(0x4000); } diff --git a/src/devices/bus/vic20/vic1111.h b/src/devices/bus/vic20/vic1111.h index eb42db2f149..7d391875732 100644 --- a/src/devices/bus/vic20/vic1111.h +++ b/src/devices/bus/vic20/vic1111.h @@ -37,7 +37,7 @@ protected: virtual void vic20_cd_w(offs_t offset, uint8_t data, int ram1, int ram2, int ram3, int blk1, int blk2, int blk3, int blk5, int io2, int io3) override; private: - optional_shared_ptr<uint8_t> m_ram; + memory_share_creator<uint8_t> m_ram; }; diff --git a/src/devices/bus/vic20/vic1210.cpp b/src/devices/bus/vic20/vic1210.cpp index 6fa2a917254..88c94e8fbbd 100644 --- a/src/devices/bus/vic20/vic1210.cpp +++ b/src/devices/bus/vic20/vic1210.cpp @@ -31,7 +31,7 @@ DEFINE_DEVICE_TYPE(VIC1210, vic1210_device, "vic1210", "VIC-1210 3K RAM Expansio vic1210_device::vic1210_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : device_t(mconfig, VIC1210, tag, owner, clock) , device_vic20_expansion_card_interface(mconfig, *this) - , m_ram(*this, "ram") + , m_ram(*this, "ram", 0xc00, ENDIANNESS_LITTLE) { } @@ -42,8 +42,6 @@ vic1210_device::vic1210_device(const machine_config &mconfig, const char *tag, d void vic1210_device::device_start() { - // allocate memory - m_ram.allocate(0xc00); } diff --git a/src/devices/bus/vic20/vic1210.h b/src/devices/bus/vic20/vic1210.h index f890d5ad61e..9f20f9164ad 100644 --- a/src/devices/bus/vic20/vic1210.h +++ b/src/devices/bus/vic20/vic1210.h @@ -38,7 +38,7 @@ protected: virtual void vic20_cd_w(offs_t offset, uint8_t data, int ram1, int ram2, int ram3, int blk1, int blk2, int blk3, int blk5, int io2, int io3) override; private: - optional_shared_ptr<uint8_t> m_ram; + memory_share_creator<uint8_t> m_ram; }; diff --git a/src/devices/bus/vic20/videopak.cpp b/src/devices/bus/vic20/videopak.cpp index 1f2b3c35431..542c2fb8320 100644 --- a/src/devices/bus/vic20/videopak.cpp +++ b/src/devices/bus/vic20/videopak.cpp @@ -131,8 +131,8 @@ vic20_video_pak_device::vic20_video_pak_device(const machine_config &mconfig, co m_crtc(*this, MC6845_TAG), m_palette(*this, "palette"), m_char_rom(*this, MC6845_TAG), - m_videoram(*this, "videoram"), - m_ram(*this, "ram") + m_videoram(*this, "videoram", VIDEORAM_SIZE, ENDIANNESS_LITTLE), + m_ram(*this, "ram", RAM_SIZE, ENDIANNESS_LITTLE) { } @@ -143,9 +143,6 @@ vic20_video_pak_device::vic20_video_pak_device(const machine_config &mconfig, co void vic20_video_pak_device::device_start() { - // allocate memory - m_videoram.allocate(VIDEORAM_SIZE); - m_ram.allocate(RAM_SIZE); } diff --git a/src/devices/bus/vic20/videopak.h b/src/devices/bus/vic20/videopak.h index 9e3176e5365..d87b04d35c1 100644 --- a/src/devices/bus/vic20/videopak.h +++ b/src/devices/bus/vic20/videopak.h @@ -51,8 +51,8 @@ private: required_device<mc6845_device> m_crtc; required_device<palette_device> m_palette; required_memory_region m_char_rom; - optional_shared_ptr<uint8_t> m_videoram; - optional_shared_ptr<uint8_t> m_ram; + memory_share_creator<uint8_t> m_videoram; + memory_share_creator<uint8_t> m_ram; bool m_case; bool m_bank_size; diff --git a/src/devices/bus/vip/vp570.cpp b/src/devices/bus/vip/vp570.cpp index f9473bd2f87..f2e32dffd35 100644 --- a/src/devices/bus/vip/vp570.cpp +++ b/src/devices/bus/vip/vp570.cpp @@ -63,7 +63,7 @@ ioport_constructor vp570_device::device_input_ports() const vp570_device::vp570_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : device_t(mconfig, VP570, tag, owner, clock), device_vip_expansion_card_interface(mconfig, *this), - m_ram(*this, "ram"), + m_ram(*this, "ram", 0x1000, ENDIANNESS_LITTLE), m_base(*this, "BASE"), m_sw1(*this, "SW1") { @@ -76,7 +76,6 @@ vp570_device::vp570_device(const machine_config &mconfig, const char *tag, devic void vp570_device::device_start() { - m_ram.allocate(0x1000); } diff --git a/src/devices/bus/vip/vp570.h b/src/devices/bus/vip/vp570.h index 04ad752d804..2f026bd1eac 100644 --- a/src/devices/bus/vip/vp570.h +++ b/src/devices/bus/vip/vp570.h @@ -40,7 +40,7 @@ protected: virtual void vip_program_w(offs_t offset, uint8_t data, int cdef, int *minh) override; private: - optional_shared_ptr<uint8_t> m_ram; + memory_share_creator<uint8_t> m_ram; required_ioport m_base; required_ioport m_sw1; }; diff --git a/src/devices/bus/vip/vp590.cpp b/src/devices/bus/vip/vp590.cpp index 3fd9185c5d1..296ce70fb8b 100644 --- a/src/devices/bus/vip/vp590.cpp +++ b/src/devices/bus/vip/vp590.cpp @@ -131,7 +131,7 @@ vp590_device::vp590_device(const machine_config &mconfig, const char *tag, devic device_t(mconfig, VP590, tag, owner, clock), device_vip_expansion_card_interface(mconfig, *this), m_cgc(*this, CDP1862_TAG), - m_color_ram(*this, "color_ram"), + m_color_ram(*this, "color_ram", COLOR_RAM_SIZE, ENDIANNESS_LITTLE), m_j1(*this, "J1"), m_j2(*this, "J2"), m_a12(0), m_color(0), m_keylatch(0) @@ -145,9 +145,6 @@ vp590_device::vp590_device(const machine_config &mconfig, const char *tag, devic void vp590_device::device_start() { - // allocate memory - m_color_ram.allocate(COLOR_RAM_SIZE); - // state saving save_item(NAME(m_a12)); save_item(NAME(m_color)); diff --git a/src/devices/bus/vip/vp590.h b/src/devices/bus/vip/vp590.h index 230b7d8d02d..9c69762f7be 100644 --- a/src/devices/bus/vip/vp590.h +++ b/src/devices/bus/vip/vp590.h @@ -50,7 +50,7 @@ private: DECLARE_READ_LINE_MEMBER( gd_r ); required_device<cdp1862_device> m_cgc; - optional_shared_ptr<uint8_t> m_color_ram; + memory_share_creator<uint8_t> m_color_ram; required_ioport m_j1; required_ioport m_j2; diff --git a/src/devices/bus/vtech/memexp/memory.cpp b/src/devices/bus/vtech/memexp/memory.cpp index 22bcc69b959..1b9465d9da9 100644 --- a/src/devices/bus/vtech/memexp/memory.cpp +++ b/src/devices/bus/vtech/memexp/memory.cpp @@ -129,7 +129,8 @@ void vtech_laser310_16k_device::device_reset() vtech_laser_64k_device::vtech_laser_64k_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : device_t(mconfig, VTECH_LASER_64K, tag, owner, clock), - device_vtech_memexp_interface(mconfig, *this) + device_vtech_memexp_interface(mconfig, *this), + m_bank(*this, "bank") { } @@ -152,10 +153,10 @@ void vtech_laser_64k_device::device_reset() program_space().install_ram(0x8000, 0xbfff, &m_ram[0]); // other banks - program_space().install_readwrite_bank(0xc000, 0xffff, tag()); + program_space().install_readwrite_bank(0xc000, 0xffff, m_bank); - membank(tag())->configure_entries(0, 4, &m_ram[0], 0x4000); - membank(tag())->set_entry(1); + m_bank->configure_entries(0, 4, &m_ram[0], 0x4000); + m_bank->set_entry(1); // bank switch io_space().install_write_handler(0x70, 0x7f, write8smo_delegate(*this, FUNC(vtech_laser_64k_device::bankswitch_w))); @@ -163,5 +164,5 @@ void vtech_laser_64k_device::device_reset() void vtech_laser_64k_device::bankswitch_w(uint8_t data) { - membank(tag())->set_entry(data & 0x03); + m_bank->set_entry(data & 0x03); } diff --git a/src/devices/bus/vtech/memexp/memory.h b/src/devices/bus/vtech/memexp/memory.h index 6f87f3b51b8..84c3952fb67 100644 --- a/src/devices/bus/vtech/memexp/memory.h +++ b/src/devices/bus/vtech/memexp/memory.h @@ -81,6 +81,7 @@ protected: virtual void device_reset() override; private: + memory_bank_creator m_bank; std::vector<uint8_t> m_ram; }; diff --git a/src/devices/bus/wangpc/emb.cpp b/src/devices/bus/wangpc/emb.cpp index 8a1817d1666..6a69c1a0fee 100644 --- a/src/devices/bus/wangpc/emb.cpp +++ b/src/devices/bus/wangpc/emb.cpp @@ -47,7 +47,7 @@ DEFINE_DEVICE_TYPE(WANGPC_EMB, wangpc_emb_device, "wangpc_emb", "Wang PC-PM031-B wangpc_emb_device::wangpc_emb_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : device_t(mconfig, WANGPC_EMB, tag, owner, clock), device_wangpcbus_card_interface(mconfig, *this), - m_ram(*this, "ram"), + m_ram(*this, "ram", RAM_SIZE, ENDIANNESS_LITTLE), m_option(0), m_parity_error(0), m_parity_odd(0) { } @@ -59,9 +59,6 @@ wangpc_emb_device::wangpc_emb_device(const machine_config &mconfig, const char * void wangpc_emb_device::device_start() { - // allocate memory - m_ram.allocate(RAM_SIZE); - // state saving save_item(NAME(m_option)); save_item(NAME(m_parity_error)); diff --git a/src/devices/bus/wangpc/emb.h b/src/devices/bus/wangpc/emb.h index 1e175ae6867..1f23fed9f09 100644 --- a/src/devices/bus/wangpc/emb.h +++ b/src/devices/bus/wangpc/emb.h @@ -40,7 +40,7 @@ protected: virtual void wangpcbus_aiowc_w(offs_t offset, uint16_t mem_mask, uint16_t data) override; private: - optional_shared_ptr<uint16_t> m_ram; + memory_share_creator<uint16_t> m_ram; uint16_t m_option; int m_parity_error; int m_parity_odd; diff --git a/src/devices/bus/wangpc/lvc.cpp b/src/devices/bus/wangpc/lvc.cpp index 1fd3c0610d4..2eb45e47db0 100644 --- a/src/devices/bus/wangpc/lvc.cpp +++ b/src/devices/bus/wangpc/lvc.cpp @@ -164,7 +164,7 @@ wangpc_lvc_device::wangpc_lvc_device(const machine_config &mconfig, const char * device_t(mconfig, WANGPC_LVC, tag, owner, clock), device_wangpcbus_card_interface(mconfig, *this), m_crtc(*this, MC6845_TAG), - m_video_ram(*this, "video_ram"), + m_video_ram(*this, "video_ram", RAM_SIZE, ENDIANNESS_LITTLE), m_option(0), m_scroll(0), m_irq(CLEAR_LINE) { @@ -177,9 +177,6 @@ wangpc_lvc_device::wangpc_lvc_device(const machine_config &mconfig, const char * void wangpc_lvc_device::device_start() { - // allocate memory - m_video_ram.allocate(RAM_SIZE); - // state saving save_item(NAME(m_option)); save_item(NAME(m_scroll)); diff --git a/src/devices/bus/wangpc/lvc.h b/src/devices/bus/wangpc/lvc.h index 3fa858adf1c..7f0cb5ac816 100644 --- a/src/devices/bus/wangpc/lvc.h +++ b/src/devices/bus/wangpc/lvc.h @@ -48,7 +48,7 @@ private: inline void set_irq(int state); required_device<mc6845_device> m_crtc; - optional_shared_ptr<uint16_t> m_video_ram; + memory_share_creator<uint16_t> m_video_ram; rgb_t m_palette[16]; uint8_t m_option; diff --git a/src/devices/bus/wangpc/mvc.cpp b/src/devices/bus/wangpc/mvc.cpp index cff515a05c1..9455ba23463 100644 --- a/src/devices/bus/wangpc/mvc.cpp +++ b/src/devices/bus/wangpc/mvc.cpp @@ -186,9 +186,9 @@ wangpc_mvc_device::wangpc_mvc_device(const machine_config &mconfig, const char * device_t(mconfig, WANGPC_MVC, tag, owner, clock), device_wangpcbus_card_interface(mconfig, *this), m_crtc(*this, MC6845_TAG), - m_video_ram(*this, "video_ram"), - m_char_ram(*this, "char_ram"), - m_bitmap_ram(*this, "bitmap_ram"), + m_video_ram(*this, "video_ram", VIDEO_RAM_SIZE, ENDIANNESS_LITTLE), + m_char_ram(*this, "char_ram", CHAR_RAM_SIZE, ENDIANNESS_LITTLE), + m_bitmap_ram(*this, "bitmap_ram", BITMAP_RAM_SIZE, ENDIANNESS_LITTLE), m_option(0), m_irq(CLEAR_LINE) { @@ -201,11 +201,6 @@ wangpc_mvc_device::wangpc_mvc_device(const machine_config &mconfig, const char * void wangpc_mvc_device::device_start() { - // allocate memory - m_video_ram.allocate(VIDEO_RAM_SIZE); - m_char_ram.allocate(CHAR_RAM_SIZE); - m_bitmap_ram.allocate(BITMAP_RAM_SIZE); - // state saving save_item(NAME(m_option)); save_item(NAME(m_irq)); diff --git a/src/devices/bus/wangpc/mvc.h b/src/devices/bus/wangpc/mvc.h index aee0cdf51b2..9911952f6ac 100644 --- a/src/devices/bus/wangpc/mvc.h +++ b/src/devices/bus/wangpc/mvc.h @@ -48,9 +48,9 @@ private: inline void set_irq(int state); required_device<mc6845_device> m_crtc; - optional_shared_ptr<uint16_t> m_video_ram; - optional_shared_ptr<uint16_t> m_char_ram; - optional_shared_ptr<uint16_t> m_bitmap_ram; + memory_share_creator<uint16_t> m_video_ram; + memory_share_creator<uint16_t> m_char_ram; + memory_share_creator<uint16_t> m_bitmap_ram; uint8_t m_option; int m_irq; diff --git a/src/devices/bus/wangpc/rtc.cpp b/src/devices/bus/wangpc/rtc.cpp index bb299017730..8cd5e055ac6 100644 --- a/src/devices/bus/wangpc/rtc.cpp +++ b/src/devices/bus/wangpc/rtc.cpp @@ -186,7 +186,7 @@ wangpc_rtc_device::wangpc_rtc_device(const machine_config &mconfig, const char * m_ctc0(*this, Z80CTC_0_TAG), m_ctc1(*this, Z80CTC_1_TAG), m_sio(*this, Z80SIO_TAG), - m_char_ram(*this, "char_ram") + m_char_ram(*this, "char_ram", 0x100, ENDIANNESS_LITTLE) { } @@ -197,7 +197,6 @@ wangpc_rtc_device::wangpc_rtc_device(const machine_config &mconfig, const char * void wangpc_rtc_device::device_start() { - m_char_ram.allocate(0x100); } diff --git a/src/devices/bus/wangpc/rtc.h b/src/devices/bus/wangpc/rtc.h index eb848b599ec..4366536ccdf 100644 --- a/src/devices/bus/wangpc/rtc.h +++ b/src/devices/bus/wangpc/rtc.h @@ -52,7 +52,7 @@ private: required_device<z80ctc_device> m_ctc0; required_device<z80ctc_device> m_ctc1; required_device<z80sio_device> m_sio; - optional_shared_ptr<uint8_t> m_char_ram; + memory_share_creator<uint8_t> m_char_ram; void wangpc_rtc_io(address_map &map); void wangpc_rtc_mem(address_map &map); diff --git a/src/devices/bus/x68k/x68k_scsiext.cpp b/src/devices/bus/x68k/x68k_scsiext.cpp index 54766c445ac..bec669ef1f5 100644 --- a/src/devices/bus/x68k/x68k_scsiext.cpp +++ b/src/devices/bus/x68k/x68k_scsiext.cpp @@ -65,13 +65,11 @@ x68k_scsiext_device::x68k_scsiext_device(const machine_config &mconfig, const ch void x68k_scsiext_device::device_start() { - m_slot = dynamic_cast<x68k_expansion_slot_device *>(owner()); - m_slot->space().install_read_bank(0xea0020,0xea1fff,"scsi_ext"); - m_slot->space().unmap_write(0xea0020,0xea1fff); - uint8_t *ROM = machine().root_device().memregion(subtag("scsiexrom").c_str())->base(); - machine().root_device().membank("scsi_ext")->set_base(ROM); + m_slot = dynamic_cast<x68k_expansion_slot_device *>(owner()); + m_slot->space().install_rom(0xea0020,0xea1fff,ROM); + m_slot->space().unmap_write(0xea0020,0xea1fff); m_slot->space().install_readwrite_handler(0xea0000,0xea001f, read8sm_delegate(*this, FUNC(x68k_scsiext_device::register_r)), write8sm_delegate(*this, FUNC(x68k_scsiext_device::register_w)), 0x00ff00ff); } |