summaryrefslogtreecommitdiffstatshomepage
path: root/src/devices/cpu/pps4
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/pps4
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/pps4')
-rw-r--r--src/devices/cpu/pps4/pps4.cpp25
-rw-r--r--src/devices/cpu/pps4/pps4.h8
2 files changed, 17 insertions, 16 deletions
diff --git a/src/devices/cpu/pps4/pps4.cpp b/src/devices/cpu/pps4/pps4.cpp
index f17b420a004..7f0b9ba70dd 100644
--- a/src/devices/cpu/pps4/pps4.cpp
+++ b/src/devices/cpu/pps4/pps4.cpp
@@ -123,7 +123,7 @@ device_memory_interface::space_config_vector pps4_device::memory_space_config()
*/
u8 pps4_device::M()
{
- u8 ret = m_data->read_byte(m_B & ~m_SAG);
+ u8 ret = m_data.read_byte(m_B & ~m_SAG);
m_SAG = 0;
return ret;
}
@@ -135,7 +135,7 @@ u8 pps4_device::M()
*/
void pps4_device::W(u8 data)
{
- m_data->write_byte(m_B & ~m_SAG, data);
+ m_data.write_byte(m_B & ~m_SAG, data);
m_SAG = 0;
}
@@ -153,7 +153,7 @@ std::unique_ptr<util::disasm_interface> pps4_device::create_disassembler()
*/
inline u8 pps4_device::ROP()
{
- const u8 op = m_cache->read_byte(m_P & 0xFFF);
+ const u8 op = m_cache.read_byte(m_P & 0xFFF);
m_Ip = m_I1; // save previous opcode
m_P = (m_P + 1) & 0xFFF;
m_icount -= 1;
@@ -169,7 +169,7 @@ inline u8 pps4_device::ROP()
*/
inline u8 pps4_device::ARG()
{
- const u8 arg = m_cache->read_byte(m_P & 0xFFF);
+ const u8 arg = m_cache.read_byte(m_P & 0xFFF);
m_P = (m_P + 1) & 0xFFF;
m_icount -= 1;
return arg;
@@ -1237,9 +1237,9 @@ void pps4_device::iIOL()
{
u8 ac = (~m_A & 15);
m_I2 = ARG();
- m_io->write_byte(m_I2, ac);
+ m_io.write_byte(m_I2, ac);
LOG("%s: port:%02x <- %x\n", __FUNCTION__, m_I2, ac);
- ac = m_io->read_byte(m_I2) & 15;
+ ac = m_io.read_byte(m_I2) & 15;
LOG("%s: port:%02x -> %x\n", __FUNCTION__, m_I2, ac);
m_A = ~ac & 15;
}
@@ -1568,10 +1568,10 @@ void pps4_device::execute_run()
void pps4_device::device_start()
{
- m_program = &space(AS_PROGRAM);
- m_cache = m_program->cache<0, 0, ENDIANNESS_LITTLE>();
- 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_A));
save_item(NAME(m_X));
@@ -1658,9 +1658,10 @@ void pps4_2_device::device_reset()
READ16_MEMBER(pps4_device::address_bus_r)
{
- if (&space == m_io || &space == m_data)
+ int id = space.spacenum();
+ if (id == AS_IO || id == AS_DATA)
return m_B;
- else if (&space == m_program)
+ else if (id == AS_PROGRAM)
return m_P;
else
return 0;
diff --git a/src/devices/cpu/pps4/pps4.h b/src/devices/cpu/pps4/pps4.h
index e3ca3b012bb..f4047e68e99 100644
--- a/src/devices/cpu/pps4/pps4.h
+++ b/src/devices/cpu/pps4/pps4.h
@@ -79,10 +79,10 @@ protected:
devcb_read8 m_dib_cb;
devcb_write8 m_do_cb;
- address_space *m_program;
- memory_access_cache<0, 0, ENDIANNESS_LITTLE> *m_cache;
- address_space *m_data;
- address_space *m_io;
+ memory_access<12, 0, 0, ENDIANNESS_LITTLE>::cache m_cache;
+ memory_access<12, 0, 0, ENDIANNESS_LITTLE>::specific m_program;
+ memory_access<12, 0, 0, ENDIANNESS_LITTLE>::specific m_data;
+ memory_access< 8, 0, 0, ENDIANNESS_LITTLE>::specific m_io;
int m_icount;
u8 m_A; //!< Accumulator A(4:1)