diff --git a/docs/source/techspecs/memory.rst b/docs/source/techspecs/memory.rst index e760b004894..d3de2579f6e 100644 --- a/docs/source/techspecs/memory.rst +++ b/docs/source/techspecs/memory.rst @@ -57,7 +57,7 @@ Memory banks are zones that indirect memory access, giving the possibility to dynamically and efficiently change where a zone actually points to. -Memory regions are read-only memory zones in which roms are loaded. +Memory regions are read-only memory zones in which ROMs are loaded. All of these have names allowing to access them. @@ -100,8 +100,8 @@ object. A memory share can be created if it doesn't exist in a memory map through that creator class. If it already exists it is just -retrieved. That class behaves like a pointer but also has the share() -method to get th memory_share object and the bytes(), endianness(), +retrieved. That class behaves like a pointer but also has the target() +method to get the memory_share object and the bytes(), endianness(), bitwidth() and bytewidth() methods for share information. | memory_share \*memshare(string tag) const; @@ -304,11 +304,11 @@ both for the current entry. 4.3.3 Lambda function ''''''''''''''''''''' -| (...).lr{8,16,32,64}(FUNC([...](address_space &space, offs_t offset, uNN mem_mask) -> uNN { ... })) +| (...).lr{8,16,32,64}(NAME([...](address_space &space, offs_t offset, uNN mem_mask) -> uNN { ... })) | (...).lr{8,16,32,64}([...](address_space &space, offs_t offset, uNN mem_mask) -> uNN { ... }, "name") -| (...).lw{8,16,32,64}(FUNC([...](address_space &space, offs_t offset, uNN data, uNN mem_mask) -> void { ... })) +| (...).lw{8,16,32,64}(NAME([...](address_space &space, offs_t offset, uNN data, uNN mem_mask) -> void { ... })) | (...).lw{8,16,32,64}([...](address_space &space, offs_t offset, uNN data, uNN mem_mask) -> void { ... }, "name") -| (...).lrw{8,16,32,64}(FUNC(read), FUNC(write)) +| (...).lrw{8,16,32,64}(NAME(read), NAME(write)) | (...).lrw{8,16,32,64}(read, "name_r", write, "name_w") Sets a lambda called on read, write or both. The lambda prototype can @@ -324,22 +324,22 @@ number is the data width of the access, e.g. the NN. | (...).writeonly() | (...).ram() -Selects the range to access a memory zone as readonly, writeonly or -readwrite respectively. Specific handle qualifiers allow to tell +Selects the range to access a memory zone as read-only, write-only or +read/write respectively. Specific handle qualifiers allow to tell where this memory zone should be. There are two cases when no qualifier is acceptable: -* ram() gives an anonymous ram zone not accessibles outside of the +* ram() gives an anonymous ram zone not accessible outside of the address space. * rom() when the memory map is used in an AS_PROGRAM - space of a (cpu) device which names is also the name of a region. + space of a (CPU) device which names is also the name of a region. Then the memory zone points to that region at the offset corresponding to the start of the zone. | (...).rom().region("name", offset) -The region qualifier allows to make a readonly zone point to the +The region qualifier allows to make a read-only zone point to the contents of a given region at a given offset. | (...).rom().share("name") @@ -485,7 +485,7 @@ The parameter is that trigger width (would be 16 in the 68000 case). A series of methods allow to change the bus decoding of an address space on the fly. They're powerful but have some issues: -* changing the mappings repeateadly can be slow +* changing the mappings repeatedly can be slow * the address space state is not saved in the saved states, so it has to be rebuilt after state load * they can be hidden anywhere rather that be grouped in an address map, which can be less readable @@ -538,8 +538,8 @@ Note that as all delegates they can also wrap lambdas. | space.install_readwrite_handler(addrstart, addrend, addrmask, addrmirror, addrselect, read_delegate, write_delegate, *unitmask*, *cswidth*) These six methods allow to install delegate-wrapped handlers in a live -address space. either plain of with mask, mirror and select. In the -readwrite case both delegates must be of the same flavor (smo stuff) +address space. Either plain or with mask, mirror and select. In the +read/write case both delegates must be of the same flavor (smo stuff) to avoid a combinatorial explosion of method types. 5.3 Direct memory range mapping @@ -553,7 +553,7 @@ to avoid a combinatorial explosion of method types. | space.install_ram(addrstart, addrend, addrmirror, void \*pointer) Installs a memory block in an address space, with or without mirror. -rom is readonly, ram is read/write, writeonly is write only. The +rom is read-only, ram is read/write, writeonly is write-only. The pointer must be non-null, this method will not allocate the memory. 5.4 Bank mapping diff --git a/src/devices/bus/abcbus/ssa.h b/src/devices/bus/abcbus/ssa.h index 2eceb3ad0dd..2be5046b24a 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.share()->bytes()); } } - virtual void nvram_write(emu_file &file) override { if (m_nvram != nullptr) { file.write(m_nvram, m_nvram.share()->bytes()); } } + 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()); } } // device_abcbus_interface overrides virtual void abcbus_cs(uint8_t data) override { m_bus->write_cs(data); } diff --git a/src/devices/bus/c64/fcc.cpp b/src/devices/bus/c64/fcc.cpp index 1d9300f1a07..07ff8840e3a 100644 --- a/src/devices/bus/c64/fcc.cpp +++ b/src/devices/bus/c64/fcc.cpp @@ -98,9 +98,9 @@ c64_final_chesscard_device::c64_final_chesscard_device(const machine_config &mco void c64_final_chesscard_device::device_start() { m_nvram = std::make_unique(0x2000); - save_pointer(NAME(m_nvram), 0x2000); // state saving + save_pointer(NAME(m_nvram), 0x2000); save_item(NAME(m_bank)); save_item(NAME(m_hidden)); } diff --git a/src/devices/bus/pofo/ccm.cpp b/src/devices/bus/pofo/ccm.cpp index b5790a14a3b..1ab5c3054b8 100644 --- a/src/devices/bus/pofo/ccm.cpp +++ b/src/devices/bus/pofo/ccm.cpp @@ -71,9 +71,7 @@ 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/ram.h b/src/devices/bus/pofo/ram.h index c3eee30910d..fc00ac48d2d 100644 --- a/src/devices/bus/pofo/ram.h +++ b/src/devices/bus/pofo/ram.h @@ -36,8 +36,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.share()->bytes()); } } - virtual void nvram_write(emu_file &file) override { if (m_nvram != nullptr) { file.write(m_nvram, m_nvram.share()->bytes()); } } + 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()); } } // device_portfolio_memory_card_slot_interface overrides virtual bool cdet() override { return 0; } diff --git a/src/emu/devfind.cpp b/src/emu/devfind.cpp index a2f9551051a..330ebc7c14a 100644 --- a/src/emu/devfind.cpp +++ b/src/emu/devfind.cpp @@ -73,13 +73,13 @@ void *finder_base::find_memregion(u8 width, size_t &length, bool required) const if (region->bytewidth() != width) { if (required) - osd_printf_warning("Region '%s' found but is width %d, not %d as requested\n", m_tag, region->bitwidth(), width*8); + osd_printf_warning("Region '%s' found but is width %d, not %d as requested\n", m_tag, region->bitwidth(), width * 8); length = 0; return nullptr; } // return results - length = region->bytes()/width; + length = region->bytes() / width; return region->base(); } @@ -316,6 +316,7 @@ bool ioport_finder::findit(validity_checker *valid) } + //************************************************************************** // ADDRESS SPACE FINDER //************************************************************************** @@ -342,6 +343,7 @@ bool address_space_finder::findit(validity_checker *valid) } + //************************************************************************** // MEMORY BANK CREATOR //************************************************************************** @@ -353,46 +355,48 @@ bool memory_bank_creator::findit(validity_checker *valid) device_t &dev = m_base.get(); memory_manager &manager = dev.machine().memory(); - std::string tag = dev.subtag(m_tag); - memory_bank *bank = manager.bank_find(tag); - if (bank) - m_target = bank; - else - m_target = manager.bank_alloc(dev, tag); + std::string const tag = dev.subtag(m_tag); + memory_bank *const bank = manager.bank_find(tag); + m_target = bank ? bank : manager.bank_alloc(dev, tag); return true; } + void memory_bank_creator::end_configuration() { m_target = nullptr; } + //************************************************************************** // MEMORY SHARE CREATOR //************************************************************************** -template memory_share_creator::memory_share_creator(device_t &base, char const *tag, size_t bytes, endianness_t endianness) +template +memory_share_creator::memory_share_creator(device_t &base, char const *tag, size_t bytes, endianness_t endianness) : finder_base(base, tag) - , m_width(sizeof(uX)*8) + , m_width(sizeof(PointerType) * 8) , m_bytes(bytes) , m_endianness(endianness) { } -template bool memory_share_creator::findit(validity_checker *valid) + +template +bool memory_share_creator::findit(validity_checker *valid) { if (valid) return true; device_t &dev = m_base.get(); memory_manager &manager = dev.machine().memory(); - std::string tag = dev.subtag(m_tag); - memory_share *share = manager.share_find(tag); + std::string const tag = dev.subtag(m_tag); + memory_share *const share = manager.share_find(tag); if (share) { m_target = share; - std::string result = share->compare(m_width, m_bytes, m_endianness); + std::string const result = share->compare(m_width, m_bytes, m_endianness); if (!result.empty()) { osd_printf_error("%s\n", result); @@ -400,11 +404,15 @@ template bool memory_share_creator::findit(validity_checker *va } } else + { m_target = manager.share_alloc(dev, tag, m_width, m_bytes, m_endianness); + } return true; } -template void memory_share_creator::end_configuration() + +template +void memory_share_creator::end_configuration() { m_target = nullptr; } @@ -489,7 +497,13 @@ template class shared_ptr_finder; template class shared_ptr_finder; template class shared_ptr_finder; template class shared_ptr_finder; + template class memory_share_creator; template class memory_share_creator; template class memory_share_creator; template class memory_share_creator; + +template class memory_share_creator; +template class memory_share_creator; +template class memory_share_creator; +template class memory_share_creator; diff --git a/src/emu/devfind.h b/src/emu/devfind.h index d9e2e95df21..cb38d8d4a85 100644 --- a/src/emu/devfind.h +++ b/src/emu/devfind.h @@ -753,9 +753,10 @@ template using memory_bank_array_finder = object template using optional_memory_bank_array = memory_bank_array_finder; template using required_memory_bank_array = memory_bank_array_finder; + /// \brief Memory bank creator /// -/// Creates a memory bank or picks up an existing one. +/// Creates a memory bank or finds an existing one. class memory_bank_creator : finder_base { public: @@ -792,10 +793,11 @@ protected: template using memory_bank_array_creator = object_array_finder; -/// \brief Memory share creator + +/// \brief Memory share creator template /// -/// Creates a memory share or picks up an existing one. -template class memory_share_creator : finder_base +/// Creates a memory share or finds an existing one. +template class memory_share_creator : finder_base { public: memory_share_creator(device_t &base, char const *tag, size_t bytes, endianness_t endianness); @@ -803,17 +805,17 @@ public: /// \brief Get pointer to the share object /// \return Pointer to share object. - memory_share *share() const { return m_target; } + memory_share *target() const { return m_target; } - /// \brief Get pointer to the share object backing ram - /// \return Pointer to the ram. - uX *ptr() const { return reinterpret_cast(m_target->ptr()); } + /// \brief Get pointer to the share object backing RAM + /// \return Pointer to the RAM. + PointerType *ptr() const { return reinterpret_cast(m_target->ptr()); } /// \brief Cast-to-pointer operator /// - /// Allows implicit casting to a pointer to the target bank object. + /// Allows implicit casting to a pointer to the target backing RAM. /// \return Pointer to target bank object - operator uX *() const { return reinterpret_cast(m_target->ptr()); } + operator PointerType *() const { return reinterpret_cast(m_target->ptr()); } /// \brief Pointer member access operator /// @@ -842,6 +844,7 @@ protected: const endianness_t m_endianness; // endianness of the memory }; + /// \brief I/O port finder template /// /// Template argument is whether the I/O port is required. It is a @@ -1239,5 +1242,15 @@ extern template class shared_ptr_finder; extern template class shared_ptr_finder; extern template class shared_ptr_finder; +extern template class memory_share_creator; +extern template class memory_share_creator; +extern template class memory_share_creator; +extern template class memory_share_creator; + +extern template class memory_share_creator; +extern template class memory_share_creator; +extern template class memory_share_creator; +extern template class memory_share_creator; + #endif // MAME_EMU_DEVFIND_H /// \} diff --git a/src/emu/emumem.cpp b/src/emu/emumem.cpp index 8fb0f0bbe28..aab74d45f64 100644 --- a/src/emu/emumem.cpp +++ b/src/emu/emumem.cpp @@ -906,8 +906,6 @@ memory_manager::memory_manager(running_machine &machine) memory_manager::~memory_manager() { - for(void *ptr : m_datablocks) - free(ptr); } //------------------------------------------------- @@ -1036,10 +1034,9 @@ void memory_manager::initialize() void *memory_manager::allocate_memory(device_t &dev, int spacenum, std::string name, u8 width, size_t bytes) { - void *ptr = malloc(bytes); + void *const ptr = m_datablocks.emplace(m_datablocks.end(), malloc(bytes))->get(); memset(ptr, 0, bytes); - m_datablocks.push_back(ptr); - machine().save().save_memory(&dev, "memory", dev.tag(), spacenum, name.c_str(), ptr, width/8, (u32)bytes / (width/8)); + machine().save().save_memory(&dev, "memory", dev.tag(), spacenum, name.c_str(), ptr, width/8, u32(bytes) / (width/8)); return ptr; } @@ -1709,8 +1706,8 @@ void address_space::populate_map_entry(const address_map_entry &entry, read_or_w install_bank_generic(entry.m_addrstart, entry.m_addrend, entry.m_addrmirror, (readorwrite == read_or_write::READ) ? bank : nullptr, (readorwrite == read_or_write::WRITE) ? bank : nullptr); - break; } + break; case AMH_DEVICE_SUBMAP: throw emu_fatalerror("Internal mapping error: leftover mapping of '%s'.\n", data.m_tag); diff --git a/src/emu/emumem.h b/src/emu/emumem.h index ed8897a2992..6c336a9243f 100644 --- a/src/emu/emumem.h +++ b/src/emu/emumem.h @@ -1787,10 +1787,12 @@ public: void region_free(std::string name); private: + struct stdlib_deleter { void operator()(void *p) const { free(p); } }; + // internal state running_machine & m_machine; // reference to the machine - std::vector m_datablocks; // list of memory blocks to free on exit + std::vector> m_datablocks; // list of memory blocks to free on exit std::unordered_map> m_banklist; // data gathered for each bank std::unordered_map> m_sharelist; // map for share lookups std::unordered_map> m_regionlist; // list of memory regions diff --git a/src/emu/romload.cpp b/src/emu/romload.cpp index b3b90ebbcf7..164f2c97fbc 100644 --- a/src/emu/romload.cpp +++ b/src/emu/romload.cpp @@ -1278,7 +1278,7 @@ void rom_load_manager::load_software_part_region(device_t &device, software_list machine().memory().region_free(memregion->name()); } - /* remember the base and length */ + // remember the base and length m_region = machine().memory().region_alloc(regiontag, regionlength, width, endianness); LOG("Allocated %X bytes @ %p\n", m_region->bytes(), m_region->base()); diff --git a/src/mame/drivers/arsystems.cpp b/src/mame/drivers/arsystems.cpp index 1e60e43fa1a..bf978a90db2 100644 --- a/src/mame/drivers/arsystems.cpp +++ b/src/mame/drivers/arsystems.cpp @@ -67,7 +67,6 @@ public: : amiga_state(mconfig, type, tag) , m_bios_region(*this, "user2") , m_rom_board(*this, "user3") - { } @@ -90,9 +89,13 @@ public: void init_dlta(); void init_argh(); - void arcadia_multibios_change_game(uint16_t data); template DECLARE_CUSTOM_INPUT_MEMBER(coin_counter_r); DECLARE_INPUT_CHANGED_MEMBER(coin_changed_callback); + +protected: + virtual void machine_reset() override; + + void arcadia_multibios_change_game(uint16_t data); void arcadia_cia_0_portb_w(uint8_t data); private: @@ -103,8 +106,6 @@ private: void argh_map(address_map &map); void overlay_512kb_map(address_map &map); - virtual void machine_reset() override; - optional_memory_region m_bios_region, m_rom_board; uint8_t m_coin_counter[2]; diff --git a/src/mame/drivers/hp3478a.cpp b/src/mame/drivers/hp3478a.cpp index c92411bdf94..cc23c1e3eae 100644 --- a/src/mame/drivers/hp3478a.cpp +++ b/src/mame/drivers/hp3478a.cpp @@ -713,7 +713,10 @@ void hp3478a_state::hp3478a(machine_config &config) ******************************************************************************/ ROM_START( hp3478a ) ROM_REGION( 0x2000, "maincpu", 0 ) - ROM_LOAD("rom_dc118.bin", 0, 0x2000, CRC(10097ced) SHA1(bd665cf7e07e63f825b2353c8322ed8a4376b3bd)) //main CPU ROM, can match other datecodes too + ROM_LOAD("rom_dc118.bin", 0, 0x2000, CRC(10097ced) SHA1(bd665cf7e07e63f825b2353c8322ed8a4376b3bd)) // main CPU ROM, can match other datecodes too + + ROM_REGION( 0x100, "nvram", 0 ) // default data for battery-backed Calibration RAM + ROM_LOAD( "calram.bin", 0, 0x100, NO_DUMP) ROM_END /****************************************************************************** diff --git a/src/mame/drivers/jtc.cpp b/src/mame/drivers/jtc.cpp index 9da8a967a49..506d620658d 100644 --- a/src/mame/drivers/jtc.cpp +++ b/src/mame/drivers/jtc.cpp @@ -92,7 +92,6 @@ private: class jtces40_state : public jtc_state { public: - using jtc_state::jtc_state; jtces40_state(const machine_config &mconfig, device_type type, const char *tag) : jtc_state(mconfig, type, tag) , m_video_ram_40(*this, "videoram40", JTC_ES40_VIDEORAM_SIZE, ENDIANNESS_BIG) diff --git a/src/mame/drivers/klax.cpp b/src/mame/drivers/klax.cpp index 5eca22d1a4d..309705aa38a 100644 --- a/src/mame/drivers/klax.cpp +++ b/src/mame/drivers/klax.cpp @@ -89,7 +89,7 @@ void klax_bootleg_state::machine_start() m_audio_sample[0] = m_audio_sample[1] = 0x00; m_audio_nibble = 0; - save_pointer(NAME(m_audio_sample), 2); + save_item(NAME(m_audio_sample)); save_item(NAME(m_audio_nibble)); } diff --git a/src/mame/drivers/monkey_king_3b.cpp b/src/mame/drivers/monkey_king_3b.cpp index 3b959e84848..4d984b18a3c 100644 --- a/src/mame/drivers/monkey_king_3b.cpp +++ b/src/mame/drivers/monkey_king_3b.cpp @@ -111,7 +111,7 @@ private: void mk3b_soc_state::map(address_map &map) { // 64MB external NOR flash - map(0x08000000, 0x0BFFFFFF).rom().share("norflash");; + map(0x08000000, 0x0BFFFFFF).rom().share("norflash"); // unknown amount and configuration of internal RAM map(0x00000000, 0x0000FFFF).ram().share("iram0"); // This section of RAM seems to contain the stack diff --git a/src/mame/drivers/tigeroad.cpp b/src/mame/drivers/tigeroad.cpp index aeae6eacef4..49b83e36797 100644 --- a/src/mame/drivers/tigeroad.cpp +++ b/src/mame/drivers/tigeroad.cpp @@ -112,6 +112,7 @@ void tigeroad_state::main_map(address_map &map) map(0xfe8000, 0xfe8003).w(FUNC(tigeroad_state::scroll_w)); map(0xfe800e, 0xfe800f).nopw(); // fe800e = watchdog or IRQ acknowledge map(0xfec000, 0xfec7ff).ram().w(FUNC(tigeroad_state::videoram_w)).share("videoram"); + map(0xff8000, 0xff87ff).ram().w(m_palette, FUNC(palette_device::write16)).share("palette"); map(0xffc000, 0xffffff).ram().share("ram16"); } diff --git a/src/mame/drivers/v1050.cpp b/src/mame/drivers/v1050.cpp index a9015497ac3..016e2cb1acd 100644 --- a/src/mame/drivers/v1050.cpp +++ b/src/mame/drivers/v1050.cpp @@ -983,7 +983,7 @@ void v1050_state::machine_start() program.install_readwrite_bank(0x2000, 0x3fff, membank("bank2")); membank("bank2")->configure_entries(0, 2, ram + 0x2000, 0x10000); membank("bank2")->configure_entry(2, ram + 0x1e000); - + program.install_readwrite_bank(0x4000, 0x7fff, membank("bank3")); membank("bank3")->configure_entries(0, 2, ram + 0x4000, 0x10000); diff --git a/src/mame/drivers/voyager.cpp b/src/mame/drivers/voyager.cpp index fd426832056..8d9d7dfccbe 100644 --- a/src/mame/drivers/voyager.cpp +++ b/src/mame/drivers/voyager.cpp @@ -263,7 +263,7 @@ void voyager_state::voyager_map(address_map &map) map(0x000a0000, 0x000bffff).rw("vga", FUNC(trident_vga_device::mem_r), FUNC(trident_vga_device::mem_w)); // VGA VRAM map(0x000c0000, 0x000c7fff).rom().region("video_bios", 0); map(0x000c8000, 0x000cffff).noprw(); - //map(0x000d0000, 0x000d0003).ram(); // XYLINX - Synchronus serial communication + //map(0x000d0000, 0x000d0003).ram(); // XYLINX - Synchronous serial communication map(0x000d0008, 0x000d000b).nopw(); // ??? map(0x000d0800, 0x000d0fff).rw(FUNC(voyager_state::nvram_r), FUNC(voyager_state::nvram_w)); // GAME_CMOS diff --git a/src/mame/includes/ojankohs.h b/src/mame/includes/ojankohs.h index 086ba486e67..1d092da76cf 100644 --- a/src/mame/includes/ojankohs.h +++ b/src/mame/includes/ojankohs.h @@ -18,6 +18,16 @@ class ojankohs_state : public driver_device { public: + ojankohs_state(const machine_config &mconfig, device_type type, const char *tag) : + ojankohs_state(mconfig, type, tag, 0x1000, 0x800) + { } + + void ojankohs(machine_config &config); + void ccasino(machine_config &config); + void ojankoc(machine_config &config); + void ojankoy(machine_config &config); + +protected: ojankohs_state(const machine_config &mconfig, device_type type, const char *tag, uint32_t vramsize, uint32_t pramsize) : driver_device(mconfig, type, tag), m_videoram(*this, "videoram", vramsize, ENDIANNESS_LITTLE), @@ -37,16 +47,6 @@ public: m_dsw3(*this, "dsw3"), m_dsw4(*this, "dsw4") { } - ojankohs_state(const machine_config &mconfig, device_type type, const char *tag) : - ojankohs_state(mconfig, type, tag, 0x1000, 0x800) - { } - - void ojankohs(machine_config &config); - void ccasino(machine_config &config); - void ojankoc(machine_config &config); - void ojankoy(machine_config &config); - -protected: virtual void machine_reset() override; private: diff --git a/src/mame/machine/315_5195.cpp b/src/mame/machine/315_5195.cpp index d7929f34826..2ed58b60793 100644 --- a/src/mame/machine/315_5195.cpp +++ b/src/mame/machine/315_5195.cpp @@ -564,7 +564,7 @@ void *sega_315_5195_mapper_device::decrypt_bank::set(offs_t start, offs_t end, o m_start = start; m_end = end; m_rgnoffs = rgnoffs; - m_srcptr = static_cast(src); + m_srcptr = reinterpret_cast(src); // configure the fd1094 cache if (m_fd1094_cache != nullptr) diff --git a/src/mame/video/toaplan1.cpp b/src/mame/video/toaplan1.cpp index e90089eca16..27aeb702505 100644 --- a/src/mame/video/toaplan1.cpp +++ b/src/mame/video/toaplan1.cpp @@ -233,8 +233,8 @@ void toaplan1_rallybik_state::video_start() create_tilemaps(); vram_alloc(); - m_buffered_spriteram = make_unique_clear(m_spriteram.share()->bytes() / 2); - save_pointer(NAME(m_buffered_spriteram), m_spriteram.share()->bytes() / 2); + m_buffered_spriteram = make_unique_clear(m_spriteram.bytes() / 2); + save_pointer(NAME(m_buffered_spriteram), m_spriteram.bytes() / 2); m_tilemap[0]->set_scrolldx(-0x00d - 6, -0x80 + 6); m_tilemap[1]->set_scrolldx(-0x00d - 4, -0x80 + 4); @@ -771,7 +771,7 @@ void toaplan1_state::draw_sprites(screen_device &screen, bitmap_rgb32 &bitmap, c u16 *size = (u16 *)m_buffered_spritesizeram.get(); int fcu_flipscreen = m_fcu_flipscreen; - for (int offs = m_spriteram.share()->bytes() / 2 - 4; offs >= 0; offs -= 4) + for (int offs = m_spriteram.bytes() / 2 - 4; offs >= 0; offs -= 4) { if (!(source[offs] & 0x8000)) { @@ -839,7 +839,7 @@ u32 toaplan1_rallybik_state::screen_update(screen_device &screen, bitmap_rgb32 & { log_vram(); - m_spritegen->draw_sprites_to_tempbitmap(cliprect, m_buffered_spriteram.get(), m_spriteram.share()->bytes()); + m_spritegen->draw_sprites_to_tempbitmap(cliprect, m_buffered_spriteram.get(), m_spriteram.bytes()); // first draw everything, including "disabled" tiles and priority 0 m_tilemap[0]->draw(screen, bitmap, cliprect, TILEMAP_DRAW_OPAQUE | TILEMAP_DRAW_ALL_CATEGORIES, 0); @@ -895,7 +895,7 @@ WRITE_LINE_MEMBER(toaplan1_rallybik_state::screen_vblank) // rising edge if (state) { - memcpy(m_buffered_spriteram.get(), m_spriteram, m_spriteram.share()->bytes()); + memcpy(m_buffered_spriteram.get(), m_spriteram, m_spriteram.bytes()); interrupt(); } } @@ -905,7 +905,7 @@ WRITE_LINE_MEMBER(toaplan1_state::screen_vblank) // rising edge if (state) { - memcpy(m_buffered_spriteram.get(), m_spriteram, m_spriteram.share()->bytes()); + memcpy(m_buffered_spriteram.get(), m_spriteram, m_spriteram.bytes()); memcpy(m_buffered_spritesizeram.get(), m_spritesizeram.get(), TOAPLAN1_SPRITESIZERAM_SIZE); interrupt(); } @@ -916,7 +916,7 @@ WRITE_LINE_MEMBER(toaplan1_samesame_state::screen_vblank) // rising edge if (state) { - memcpy(m_buffered_spriteram.get(), m_spriteram, m_spriteram.share()->bytes()); + memcpy(m_buffered_spriteram.get(), m_spriteram, m_spriteram.bytes()); memcpy(m_buffered_spritesizeram.get(), m_spritesizeram.get(), TOAPLAN1_SPRITESIZERAM_SIZE); interrupt(); m_maincpu->set_input_line(M68K_IRQ_2, HOLD_LINE); /* Frame done */