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/pic16c5x/pic16c5x.cpp | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'src/devices/cpu/pic16c5x/pic16c5x.cpp') diff --git a/src/devices/cpu/pic16c5x/pic16c5x.cpp b/src/devices/cpu/pic16c5x/pic16c5x.cpp index 21907b7d369..715cf574ee1 100644 --- a/src/devices/cpu/pic16c5x/pic16c5x.cpp +++ b/src/devices/cpu/pic16c5x/pic16c5x.cpp @@ -197,14 +197,14 @@ std::unique_ptr pic16c5x_device::create_disassembler() void pic16c5x_device::update_internalram_ptr() { - m_internalram = (uint8_t *)m_data->get_write_ptr(0x00); + m_internalram = (uint8_t *)space(AS_DATA).get_write_ptr(0x00); } -#define PIC16C5x_RDOP(A) (m_cache->read_word(A)) -#define PIC16C5x_RAM_RDMEM(A) ((uint8_t)m_data->read_byte(A)) -#define PIC16C5x_RAM_WRMEM(A,V) (m_data->write_byte(A,V)) +#define PIC16C5x_RDOP(A) (m_program.read_word(A)) +#define PIC16C5x_RAM_RDMEM(A) ((uint8_t)m_data.read_byte(A)) +#define PIC16C5x_RAM_WRMEM(A,V) (m_data.write_byte(A,V)) #define M_RDRAM(A) (((A) < 9) ? m_internalram[A] : PIC16C5x_RAM_RDMEM(A)) #define M_WRTRAM(A,V) do { if ((A) < 9) m_internalram[A] = (V); else PIC16C5x_RAM_WRMEM(A,V); } while (0) @@ -887,9 +887,8 @@ enum void pic16c5x_device::device_start() { - m_program = &space(AS_PROGRAM); - m_cache = m_program->cache<1, -1, ENDIANNESS_LITTLE>(); - m_data = &space(AS_DATA); + space(AS_PROGRAM).cache(m_program); + space(AS_DATA).specific(m_data); m_read_a.resolve_safe(0); m_read_b.resolve_safe(0); -- cgit v1.2.3-70-g09d2