From 22513fb6fe281f5ccb75aaddb6417a12a66c313d Mon Sep 17 00:00:00 2001 From: Olivier Galibert Date: Mon, 25 May 2020 16:42:42 +0200 Subject: 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). --- src/devices/cpu/mc68hc11/mc68hc11.cpp | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) (limited to 'src/devices/cpu/mc68hc11/mc68hc11.cpp') diff --git a/src/devices/cpu/mc68hc11/mc68hc11.cpp b/src/devices/cpu/mc68hc11/mc68hc11.cpp index 453c048231f..3aa83784ca7 100644 --- a/src/devices/cpu/mc68hc11/mc68hc11.cpp +++ b/src/devices/cpu/mc68hc11/mc68hc11.cpp @@ -552,13 +552,13 @@ void mc68hc11m0_device::io_map(address_map &map) uint8_t mc68hc11_cpu_device::FETCH() { - return m_cache->read_byte(m_pc++); + return m_cache.read_byte(m_pc++); } uint16_t mc68hc11_cpu_device::FETCH16() { uint16_t w; - w = m_cache->read_word(m_pc); + w = m_cache.read_word(m_pc); m_pc += 2; return w; } @@ -567,28 +567,28 @@ uint8_t mc68hc11_cpu_device::READ8(uint32_t address) { if(address >= m_reg_position && (address - m_reg_position) < m_reg_block_size) { - return m_io->read_byte(address-m_reg_position); + return m_io.read_byte(address-m_reg_position); } else if(address >= m_ram_position && address < m_ram_position+m_internal_ram_size) { - return m_data->read_byte(address-m_ram_position); + return m_data.read_byte(address-m_ram_position); } - return m_program->read_byte(address); + return m_program.read_byte(address); } void mc68hc11_cpu_device::WRITE8(uint32_t address, uint8_t value) { if(address >= m_reg_position && (address - m_reg_position) < m_reg_block_size) { - m_io->write_byte(address-m_reg_position, value); + m_io.write_byte(address-m_reg_position, value); return; } else if(address >= m_ram_position && address < m_ram_position+m_internal_ram_size) { - m_data->write_byte(address-m_ram_position, value); + m_data.write_byte(address-m_ram_position, value); return; } - m_program->write_byte(address, value); + m_program.write_byte(address, value); } uint16_t mc68hc11_cpu_device::READ16(uint32_t address) @@ -639,10 +639,10 @@ void mc68hc11_cpu_device::device_start() } } - m_program = &space(AS_PROGRAM); - m_cache = m_program->cache<0, 0, ENDIANNESS_BIG>(); - m_data = &space(AS_DATA); - m_io = &space(AS_IO); + space(AS_PROGRAM).cache(m_cache); + space(AS_PROGRAM).specific(m_program); + space(AS_DATA).specific(m_data); + space(AS_IO).specific(m_io); save_item(NAME(m_pc)); save_item(NAME(m_ix)); -- cgit v1.2.3-70-g09d2