summaryrefslogtreecommitdiffstatshomepage
path: root/src/devices/cpu/tms7000/tms7000.h
diff options
context:
space:
mode:
author Olivier Galibert <galibert@pobox.com>2020-05-25 16:42:42 +0200
committer Olivier Galibert <galibert@pobox.com>2020-05-25 16:42:57 +0200
commit22513fb6fe281f5ccb75aaddb6417a12a66c313d (patch)
tree3cf84032cc6482d685a8dbb57e015bd17c7f7fdc /src/devices/cpu/tms7000/tms7000.h
parente42c2d2874cf9c1092c01ab5ce9ef997d465ce25 (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/tms7000/tms7000.h')
-rw-r--r--src/devices/cpu/tms7000/tms7000.h44
1 files changed, 22 insertions, 22 deletions
diff --git a/src/devices/cpu/tms7000/tms7000.h b/src/devices/cpu/tms7000/tms7000.h
index cf1ced0e9b0..a35656422ff 100644
--- a/src/devices/cpu/tms7000/tms7000.h
+++ b/src/devices/cpu/tms7000/tms7000.h
@@ -113,8 +113,8 @@ protected:
const uint32_t m_info_flags;
unsigned m_divider;
- address_space *m_program;
- memory_access_cache<0, 0, ENDIANNESS_BIG> *m_cache;
+ memory_access<16, 0, 0, ENDIANNESS_BIG>::cache m_cache;
+ memory_access<16, 0, 0, ENDIANNESS_BIG>::specific m_program;
int m_icount;
bool m_irq_state[2];
@@ -148,26 +148,26 @@ protected:
void timer_tick_low(int tmr);
// internal read/write
- inline uint8_t read_r8(uint8_t address) { return m_program->read_byte(address); }
- inline void write_r8(uint8_t address, uint8_t data) { m_program->write_byte(address, data); }
- inline uint16_t read_r16(uint8_t address) { return m_program->read_byte((address - 1) & 0xff) << 8 | m_program->read_byte(address); }
- inline void write_r16(uint8_t address, uint16_t data) { m_program->write_byte((address - 1) & 0xff, data >> 8 & 0xff); m_program->write_byte(address, data & 0xff); }
-
- inline uint8_t read_p(uint8_t address) { return m_program->read_byte(0x100 + address); }
- inline void write_p(uint8_t address, uint8_t data) { m_program->write_byte(0x100 + address, data); }
-
- inline uint8_t read_mem8(uint16_t address) { return m_program->read_byte(address); }
- inline void write_mem8(uint16_t address, uint8_t data) { m_program->write_byte(address, data); }
- inline uint16_t read_mem16(uint16_t address) { return m_program->read_byte(address) << 8 | m_program->read_byte((address + 1) & 0xffff); }
- inline void write_mem16(uint16_t address, uint16_t data) { m_program->write_byte(address, data >> 8 & 0xff); m_program->write_byte((address + 1) & 0xffff, data & 0xff); }
-
- inline uint8_t imm8() { return m_cache->read_byte(m_pc++); }
- inline uint16_t imm16() { uint16_t ret = m_cache->read_byte(m_pc++) << 8; return ret | m_cache->read_byte(m_pc++); }
-
- inline uint8_t pull8() { return m_program->read_byte(m_sp--); }
- inline void push8(uint8_t data) { m_program->write_byte(++m_sp, data); }
- inline uint16_t pull16() { uint16_t ret = m_program->read_byte(m_sp--); return ret | m_program->read_byte(m_sp--) << 8; }
- inline void push16(uint16_t data) { m_program->write_byte(++m_sp, data >> 8 & 0xff); m_program->write_byte(++m_sp, data & 0xff); }
+ inline uint8_t read_r8(uint8_t address) { return m_program.read_byte(address); }
+ inline void write_r8(uint8_t address, uint8_t data) { m_program.write_byte(address, data); }
+ inline uint16_t read_r16(uint8_t address) { return m_program.read_byte((address - 1) & 0xff) << 8 | m_program.read_byte(address); }
+ inline void write_r16(uint8_t address, uint16_t data) { m_program.write_byte((address - 1) & 0xff, data >> 8 & 0xff); m_program.write_byte(address, data & 0xff); }
+
+ inline uint8_t read_p(uint8_t address) { return m_program.read_byte(0x100 + address); }
+ inline void write_p(uint8_t address, uint8_t data) { m_program.write_byte(0x100 + address, data); }
+
+ inline uint8_t read_mem8(uint16_t address) { return m_program.read_byte(address); }
+ inline void write_mem8(uint16_t address, uint8_t data) { m_program.write_byte(address, data); }
+ inline uint16_t read_mem16(uint16_t address) { return m_program.read_byte(address) << 8 | m_program.read_byte((address + 1) & 0xffff); }
+ inline void write_mem16(uint16_t address, uint16_t data) { m_program.write_byte(address, data >> 8 & 0xff); m_program.write_byte((address + 1) & 0xffff, data & 0xff); }
+
+ inline uint8_t imm8() { return m_cache.read_byte(m_pc++); }
+ inline uint16_t imm16() { uint16_t ret = m_cache.read_byte(m_pc++) << 8; return ret | m_cache.read_byte(m_pc++); }
+
+ inline uint8_t pull8() { return m_program.read_byte(m_sp--); }
+ inline void push8(uint8_t data) { m_program.write_byte(++m_sp, data); }
+ inline uint16_t pull16() { uint16_t ret = m_program.read_byte(m_sp--); return ret | m_program.read_byte(m_sp--) << 8; }
+ inline void push16(uint16_t data) { m_program.write_byte(++m_sp, data >> 8 & 0xff); m_program.write_byte(++m_sp, data & 0xff); }
// statusreg flags
enum