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/pace/pace.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/pace/pace.cpp')
-rw-r--r-- | src/devices/cpu/pace/pace.cpp | 26 |
1 files changed, 8 insertions, 18 deletions
diff --git a/src/devices/cpu/pace/pace.cpp b/src/devices/cpu/pace/pace.cpp index b971edc41fa..2bfba2cc338 100644 --- a/src/devices/cpu/pace/pace.cpp +++ b/src/devices/cpu/pace/pace.cpp @@ -65,8 +65,6 @@ ALLOW_SAVE_TYPE(pace_device::cycle); pace_device::pace_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, u32 clock) : cpu_device(mconfig, type, tag, owner, clock) , m_space_config("program", ENDIANNESS_LITTLE, 16, 16, -1) - , m_space(nullptr) - , m_cache(nullptr) , m_bps_callback(*this) , m_jc_callback(*this) , m_flag_callback(*this) @@ -132,8 +130,8 @@ void pace_device::device_resolve_objects() void pace_device::device_start() { // get memory spaces - m_space = &space(AS_PROGRAM); - m_cache = m_space->cache<1, -1, ENDIANNESS_LITTLE>(); + space(AS_PROGRAM).cache(m_cache); + space(AS_PROGRAM).specific(m_space); set_icountptr(m_icount); @@ -542,7 +540,7 @@ void pace_device::read_instruction() // TODO: interrupt check m_ppc = m_pc; debugger_instruction_hook(m_pc); - m_mdr = m_cache->read_word(m_pc++); + m_mdr = m_cache.read_word(m_pc++); m_cir = m_mdr >> 6; sign_extend(m_mdr); } @@ -583,12 +581,7 @@ void pace_device::read_effective_address() { // All opcodes with bit 15 set read from an EA except RTS and non-indirect ST if (m_cir > 0x200 && (m_cir & 0x3c0) != 0x340) - { - if ((m_cir & 0x00c) == 0x004) - m_mdr = m_cache->read_word(m_mar); - else - m_mdr = m_space->read_word(m_mar); - } + m_mdr = m_space.read_word(m_mar); } @@ -599,10 +592,7 @@ void pace_device::read_effective_address() void pace_device::write_effective_address(u16 r) { - if ((m_cir & 0x00c) == 0x004) - m_cache->write_word(m_mar, r); - else - m_space->write_word(m_mar, r); + m_space.write_word(m_mar, r); } @@ -733,7 +723,7 @@ pace_device::cycle pace_device::execute_one() return cycle::IFETCH_M1; case cycle::LD_IND_M4: - m_mdr = m_space->read_word(m_mdr); + m_mdr = m_space.read_word(m_mdr); return cycle::LD_IND_M5; case cycle::LD_IND_M5: @@ -745,11 +735,11 @@ pace_device::cycle pace_device::execute_one() return cycle::IFETCH_M1; case cycle::ST_IND_M4: - m_space->write_word(m_mdr, m_ac[0]); + m_space.write_word(m_mdr, m_ac[0]); return cycle::IFETCH_M1; case cycle::LSEX_M4: - m_mdr = m_space->read_word(m_mdr); + m_mdr = m_space.read_word(m_mdr); sign_extend(m_mdr); return cycle::IFETCH_M1; |