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/plus4 | |
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/plus4')
-rw-r--r-- | src/devices/bus/plus4/exp.cpp | 4 | ||||
-rw-r--r-- | src/devices/bus/plus4/exp.h | 8 | ||||
-rw-r--r-- | src/devices/bus/plus4/std.cpp | 16 |
3 files changed, 12 insertions, 16 deletions
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; |