diff options
author | 2020-05-25 16:42:42 +0200 | |
---|---|---|
committer | 2020-05-25 16:42:57 +0200 | |
commit | 22513fb6fe281f5ccb75aaddb6417a12a66c313d (patch) | |
tree | 3cf84032cc6482d685a8dbb57e015bd17c7f7fdc /src/devices/cpu/v30mz/v30mz.cpp | |
parent | e42c2d2874cf9c1092c01ab5ce9ef997d465ce25 (diff) |
emumem: A little more speedup. cache and specific change syntax, and are not pointers anymore [O. Galibert]
The last(?) two changes are:
- Add a template parameter to everything (theoretically the address
space width, in practice a level derived from it to keep as much
compatibility between widths as possible) so that the shift size
becomes a constant.
- Change the syntax of declaring and initializing the caches and
specifics so that they're embedded in the owner device. Solves
lifetime issues and also removes one indirection (looking up the base
dispatch pointer through the cache/specific pointer).
Diffstat (limited to 'src/devices/cpu/v30mz/v30mz.cpp')
-rw-r--r-- | src/devices/cpu/v30mz/v30mz.cpp | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/src/devices/cpu/v30mz/v30mz.cpp b/src/devices/cpu/v30mz/v30mz.cpp index c556f3f01f3..db96c6b92e5 100644 --- a/src/devices/cpu/v30mz/v30mz.cpp +++ b/src/devices/cpu/v30mz/v30mz.cpp @@ -146,9 +146,9 @@ device_memory_interface::space_config_vector v30mz_cpu_device::memory_space_conf void v30mz_cpu_device::device_start() { - m_program = &space(AS_PROGRAM); - m_cache = m_program->cache<0, 0, ENDIANNESS_LITTLE>(); - m_io = &space(AS_IO); + space(AS_PROGRAM).cache(m_cache); + space(AS_PROGRAM).specific(m_program); + space(AS_IO).specific(m_io); save_item(NAME(m_regs.w)); save_item(NAME(m_sregs)); @@ -282,44 +282,44 @@ inline uint32_t v30mz_cpu_device::pc() inline uint8_t v30mz_cpu_device::read_byte(uint32_t addr) { - return m_program->read_byte(addr); + return m_program.read_byte(addr); } inline uint16_t v30mz_cpu_device::read_word(uint32_t addr) { - return m_program->read_byte(addr) | ( m_program->read_byte(addr+1) << 8 ); + return m_program.read_byte(addr) | ( m_program.read_byte(addr+1) << 8 ); } inline void v30mz_cpu_device::write_byte(uint32_t addr, uint8_t data) { - m_program->write_byte(addr, data); + m_program.write_byte(addr, data); } inline void v30mz_cpu_device::write_word(uint32_t addr, uint16_t data) { - m_program->write_byte( addr, data & 0xff ); - m_program->write_byte( addr + 1, data >> 8 ); + m_program.write_byte( addr, data & 0xff ); + m_program.write_byte( addr + 1, data >> 8 ); } inline uint8_t v30mz_cpu_device::read_port(uint16_t port) { - return m_io->read_byte(port); + return m_io.read_byte(port); } inline void v30mz_cpu_device::write_port(uint16_t port, uint8_t data) { - m_io->write_byte(port, data); + m_io.write_byte(port, data); } inline uint8_t v30mz_cpu_device::fetch_op() { - uint8_t data = m_cache->read_byte( pc() ); + uint8_t data = m_cache.read_byte( pc() ); m_ip++; return data; } @@ -327,7 +327,7 @@ inline uint8_t v30mz_cpu_device::fetch_op() inline uint8_t v30mz_cpu_device::fetch() { - uint8_t data = m_cache->read_byte( pc() ); + uint8_t data = m_cache.read_byte( pc() ); m_ip++; return data; } |