summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author Olivier Galibert <galibert@pobox.com>2017-05-10 17:13:54 +0200
committer Olivier Galibert <galibert@pobox.com>2017-11-29 10:32:31 +0100
commitc46e1007a8c0b42b7c50dce9b8bc9dff0db328e5 (patch)
treeaa08023cdf065d10dbe9633c845496447c953484
parent5676444d8cf9da4b27ceba2efd0a2d82a343cc57 (diff)
emumem: API change [O. Galibert]
* direct_read_data is now a template which takes the address bus shift as a parameter. * address_space::direct<shift>() is now a template method that takes the shift as a parameter and returns a pointer instead of a reference * the address to give to {read|write}_* on address_space or direct_read_data is now the address one wants to access Longer explanation: Up until now, the {read|write}_* methods required the caller to give the byte offset instead of the actual address. That's the same on byte-addressing CPUs, e.g. the ones everyone knows, but it's different on the word/long/quad addressing ones (tms, sharc, etc...) or the bit-addressing one (tms340x0). Changing that required templatizing the direct access interface on the bus addressing granularity, historically called address bus shift. Also, since everybody was taking the address of the reference returned by direct(), and structurally didn't have much choice in the matter, it got changed to return a pointer directly. Longest historical explanation: In a cpu core, the hottest memory access, by far, is the opcode fetching. It's also an access with very good locality (doesn't move much, tends to stay in the same rom/ram zone even when jumping around, tends not to hit handlers), which makes efficient caching worthwhile (as in, 30-50% faster core iirc on something like the 6502, but that was 20 years ago and a number of things changed since then). In fact, opcode fetching was, in the distant past, just an array lookup indexed by pc on an offset pointer, which was updated on branches. It didn't stay that way because more elaborate access is often needed (handlers, banking with instructions crossing a bank...) but it still ends up with a frontend of "if the address is still in the current range read from pointer+address otherwise do the slowpath", e.g. two usually correctly predicted branches plus the read most of the time. Then the >8 bits cpus arrived. That was ok, it just required to do the add to a u8 *, then convert to a u16/u32 * and do the read. At the asm level, it was all identical except for the final read, and read_byte/word/long being separate there was no test (and associated overhead) added in the path. Then the word-addressing CPUs arrived with, iirc, the tms cpus used in atari games. They require, to read from the pointer, to shift the address, either explicitely, or implicitely through indexing a u16 *. There were three possibilities: 1- create a new read_* method for each size and granularity. That amounts to a lot of copy/paste in the end, and functions with identical prototypes so the compiler can't detect you're using the wrong one. 2- put a variable shift in the read path. That was too expensive especially since the most critical cpus are byte-addressing (68000 at the time was the key). Having bit-adressing cpus which means the shift can either be right or left depending on the variable makes things even worse. 3- require the caller to do the shift himself when needed. The last solution was chosen, and starting that day the address was a byte offset and not the real address. Which is, actually, quite surprising when writing a new cpu core or, worse, when using the read/write methods from the driver code. But since then, C++ happened. And, in particular, templates with non-type parameters. Suddendly, solution 1 can be done without the copy/paste and with different types allowing to detect (at runtime, but systematically and at startup) if you got it wrong, while still generating optimal code. So it was time to switch to that solution and makes the address parameter sane again. Especially since it makes mucking in the rest of the memory subsystem code a lot more understandable.
-rw-r--r--src/devices/cpu/8x300/8x300.cpp2
-rw-r--r--src/devices/cpu/8x300/8x300.h2
-rw-r--r--src/devices/cpu/adsp2100/adsp2100.cpp16
-rw-r--r--src/devices/cpu/adsp2100/adsp2100.h2
-rw-r--r--src/devices/cpu/alph8201/alph8201.cpp2
-rw-r--r--src/devices/cpu/alph8201/alph8201.h2
-rw-r--r--src/devices/cpu/am29000/am29000.cpp4
-rw-r--r--src/devices/cpu/am29000/am29000.h5
-rw-r--r--src/devices/cpu/arm/arm.cpp2
-rw-r--r--src/devices/cpu/arm/arm.h2
-rw-r--r--src/devices/cpu/arm7/arm7.cpp2
-rw-r--r--src/devices/cpu/arm7/arm7.h2
-rw-r--r--src/devices/cpu/arm7/arm7core.h2
-rw-r--r--src/devices/cpu/asap/asap.cpp2
-rw-r--r--src/devices/cpu/asap/asap.h2
-rw-r--r--src/devices/cpu/capricorn/capricorn.cpp2
-rw-r--r--src/devices/cpu/capricorn/capricorn.h2
-rw-r--r--src/devices/cpu/ccpu/ccpu.cpp6
-rw-r--r--src/devices/cpu/ccpu/ccpu.h2
-rw-r--r--src/devices/cpu/cop400/cop400.cpp2
-rw-r--r--src/devices/cpu/cop400/cop400.h2
-rw-r--r--src/devices/cpu/cosmac/cosmac.cpp2
-rw-r--r--src/devices/cpu/cosmac/cosmac.h2
-rw-r--r--src/devices/cpu/cp1610/cp1610.cpp6
-rw-r--r--src/devices/cpu/cubeqcpu/cubeqcpu.cpp12
-rw-r--r--src/devices/cpu/cubeqcpu/cubeqcpu.h6
-rw-r--r--src/devices/cpu/dsp16/dsp16.cpp8
-rw-r--r--src/devices/cpu/dsp16/dsp16.h2
-rw-r--r--src/devices/cpu/dsp32/dsp32.cpp2
-rw-r--r--src/devices/cpu/dsp32/dsp32.h2
-rw-r--r--src/devices/cpu/dsp56k/dsp56k.cpp8
-rw-r--r--src/devices/cpu/dsp56k/dsp56k.h2
-rw-r--r--src/devices/cpu/dsp56k/dsp56ops.hxx71
-rw-r--r--src/devices/cpu/dsp56k/inst.h1
-rw-r--r--src/devices/cpu/e0c6200/e0c6200.cpp2
-rw-r--r--src/devices/cpu/e132xs/e132xs.cpp4
-rw-r--r--src/devices/cpu/e132xs/e132xs.h2
-rw-r--r--src/devices/cpu/esrip/esrip.cpp4
-rw-r--r--src/devices/cpu/esrip/esrip.h2
-rw-r--r--src/devices/cpu/f8/f8.cpp2
-rw-r--r--src/devices/cpu/f8/f8.h2
-rw-r--r--src/devices/cpu/h6280/h6280.cpp2
-rw-r--r--src/devices/cpu/h6280/h6280.h2
-rw-r--r--src/devices/cpu/h8/h8.cpp2
-rw-r--r--src/devices/cpu/h8/h8.h2
-rw-r--r--src/devices/cpu/h8/h8_adc.cpp2
-rw-r--r--src/devices/cpu/h8/h8_port.cpp2
-rw-r--r--src/devices/cpu/hd61700/hd61700.cpp10
-rw-r--r--src/devices/cpu/hmcs40/hmcs40.cpp2
-rw-r--r--src/devices/cpu/hmcs40/hmcs40op.cpp2
-rw-r--r--src/devices/cpu/hphybrid/hphybrid.cpp1406
-rw-r--r--src/devices/cpu/hphybrid/hphybrid.h2
-rw-r--r--src/devices/cpu/i386/i386.cpp2
-rw-r--r--src/devices/cpu/i386/i386.h2
-rw-r--r--src/devices/cpu/i8008/i8008.cpp2
-rw-r--r--src/devices/cpu/i8008/i8008.h2
-rw-r--r--src/devices/cpu/i8085/i8085.cpp4
-rw-r--r--src/devices/cpu/i8085/i8085.h4
-rw-r--r--src/devices/cpu/i86/i86.cpp4
-rw-r--r--src/devices/cpu/i86/i86.h2
-rw-r--r--src/devices/cpu/i960/i960.cpp2
-rw-r--r--src/devices/cpu/i960/i960.h2
-rw-r--r--src/devices/cpu/ie15/ie15.cpp2
-rw-r--r--src/devices/cpu/ie15/ie15.h2
-rw-r--r--src/devices/cpu/jaguar/jaguar.cpp2
-rw-r--r--src/devices/cpu/jaguar/jaguar.h2
-rw-r--r--src/devices/cpu/lc8670/lc8670.cpp2
-rw-r--r--src/devices/cpu/lc8670/lc8670.h2
-rw-r--r--src/devices/cpu/lh5801/lh5801.cpp2
-rw-r--r--src/devices/cpu/lh5801/lh5801.h2
-rw-r--r--src/devices/cpu/m37710/m37710.cpp2
-rw-r--r--src/devices/cpu/m37710/m37710.h2
-rw-r--r--src/devices/cpu/m6502/m6502.cpp4
-rw-r--r--src/devices/cpu/m6502/m6502.h2
-rw-r--r--src/devices/cpu/m6800/m6800.cpp4
-rw-r--r--src/devices/cpu/m6800/m6800.h2
-rw-r--r--src/devices/cpu/m68000/m68000.h2
-rw-r--r--src/devices/cpu/m68000/m68kcpu.cpp20
-rw-r--r--src/devices/cpu/m6805/m6805.cpp5
-rw-r--r--src/devices/cpu/m6805/m6805.h2
-rw-r--r--src/devices/cpu/m6809/m6809.cpp4
-rw-r--r--src/devices/cpu/m6809/m6809.h2
-rw-r--r--src/devices/cpu/mb86233/mb86233.cpp8
-rw-r--r--src/devices/cpu/mb86233/mb86233.h2
-rw-r--r--src/devices/cpu/mb86235/mb86235.cpp2
-rw-r--r--src/devices/cpu/mb86235/mb86235.h2
-rw-r--r--src/devices/cpu/mb86235/mb86235drc.cpp11
-rw-r--r--src/devices/cpu/mb86235/mb86235fe.cpp2
-rw-r--r--src/devices/cpu/mb88xx/mb88xx.cpp2
-rw-r--r--src/devices/cpu/mb88xx/mb88xx.h2
-rw-r--r--src/devices/cpu/mc68hc11/mc68hc11.cpp2
-rw-r--r--src/devices/cpu/mc68hc11/mc68hc11.h2
-rw-r--r--src/devices/cpu/mcs40/mcs40.cpp2
-rw-r--r--src/devices/cpu/mcs40/mcs40.h2
-rw-r--r--src/devices/cpu/mcs48/mcs48.cpp2
-rw-r--r--src/devices/cpu/mcs48/mcs48.h2
-rw-r--r--src/devices/cpu/mcs51/mcs51.cpp2
-rw-r--r--src/devices/cpu/mcs51/mcs51.h2
-rw-r--r--src/devices/cpu/mcs96/i8x9x.cpp18
-rw-r--r--src/devices/cpu/mcs96/mcs96.cpp2
-rw-r--r--src/devices/cpu/mcs96/mcs96.h2
-rw-r--r--src/devices/cpu/melps4/melps4.cpp2
-rw-r--r--src/devices/cpu/mips/mips3.cpp2
-rw-r--r--src/devices/cpu/mips/mips3.h2
-rw-r--r--src/devices/cpu/mips/r3000.cpp2
-rw-r--r--src/devices/cpu/mips/r3000.h2
-rw-r--r--src/devices/cpu/nanoprocessor/nanoprocessor.cpp2
-rw-r--r--src/devices/cpu/nanoprocessor/nanoprocessor.h2
-rw-r--r--src/devices/cpu/nec/nec.cpp2
-rw-r--r--src/devices/cpu/nec/nec.h2
-rw-r--r--src/devices/cpu/nec/v25.cpp2
-rw-r--r--src/devices/cpu/nec/v25.h2
-rw-r--r--src/devices/cpu/pic16c5x/pic16c5x.cpp4
-rw-r--r--src/devices/cpu/pic16c5x/pic16c5x.h2
-rw-r--r--src/devices/cpu/pic16c62x/pic16c62x.cpp4
-rw-r--r--src/devices/cpu/pic16c62x/pic16c62x.h2
-rw-r--r--src/devices/cpu/powerpc/ppc.h2
-rw-r--r--src/devices/cpu/powerpc/ppccom.cpp2
-rw-r--r--src/devices/cpu/pps4/pps4.cpp2
-rw-r--r--src/devices/cpu/pps4/pps4.h2
-rw-r--r--src/devices/cpu/psx/psx.cpp2
-rw-r--r--src/devices/cpu/psx/psx.h2
-rw-r--r--src/devices/cpu/rsp/rsp.cpp2
-rw-r--r--src/devices/cpu/rsp/rsp.h2
-rw-r--r--src/devices/cpu/s2650/s2650.cpp2
-rw-r--r--src/devices/cpu/s2650/s2650.h2
-rw-r--r--src/devices/cpu/saturn/saturn.cpp2
-rw-r--r--src/devices/cpu/saturn/saturn.h2
-rw-r--r--src/devices/cpu/sc61860/sc61860.cpp2
-rw-r--r--src/devices/cpu/sc61860/sc61860.h2
-rw-r--r--src/devices/cpu/scmp/scmp.cpp2
-rw-r--r--src/devices/cpu/scmp/scmp.h2
-rw-r--r--src/devices/cpu/score/score.cpp2
-rw-r--r--src/devices/cpu/score/score.h2
-rw-r--r--src/devices/cpu/scudsp/scudsp.cpp8
-rw-r--r--src/devices/cpu/se3208/se3208.cpp4
-rw-r--r--src/devices/cpu/se3208/se3208.h2
-rw-r--r--src/devices/cpu/sh/sh.h2
-rw-r--r--src/devices/cpu/sh/sh2.cpp2
-rw-r--r--src/devices/cpu/sh/sh4.cpp2
-rw-r--r--src/devices/cpu/sharc/sharc.cpp4
-rw-r--r--src/devices/cpu/sharc/sharcdrc.cpp6
-rw-r--r--src/devices/cpu/sharc/sharcmem.hxx12
-rw-r--r--src/devices/cpu/ssp1601/ssp1601.cpp6
-rw-r--r--src/devices/cpu/ssp1601/ssp1601.h2
-rw-r--r--src/devices/cpu/t11/t11.cpp2
-rw-r--r--src/devices/cpu/t11/t11.h2
-rw-r--r--src/devices/cpu/tms1000/tms0980.cpp2
-rw-r--r--src/devices/cpu/tms32010/tms32010.cpp20
-rw-r--r--src/devices/cpu/tms32010/tms32010.h2
-rw-r--r--src/devices/cpu/tms32025/tms32025.cpp96
-rw-r--r--src/devices/cpu/tms32025/tms32025.h6
-rw-r--r--src/devices/cpu/tms32031/tms32031.cpp8
-rw-r--r--src/devices/cpu/tms32031/tms32031.h2
-rw-r--r--src/devices/cpu/tms32051/tms32051.cpp16
-rw-r--r--src/devices/cpu/tms32051/tms32051.h2
-rw-r--r--src/devices/cpu/tms32082/tms32082.cpp4
-rw-r--r--src/devices/cpu/tms32082/tms32082.h4
-rw-r--r--src/devices/cpu/tms34010/34010fld.hxx8
-rw-r--r--src/devices/cpu/tms34010/34010gfx.hxx90
-rw-r--r--src/devices/cpu/tms34010/34010ops.h72
-rw-r--r--src/devices/cpu/tms34010/34010ops.hxx8
-rw-r--r--src/devices/cpu/tms34010/tms34010.cpp66
-rw-r--r--src/devices/cpu/tms34010/tms34010.h6
-rw-r--r--src/devices/cpu/tms57002/tms57002.cpp4
-rw-r--r--src/devices/cpu/tms7000/tms7000.cpp2
-rw-r--r--src/devices/cpu/tms7000/tms7000.h2
-rw-r--r--src/devices/cpu/unsp/unsp.cpp4
-rw-r--r--src/devices/cpu/unsp/unspdasm.cpp2
-rw-r--r--src/devices/cpu/upd7725/upd7725.cpp8
-rw-r--r--src/devices/cpu/upd7725/upd7725.h2
-rw-r--r--src/devices/cpu/upd7810/upd7810.cpp2
-rw-r--r--src/devices/cpu/upd7810/upd7810.h2
-rw-r--r--src/devices/cpu/v30mz/v30mz.cpp2
-rw-r--r--src/devices/cpu/v30mz/v30mz.h2
-rw-r--r--src/devices/cpu/v60/v60.cpp2
-rw-r--r--src/devices/cpu/v60/v60.h2
-rw-r--r--src/devices/cpu/v810/v810.cpp2
-rw-r--r--src/devices/cpu/v810/v810.h2
-rw-r--r--src/devices/cpu/z180/z180.cpp4
-rw-r--r--src/devices/cpu/z180/z180.h4
-rw-r--r--src/devices/cpu/z8/z8.cpp2
-rw-r--r--src/devices/cpu/z8/z8.h2
-rw-r--r--src/devices/cpu/z80/z80.cpp4
-rw-r--r--src/devices/cpu/z80/z80.h4
-rw-r--r--src/devices/cpu/z8000/z8000.cpp4
-rw-r--r--src/devices/cpu/z8000/z8000.h2
-rw-r--r--src/devices/machine/68307.cpp2
-rw-r--r--src/devices/video/hd63484.cpp4
-rw-r--r--src/emu/addrmap.cpp20
-rw-r--r--src/emu/addrmap.h4
-rw-r--r--src/emu/debug/debugbuf.cpp10
-rw-r--r--src/emu/debug/debugcmd.cpp193
-rw-r--r--src/emu/debug/debugcpu.cpp24
-rw-r--r--src/emu/debug/dvmemory.cpp7
-rw-r--r--src/emu/dirom.cpp2
-rw-r--r--src/emu/dirom.h2
-rw-r--r--src/emu/emucore.h10
-rw-r--r--src/emu/emufwd.h2
-rw-r--r--src/emu/emumem.cpp869
-rw-r--r--src/emu/emumem.h270
-rw-r--r--src/frontend/mame/luaengine.cpp4
-rw-r--r--src/mame/audio/dcs.cpp24
-rw-r--r--src/mame/audio/turrett.cpp2
-rw-r--r--src/mame/drivers/atarisy4.cpp7
-rw-r--r--src/mame/drivers/coolpool.cpp4
-rw-r--r--src/mame/drivers/exterm.cpp4
-rw-r--r--src/mame/drivers/skimaxx.cpp4
-rw-r--r--src/mame/drivers/tickee.cpp4
-rw-r--r--src/mame/drivers/unichamp.cpp25
-rw-r--r--src/mame/drivers/vii.cpp20
-rw-r--r--src/mame/drivers/xtheball.cpp8
-rw-r--r--src/mame/includes/turrett.h2
-rw-r--r--src/mame/machine/c117.cpp4
-rw-r--r--src/mame/machine/c117.h2
-rw-r--r--src/mame/machine/inder_vid.cpp8
-rw-r--r--src/mame/machine/midtunit.cpp10
-rw-r--r--src/mame/machine/midyunit.cpp2
-rw-r--r--src/mame/machine/slapstic.cpp2
-rw-r--r--src/mame/video/artmagic.cpp8
-rw-r--r--src/mame/video/btoads.cpp10
-rw-r--r--src/mame/video/exterm.cpp8
-rw-r--r--src/mame/video/jpmimpct.cpp4
223 files changed, 2187 insertions, 1803 deletions
diff --git a/src/devices/cpu/8x300/8x300.cpp b/src/devices/cpu/8x300/8x300.cpp
index 93db492465e..575b3f2d0d0 100644
--- a/src/devices/cpu/8x300/8x300.cpp
+++ b/src/devices/cpu/8x300/8x300.cpp
@@ -97,7 +97,7 @@ uint8_t n8x300_cpu_device::get_reg(uint8_t reg)
void n8x300_cpu_device::device_start()
{
m_program = &space(AS_PROGRAM);
- m_direct = &m_program->direct();
+ m_direct = m_program->direct<0>();
m_io = &space(AS_IO);
save_item(NAME(m_PC));
diff --git a/src/devices/cpu/8x300/8x300.h b/src/devices/cpu/8x300/8x300.h
index d98cdd2c84d..7a36dc941a6 100644
--- a/src/devices/cpu/8x300/8x300.h
+++ b/src/devices/cpu/8x300/8x300.h
@@ -72,7 +72,7 @@ protected:
bool m_increment_pc;
address_space *m_program;
- direct_read_data *m_direct;
+ direct_read_data<0> *m_direct;
address_space *m_io;
uint16_t m_PC; // Program Counter
diff --git a/src/devices/cpu/adsp2100/adsp2100.cpp b/src/devices/cpu/adsp2100/adsp2100.cpp
index dd1b0ef0086..7c9b6da7727 100644
--- a/src/devices/cpu/adsp2100/adsp2100.cpp
+++ b/src/devices/cpu/adsp2100/adsp2100.cpp
@@ -418,7 +418,7 @@ void adsp21xx_device::device_start()
// get our address spaces
m_program = &space(AS_PROGRAM);
- m_direct = &m_program->direct();
+ m_direct = m_program->direct<-2>();
m_data = &space(AS_DATA);
m_io = has_space(AS_IO) ? &space(AS_IO) : nullptr;
@@ -776,37 +776,37 @@ util::disasm_interface *adsp21xx_device::create_disassembler()
inline uint16_t adsp21xx_device::data_read(uint32_t addr)
{
- return m_data->read_word(addr << 1);
+ return m_data->read_word(addr);
}
inline void adsp21xx_device::data_write(uint32_t addr, uint16_t data)
{
- m_data->write_word(addr << 1, data);
+ m_data->write_word(addr, data);
}
inline uint16_t adsp21xx_device::io_read(uint32_t addr)
{
- return m_io->read_word(addr << 1);
+ return m_io->read_word(addr);
}
inline void adsp21xx_device::io_write(uint32_t addr, uint16_t data)
{
- m_io->write_word(addr << 1, data);
+ m_io->write_word(addr, data);
}
inline uint32_t adsp21xx_device::program_read(uint32_t addr)
{
- return m_program->read_dword(addr << 2);
+ return m_program->read_dword(addr);
}
inline void adsp21xx_device::program_write(uint32_t addr, uint32_t data)
{
- m_program->write_dword(addr << 2, data & 0xffffff);
+ m_program->write_dword(addr, data & 0xffffff);
}
inline uint32_t adsp21xx_device::opcode_read()
{
- return m_direct->read_dword(m_pc << 2);
+ return m_direct->read_dword(m_pc);
}
diff --git a/src/devices/cpu/adsp2100/adsp2100.h b/src/devices/cpu/adsp2100/adsp2100.h
index 6835e984c31..4b2cbcd98a8 100644
--- a/src/devices/cpu/adsp2100/adsp2100.h
+++ b/src/devices/cpu/adsp2100/adsp2100.h
@@ -450,7 +450,7 @@ protected:
address_space * m_program;
address_space * m_data;
address_space * m_io;
- direct_read_data * m_direct;
+ direct_read_data<-2> *m_direct;
// tables
uint8_t m_condition_table[0x1000];
diff --git a/src/devices/cpu/alph8201/alph8201.cpp b/src/devices/cpu/alph8201/alph8201.cpp
index b3eda17fd48..8a422d3a450 100644
--- a/src/devices/cpu/alph8201/alph8201.cpp
+++ b/src/devices/cpu/alph8201/alph8201.cpp
@@ -394,7 +394,7 @@ const alpha8201_cpu_device::s_opcode alpha8201_cpu_device::opcode_8301[256]=
void alpha8201_cpu_device::device_start()
{
m_program = &space(AS_PROGRAM);
- m_direct = &m_program->direct();
+ m_direct = m_program->direct<0>();
state_add( ALPHA8201_PC, "PC", m_pc.w.l ).callimport().mask(0x3ff).formatstr("%03X");
state_add( ALPHA8201_SP, "SP", m_sp ).callimport().callexport().formatstr("%02X");
diff --git a/src/devices/cpu/alph8201/alph8201.h b/src/devices/cpu/alph8201/alph8201.h
index aa17c6d8dc0..5627bf23068 100644
--- a/src/devices/cpu/alph8201/alph8201.h
+++ b/src/devices/cpu/alph8201/alph8201.h
@@ -388,7 +388,7 @@ protected:
u8 m_halt; /* halt input line */
address_space *m_program;
- direct_read_data *m_direct;
+ direct_read_data<0> *m_direct;
int m_icount;
int m_inst_cycles;
diff --git a/src/devices/cpu/am29000/am29000.cpp b/src/devices/cpu/am29000/am29000.cpp
index 624cf2ae29f..fffd26c3cbc 100644
--- a/src/devices/cpu/am29000/am29000.cpp
+++ b/src/devices/cpu/am29000/am29000.cpp
@@ -131,9 +131,9 @@ device_memory_interface::space_config_vector am29000_cpu_device::memory_space_co
void am29000_cpu_device::device_start()
{
m_program = &space(AS_PROGRAM);
- m_direct = &m_program->direct();
+ m_direct = m_program->direct<0>();
m_data = &space(AS_DATA);
- m_datadirect = &m_data->direct();
+ m_datadirect = m_data->direct<0>();
m_io = &space(AS_IO);
m_cfg = (PRL_AM29000 | PRL_REV_D) << CFG_PRL_SHIFT;
diff --git a/src/devices/cpu/am29000/am29000.h b/src/devices/cpu/am29000/am29000.h
index 746a8dd7254..d7d061996e8 100644
--- a/src/devices/cpu/am29000/am29000.h
+++ b/src/devices/cpu/am29000/am29000.h
@@ -630,9 +630,10 @@ protected:
uint32_t m_next_pc;
address_space *m_program;
- direct_read_data *m_direct;
+ direct_read_data<0> *m_direct;
address_space *m_data;
- direct_read_data *m_datadirect;
+
+ direct_read_data<0> *m_datadirect;
address_space *m_io;
typedef void ( am29000_cpu_device::*opcode_func ) ();
diff --git a/src/devices/cpu/arm/arm.cpp b/src/devices/cpu/arm/arm.cpp
index ccf0f3e5009..77c8a44ac6d 100644
--- a/src/devices/cpu/arm/arm.cpp
+++ b/src/devices/cpu/arm/arm.cpp
@@ -510,7 +510,7 @@ void arm_cpu_device::execute_set_input(int irqline, int state)
void arm_cpu_device::device_start()
{
m_program = &space(AS_PROGRAM);
- m_direct = &m_program->direct();
+ m_direct = m_program->direct<0>();
save_item(NAME(m_sArmRegister));
save_item(NAME(m_coproRegister));
diff --git a/src/devices/cpu/arm/arm.h b/src/devices/cpu/arm/arm.h
index 653d316b1fe..3cfb1386fa9 100644
--- a/src/devices/cpu/arm/arm.h
+++ b/src/devices/cpu/arm/arm.h
@@ -74,7 +74,7 @@ protected:
uint8_t m_pendingIrq;
uint8_t m_pendingFiq;
address_space *m_program;
- direct_read_data *m_direct;
+ direct_read_data<0> *m_direct;
endianness_t m_endian;
copro_type m_copro_type;
diff --git a/src/devices/cpu/arm7/arm7.cpp b/src/devices/cpu/arm7/arm7.cpp
index cf8a8560990..6538e573935 100644
--- a/src/devices/cpu/arm7/arm7.cpp
+++ b/src/devices/cpu/arm7/arm7.cpp
@@ -555,7 +555,7 @@ bool arm7_cpu_device::memory_translate(int spacenum, int intention, offs_t &addr
void arm7_cpu_device::device_start()
{
m_program = &space(AS_PROGRAM);
- m_direct = &m_program->direct();
+ m_direct = m_program->direct<0>();
save_item(NAME(m_r));
save_item(NAME(m_pendingIrq));
diff --git a/src/devices/cpu/arm7/arm7.h b/src/devices/cpu/arm7/arm7.h
index b6c9926610e..2fde4b1805a 100644
--- a/src/devices/cpu/arm7/arm7.h
+++ b/src/devices/cpu/arm7/arm7.h
@@ -162,7 +162,7 @@ protected:
int m_icount;
endianness_t m_endian;
address_space *m_program;
- direct_read_data *m_direct;
+ direct_read_data<0> *m_direct;
/* Coprocessor Registers */
uint32_t m_control;
diff --git a/src/devices/cpu/arm7/arm7core.h b/src/devices/cpu/arm7/arm7core.h
index 14d6f6267e8..9ae499ae109 100644
--- a/src/devices/cpu/arm7/arm7core.h
+++ b/src/devices/cpu/arm7/arm7core.h
@@ -163,7 +163,7 @@ struct arm_state
int m_icount;
endianness_t m_endian;
address_space *m_program;
- direct_read_data *m_direct;
+ direct_read_data<0> *m_direct;
/* Coprocessor Registers */
uint32_t m_control;
diff --git a/src/devices/cpu/asap/asap.cpp b/src/devices/cpu/asap/asap.cpp
index 94d54c4e4ea..c5d91084a83 100644
--- a/src/devices/cpu/asap/asap.cpp
+++ b/src/devices/cpu/asap/asap.cpp
@@ -184,7 +184,7 @@ void asap_device::device_start()
{
// get our address spaces
m_program = &space(AS_PROGRAM);
- m_direct = &m_program->direct();
+ m_direct = m_program->direct<0>();
// register our state for the debugger
state_add(STATE_GENPC, "GENPC", m_pc).noshow();
diff --git a/src/devices/cpu/asap/asap.h b/src/devices/cpu/asap/asap.h
index 93df7d56e0d..bfeb7c60350 100644
--- a/src/devices/cpu/asap/asap.h
+++ b/src/devices/cpu/asap/asap.h
@@ -238,7 +238,7 @@ protected:
uint8_t m_irq_state;
int m_icount;
address_space * m_program;
- direct_read_data * m_direct;
+ direct_read_data<0> *m_direct;
// src2val table, registers are at the end
uint32_t m_src2val[65536];
diff --git a/src/devices/cpu/capricorn/capricorn.cpp b/src/devices/cpu/capricorn/capricorn.cpp
index c99a66be04d..b41a3892667 100644
--- a/src/devices/cpu/capricorn/capricorn.cpp
+++ b/src/devices/cpu/capricorn/capricorn.cpp
@@ -170,7 +170,7 @@ void capricorn_cpu_device::device_start()
state_add(STATE_GENFLAGS , "GENFLAGS" , m_flags).noshow().formatstr("%9s");
m_program = &space(AS_PROGRAM);
- m_direct = &m_program->direct();
+ m_direct = m_program->direct<0>();
save_item(NAME(m_reg));
save_item(NAME(m_arp));
diff --git a/src/devices/cpu/capricorn/capricorn.h b/src/devices/cpu/capricorn/capricorn.h
index 874db7d637e..e20d6875def 100644
--- a/src/devices/cpu/capricorn/capricorn.h
+++ b/src/devices/cpu/capricorn/capricorn.h
@@ -44,7 +44,7 @@ protected:
private:
address_space_config m_program_config;
address_space *m_program;
- direct_read_data *m_direct;
+ direct_read_data<0> *m_direct;
int m_icount;
diff --git a/src/devices/cpu/ccpu/ccpu.cpp b/src/devices/cpu/ccpu/ccpu.cpp
index 5f04c3d7235..467b5eb2402 100644
--- a/src/devices/cpu/ccpu/ccpu.cpp
+++ b/src/devices/cpu/ccpu/ccpu.cpp
@@ -25,8 +25,8 @@ DEFINE_DEVICE_TYPE(CCPU, ccpu_cpu_device, "ccpu", "Cinematronics CPU")
#define READOP(a) (m_direct->read_byte(a))
-#define RDMEM(a) (m_data->read_word((a) * 2) & 0xfff)
-#define WRMEM(a,v) (m_data->write_word((a) * 2, (v)))
+#define RDMEM(a) (m_data->read_word((a) & 0xfff))
+#define WRMEM(a,v) (m_data->write_word((a), (v)))
#define READPORT(a) (m_io->read_byte(a))
#define WRITEPORT(a,v) (m_io->write_byte((a), (v)))
@@ -107,7 +107,7 @@ void ccpu_cpu_device::device_start()
assert(!m_vector_callback.isnull());
m_program = &space(AS_PROGRAM);
- m_direct = &m_program->direct();
+ m_direct = m_program->direct<0>();
m_data = &space(AS_DATA);
m_io = &space(AS_IO);
diff --git a/src/devices/cpu/ccpu/ccpu.h b/src/devices/cpu/ccpu/ccpu.h
index 5b45f19b64c..4cad4d66965 100644
--- a/src/devices/cpu/ccpu/ccpu.h
+++ b/src/devices/cpu/ccpu/ccpu.h
@@ -109,7 +109,7 @@ protected:
int m_icount;
address_space *m_program;
- direct_read_data *m_direct;
+ direct_read_data<0> *m_direct;
address_space *m_data;
address_space *m_io;
diff --git a/src/devices/cpu/cop400/cop400.cpp b/src/devices/cpu/cop400/cop400.cpp
index 5451e6775c3..03416a54b28 100644
--- a/src/devices/cpu/cop400/cop400.cpp
+++ b/src/devices/cpu/cop400/cop400.cpp
@@ -1068,7 +1068,7 @@ void cop400_cpu_device::device_start()
{
/* find address spaces */
m_program = &space(AS_PROGRAM);
- m_direct = &m_program->direct();
+ m_direct = m_program->direct<0>();
m_data = &space(AS_DATA);
/* find i/o handlers */
diff --git a/src/devices/cpu/cop400/cop400.h b/src/devices/cpu/cop400/cop400.h
index 257fbfa693e..d98d7bbbc6f 100644
--- a/src/devices/cpu/cop400/cop400.h
+++ b/src/devices/cpu/cop400/cop400.h
@@ -205,7 +205,7 @@ protected:
bool m_has_inil;
address_space *m_program;
- direct_read_data *m_direct;
+ direct_read_data<0> *m_direct;
address_space *m_data;
uint8_t m_featuremask;
diff --git a/src/devices/cpu/cosmac/cosmac.cpp b/src/devices/cpu/cosmac/cosmac.cpp
index f489eca224b..60b28dee897 100644
--- a/src/devices/cpu/cosmac/cosmac.cpp
+++ b/src/devices/cpu/cosmac/cosmac.cpp
@@ -338,7 +338,7 @@ void cosmac_device::device_start()
// get our address spaces
m_program = &space(AS_PROGRAM);
- m_direct = &m_program->direct();
+ m_direct = m_program->direct<0>();
m_io = &space(AS_IO);
// register our state for the debugger
diff --git a/src/devices/cpu/cosmac/cosmac.h b/src/devices/cpu/cosmac/cosmac.h
index 17cf3b4e798..515dde74d45 100644
--- a/src/devices/cpu/cosmac/cosmac.h
+++ b/src/devices/cpu/cosmac/cosmac.h
@@ -437,7 +437,7 @@ protected:
int m_icount;
address_space * m_program;
address_space * m_io;
- direct_read_data * m_direct;
+ direct_read_data<0> *m_direct;
// opcode/condition tables
typedef void (cosmac_device::*ophandler)();
diff --git a/src/devices/cpu/cp1610/cp1610.cpp b/src/devices/cpu/cp1610/cp1610.cpp
index 085ee1e2ab5..aafbe86fbe9 100644
--- a/src/devices/cpu/cp1610/cp1610.cpp
+++ b/src/devices/cpu/cp1610/cp1610.cpp
@@ -27,9 +27,9 @@ DEFINE_DEVICE_TYPE(CP1610, cp1610_cpu_device, "cp1610", "GI CP1610")
#define C 0x10
-#define cp1610_readop(A) m_program->read_word((A)<<1)
-#define cp1610_readmem16(A) m_program->read_word((A)<<1)
-#define cp1610_writemem16(A,B) m_program->write_word((A)<<1,B)
+#define cp1610_readop(A) m_program->read_word(A)
+#define cp1610_readmem16(A) m_program->read_word(A)
+#define cp1610_writemem16(A,B) m_program->write_word(A,B)
/* clear all flags */
#define CLR_SZOC \
diff --git a/src/devices/cpu/cubeqcpu/cubeqcpu.cpp b/src/devices/cpu/cubeqcpu/cubeqcpu.cpp
index 9f614bcf017..f00ed3eefa0 100644
--- a/src/devices/cpu/cubeqcpu/cubeqcpu.cpp
+++ b/src/devices/cpu/cubeqcpu/cubeqcpu.cpp
@@ -183,7 +183,7 @@ void cquestsnd_cpu_device::device_start()
m_sound_data = (uint16_t*)machine().root_device().memregion(m_sound_region_tag)->base();
m_program = &space(AS_PROGRAM);
- m_direct = &m_program->direct();
+ m_direct = m_program->direct<-3>();
memset(m_ram, 0, sizeof(m_ram));
m_q = 0;
@@ -262,7 +262,7 @@ void cquestrot_cpu_device::device_start()
m_linedata_w.resolve_safe();
m_program = &space(AS_PROGRAM);
- m_direct = &m_program->direct();
+ m_direct = m_program->direct<-3>();
memset(m_ram, 0, sizeof(m_ram));
m_q = 0;
@@ -393,7 +393,7 @@ void cquestlin_cpu_device::device_start()
m_linedata_r.resolve_safe(0);
m_program = &space(AS_PROGRAM);
- m_direct = &m_program->direct();
+ m_direct = m_program->direct<-3>();
memset(m_ram, 0, sizeof(m_ram));
m_q = 0;
@@ -542,7 +542,7 @@ void cquestsnd_cpu_device::execute_run()
do
{
/* Decode the instruction */
- uint64_t inst = m_direct->read_qword(SND_PC << 3);
+ uint64_t inst = m_direct->read_qword(SND_PC);
uint32_t inslow = inst & 0xffffffff;
uint32_t inshig = inst >> 32;
@@ -798,7 +798,7 @@ void cquestrot_cpu_device::execute_run()
do
{
/* Decode the instruction */
- uint64_t inst = m_direct->read_qword(ROT_PC << 3);
+ uint64_t inst = m_direct->read_qword(ROT_PC);
uint32_t inslow = inst & 0xffffffff;
uint32_t inshig = inst >> 32;
@@ -1218,7 +1218,7 @@ void cquestlin_cpu_device::execute_run()
int prog = (m_clkcnt & 3) ? BACKGROUND : FOREGROUND;
m_curpc = LINE_PC;
- uint64_t inst = m_direct->read_qword(LINE_PC << 3);
+ uint64_t inst = m_direct->read_qword(LINE_PC);
uint32_t inslow = inst & 0xffffffff;
uint32_t inshig = inst >> 32;
diff --git a/src/devices/cpu/cubeqcpu/cubeqcpu.h b/src/devices/cpu/cubeqcpu/cubeqcpu.h
index 321d10efb11..46b3235c6be 100644
--- a/src/devices/cpu/cubeqcpu/cubeqcpu.h
+++ b/src/devices/cpu/cubeqcpu/cubeqcpu.h
@@ -118,7 +118,7 @@ private:
uint16_t *m_sound_data;
address_space *m_program;
- direct_read_data *m_direct;
+ direct_read_data<-3> *m_direct;
int m_icount;
int do_sndjmp(int jmp);
@@ -227,7 +227,7 @@ private:
uint8_t m_clkcnt;
address_space *m_program;
- direct_read_data *m_direct;
+ direct_read_data<-3> *m_direct;
int m_icount;
// For the debugger
@@ -344,7 +344,7 @@ private:
uint32_t m_o_stack[32768]; /* Stack DRAM: 32kx20 */
address_space *m_program;
- direct_read_data *m_direct;
+ direct_read_data<-3> *m_direct;
int m_icount;
// For the debugger
diff --git a/src/devices/cpu/dsp16/dsp16.cpp b/src/devices/cpu/dsp16/dsp16.cpp
index d1bf8847906..33c25a32dc6 100644
--- a/src/devices/cpu/dsp16/dsp16.cpp
+++ b/src/devices/cpu/dsp16/dsp16.cpp
@@ -162,7 +162,7 @@ void dsp16_device::device_start()
// get our address spaces
m_program = &space(AS_PROGRAM);
m_data = &space(AS_DATA);
- m_direct = &m_program->direct();
+ m_direct = m_program->direct<-1>();
// set our instruction counter
m_icountptr = &m_icount;
@@ -339,18 +339,18 @@ util::disasm_interface *dsp16_device::create_disassembler()
inline uint32_t dsp16_device::data_read(const uint16_t& addr)
{
- return m_data->read_word(addr << 1);
+ return m_data->read_word(addr);
}
inline void dsp16_device::data_write(const uint16_t& addr, const uint16_t& data)
{
- m_data->write_word(addr << 1, data & 0xffff);
+ m_data->write_word(addr, data & 0xffff);
}
inline uint32_t dsp16_device::opcode_read(const uint8_t pcOffset)
{
const uint16_t readPC = m_pc + pcOffset;
- return m_direct->read_dword(readPC << 1);
+ return m_direct->read_dword(readPC);
}
diff --git a/src/devices/cpu/dsp16/dsp16.h b/src/devices/cpu/dsp16/dsp16.h
index 9c3ec245f11..2dcf6892833 100644
--- a/src/devices/cpu/dsp16/dsp16.h
+++ b/src/devices/cpu/dsp16/dsp16.h
@@ -146,7 +146,7 @@ protected:
// address spaces
address_space* m_program;
address_space* m_data;
- direct_read_data* m_direct;
+ direct_read_data<-1> *m_direct;
// other internal states
int m_icount;
diff --git a/src/devices/cpu/dsp32/dsp32.cpp b/src/devices/cpu/dsp32/dsp32.cpp
index 4169d110384..e700edd0075 100644
--- a/src/devices/cpu/dsp32/dsp32.cpp
+++ b/src/devices/cpu/dsp32/dsp32.cpp
@@ -192,7 +192,7 @@ void dsp32c_device::device_start()
// get our address spaces
m_program = &space(AS_PROGRAM);
- m_direct = &m_program->direct();
+ m_direct = m_program->direct<0>();
// register our state for the debugger
state_add(STATE_GENPC, "GENPC", m_r[15]).noshow();
diff --git a/src/devices/cpu/dsp32/dsp32.h b/src/devices/cpu/dsp32/dsp32.h
index 6e6c121d80e..8f8ad369736 100644
--- a/src/devices/cpu/dsp32/dsp32.h
+++ b/src/devices/cpu/dsp32/dsp32.h
@@ -421,7 +421,7 @@ protected:
uint8_t m_lastpins;
uint32_t m_ppc;
address_space * m_program;
- direct_read_data *m_direct;
+ direct_read_data<0> *m_direct;
devcb_write32 m_output_pins_changed;
// tables
diff --git a/src/devices/cpu/dsp56k/dsp56k.cpp b/src/devices/cpu/dsp56k/dsp56k.cpp
index 69b2d8b0341..132ccb55c98 100644
--- a/src/devices/cpu/dsp56k/dsp56k.cpp
+++ b/src/devices/cpu/dsp56k/dsp56k.cpp
@@ -290,7 +290,7 @@ void dsp56k_device::device_start()
save_item(NAME(m_dsp56k_core.peripheral_ram));
m_dsp56k_core.program = &space(AS_PROGRAM);
- m_dsp56k_core.direct = &m_dsp56k_core.program->direct();
+ m_dsp56k_core.direct = m_dsp56k_core.program->direct<-1>();
m_dsp56k_core.data = &space(AS_DATA);
state_add(DSP56K_PC, "PC", m_dsp56k_core.PCU.pc).formatstr("%04X");
@@ -464,9 +464,9 @@ static size_t execute_one_new(dsp56k_core* cpustate)
cpustate->ppc = PC;
debugger_instruction_hook(cpustate->device, PC);
- cpustate->op = ROPCODE(ADDRESS(PC));
- uint16_t w0 = ROPCODE(ADDRESS(PC));
- uint16_t w1 = ROPCODE(ADDRESS(PC) + ADDRESS(1));
+ cpustate->op = ROPCODE(PC);
+ uint16_t w0 = ROPCODE(PC);
+ uint16_t w1 = ROPCODE(PC + 1);
Opcode op(w0, w1);
op.evaluate(cpustate);
diff --git a/src/devices/cpu/dsp56k/dsp56k.h b/src/devices/cpu/dsp56k/dsp56k.h
index 670078c16c7..43e94e60442 100644
--- a/src/devices/cpu/dsp56k/dsp56k.h
+++ b/src/devices/cpu/dsp56k/dsp56k.h
@@ -192,7 +192,7 @@ struct dsp56k_core
void (*output_pins_changed)(uint32_t pins);
cpu_device *device;
address_space *program;
- direct_read_data *direct;
+ direct_read_data<-1> *direct;
address_space *data;
uint16_t peripheral_ram[0x40];
diff --git a/src/devices/cpu/dsp56k/dsp56ops.hxx b/src/devices/cpu/dsp56k/dsp56ops.hxx
index 0c898e7c674..a7815da5a4d 100644
--- a/src/devices/cpu/dsp56k/dsp56ops.hxx
+++ b/src/devices/cpu/dsp56k/dsp56ops.hxx
@@ -42,7 +42,6 @@ struct typed_pointer
char data_type;
};
-//#define ADDRESS(X) (X<<1)
#define BITS(CUR,MASK) (Dsp56kOpMask(CUR,MASK))
/*********************/
@@ -243,10 +242,10 @@ static void execute_one(dsp56k_core* cpustate)
cpustate->ppc = PC;
debugger_instruction_hook(cpustate->device, PC);
- cpustate->op = ROPCODE(ADDRESS(PC));
+ cpustate->op = ROPCODE(PC);
/* The words we're going to be working with */
- op = ROPCODE(ADDRESS(PC));
- op2 = ROPCODE(ADDRESS(PC) + ADDRESS(1));
+ op = ROPCODE(PC);
+ op2 = ROPCODE(PC + 1);
/* DECODE */
@@ -2308,7 +2307,7 @@ static size_t dsp56k_op_bfop(dsp56k_core* cpustate, const uint16_t op, const uin
decode_BBB_bitmask(cpustate, BITS(op2,0xe000), &iVal);
workAddr = assemble_address_from_Pppppp_table(cpustate, BITS(op,0x0020), BITS(op,0x001f));
- previousValue = cpustate->data->read_word(ADDRESS(workAddr));
+ previousValue = cpustate->data->read_word(workAddr);
workingWord = previousValue;
switch(BITS(op2, 0x1f00))
@@ -2332,7 +2331,7 @@ static size_t dsp56k_op_bfop(dsp56k_core* cpustate, const uint16_t op, const uin
tempTP.addr = &workingWord;
tempTP.data_type = DT_WORD;
- SetDataMemoryValue(cpustate, tempTP, ADDRESS(workAddr));
+ SetDataMemoryValue(cpustate, tempTP, workAddr);
/* S L E U N Z V C */
/* - * - - - - - ? */
@@ -2374,7 +2373,7 @@ static size_t dsp56k_op_bfop_1(dsp56k_core* cpustate, const uint16_t op, const u
decode_RR_table(cpustate, BITS(op,0x0003), &R);
workAddr = *((uint16_t*)R.addr);
- previousValue = cpustate->data->read_word(ADDRESS(workAddr));
+ previousValue = cpustate->data->read_word(workAddr);
workingWord = previousValue;
switch(BITS(op2, 0x1f00))
@@ -2398,7 +2397,7 @@ static size_t dsp56k_op_bfop_1(dsp56k_core* cpustate, const uint16_t op, const u
tempTP.addr = &workingWord;
tempTP.data_type = DT_WORD;
- SetDataMemoryValue(cpustate, tempTP, ADDRESS(workAddr));
+ SetDataMemoryValue(cpustate, tempTP, workAddr);
/* S L E U N Z V C */
/* - * - - - - - ? */
@@ -3112,7 +3111,7 @@ static size_t dsp56k_op_jsr(dsp56k_core* cpustate, const uint16_t op, const uint
PC += 2;
/* TODO: This is a hacky implementation of Long vs Fast Interrupts. Do it right someday! */
- if (PC < ADDRESS(0x40))
+ if (PC < 0x80)
{
/* Long interrupt gets the previous PC, not the current one */
SP++;
@@ -3265,7 +3264,7 @@ static size_t dsp56k_op_movec(dsp56k_core* cpustate, const uint16_t op, uint8_t*
if (W)
{
/* Write D */
- uint16_t value = cpustate->data->read_word(ADDRESS(*((uint16_t*)R.addr))) ;
+ uint16_t value = cpustate->data->read_word(*((uint16_t*)R.addr)) ;
typed_pointer temp_src = { &value, DT_WORD };
SetDestinationValue(temp_src, SD);
}
@@ -3273,7 +3272,7 @@ static size_t dsp56k_op_movec(dsp56k_core* cpustate, const uint16_t op, uint8_t*
{
/* Read S */
uint16_t dataMemOffset = *((uint16_t*)R.addr);
- SetDataMemoryValue(cpustate, SD, ADDRESS(dataMemOffset));
+ SetDataMemoryValue(cpustate, SD, dataMemOffset);
}
execute_MM_table(cpustate, BITS(op,0x0003), BITS(op,0x000c));
@@ -3307,7 +3306,7 @@ static size_t dsp56k_op_movec_1(dsp56k_core* cpustate, const uint16_t op, uint8_
if (W)
{
/* Write D */
- uint16_t tempData = cpustate->data->read_word(ADDRESS(memOffset));
+ uint16_t tempData = cpustate->data->read_word(memOffset);
typed_pointer temp_src = { (void*)&tempData, DT_WORD };
SetDestinationValue(temp_src, SD);
}
@@ -3316,7 +3315,7 @@ static size_t dsp56k_op_movec_1(dsp56k_core* cpustate, const uint16_t op, uint8_
/* Read S */
uint16_t tempData = *((uint16_t*)SD.addr);
typed_pointer temp_src = { (void*)&tempData, DT_WORD };
- SetDataMemoryValue(cpustate, temp_src, ADDRESS(memOffset));
+ SetDataMemoryValue(cpustate, temp_src, memOffset);
}
/* S L E U N Z V C */
@@ -3351,7 +3350,7 @@ static size_t dsp56k_op_movec_2(dsp56k_core* cpustate, const uint16_t op, uint8_
if (W)
{
/* Write D */
- uint16_t tempData = cpustate->data->read_word(ADDRESS(memOffset));
+ uint16_t tempData = cpustate->data->read_word(memOffset);
typed_pointer temp_src = { (void*)&tempData, DT_WORD };
SetDestinationValue(temp_src, SD);
}
@@ -3360,7 +3359,7 @@ static size_t dsp56k_op_movec_2(dsp56k_core* cpustate, const uint16_t op, uint8_
/* Read S */
uint16_t tempData = *((uint16_t*)SD.addr);
typed_pointer temp_src = { (void*)&tempData, DT_WORD };
- SetDataMemoryValue(cpustate, temp_src, ADDRESS(memOffset));
+ SetDataMemoryValue(cpustate, temp_src, memOffset);
}
@@ -3402,7 +3401,7 @@ static size_t dsp56k_op_movec_3(dsp56k_core* cpustate, const uint16_t op, const
else
{
/* 16-bit long address */
- uint16_t tempD = cpustate->data->read_word(ADDRESS(op2));
+ uint16_t tempD = cpustate->data->read_word(op2);
typed_pointer tempTP = {&tempD, DT_WORD};
SetDestinationValue(tempTP, SD);
}
@@ -3418,7 +3417,7 @@ static size_t dsp56k_op_movec_3(dsp56k_core* cpustate, const uint16_t op, const
else
{
/* 16-bit long address */
- SetDataMemoryValue(cpustate, SD, ADDRESS(op2));
+ SetDataMemoryValue(cpustate, SD, op2);
}
}
@@ -3480,7 +3479,7 @@ static size_t dsp56k_op_movec_5(dsp56k_core* cpustate, const uint16_t op, const
if (W)
{
/* Write D */
- uint16_t tempData = cpustate->data->read_word(ADDRESS(memOffset));
+ uint16_t tempData = cpustate->data->read_word(memOffset);
typed_pointer temp_src = { (void*)&tempData, DT_WORD };
SetDestinationValue(temp_src, SD);
}
@@ -3489,7 +3488,7 @@ static size_t dsp56k_op_movec_5(dsp56k_core* cpustate, const uint16_t op, const
/* Read S */
uint16_t tempData = *((uint16_t*)SD.addr);
typed_pointer temp_src = { (void*)&tempData, DT_WORD };
- SetDataMemoryValue(cpustate, temp_src, ADDRESS(memOffset));
+ SetDataMemoryValue(cpustate, temp_src, memOffset);
}
/* S L E U N Z V C */
@@ -3543,7 +3542,7 @@ static size_t dsp56k_op_movem(dsp56k_core* cpustate, const uint16_t op, uint8_t*
{
/* Read from Program Memory */
typed_pointer data;
- uint16_t ldata = cpustate->program->read_word(ADDRESS(*((uint16_t*)R.addr)));
+ uint16_t ldata = cpustate->program->read_word(*((uint16_t*)R.addr));
data.addr = &ldata;
data.data_type = DT_WORD;
@@ -3552,7 +3551,7 @@ static size_t dsp56k_op_movem(dsp56k_core* cpustate, const uint16_t op, uint8_t*
else
{
/* Write to Program Memory */
- SetProgramMemoryValue(cpustate, SD, ADDRESS(*((uint16_t*)R.addr))) ;
+ SetProgramMemoryValue(cpustate, SD, *((uint16_t*)R.addr)) ;
}
execute_MM_table(cpustate, BITS(op,0x00c0), BITS(op,0x0018));
@@ -3597,7 +3596,7 @@ static size_t dsp56k_op_movep(dsp56k_core* cpustate, const uint16_t op, uint8_t*
if (W)
{
- uint16_t data = cpustate->data->read_word(ADDRESS(pp));
+ uint16_t data = cpustate->data->read_word(pp);
typed_pointer tempTP;
tempTP.addr = &data;
@@ -3607,7 +3606,7 @@ static size_t dsp56k_op_movep(dsp56k_core* cpustate, const uint16_t op, uint8_t*
}
else
{
- SetDataMemoryValue(cpustate, SD, ADDRESS(pp));
+ SetDataMemoryValue(cpustate, SD, pp);
}
/* S L E U N Z V C */
@@ -3636,13 +3635,13 @@ static size_t dsp56k_op_movep_1(dsp56k_core* cpustate, const uint16_t op, uint8_
/* A little different than most W if's - opposite read and write */
if (W)
{
- uint16_t data = cpustate->data->read_word(ADDRESS(*((uint16_t*)SD.addr)));
+ uint16_t data = cpustate->data->read_word(*((uint16_t*)SD.addr));
typed_pointer tempTP;
tempTP.addr = &data;
tempTP.data_type = DT_WORD;
- SetDataMemoryValue(cpustate, tempTP, ADDRESS(pp));
+ SetDataMemoryValue(cpustate, tempTP, pp);
}
else
{
@@ -3770,7 +3769,7 @@ static size_t dsp56k_op_rep_1(dsp56k_core* cpustate, const uint16_t op, uint8_t*
LC = iVal;
cpustate->repFlag = 1;
- cpustate->repAddr = PC + ADDRESS(1);
+ cpustate->repAddr = PC + 2;
cycles += 4; /* TODO: + mv oscillator clock cycles */
}
@@ -3806,7 +3805,7 @@ static size_t dsp56k_op_rep_2(dsp56k_core* cpustate, const uint16_t op, uint8_t*
LC = repValue;
cpustate->repFlag = 1;
- cpustate->repAddr = PC + ADDRESS(1);
+ cpustate->repAddr = PC + 2;
cycles += 4; /* TODO: + mv oscillator clock cycles */
}
@@ -4663,7 +4662,7 @@ static void execute_x_memory_data_move(dsp56k_core* cpustate, const uint16_t op,
if (W)
{
/* From X:<ea> to SD */
- uint16_t data = cpustate->data->read_word(ADDRESS(*((uint16_t*)R.addr)));
+ uint16_t data = cpustate->data->read_word(*((uint16_t*)R.addr));
typed_pointer tempTP;
tempTP.addr = &data;
@@ -4681,11 +4680,11 @@ static void execute_x_memory_data_move(dsp56k_core* cpustate, const uint16_t op,
tempTP.addr = prev_accum_value;
tempTP.data_type = DT_LONG_WORD;
- SetDataMemoryValue(cpustate, tempTP, ADDRESS(*((uint16_t*)R.addr))) ;
+ SetDataMemoryValue(cpustate, tempTP, *((uint16_t*)R.addr)) ;
}
else
{
- SetDataMemoryValue(cpustate, SD, ADDRESS(*((uint16_t*)R.addr))) ;
+ SetDataMemoryValue(cpustate, SD, *((uint16_t*)R.addr)) ;
}
}
@@ -4711,14 +4710,14 @@ static void execute_x_memory_data_move2(dsp56k_core* cpustate, const uint16_t op
if (W)
{
/* Write D */
- uint16_t value = cpustate->data->read_word(ADDRESS(*mem_offset));
+ uint16_t value = cpustate->data->read_word(*mem_offset);
typed_pointer tempV = {&value, DT_WORD};
SetDestinationValue(tempV, SD);
}
else
{
/* Read S */
- SetDataMemoryValue(cpustate, SD, ADDRESS(*mem_offset));
+ SetDataMemoryValue(cpustate, SD, *mem_offset);
}
}
@@ -4739,7 +4738,7 @@ static void execute_x_memory_data_move_with_short_displacement(dsp56k_core* cpus
if (W)
{
/* Write D */
- uint16_t tempData = cpustate->data->read_word(ADDRESS(memOffset));
+ uint16_t tempData = cpustate->data->read_word(memOffset);
typed_pointer temp_src = { (void*)&tempData, DT_WORD };
SetDestinationValue(temp_src, SD);
}
@@ -4748,7 +4747,7 @@ static void execute_x_memory_data_move_with_short_displacement(dsp56k_core* cpus
/* Read S */
uint16_t tempData = *((uint16_t*)SD.addr);
typed_pointer temp_src = { (void*)&tempData, DT_WORD };
- SetDataMemoryValue(cpustate, temp_src, ADDRESS(memOffset));
+ SetDataMemoryValue(cpustate, temp_src, memOffset);
}
}
@@ -4775,13 +4774,13 @@ static void execute_dual_x_memory_data_read(dsp56k_core* cpustate, const uint16_
fatalerror("Dsp56k: Unimplemented access to external X Data Memory >= 0xffc0 in Dual X Memory Data Read.\n");
/* First memmove */
- srcVal1 = cpustate->data->read_word(ADDRESS(*((uint16_t*)R.addr)));
+ srcVal1 = cpustate->data->read_word(*((uint16_t*)R.addr));
tempV.addr = &srcVal1;
tempV.data_type = DT_WORD;
SetDestinationValue(tempV, D1);
/* Second memmove */
- srcVal2 = cpustate->data->read_word(ADDRESS(R3));
+ srcVal2 = cpustate->data->read_word(R3);
tempV.addr = &srcVal2;
tempV.data_type = DT_WORD;
SetDestinationValue(tempV, D2);
diff --git a/src/devices/cpu/dsp56k/inst.h b/src/devices/cpu/dsp56k/inst.h
index a1ac7ad0a5b..d2db2a013e9 100644
--- a/src/devices/cpu/dsp56k/inst.h
+++ b/src/devices/cpu/dsp56k/inst.h
@@ -15,7 +15,6 @@
//
namespace DSP56K
{
-#define ADDRESS(X) ((X)<<1)
#define UNIMPLEMENTED_OPCODE() osd_printf_error("Unimplemented opcode: PC=%04x | %s;\n", PC, __PRETTY_FUNCTION__);
class Opcode;
diff --git a/src/devices/cpu/e0c6200/e0c6200.cpp b/src/devices/cpu/e0c6200/e0c6200.cpp
index 46d169547e2..4deadeb6bff 100644
--- a/src/devices/cpu/e0c6200/e0c6200.cpp
+++ b/src/devices/cpu/e0c6200/e0c6200.cpp
@@ -211,7 +211,7 @@ void e0c6200_cpu_device::execute_run()
// fetch next opcode
debugger_instruction_hook(this, m_pc);
- m_op = m_program->read_word(m_pc << 1) & 0xfff;
+ m_op = m_program->read_word(m_pc) & 0xfff;
m_pc = (m_pc & 0x1000) | ((m_pc + 1) & 0x0fff);
// minimal opcode time is 5 clock cycles, opcodes take 5, 7, or 12 clock cycles
diff --git a/src/devices/cpu/e132xs/e132xs.cpp b/src/devices/cpu/e132xs/e132xs.cpp
index bfeac9a702b..73725ec8a25 100644
--- a/src/devices/cpu/e132xs/e132xs.cpp
+++ b/src/devices/cpu/e132xs/e132xs.cpp
@@ -1030,7 +1030,7 @@ void hyperstone_device::init(int scale_mask)
m_icount = 0;
m_program = &space(AS_PROGRAM);
- m_direct = &m_program->direct();
+ m_direct = m_program->direct<0>();
m_io = &space(AS_IO);
m_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(hyperstone_device::timer_callback), this));
@@ -1269,7 +1269,7 @@ void hyperstone_device::device_reset()
//TODO: Add different reset initializations for BCR, MCR, FCR, TPR
m_program = &space(AS_PROGRAM);
- m_direct = &m_program->direct();
+ m_direct = m_program->direct<0>();
m_io = &space(AS_IO);
m_tr_clocks_per_tick = 2;
diff --git a/src/devices/cpu/e132xs/e132xs.h b/src/devices/cpu/e132xs/e132xs.h
index e0a3819e0c0..81575c4f0cf 100644
--- a/src/devices/cpu/e132xs/e132xs.h
+++ b/src/devices/cpu/e132xs/e132xs.h
@@ -145,7 +145,7 @@ protected:
const address_space_config m_program_config;
const address_space_config m_io_config;
address_space *m_program;
- direct_read_data *m_direct;
+ direct_read_data<0> *m_direct;
address_space *m_io;
// CPU registers
diff --git a/src/devices/cpu/esrip/esrip.cpp b/src/devices/cpu/esrip/esrip.cpp
index 9f85cc2cdf3..e87fd1821d6 100644
--- a/src/devices/cpu/esrip/esrip.cpp
+++ b/src/devices/cpu/esrip/esrip.cpp
@@ -193,7 +193,7 @@ void esrip_device::device_start()
m_ipt_ram.resize(IPT_RAM_SIZE/2);
m_program = &space(AS_PROGRAM);
- m_direct = &m_program->direct();
+ m_direct = m_program->direct<-3>();
// register our state for the debugger
state_add(STATE_GENPC, "GENPC", m_rip_pc).noshow();
@@ -1878,7 +1878,7 @@ void esrip_device::execute_run()
m_pl7 = m_l7;
/* Latch instruction */
- inst = m_direct->read_qword(RIP_PC << 3);
+ inst = m_direct->read_qword(RIP_PC);
in_h = inst >> 32;
in_l = inst & 0xffffffff;
diff --git a/src/devices/cpu/esrip/esrip.h b/src/devices/cpu/esrip/esrip.h
index 69e03139704..ed2fadd98e9 100644
--- a/src/devices/cpu/esrip/esrip.h
+++ b/src/devices/cpu/esrip/esrip.h
@@ -193,7 +193,7 @@ protected:
uint8_t *m_lbrm;
address_space *m_program;
- direct_read_data *m_direct;
+ direct_read_data<-3> *m_direct;
int m_icount;
diff --git a/src/devices/cpu/f8/f8.cpp b/src/devices/cpu/f8/f8.cpp
index 17db2883556..ba386a1af13 100644
--- a/src/devices/cpu/f8/f8.cpp
+++ b/src/devices/cpu/f8/f8.cpp
@@ -1959,7 +1959,7 @@ void f8_cpu_device::device_start()
{
// TODO register debug state
m_program = &space(AS_PROGRAM);
- m_direct = &m_program->direct();
+ m_direct = m_program->direct<0>();
m_iospace = &space(AS_IO);
save_item(NAME(m_pc0));
diff --git a/src/devices/cpu/f8/f8.h b/src/devices/cpu/f8/f8.h
index ebe0fde3eb3..287f7a9fbf3 100644
--- a/src/devices/cpu/f8/f8.h
+++ b/src/devices/cpu/f8/f8.h
@@ -71,7 +71,7 @@ private:
uint16_t m_io; /* last I/O address */
uint16_t m_irq_vector;
address_space *m_program;
- direct_read_data *m_direct;
+ direct_read_data<0> *m_direct;
address_space *m_iospace;
int m_icount;
uint8_t m_r[64]; /* scratchpad RAM */
diff --git a/src/devices/cpu/h6280/h6280.cpp b/src/devices/cpu/h6280/h6280.cpp
index 8922bac892e..c47ed31a70f 100644
--- a/src/devices/cpu/h6280/h6280.cpp
+++ b/src/devices/cpu/h6280/h6280.cpp
@@ -301,7 +301,7 @@ void h6280_device::device_reset()
m_io_buffer = 0;
m_program = &space(AS_PROGRAM);
- m_direct = &m_program->direct();
+ m_direct = m_program->direct<0>();
m_io = &space(AS_IO);
/* set I and B flags */
diff --git a/src/devices/cpu/h6280/h6280.h b/src/devices/cpu/h6280/h6280.h
index 6ac69b3100b..e744247e8cb 100644
--- a/src/devices/cpu/h6280/h6280.h
+++ b/src/devices/cpu/h6280/h6280.h
@@ -357,7 +357,7 @@ protected:
// address spaces
address_space *m_program;
address_space *m_io;
- direct_read_data *m_direct;
+ direct_read_data<0> *m_direct;
typedef void (h6280_device::*ophandler)();
diff --git a/src/devices/cpu/h8/h8.cpp b/src/devices/cpu/h8/h8.cpp
index 078e89c31d1..e54155b120d 100644
--- a/src/devices/cpu/h8/h8.cpp
+++ b/src/devices/cpu/h8/h8.cpp
@@ -32,7 +32,7 @@ h8_device::h8_device(const machine_config &mconfig, device_type type, const char
void h8_device::device_start()
{
program = &space(AS_PROGRAM);
- direct = &program->direct();
+ direct = program->direct<0>();
io = &space(AS_IO);
state_add(STATE_GENPC, "GENPC", NPC).noshow();
diff --git a/src/devices/cpu/h8/h8.h b/src/devices/cpu/h8/h8.h
index 920d71c7663..78ce598bb84 100644
--- a/src/devices/cpu/h8/h8.h
+++ b/src/devices/cpu/h8/h8.h
@@ -112,7 +112,7 @@ protected:
address_space_config program_config, io_config;
address_space *program, *io;
- direct_read_data *direct;
+ direct_read_data<0> *direct;
h8_dma_device *dma_device;
h8_dtc_device *dtc_device;
h8_dma_state *current_dma;
diff --git a/src/devices/cpu/h8/h8_adc.cpp b/src/devices/cpu/h8/h8_adc.cpp
index 979b13fe631..76b03584e6d 100644
--- a/src/devices/cpu/h8/h8_adc.cpp
+++ b/src/devices/cpu/h8/h8_adc.cpp
@@ -168,7 +168,7 @@ void h8_adc_device::conversion_wait(bool first, bool poweron, uint64_t current_t
void h8_adc_device::buffer_value(int port, int buffer)
{
- buf[buffer] = io->read_word(2*(h8_device::ADC_0 + port));
+ buf[buffer] = io->read_word(h8_device::ADC_0 + port);
if(V>=1) logerror("adc buffer %d -> %d:%03x\n", port, buffer, buf[buffer]);
}
diff --git a/src/devices/cpu/h8/h8_port.cpp b/src/devices/cpu/h8/h8_port.cpp
index ae63eedad51..bc21c99d6df 100644
--- a/src/devices/cpu/h8/h8_port.cpp
+++ b/src/devices/cpu/h8/h8_port.cpp
@@ -13,7 +13,7 @@ h8_port_device::h8_port_device(const machine_config &mconfig, const char *tag, d
void h8_port_device::set_info(int _address, uint8_t _default_ddr, uint8_t _mask)
{
- address = 2*_address;
+ address = _address;
default_ddr = _default_ddr;
mask = _mask;
}
diff --git a/src/devices/cpu/hd61700/hd61700.cpp b/src/devices/cpu/hd61700/hd61700.cpp
index dfa496d528b..1c6225a9d79 100644
--- a/src/devices/cpu/hd61700/hd61700.cpp
+++ b/src/devices/cpu/hd61700/hd61700.cpp
@@ -2754,7 +2754,7 @@ inline uint8_t hd61700_cpu_device::read_op()
if (m_pc <= INT_ROM)
{
- data = m_program->read_word(addr18<<1);
+ data = m_program->read_word(addr18);
if (!(m_fetch_addr&1))
data = (data>>8) ;
@@ -2762,9 +2762,9 @@ inline uint8_t hd61700_cpu_device::read_op()
else
{
if (m_fetch_addr&1)
- data = m_program->read_word((addr18+1)<<1);
+ data = m_program->read_word(addr18 + 1);
else
- data = m_program->read_word((addr18+0)<<1);
+ data = m_program->read_word(addr18 + 0);
}
m_fetch_addr += ((m_pc > INT_ROM) ? 2 : 1);
@@ -2780,12 +2780,12 @@ inline uint8_t hd61700_cpu_device::read_op()
inline uint8_t hd61700_cpu_device::mem_readbyte(uint8_t segment, uint16_t offset)
{
- return m_program->read_word(make_18bit_addr(segment, offset)<<1) & 0xff;
+ return m_program->read_word(make_18bit_addr(segment, offset)) & 0xff;
}
inline void hd61700_cpu_device::mem_writebyte(uint8_t segment, uint16_t offset, uint8_t data)
{
- m_program->write_word(make_18bit_addr(segment, offset)<<1, data);
+ m_program->write_word(make_18bit_addr(segment, offset), data);
}
inline uint32_t hd61700_cpu_device::make_18bit_addr(uint8_t segment, uint16_t offset)
diff --git a/src/devices/cpu/hmcs40/hmcs40.cpp b/src/devices/cpu/hmcs40/hmcs40.cpp
index e1260f36d7a..a80c067aaeb 100644
--- a/src/devices/cpu/hmcs40/hmcs40.cpp
+++ b/src/devices/cpu/hmcs40/hmcs40.cpp
@@ -619,7 +619,7 @@ void hmcs40_cpu_device::execute_run()
// fetch next opcode
debugger_instruction_hook(this, m_pc);
m_icount--;
- m_op = m_program->read_word(m_pc << 1) & 0x3ff;
+ m_op = m_program->read_word(m_pc) & 0x3ff;
m_i = BITSWAP8(m_op,7,6,5,4,0,1,2,3) & 0xf; // reversed bit-order for 4-bit immediate param (except for XAMR)
increment_pc();
diff --git a/src/devices/cpu/hmcs40/hmcs40op.cpp b/src/devices/cpu/hmcs40/hmcs40op.cpp
index 2c28d4cb54e..2078d5e765b 100644
--- a/src/devices/cpu/hmcs40/hmcs40op.cpp
+++ b/src/devices/cpu/hmcs40/hmcs40op.cpp
@@ -663,7 +663,7 @@ void hmcs40_cpu_device::op_p()
// P p: Pattern Generation
m_icount--;
u16 address = m_a | m_b << 4 | m_c << 8 | (m_op & 7) << 9 | (m_pc & ~0x3f);
- u16 o = m_program->read_word((address & m_prgmask) << 1);
+ u16 o = m_program->read_word(address & m_prgmask);
// destination is determined by the 2 highest bits
if (o & 0x100)
diff --git a/src/devices/cpu/hphybrid/hphybrid.cpp b/src/devices/cpu/hphybrid/hphybrid.cpp
index 3974a862c95..9e8457b255d 100644
--- a/src/devices/cpu/hphybrid/hphybrid.cpp
+++ b/src/devices/cpu/hphybrid/hphybrid.cpp
@@ -202,7 +202,7 @@ void hp_hybrid_cpu_device::device_start()
}
m_program = &space(AS_PROGRAM);
- m_direct = &m_program->direct();
+ m_direct = m_program->direct<-1>();
m_io = &space(AS_IO);
save_item(NAME(m_reg_A));
@@ -297,388 +297,388 @@ uint16_t hp_hybrid_cpu_device::execute_one(uint16_t opcode)
*/
uint16_t hp_hybrid_cpu_device::execute_one_sub(uint16_t opcode)
{
- uint32_t ea;
- uint16_t tmp;
-
- switch (opcode & 0x7800) {
- case 0x0000:
- // LDA
- m_icount -= 13;
- m_reg_A = RM(get_ea(opcode));
- break;
-
- case 0x0800:
- // LDB
- m_icount -= 13;
- m_reg_B = RM(get_ea(opcode));
- break;
-
- case 0x1000:
- // CPA
- m_icount -= 16;
- if (m_reg_A != RM(get_ea(opcode))) {
- // Skip next instruction
- return m_reg_P + 2;
- }
- break;
-
- case 0x1800:
- // CPB
- m_icount -= 16;
- if (m_reg_B != RM(get_ea(opcode))) {
- // Skip next instruction
- return m_reg_P + 2;
- }
- break;
-
- case 0x2000:
- // ADA
- m_icount -= 13;
- do_add(m_reg_A , RM(get_ea(opcode)));
- break;
-
- case 0x2800:
- // ADB
- m_icount -= 13;
- do_add(m_reg_B , RM(get_ea(opcode)));
- break;
-
- case 0x3000:
- // STA
- m_icount -= 13;
- WM(get_ea(opcode) , m_reg_A);
- break;
-
- case 0x3800:
- // STB
- m_icount -= 13;
- WM(get_ea(opcode) , m_reg_B);
- break;
-
- case 0x4000:
- // JSM
- m_icount -= 17;
- WM(AEC_CASE_C , ++m_reg_R , m_reg_P);
- return remove_mae(get_ea(opcode));
-
- case 0x4800:
- // ISZ
- m_icount -= 19;
- ea = get_ea(opcode);
- tmp = RM(ea) + 1;
- WM(ea , tmp);
- if (tmp == 0) {
- // Skip next instruction
- return m_reg_P + 2;
- }
- break;
-
- case 0x5000:
- // AND
- m_icount -= 13;
- m_reg_A &= RM(get_ea(opcode));
- break;
-
- case 0x5800:
- // DSZ
- m_icount -= 19;
- ea = get_ea(opcode);
- tmp = RM(ea) - 1;
- WM(ea , tmp);
- if (tmp == 0) {
- // Skip next instruction
- return m_reg_P + 2;
- }
- break;
-
- case 0x6000:
- // IOR
- m_icount -= 13;
- m_reg_A |= RM(get_ea(opcode));
- break;
-
- case 0x6800:
- // JMP
- m_icount -= 8;
- return remove_mae(get_ea(opcode));
+ uint32_t ea;
+ uint16_t tmp;
+
+ switch (opcode & 0x7800) {
+ case 0x0000:
+ // LDA
+ m_icount -= 13;
+ m_reg_A = RM(get_ea(opcode));
+ break;
+
+ case 0x0800:
+ // LDB
+ m_icount -= 13;
+ m_reg_B = RM(get_ea(opcode));
+ break;
+
+ case 0x1000:
+ // CPA
+ m_icount -= 16;
+ if (m_reg_A != RM(get_ea(opcode))) {
+ // Skip next instruction
+ return m_reg_P + 2;
+ }
+ break;
+
+ case 0x1800:
+ // CPB
+ m_icount -= 16;
+ if (m_reg_B != RM(get_ea(opcode))) {
+ // Skip next instruction
+ return m_reg_P + 2;
+ }
+ break;
+
+ case 0x2000:
+ // ADA
+ m_icount -= 13;
+ do_add(m_reg_A , RM(get_ea(opcode)));
+ break;
+
+ case 0x2800:
+ // ADB
+ m_icount -= 13;
+ do_add(m_reg_B , RM(get_ea(opcode)));
+ break;
+
+ case 0x3000:
+ // STA
+ m_icount -= 13;
+ WM(get_ea(opcode) , m_reg_A);
+ break;
+
+ case 0x3800:
+ // STB
+ m_icount -= 13;
+ WM(get_ea(opcode) , m_reg_B);
+ break;
+
+ case 0x4000:
+ // JSM
+ m_icount -= 17;
+ WM(AEC_CASE_C , ++m_reg_R , m_reg_P);
+ return remove_mae(get_ea(opcode));
+
+ case 0x4800:
+ // ISZ
+ m_icount -= 19;
+ ea = get_ea(opcode);
+ tmp = RM(ea) + 1;
+ WM(ea , tmp);
+ if (tmp == 0) {
+ // Skip next instruction
+ return m_reg_P + 2;
+ }
+ break;
+
+ case 0x5000:
+ // AND
+ m_icount -= 13;
+ m_reg_A &= RM(get_ea(opcode));
+ break;
+
+ case 0x5800:
+ // DSZ
+ m_icount -= 19;
+ ea = get_ea(opcode);
+ tmp = RM(ea) - 1;
+ WM(ea , tmp);
+ if (tmp == 0) {
+ // Skip next instruction
+ return m_reg_P + 2;
+ }
+ break;
+
+ case 0x6000:
+ // IOR
+ m_icount -= 13;
+ m_reg_A |= RM(get_ea(opcode));
+ break;
+
+ case 0x6800:
+ // JMP
+ m_icount -= 8;
+ return remove_mae(get_ea(opcode));
+
+ default:
+ switch (opcode & 0xfec0) {
+ case 0x7400:
+ // RZA
+ // SZA
+ m_icount -= 14;
+ return get_skip_addr(opcode , m_reg_A == 0);
+
+ case 0x7440:
+ // RIA
+ // SIA
+ m_icount -= 14;
+ return get_skip_addr(opcode , m_reg_A++ == 0);
+
+ case 0x7480:
+ // SFS
+ // SFC
+ m_icount -= 14;
+ return get_skip_addr(opcode , !BIT(m_flags , HPHYBRID_FLG_BIT));
+
+ case 0x7C00:
+ // RZB
+ // SZB
+ m_icount -= 14;
+ return get_skip_addr(opcode , m_reg_B == 0);
+
+ case 0x7C40:
+ // RIB
+ // SIB
+ m_icount -= 14;
+ return get_skip_addr(opcode , m_reg_B++ == 0);
+
+ case 0x7c80:
+ // SSS
+ // SSC
+ m_icount -= 14;
+ return get_skip_addr(opcode , !BIT(m_flags , HPHYBRID_STS_BIT));
+
+ case 0x7cc0:
+ // SHS
+ // SHC
+ m_icount -= 14;
+ return get_skip_addr(opcode , !BIT(m_flags , HPHYBRID_HALT_BIT));
+
+ default:
+ switch (opcode & 0xfe00) {
+ case 0x7600:
+ // SLA
+ // RLA
+ m_icount -= 14;
+ return get_skip_addr_sc(opcode , m_reg_A , 0);
+
+ case 0x7e00:
+ // SLB
+ // RLB
+ m_icount -= 14;
+ return get_skip_addr_sc(opcode , m_reg_B , 0);
+
+ case 0xf400:
+ // SAP
+ // SAM
+ m_icount -= 14;
+ return get_skip_addr_sc(opcode , m_reg_A , 15);
+
+ case 0xf600:
+ // SOC
+ // SOS
+ m_icount -= 14;
+ return get_skip_addr_sc(opcode , m_flags , HPHYBRID_O_BIT);
+
+ case 0xfc00:
+ // SBP
+ // SBM
+ m_icount -= 14;
+ return get_skip_addr_sc(opcode , m_reg_B , 15);
+
+ case 0xfe00:
+ // SEC
+ // SES
+ m_icount -= 14;
+ return get_skip_addr_sc(opcode , m_flags , HPHYBRID_C_BIT);
+
+ default:
+ switch (opcode & 0xfff0) {
+ case 0xf100:
+ // AAR
+ tmp = (opcode & 0xf) + 1;
+ m_icount -= (9 + tmp);
+ // A shift by 16 positions is equivalent to a shift by 15
+ tmp = tmp > 15 ? 15 : tmp;
+ m_reg_A = ((m_reg_A ^ 0x8000) >> tmp) - (0x8000 >> tmp);
+ break;
+
+ case 0xf900:
+ // ABR
+ tmp = (opcode & 0xf) + 1;
+ m_icount -= (9 + tmp);
+ tmp = tmp > 15 ? 15 : tmp;
+ m_reg_B = ((m_reg_B ^ 0x8000) >> tmp) - (0x8000 >> tmp);
+ break;
+
+ case 0xf140:
+ // SAR
+ tmp = (opcode & 0xf) + 1;
+ m_icount -= (9 + tmp);
+ m_reg_A >>= tmp;
+ break;
+
+ case 0xf940:
+ // SBR
+ tmp = (opcode & 0xf) + 1;
+ m_icount -= (9 + tmp);
+ m_reg_B >>= tmp;
+ break;
+
+ case 0xf180:
+ // SAL
+ tmp = (opcode & 0xf) + 1;
+ m_icount -= (9 + tmp);
+ m_reg_A <<= tmp;
+ break;
+
+ case 0xf980:
+ // SBL
+ tmp = (opcode & 0xf) + 1;
+ m_icount -= (9 + tmp);
+ m_reg_B <<= tmp;
+ break;
+
+ case 0xf1c0:
+ // RAR
+ tmp = (opcode & 0xf) + 1;
+ m_icount -= (9 + tmp);
+ m_reg_A = (m_reg_A >> tmp) | (m_reg_A << (16 - tmp));
+ break;
+
+ case 0xf9c0:
+ // RBR
+ tmp = (opcode & 0xf) + 1;
+ m_icount -= (9 + tmp);
+ m_reg_B = (m_reg_B >> tmp) | (m_reg_B << (16 - tmp));
+ break;
default:
- switch (opcode & 0xfec0) {
- case 0x7400:
- // RZA
- // SZA
- m_icount -= 14;
- return get_skip_addr(opcode , m_reg_A == 0);
-
- case 0x7440:
- // RIA
- // SIA
- m_icount -= 14;
- return get_skip_addr(opcode , m_reg_A++ == 0);
-
- case 0x7480:
- // SFS
- // SFC
- m_icount -= 14;
- return get_skip_addr(opcode , !BIT(m_flags , HPHYBRID_FLG_BIT));
-
- case 0x7C00:
- // RZB
- // SZB
- m_icount -= 14;
- return get_skip_addr(opcode , m_reg_B == 0);
-
- case 0x7C40:
- // RIB
- // SIB
- m_icount -= 14;
- return get_skip_addr(opcode , m_reg_B++ == 0);
-
- case 0x7c80:
- // SSS
- // SSC
- m_icount -= 14;
- return get_skip_addr(opcode , !BIT(m_flags , HPHYBRID_STS_BIT));
-
- case 0x7cc0:
- // SHS
- // SHC
- m_icount -= 14;
- return get_skip_addr(opcode , !BIT(m_flags , HPHYBRID_HALT_BIT));
-
- default:
- switch (opcode & 0xfe00) {
- case 0x7600:
- // SLA
- // RLA
- m_icount -= 14;
- return get_skip_addr_sc(opcode , m_reg_A , 0);
-
- case 0x7e00:
- // SLB
- // RLB
- m_icount -= 14;
- return get_skip_addr_sc(opcode , m_reg_B , 0);
-
- case 0xf400:
- // SAP
- // SAM
- m_icount -= 14;
- return get_skip_addr_sc(opcode , m_reg_A , 15);
-
- case 0xf600:
- // SOC
- // SOS
- m_icount -= 14;
- return get_skip_addr_sc(opcode , m_flags , HPHYBRID_O_BIT);
-
- case 0xfc00:
- // SBP
- // SBM
- m_icount -= 14;
- return get_skip_addr_sc(opcode , m_reg_B , 15);
-
- case 0xfe00:
- // SEC
- // SES
- m_icount -= 14;
- return get_skip_addr_sc(opcode , m_flags , HPHYBRID_C_BIT);
-
- default:
- switch (opcode & 0xfff0) {
- case 0xf100:
- // AAR
- tmp = (opcode & 0xf) + 1;
- m_icount -= (9 + tmp);
- // A shift by 16 positions is equivalent to a shift by 15
- tmp = tmp > 15 ? 15 : tmp;
- m_reg_A = ((m_reg_A ^ 0x8000) >> tmp) - (0x8000 >> tmp);
- break;
-
- case 0xf900:
- // ABR
- tmp = (opcode & 0xf) + 1;
- m_icount -= (9 + tmp);
- tmp = tmp > 15 ? 15 : tmp;
- m_reg_B = ((m_reg_B ^ 0x8000) >> tmp) - (0x8000 >> tmp);
- break;
-
- case 0xf140:
- // SAR
- tmp = (opcode & 0xf) + 1;
- m_icount -= (9 + tmp);
- m_reg_A >>= tmp;
- break;
-
- case 0xf940:
- // SBR
- tmp = (opcode & 0xf) + 1;
- m_icount -= (9 + tmp);
- m_reg_B >>= tmp;
- break;
-
- case 0xf180:
- // SAL
- tmp = (opcode & 0xf) + 1;
- m_icount -= (9 + tmp);
- m_reg_A <<= tmp;
- break;
-
- case 0xf980:
- // SBL
- tmp = (opcode & 0xf) + 1;
- m_icount -= (9 + tmp);
- m_reg_B <<= tmp;
- break;
-
- case 0xf1c0:
- // RAR
- tmp = (opcode & 0xf) + 1;
- m_icount -= (9 + tmp);
- m_reg_A = (m_reg_A >> tmp) | (m_reg_A << (16 - tmp));
- break;
-
- case 0xf9c0:
- // RBR
- tmp = (opcode & 0xf) + 1;
- m_icount -= (9 + tmp);
- m_reg_B = (m_reg_B >> tmp) | (m_reg_B << (16 - tmp));
- break;
-
- default:
- if ((opcode & 0xf760) == 0x7160) {
- // Place/withdraw instructions
- m_icount -= 23;
- do_pw(opcode);
- } else if ((opcode & 0xff80) == 0xf080) {
- // RET
- m_icount -= 16;
- if (BIT(opcode , 6)) {
- // Pop PA stack
- if (BIT(m_flags , HPHYBRID_IRH_SVC_BIT)) {
- BIT_CLR(m_flags , HPHYBRID_IRH_SVC_BIT);
- memmove(&m_reg_PA[ 0 ] , &m_reg_PA[ 1 ] , HPHYBRID_INT_LVLS);
- m_pa_changed_func((uint8_t)CURRENT_PA);
- } else if (BIT(m_flags , HPHYBRID_IRL_SVC_BIT)) {
- BIT_CLR(m_flags , HPHYBRID_IRL_SVC_BIT);
- memmove(&m_reg_PA[ 0 ] , &m_reg_PA[ 1 ] , HPHYBRID_INT_LVLS);
- m_pa_changed_func((uint8_t)CURRENT_PA);
- }
- tmp = RM(AEC_CASE_C , m_reg_R--) + (opcode & 0x1f);
- BIT_CLR(m_flags, HPHYBRID_IM_BIT);
- } else {
- tmp = RM(AEC_CASE_C , m_reg_R--) + (opcode & 0x1f);
- }
- return BIT(opcode , 5) ? tmp - 0x20 : tmp;
- } else {
- switch (opcode) {
- case 0x7100:
- // SDO
- m_icount -= 12;
- BIT_SET(m_flags , HPHYBRID_DMADIR_BIT);
- break;
-
- case 0x7108:
- // SDI
- m_icount -= 12;
- BIT_CLR(m_flags , HPHYBRID_DMADIR_BIT);
- break;
-
- case 0x7110:
- // EIR
- m_icount -= 12;
- BIT_SET(m_flags , HPHYBRID_INTEN_BIT);
- break;
-
- case 0x7118:
- // DIR
- m_icount -= 12;
- BIT_CLR(m_flags , HPHYBRID_INTEN_BIT);
- break;
-
- case 0x7120:
- // DMA
- m_icount -= 12;
- BIT_SET(m_flags , HPHYBRID_DMAEN_BIT);
- break;
-
- case 0x7138:
- // DDR
- m_icount -= 12;
- BIT_CLR(m_flags , HPHYBRID_DMAEN_BIT);
- break;
-
- case 0x7140:
- // DBL
- m_icount -= 12;
- BIT_CLR(m_flags , HPHYBRID_DB_BIT);
- break;
-
- case 0x7148:
- // CBL
- m_icount -= 12;
- BIT_CLR(m_flags , HPHYBRID_CB_BIT);
- break;
-
- case 0x7150:
- // DBU
- m_icount -= 12;
- BIT_SET(m_flags , HPHYBRID_DB_BIT);
- break;
-
- case 0x7158:
- // CBU
- m_icount -= 12;
- BIT_SET(m_flags , HPHYBRID_CB_BIT);
- break;
-
- case 0xf020:
- // TCA
- m_icount -= 9;
- m_reg_A = ~m_reg_A;
- do_add(m_reg_A , 1);
- break;
-
- case 0xf060:
- // CMA
- m_icount -= 9;
- m_reg_A = ~m_reg_A;
- break;
-
- case 0xf820:
- // TCB
- m_icount -= 9;
- m_reg_B = ~m_reg_B;
- do_add(m_reg_B , 1);
- break;
-
- case 0xf860:
- // CMB
- m_icount -= 9;
- m_reg_B = ~m_reg_B;
- break;
-
- default:
- // Unrecognized instruction: pass it on for further processing (by EMC if present)
- return execute_no_bpc_ioc(opcode);
- }
- }
- }
- }
- }
- }
-
- return m_reg_P + 1;
+ if ((opcode & 0xf760) == 0x7160) {
+ // Place/withdraw instructions
+ m_icount -= 23;
+ do_pw(opcode);
+ } else if ((opcode & 0xff80) == 0xf080) {
+ // RET
+ m_icount -= 16;
+ if (BIT(opcode , 6)) {
+ // Pop PA stack
+ if (BIT(m_flags , HPHYBRID_IRH_SVC_BIT)) {
+ BIT_CLR(m_flags , HPHYBRID_IRH_SVC_BIT);
+ memmove(&m_reg_PA[ 0 ] , &m_reg_PA[ 1 ] , HPHYBRID_INT_LVLS);
+ m_pa_changed_func((uint8_t)CURRENT_PA);
+ } else if (BIT(m_flags , HPHYBRID_IRL_SVC_BIT)) {
+ BIT_CLR(m_flags , HPHYBRID_IRL_SVC_BIT);
+ memmove(&m_reg_PA[ 0 ] , &m_reg_PA[ 1 ] , HPHYBRID_INT_LVLS);
+ m_pa_changed_func((uint8_t)CURRENT_PA);
+ }
+ tmp = RM(AEC_CASE_C , m_reg_R--) + (opcode & 0x1f);
+ BIT_CLR(m_flags, HPHYBRID_IM_BIT);
+ } else {
+ tmp = RM(AEC_CASE_C , m_reg_R--) + (opcode & 0x1f);
+ }
+ return BIT(opcode , 5) ? tmp - 0x20 : tmp;
+ } else {
+ switch (opcode) {
+ case 0x7100:
+ // SDO
+ m_icount -= 12;
+ BIT_SET(m_flags , HPHYBRID_DMADIR_BIT);
+ break;
+
+ case 0x7108:
+ // SDI
+ m_icount -= 12;
+ BIT_CLR(m_flags , HPHYBRID_DMADIR_BIT);
+ break;
+
+ case 0x7110:
+ // EIR
+ m_icount -= 12;
+ BIT_SET(m_flags , HPHYBRID_INTEN_BIT);
+ break;
+
+ case 0x7118:
+ // DIR
+ m_icount -= 12;
+ BIT_CLR(m_flags , HPHYBRID_INTEN_BIT);
+ break;
+
+ case 0x7120:
+ // DMA
+ m_icount -= 12;
+ BIT_SET(m_flags , HPHYBRID_DMAEN_BIT);
+ break;
+
+ case 0x7138:
+ // DDR
+ m_icount -= 12;
+ BIT_CLR(m_flags , HPHYBRID_DMAEN_BIT);
+ break;
+
+ case 0x7140:
+ // DBL
+ m_icount -= 12;
+ BIT_CLR(m_flags , HPHYBRID_DB_BIT);
+ break;
+
+ case 0x7148:
+ // CBL
+ m_icount -= 12;
+ BIT_CLR(m_flags , HPHYBRID_CB_BIT);
+ break;
+
+ case 0x7150:
+ // DBU
+ m_icount -= 12;
+ BIT_SET(m_flags , HPHYBRID_DB_BIT);
+ break;
+
+ case 0x7158:
+ // CBU
+ m_icount -= 12;
+ BIT_SET(m_flags , HPHYBRID_CB_BIT);
+ break;
+
+ case 0xf020:
+ // TCA
+ m_icount -= 9;
+ m_reg_A = ~m_reg_A;
+ do_add(m_reg_A , 1);
+ break;
+
+ case 0xf060:
+ // CMA
+ m_icount -= 9;
+ m_reg_A = ~m_reg_A;
+ break;
+
+ case 0xf820:
+ // TCB
+ m_icount -= 9;
+ m_reg_B = ~m_reg_B;
+ do_add(m_reg_B , 1);
+ break;
+
+ case 0xf860:
+ // CMB
+ m_icount -= 9;
+ m_reg_B = ~m_reg_B;
+ break;
+
+ default:
+ // Unrecognized instruction: pass it on for further processing (by EMC if present)
+ return execute_no_bpc_ioc(opcode);
+ }
+ }
+ }
+ }
+ }
+ }
+
+ return m_reg_P + 1;
}
void hp_hybrid_cpu_device::state_string_export(const device_state_entry &entry, std::string &str) const
{
if (entry.index() == STATE_GENFLAGS) {
str = string_format("%s %s %c %c",
- BIT(m_flags , HPHYBRID_DB_BIT) ? "Db":"..",
- BIT(m_flags , HPHYBRID_CB_BIT) ? "Cb":"..",
- BIT(m_flags , HPHYBRID_O_BIT) ? 'O':'.',
- BIT(m_flags , HPHYBRID_C_BIT) ? 'E':'.');
+ BIT(m_flags , HPHYBRID_DB_BIT) ? "Db":"..",
+ BIT(m_flags , HPHYBRID_CB_BIT) ? "Cb":"..",
+ BIT(m_flags , HPHYBRID_O_BIT) ? 'O':'.',
+ BIT(m_flags , HPHYBRID_C_BIT) ? 'E':'.');
}
}
@@ -689,415 +689,417 @@ util::disasm_interface *hp_hybrid_cpu_device::create_disassembler()
uint16_t hp_hybrid_cpu_device::remove_mae(uint32_t addr)
{
- return (uint16_t)(addr & 0xffff);
+ return (uint16_t)(addr & 0xffff);
}
uint16_t hp_hybrid_cpu_device::RM(aec_cases_t aec_case , uint16_t addr)
{
- return RM(add_mae(aec_case , addr));
+ return RM(add_mae(aec_case , addr));
}
uint16_t hp_hybrid_cpu_device::RM(uint32_t addr)
{
- uint16_t tmp;
- uint16_t addr_wo_bsc = remove_mae(addr);
+ uint16_t tmp;
+ uint16_t addr_wo_bsc = remove_mae(addr);
- if (addr_wo_bsc <= HP_REG_LAST_ADDR) {
- // Any access to internal registers removes forcing of BSC 2x
- m_forced_bsc_25 = false;
+ if (addr_wo_bsc <= HP_REG_LAST_ADDR) {
+ // Any access to internal registers removes forcing of BSC 2x
+ m_forced_bsc_25 = false;
- // Memory mapped registers that are present in both 3001 & 3011
- switch (addr_wo_bsc) {
- case HP_REG_A_ADDR:
- return m_reg_A;
+ // Memory mapped registers that are present in both 3001 & 3011
+ switch (addr_wo_bsc) {
+ case HP_REG_A_ADDR:
+ return m_reg_A;
- case HP_REG_B_ADDR:
- return m_reg_B;
+ case HP_REG_B_ADDR:
+ return m_reg_B;
- case HP_REG_P_ADDR:
- return m_reg_P;
+ case HP_REG_P_ADDR:
+ return m_reg_P;
- case HP_REG_R_ADDR:
- return m_reg_R;
+ case HP_REG_R_ADDR:
+ return m_reg_R;
- case HP_REG_R4_ADDR:
- case HP_REG_R5_ADDR:
- case HP_REG_R6_ADDR:
- case HP_REG_R7_ADDR:
- return RIO(CURRENT_PA , addr_wo_bsc - HP_REG_R4_ADDR);
+ case HP_REG_R4_ADDR:
+ case HP_REG_R5_ADDR:
+ case HP_REG_R6_ADDR:
+ case HP_REG_R7_ADDR:
+ return RIO(CURRENT_PA , addr_wo_bsc - HP_REG_R4_ADDR);
- case HP_REG_IV_ADDR:
- return m_reg_IV;
+ case HP_REG_IV_ADDR:
+ return m_reg_IV;
- case HP_REG_PA_ADDR:
- return CURRENT_PA;
+ case HP_REG_PA_ADDR:
+ return CURRENT_PA;
- case HP_REG_W_ADDR:
- return m_reg_W;
+ case HP_REG_W_ADDR:
+ return m_reg_W;
- case HP_REG_DMAPA_ADDR:
- tmp = m_dmapa & HP_REG_PA_MASK;
- if (BIT(m_flags , HPHYBRID_CB_BIT)) {
- BIT_SET(tmp , 15);
- }
- if (BIT(m_flags , HPHYBRID_DB_BIT)) {
- BIT_SET(tmp , 14);
- }
- return tmp;
+ case HP_REG_DMAPA_ADDR:
+ tmp = m_dmapa & HP_REG_PA_MASK;
+ if (BIT(m_flags , HPHYBRID_CB_BIT)) {
+ BIT_SET(tmp , 15);
+ }
+ if (BIT(m_flags , HPHYBRID_DB_BIT)) {
+ BIT_SET(tmp , 14);
+ }
+ return tmp;
- case HP_REG_DMAMA_ADDR:
- return m_dmama;
+ case HP_REG_DMAMA_ADDR:
+ return m_dmama;
- case HP_REG_DMAC_ADDR:
- return m_dmac;
+ case HP_REG_DMAC_ADDR:
+ return m_dmac;
- case HP_REG_C_ADDR:
- return m_reg_C;
+ case HP_REG_C_ADDR:
+ return m_reg_C;
- case HP_REG_D_ADDR:
- return m_reg_D;
+ case HP_REG_D_ADDR:
+ return m_reg_D;
- default:
- return read_non_common_reg(addr_wo_bsc);
- }
- } else {
- return m_direct->read_word(addr << 1);
+ default:
+ return read_non_common_reg(addr_wo_bsc);
}
+ } else {
+ return m_direct->read_word(addr << 1);
+ }
}
void hp_hybrid_cpu_device::WM(aec_cases_t aec_case , uint16_t addr , uint16_t v)
{
- WM(add_mae(aec_case , addr) , v);
+ WM(add_mae(aec_case , addr) , v);
}
void hp_hybrid_cpu_device::WM(uint32_t addr , uint16_t v)
{
- uint16_t addr_wo_bsc = remove_mae(addr);
-
- if (addr_wo_bsc <= HP_REG_LAST_ADDR) {
- // Any access to internal registers removes forcing of BSC 2x
- m_forced_bsc_25 = false;
-
- // Memory mapped registers
- switch (addr_wo_bsc) {
- case HP_REG_A_ADDR:
- m_reg_A = v;
- break;
-
- case HP_REG_B_ADDR:
- m_reg_B = v;
- break;
-
- case HP_REG_P_ADDR:
- m_reg_P = v;
- break;
-
- case HP_REG_R_ADDR:
- m_reg_R = v;
- break;
-
- case HP_REG_R4_ADDR:
- case HP_REG_R5_ADDR:
- case HP_REG_R6_ADDR:
- case HP_REG_R7_ADDR:
- WIO(CURRENT_PA , addr_wo_bsc - HP_REG_R4_ADDR , v);
- break;
-
- case HP_REG_IV_ADDR:
- m_reg_IV = v & HP_REG_IV_MASK;
- break;
-
- case HP_REG_PA_ADDR:
- CURRENT_PA = v & HP_REG_PA_MASK;
- m_pa_changed_func((uint8_t)CURRENT_PA);
- break;
-
- case HP_REG_W_ADDR:
- m_reg_W = v;
- break;
-
- case HP_REG_DMAPA_ADDR:
- m_dmapa = v & HP_REG_PA_MASK;
- break;
-
- case HP_REG_DMAMA_ADDR:
- m_dmama = v;
- break;
-
- case HP_REG_DMAC_ADDR:
- m_dmac = v;
- break;
-
- case HP_REG_C_ADDR:
- m_reg_C = v;
- break;
-
- case HP_REG_D_ADDR:
- m_reg_D = v;
- break;
+ uint16_t addr_wo_bsc = remove_mae(addr);
- default:
- write_non_common_reg(addr_wo_bsc , v);
- break;
- }
- } else {
- m_program->write_word(addr << 1 , v);
+ if (addr_wo_bsc <= HP_REG_LAST_ADDR) {
+ // Any access to internal registers removes forcing of BSC 2x
+ m_forced_bsc_25 = false;
+
+ // Memory mapped registers
+ switch (addr_wo_bsc) {
+ case HP_REG_A_ADDR:
+ m_reg_A = v;
+ break;
+
+ case HP_REG_B_ADDR:
+ m_reg_B = v;
+ break;
+
+ case HP_REG_P_ADDR:
+ m_reg_P = v;
+ break;
+
+ case HP_REG_R_ADDR:
+ m_reg_R = v;
+ break;
+
+ case HP_REG_R4_ADDR:
+ case HP_REG_R5_ADDR:
+ case HP_REG_R6_ADDR:
+ case HP_REG_R7_ADDR:
+ WIO(CURRENT_PA , addr_wo_bsc - HP_REG_R4_ADDR , v);
+ break;
+
+ case HP_REG_IV_ADDR:
+ m_reg_IV = v & HP_REG_IV_MASK;
+ break;
+
+ case HP_REG_PA_ADDR:
+ CURRENT_PA = v & HP_REG_PA_MASK;
+ m_pa_changed_func((uint8_t)CURRENT_PA);
+ break;
+
+ case HP_REG_W_ADDR:
+ m_reg_W = v;
+ break;
+
+ case HP_REG_DMAPA_ADDR:
+ m_dmapa = v & HP_REG_PA_MASK;
+ break;
+
+ case HP_REG_DMAMA_ADDR:
+ m_dmama = v;
+ break;
+
+ case HP_REG_DMAC_ADDR:
+ m_dmac = v;
+ break;
+
+ case HP_REG_C_ADDR:
+ m_reg_C = v;
+ break;
+
+ case HP_REG_D_ADDR:
+ m_reg_D = v;
+ break;
+
+ default:
+ write_non_common_reg(addr_wo_bsc , v);
+ break;
}
+ } else {
+ m_program->write_word(addr , v);
+ }
}
uint16_t hp_hybrid_cpu_device::fetch(void)
{
- m_genpc = add_mae(AEC_CASE_A , m_reg_P);
- return RM(m_genpc);
+ m_genpc = add_mae(AEC_CASE_A , m_reg_P);
+ return RM(m_genpc);
}
uint32_t hp_hybrid_cpu_device::get_ea(uint16_t opcode)
{
- uint16_t base;
- uint16_t off;
- aec_cases_t aec;
-
- if (BIT(opcode , 10)) {
- // Current page
- base = m_reg_P;
- aec = AEC_CASE_A;
- } else {
- // Base page
- base = 0;
- aec = AEC_CASE_B;
- }
+ uint16_t base;
+ uint16_t off;
+ aec_cases_t aec;
+
+ if (BIT(opcode , 10)) {
+ // Current page
+ base = m_reg_P;
+ aec = AEC_CASE_A;
+ } else {
+ // Base page
+ base = 0;
+ aec = AEC_CASE_B;
+ }
- off = opcode & 0x3ff;
- if (off & 0x200) {
- off -= 0x400;
- }
+ off = opcode & 0x3ff;
+ if (off & 0x200) {
+ off -= 0x400;
+ }
- base += off;
+ base += off;
- if (BIT(opcode , 15)) {
- // Indirect addressing
- m_icount -= 6;
- return add_mae(AEC_CASE_C , RM(aec , base));
- } else {
- // Direct addressing
- return add_mae(aec , base);
- }
+ if (BIT(opcode , 15)) {
+ // Indirect addressing
+ m_icount -= 6;
+ return add_mae(AEC_CASE_C , RM(aec , base));
+ } else {
+ // Direct addressing
+ return add_mae(aec , base);
+ }
}
void hp_hybrid_cpu_device::do_add(uint16_t& addend1 , uint16_t addend2)
{
- uint32_t tmp = addend1 + addend2;
+ uint32_t tmp = addend1 + addend2;
- if (BIT(tmp , 16)) {
- // Carry
- BIT_SET(m_flags , HPHYBRID_C_BIT);
- }
+ if (BIT(tmp , 16)) {
+ // Carry
+ BIT_SET(m_flags , HPHYBRID_C_BIT);
+ }
- if (BIT((tmp ^ addend1) & (tmp ^ addend2) , 15)) {
- // Overflow
- BIT_SET(m_flags , HPHYBRID_O_BIT);
- }
+ if (BIT((tmp ^ addend1) & (tmp ^ addend2) , 15)) {
+ // Overflow
+ BIT_SET(m_flags , HPHYBRID_O_BIT);
+ }
- addend1 = (uint16_t)tmp;
+ addend1 = (uint16_t)tmp;
}
uint16_t hp_hybrid_cpu_device::get_skip_addr(uint16_t opcode , bool condition) const
{
- bool skip_val = BIT(opcode , 8) != 0;
+ bool skip_val = BIT(opcode , 8) != 0;
- if (condition == skip_val) {
- uint16_t off = opcode & 0x1f;
+ if (condition == skip_val) {
+ uint16_t off = opcode & 0x1f;
- if (BIT(opcode , 5)) {
- off -= 0x20;
- }
- return m_reg_P + off;
- } else {
- return m_reg_P + 1;
- }
+ if (BIT(opcode , 5)) {
+ off -= 0x20;
+ }
+ return m_reg_P + off;
+ } else {
+ return m_reg_P + 1;
+ }
}
uint16_t hp_hybrid_cpu_device::get_skip_addr_sc(uint16_t opcode , uint16_t& v , unsigned n)
{
- bool val = BIT(v , n);
-
- if (BIT(opcode , 7)) {
- if (BIT(opcode , 6)) {
- BIT_SET(v , n);
- } else {
- BIT_CLR(v , n);
- }
- }
+ bool val = BIT(v , n);
- return get_skip_addr(opcode , val);
+ if (BIT(opcode , 7)) {
+ if (BIT(opcode , 6)) {
+ BIT_SET(v , n);
+ } else {
+ BIT_CLR(v , n);
+ }
+ }
+
+ return get_skip_addr(opcode , val);
}
uint16_t hp_hybrid_cpu_device::get_skip_addr_sc(uint16_t opcode , uint32_t& v , unsigned n)
{
- bool val = BIT(v , n);
+ bool val = BIT(v , n);
- if (BIT(opcode , 7)) {
- if (BIT(opcode , 6)) {
- BIT_SET(v , n);
- } else {
- BIT_CLR(v , n);
- }
+ if (BIT(opcode , 7)) {
+ if (BIT(opcode , 6)) {
+ BIT_SET(v , n);
+ } else {
+ BIT_CLR(v , n);
}
+ }
- return get_skip_addr(opcode , val);
+ return get_skip_addr(opcode , val);
}
void hp_hybrid_cpu_device::do_pw(uint16_t opcode)
{
- uint16_t tmp;
- uint16_t reg_addr = opcode & 7;
- uint16_t *ptr_reg;
- uint16_t b_mask;
-
- if (BIT(opcode , 3)) {
- ptr_reg = &m_reg_D;
- b_mask = BIT_MASK(HPHYBRID_DB_BIT);
- } else {
- ptr_reg = &m_reg_C;
- b_mask = BIT_MASK(HPHYBRID_CB_BIT);
- }
+ uint16_t tmp;
+ uint16_t reg_addr = opcode & 7;
+ uint16_t *ptr_reg;
+ uint16_t b_mask;
- if (BIT(opcode , 4)) {
- // Withdraw
- if (BIT(opcode , 11)) {
- // Byte
- uint32_t tmp_addr = (uint32_t)(*ptr_reg);
- if (m_flags & b_mask) {
- tmp_addr |= 0x10000;
- }
- tmp = RM(AEC_CASE_C , (uint16_t)(tmp_addr >> 1));
- if (BIT(tmp_addr , 0)) {
- tmp &= 0xff;
- } else {
- tmp >>= 8;
- }
- } else {
- // Word
- tmp = RM(AEC_CASE_C , *ptr_reg);
- }
- WM(reg_addr , tmp);
-
- if (BIT(opcode , 7)) {
- // Post-decrement
- if ((*ptr_reg)-- == 0) {
- m_flags ^= b_mask;
- }
- } else {
- // Post-increment
- if (++(*ptr_reg) == 0) {
- m_flags ^= b_mask;
- }
- }
+ if (BIT(opcode , 3)) {
+ ptr_reg = &m_reg_D;
+ b_mask = BIT_MASK(HPHYBRID_DB_BIT);
+ } else {
+ ptr_reg = &m_reg_C;
+ b_mask = BIT_MASK(HPHYBRID_CB_BIT);
+ }
+
+ if (BIT(opcode , 4)) {
+ // Withdraw
+ if (BIT(opcode , 11)) {
+ // Byte
+ uint32_t tmp_addr = (uint32_t)(*ptr_reg);
+ if (m_flags & b_mask) {
+ tmp_addr |= 0x10000;
+ }
+ tmp = RM(AEC_CASE_C , (uint16_t)(tmp_addr >> 1));
+ if (BIT(tmp_addr , 0)) {
+ tmp &= 0xff;
+ } else {
+ tmp >>= 8;
+ }
+ } else {
+ // Word
+ tmp = RM(AEC_CASE_C , *ptr_reg);
+ }
+ WM(reg_addr , tmp);
+
+ if (BIT(opcode , 7)) {
+ // Post-decrement
+ if ((*ptr_reg)-- == 0) {
+ m_flags ^= b_mask;
+ }
+ } else {
+ // Post-increment
+ if (++(*ptr_reg) == 0) {
+ m_flags ^= b_mask;
+ }
+ }
+ } else {
+ // Place
+ if (BIT(opcode , 7)) {
+ // Pre-decrement
+ if ((*ptr_reg)-- == 0) {
+ m_flags ^= b_mask;
+ }
+ } else {
+ // Pre-increment
+ if (++(*ptr_reg) == 0) {
+ m_flags ^= b_mask;
+ }
+ }
+ tmp = RM(reg_addr);
+ if (BIT(opcode , 11)) {
+ // Byte
+ uint32_t tmp_addr = (uint32_t)(*ptr_reg);
+ if (m_flags & b_mask) {
+ tmp_addr |= 0x10000;
+ }
+ if (tmp_addr <= (HP_REG_LAST_ADDR * 2 + 1)) {
+ // Single bytes can be written to registers.
+ // The addressed register gets the written byte in the proper position
+ // and a 0 in the other byte because access to registers is always done in
+ // 16 bits units.
+ if (BIT(tmp_addr , 0)) {
+ tmp &= 0xff;
} else {
- // Place
- if (BIT(opcode , 7)) {
- // Pre-decrement
- if ((*ptr_reg)-- == 0) {
- m_flags ^= b_mask;
- }
- } else {
- // Pre-increment
- if (++(*ptr_reg) == 0) {
- m_flags ^= b_mask;
- }
- }
- tmp = RM(reg_addr);
- if (BIT(opcode , 11)) {
- // Byte
- uint32_t tmp_addr = (uint32_t)(*ptr_reg);
- if (m_flags & b_mask) {
- tmp_addr |= 0x10000;
- }
- if (tmp_addr <= (HP_REG_LAST_ADDR * 2 + 1)) {
- // Single bytes can be written to registers.
- // The addressed register gets the written byte in the proper position
- // and a 0 in the other byte because access to registers is always done in
- // 16 bits units.
- if (BIT(tmp_addr , 0)) {
- tmp &= 0xff;
- } else {
- tmp <<= 8;
- }
- WM(tmp_addr >> 1 , tmp);
- } else {
- // Extend address, preserve LSB & form byte address
- tmp_addr = (add_mae(AEC_CASE_C , tmp_addr >> 1) << 1) | (tmp_addr & 1);
- m_program->write_byte(tmp_addr , (uint8_t)tmp);
- }
- } else {
- // Word
- WM(AEC_CASE_C , *ptr_reg , tmp);
- }
+ tmp <<= 8;
}
+ WM(tmp_addr >> 1 , tmp);
+ } else {
+ // Extend address, form byte address
+ uint16_t val = (tmp_addr & 1) ? uint8_t(tmp) << 8 : uint8_t(tmp);
+ uint16_t mask = (tmp_addr & 1) ? 0xff00 : 0x00ff;
+ tmp_addr = add_mae(AEC_CASE_C , tmp_addr >> 1);
+ m_program->write_word(tmp_addr , val, mask);
+ }
+ } else {
+ // Word
+ WM(AEC_CASE_C , *ptr_reg , tmp);
+ }
+ }
}
void hp_hybrid_cpu_device::check_for_interrupts(void)
{
- if (!BIT(m_flags , HPHYBRID_INTEN_BIT) || BIT(m_flags , HPHYBRID_IRH_SVC_BIT) || BIT(m_flags , HPHYBRID_IM_BIT)) {
- return;
- }
+ if (!BIT(m_flags , HPHYBRID_INTEN_BIT) || BIT(m_flags , HPHYBRID_IRH_SVC_BIT) || BIT(m_flags , HPHYBRID_IM_BIT)) {
+ return;
+ }
- int irqline;
-
- if (BIT(m_flags , HPHYBRID_IRH_BIT)) {
- // Service high-level interrupt
- BIT_SET(m_flags , HPHYBRID_IRH_SVC_BIT);
- irqline = HPHYBRID_IRH;
- if (BIT(m_flags , HPHYBRID_IRL_SVC_BIT)) {
- logerror("H pre-empted L @ %06x\n" , m_genpc);
- }
- } else if (BIT(m_flags , HPHYBRID_IRL_BIT) && !BIT(m_flags , HPHYBRID_IRL_SVC_BIT)) {
- // Service low-level interrupt
- BIT_SET(m_flags , HPHYBRID_IRL_SVC_BIT);
- irqline = HPHYBRID_IRL;
- } else {
- return;
- }
+ int irqline;
- // Get interrupt vector in low byte
- uint8_t vector = (uint8_t)standard_irq_callback(irqline);
- uint8_t new_PA;
+ if (BIT(m_flags , HPHYBRID_IRH_BIT)) {
+ // Service high-level interrupt
+ BIT_SET(m_flags , HPHYBRID_IRH_SVC_BIT);
+ irqline = HPHYBRID_IRH;
+ if (BIT(m_flags , HPHYBRID_IRL_SVC_BIT)) {
+ logerror("H pre-empted L @ %06x\n" , m_genpc);
+ }
+ } else if (BIT(m_flags , HPHYBRID_IRL_BIT) && !BIT(m_flags , HPHYBRID_IRL_SVC_BIT)) {
+ // Service low-level interrupt
+ BIT_SET(m_flags , HPHYBRID_IRL_SVC_BIT);
+ irqline = HPHYBRID_IRL;
+ } else {
+ return;
+ }
- // Get highest numbered 1
- // Don't know what happens if vector is 0, here we assume bit 7 = 1
- if (vector == 0) {
- new_PA = 7;
- } else {
- for (new_PA = 7; new_PA && !BIT(vector , 7); new_PA--, vector <<= 1) {
- }
- }
- if (irqline == HPHYBRID_IRH) {
- BIT_SET(new_PA , 3);
- }
+ // Get interrupt vector in low byte
+ uint8_t vector = (uint8_t)standard_irq_callback(irqline);
+ uint8_t new_PA;
- // Push PA stack
- memmove(&m_reg_PA[ 1 ] , &m_reg_PA[ 0 ] , HPHYBRID_INT_LVLS);
+ // Get highest numbered 1
+ // Don't know what happens if vector is 0, here we assume bit 7 = 1
+ if (vector == 0) {
+ new_PA = 7;
+ } else {
+ for (new_PA = 7; new_PA && !BIT(vector , 7); new_PA--, vector <<= 1) {
+ }
+ }
+ if (irqline == HPHYBRID_IRH) {
+ BIT_SET(new_PA , 3);
+ }
- CURRENT_PA = new_PA;
+ // Push PA stack
+ memmove(&m_reg_PA[ 1 ] , &m_reg_PA[ 0 ] , HPHYBRID_INT_LVLS);
- m_pa_changed_func((uint8_t)CURRENT_PA);
+ CURRENT_PA = new_PA;
+
+ m_pa_changed_func((uint8_t)CURRENT_PA);
- // Is this correct? Patent @ pg 210 suggests that the whole interrupt recognition sequence
- // lasts for 32 cycles
- m_icount -= 32;
+ // Is this correct? Patent @ pg 210 suggests that the whole interrupt recognition sequence
+ // lasts for 32 cycles
+ m_icount -= 32;
- // Allow special processing in 5061-3001
- enter_isr();
+ // Allow special processing in 5061-3001
+ enter_isr();
- // Do a double-indirect JSM IV,I instruction
- WM(AEC_CASE_C , ++m_reg_R , m_reg_P);
- m_reg_P = RM(AEC_CASE_C , m_reg_IV + CURRENT_PA);
- m_reg_I = fetch();
+ // Do a double-indirect JSM IV,I instruction
+ WM(AEC_CASE_C , ++m_reg_R , m_reg_P);
+ m_reg_P = RM(AEC_CASE_C , m_reg_IV + CURRENT_PA);
+ m_reg_I = fetch();
}
void hp_hybrid_cpu_device::enter_isr(void)
{
- // Do nothing special
+ // Do nothing special
}
void hp_hybrid_cpu_device::handle_dma(void)
@@ -1108,7 +1110,7 @@ void hp_hybrid_cpu_device::handle_dma(void)
if (BIT(m_flags , HPHYBRID_DMADIR_BIT)) {
// "Outward" DMA: memory -> peripheral
- tmp = RM(AEC_CASE_D , m_dmama++);
+ tmp = RM(AEC_CASE_D , m_dmama++);
WIO(m_dmapa , tc ? 2 : 0 , tmp);
m_icount -= 10;
} else {
@@ -1397,16 +1399,16 @@ uint16_t hp_5061_3001_cpu_device::execute_no_bpc_ioc(uint16_t opcode)
break;
case 0x7280:
- // FXA
- m_icount -= 40;
- tmp_ar2 = get_ar2();
- carry = do_dec_add(BIT(m_flags , HPHYBRID_DC_BIT) , tmp_ar2 , get_ar1());
- set_ar2(tmp_ar2);
- if (carry)
- BIT_SET(m_flags, HPHYBRID_DC_BIT);
- else
- BIT_CLR(m_flags, HPHYBRID_DC_BIT);
- break;
+ // FXA
+ m_icount -= 40;
+ tmp_ar2 = get_ar2();
+ carry = do_dec_add(BIT(m_flags , HPHYBRID_DC_BIT) , tmp_ar2 , get_ar1());
+ set_ar2(tmp_ar2);
+ if (carry)
+ BIT_SET(m_flags, HPHYBRID_DC_BIT);
+ else
+ BIT_CLR(m_flags, HPHYBRID_DC_BIT);
+ break;
case 0x7340:
// NRM
@@ -1598,7 +1600,7 @@ uint32_t hp_5061_3001_cpu_device::add_mae(aec_cases_t aec_case , uint16_t addr)
case AEC_CASE_D:
bsc_reg = top_half ? m_reg_aec[ HP_REG_R32_ADDR - HP_REG_R32_ADDR ] : m_reg_aec[ HP_REG_R37_ADDR - HP_REG_R32_ADDR ];
- break;
+ break;
default:
logerror("hphybrid: aec_case=%d\n" , aec_case);
diff --git a/src/devices/cpu/hphybrid/hphybrid.h b/src/devices/cpu/hphybrid/hphybrid.h
index 8482712b476..bd362d710ee 100644
--- a/src/devices/cpu/hphybrid/hphybrid.h
+++ b/src/devices/cpu/hphybrid/hphybrid.h
@@ -140,7 +140,7 @@ private:
address_space_config m_io_config;
address_space *m_program;
- direct_read_data *m_direct;
+ direct_read_data<-1> *m_direct;
address_space *m_io;
uint32_t get_ea(uint16_t opcode);
diff --git a/src/devices/cpu/i386/i386.cpp b/src/devices/cpu/i386/i386.cpp
index ee0e49e7cf4..637af658c6e 100644
--- a/src/devices/cpu/i386/i386.cpp
+++ b/src/devices/cpu/i386/i386.cpp
@@ -3244,7 +3244,7 @@ void i386_device::i386_common_init()
}
m_program = &space(AS_PROGRAM);
- m_direct = &m_program->direct();
+ m_direct = m_program->direct<0>();
m_io = &space(AS_IO);
m_smi = false;
m_debugger_temp = 0;
diff --git a/src/devices/cpu/i386/i386.h b/src/devices/cpu/i386/i386.h
index cd406276e19..93c5df1c122 100644
--- a/src/devices/cpu/i386/i386.h
+++ b/src/devices/cpu/i386/i386.h
@@ -212,7 +212,7 @@ protected:
uint8_t m_irq_state;
address_space *m_program;
- direct_read_data *m_direct;
+ direct_read_data<0> *m_direct;
address_space *m_io;
uint32_t m_a20_mask;
diff --git a/src/devices/cpu/i8008/i8008.cpp b/src/devices/cpu/i8008/i8008.cpp
index b2de40a7109..9b687eec92a 100644
--- a/src/devices/cpu/i8008/i8008.cpp
+++ b/src/devices/cpu/i8008/i8008.cpp
@@ -53,7 +53,7 @@ void i8008_device::device_start()
{
// find address spaces
m_program = &space(AS_PROGRAM);
- m_direct = &m_program->direct();
+ m_direct = m_program->direct<0>();
m_io = &space(AS_IO);
// save state
diff --git a/src/devices/cpu/i8008/i8008.h b/src/devices/cpu/i8008/i8008.h
index f808cc3790b..ea473df22af 100644
--- a/src/devices/cpu/i8008/i8008.h
+++ b/src/devices/cpu/i8008/i8008.h
@@ -83,7 +83,7 @@ protected:
address_space *m_program;
address_space *m_io;
- direct_read_data *m_direct;
+ direct_read_data<0> *m_direct;
};
// device type definition
diff --git a/src/devices/cpu/i8085/i8085.cpp b/src/devices/cpu/i8085/i8085.cpp
index d3fbd88ee26..5e984464cf3 100644
--- a/src/devices/cpu/i8085/i8085.cpp
+++ b/src/devices/cpu/i8085/i8085.cpp
@@ -338,8 +338,8 @@ void i8085a_cpu_device::device_start()
}
m_program = &space(AS_PROGRAM);
- m_direct = &m_program->direct();
- m_opcode_direct = has_space(AS_OPCODES) ? &space(AS_OPCODES).direct() : m_direct;
+ m_direct = m_program->direct<0>();
+ m_opcode_direct = has_space(AS_OPCODES) ? space(AS_OPCODES).direct<0>() : m_direct;
m_io = &space(AS_IO);
/* resolve callbacks */
diff --git a/src/devices/cpu/i8085/i8085.h b/src/devices/cpu/i8085/i8085.h
index d144283f934..b4ab5901c1f 100644
--- a/src/devices/cpu/i8085/i8085.h
+++ b/src/devices/cpu/i8085/i8085.h
@@ -139,8 +139,8 @@ private:
bool m_ietemp; /* import/export temp space */
address_space *m_program;
- direct_read_data *m_direct;
- direct_read_data *m_opcode_direct;
+ direct_read_data<0> *m_direct;
+ direct_read_data<0> *m_opcode_direct;
address_space *m_io;
int m_icount;
diff --git a/src/devices/cpu/i86/i86.cpp b/src/devices/cpu/i86/i86.cpp
index 19b5317b54a..9ecd0ddc99f 100644
--- a/src/devices/cpu/i86/i86.cpp
+++ b/src/devices/cpu/i86/i86.cpp
@@ -417,8 +417,8 @@ void i8086_common_cpu_device::device_start()
m_stack = m_program;
m_code = m_program;
m_extra = m_program;
- m_direct = &m_program->direct();
- m_direct_opcodes = &m_opcodes->direct();
+ m_direct = m_program->direct<0>();
+ m_direct_opcodes = m_opcodes->direct<0>();
m_io = &space(AS_IO);
save_item(NAME(m_regs.w));
diff --git a/src/devices/cpu/i86/i86.h b/src/devices/cpu/i86/i86.h
index 99ffb6a9f6f..f1dc8bc329d 100644
--- a/src/devices/cpu/i86/i86.h
+++ b/src/devices/cpu/i86/i86.h
@@ -314,7 +314,7 @@ protected:
uint8_t m_test_state;
address_space *m_program, *m_opcodes, *m_stack, *m_code, *m_extra;
- direct_read_data *m_direct, *m_direct_opcodes;
+ direct_read_data<0> *m_direct, *m_direct_opcodes;
address_space *m_io;
offs_t m_fetch_xor;
int m_icount;
diff --git a/src/devices/cpu/i960/i960.cpp b/src/devices/cpu/i960/i960.cpp
index 5f7d140dcdf..148cc1a8996 100644
--- a/src/devices/cpu/i960/i960.cpp
+++ b/src/devices/cpu/i960/i960.cpp
@@ -2103,7 +2103,7 @@ void i960_cpu_device::execute_set_input(int irqline, int state)
void i960_cpu_device::device_start()
{
m_program = &space(AS_PROGRAM);
- m_direct = &m_program->direct();
+ m_direct = m_program->direct<0>();
save_item(NAME(m_IP));
save_item(NAME(m_PIP));
diff --git a/src/devices/cpu/i960/i960.h b/src/devices/cpu/i960/i960.h
index 77f399960c5..2b2b53e2729 100644
--- a/src/devices/cpu/i960/i960.h
+++ b/src/devices/cpu/i960/i960.h
@@ -125,7 +125,7 @@ private:
int m_immediate_pri;
address_space *m_program;
- direct_read_data *m_direct;
+ direct_read_data<0> *m_direct;
int m_icount;
diff --git a/src/devices/cpu/ie15/ie15.cpp b/src/devices/cpu/ie15/ie15.cpp
index dd070e7f711..80c0fecdbe7 100644
--- a/src/devices/cpu/ie15/ie15.cpp
+++ b/src/devices/cpu/ie15/ie15.cpp
@@ -49,7 +49,7 @@ void ie15_cpu_device::device_start()
{
// find address spaces
m_program = &space(AS_PROGRAM);
- m_direct = &m_program->direct();
+ m_direct = m_program->direct<0>();
m_io = &space(AS_IO);
// save state
diff --git a/src/devices/cpu/ie15/ie15.h b/src/devices/cpu/ie15/ie15.h
index f990da84276..f919d81c211 100644
--- a/src/devices/cpu/ie15/ie15.h
+++ b/src/devices/cpu/ie15/ie15.h
@@ -74,7 +74,7 @@ protected:
address_space *m_program;
address_space *m_io;
- direct_read_data *m_direct;
+ direct_read_data<0> *m_direct;
};
// device type definition
diff --git a/src/devices/cpu/jaguar/jaguar.cpp b/src/devices/cpu/jaguar/jaguar.cpp
index 9039b25ad72..b38f2c1fe97 100644
--- a/src/devices/cpu/jaguar/jaguar.cpp
+++ b/src/devices/cpu/jaguar/jaguar.cpp
@@ -338,7 +338,7 @@ void jaguar_cpu_device::device_start()
init_tables();
m_program = &space(AS_PROGRAM);
- m_direct = &m_program->direct();
+ m_direct = m_program->direct<0>();
m_cpu_interrupt.resolve_safe();
save_item(NAME(m_r));
diff --git a/src/devices/cpu/jaguar/jaguar.h b/src/devices/cpu/jaguar/jaguar.h
index ae79ffe1d8a..ac7f406621d 100644
--- a/src/devices/cpu/jaguar/jaguar.h
+++ b/src/devices/cpu/jaguar/jaguar.h
@@ -139,7 +139,7 @@ protected:
int m_bankswitch_icount;
devcb_write_line m_cpu_interrupt;
address_space *m_program;
- direct_read_data *m_direct;
+ direct_read_data<0> *m_direct;
uint32_t m_internal_ram_start;
uint32_t m_internal_ram_end;
diff --git a/src/devices/cpu/lc8670/lc8670.cpp b/src/devices/cpu/lc8670/lc8670.cpp
index e93c134cab5..34078ecb994 100644
--- a/src/devices/cpu/lc8670/lc8670.cpp
+++ b/src/devices/cpu/lc8670/lc8670.cpp
@@ -195,7 +195,7 @@ void lc8670_cpu_device::device_start()
m_program = &space(AS_PROGRAM);
m_data = &space(AS_DATA);
m_io = &space(AS_IO);
- m_direct = &m_program->direct();
+ m_direct = m_program->direct<0>();
// set our instruction counter
m_icountptr = &m_icount;
diff --git a/src/devices/cpu/lc8670/lc8670.h b/src/devices/cpu/lc8670/lc8670.h
index 40727da5fb9..c0fddecb60b 100644
--- a/src/devices/cpu/lc8670/lc8670.h
+++ b/src/devices/cpu/lc8670/lc8670.h
@@ -197,7 +197,7 @@ private:
address_space * m_program; // program space (ROM or flash)
address_space * m_data; // internal RAM/register
address_space * m_io; // I/O ports
- direct_read_data * m_direct;
+ direct_read_data<0> *m_direct;
// timers
static const device_timer_id BASE_TIMER = 1;
diff --git a/src/devices/cpu/lh5801/lh5801.cpp b/src/devices/cpu/lh5801/lh5801.cpp
index 1a28c90fc05..6ba677d1e17 100644
--- a/src/devices/cpu/lh5801/lh5801.cpp
+++ b/src/devices/cpu/lh5801/lh5801.cpp
@@ -92,7 +92,7 @@ void lh5801_cpu_device::device_start()
{
m_program = &space(AS_PROGRAM);
m_io = &space(AS_IO);
- m_direct = &m_program->direct();
+ m_direct = m_program->direct<0>();
m_in_func.resolve_safe(0);
diff --git a/src/devices/cpu/lh5801/lh5801.h b/src/devices/cpu/lh5801/lh5801.h
index 51ffa7c00cd..2981bda7d0f 100644
--- a/src/devices/cpu/lh5801/lh5801.h
+++ b/src/devices/cpu/lh5801/lh5801.h
@@ -103,7 +103,7 @@ private:
address_space *m_program; //ME0
address_space *m_io; //ME1
- direct_read_data *m_direct;
+ direct_read_data<0> *m_direct;
PAIR m_s;
PAIR m_p;
diff --git a/src/devices/cpu/m37710/m37710.cpp b/src/devices/cpu/m37710/m37710.cpp
index e8a0af3b858..53bb01301eb 100644
--- a/src/devices/cpu/m37710/m37710.cpp
+++ b/src/devices/cpu/m37710/m37710.cpp
@@ -998,7 +998,7 @@ void m37710_cpu_device::device_start()
memset(m_m37710_regs, 0, sizeof(m_m37710_regs));
m_program = &space(AS_PROGRAM);
- m_direct = &m_program->direct();
+ m_direct = m_program->direct<0>();
m_io = &space(AS_IO);
m_ICount = 0;
diff --git a/src/devices/cpu/m37710/m37710.h b/src/devices/cpu/m37710/m37710.h
index 6daaa2d26da..4a52bfd8bcc 100644
--- a/src/devices/cpu/m37710/m37710.h
+++ b/src/devices/cpu/m37710/m37710.h
@@ -171,7 +171,7 @@ private:
uint32_t m_source; /* temp register */
uint32_t m_destination; /* temp register */
address_space *m_program;
- direct_read_data *m_direct;
+ direct_read_data<0> *m_direct;
address_space *m_io;
uint32_t m_stopped; /* Sets how the CPU is stopped */
diff --git a/src/devices/cpu/m6502/m6502.cpp b/src/devices/cpu/m6502/m6502.cpp
index 9046d766487..2cbded54949 100644
--- a/src/devices/cpu/m6502/m6502.cpp
+++ b/src/devices/cpu/m6502/m6502.cpp
@@ -45,8 +45,8 @@ void m6502_device::init()
mintf->program = &space(AS_PROGRAM);
mintf->sprogram = has_space(AS_OPCODES) ? &space(AS_OPCODES) : mintf->program;
- mintf->direct = &mintf->program->direct();
- mintf->sdirect = &mintf->sprogram->direct();
+ mintf->direct = mintf->program->direct<0>();
+ mintf->sdirect = mintf->sprogram->direct<0>();
sync_w.resolve_safe();
diff --git a/src/devices/cpu/m6502/m6502.h b/src/devices/cpu/m6502/m6502.h
index 9bbc1bdeee2..8f5236818f9 100644
--- a/src/devices/cpu/m6502/m6502.h
+++ b/src/devices/cpu/m6502/m6502.h
@@ -41,7 +41,7 @@ protected:
class memory_interface {
public:
address_space *program, *sprogram;
- direct_read_data *direct, *sdirect;
+ direct_read_data<0> *direct, *sdirect;
virtual ~memory_interface() {}
virtual uint8_t read(uint16_t adr) = 0;
diff --git a/src/devices/cpu/m6800/m6800.cpp b/src/devices/cpu/m6800/m6800.cpp
index a8be5ed2f25..856172ee368 100644
--- a/src/devices/cpu/m6800/m6800.cpp
+++ b/src/devices/cpu/m6800/m6800.cpp
@@ -464,9 +464,9 @@ void m6800_cpu_device::EAT_CYCLES()
void m6800_cpu_device::device_start()
{
m_program = &space(AS_PROGRAM);
- m_direct = &m_program->direct();
+ m_direct = m_program->direct<0>();
m_decrypted_opcodes = has_space(AS_OPCODES) ? &space(AS_OPCODES) : m_program;
- m_decrypted_opcodes_direct = &m_decrypted_opcodes->direct();
+ m_decrypted_opcodes_direct = m_decrypted_opcodes->direct<0>();
m_pc.d = 0;
m_s.d = 0;
diff --git a/src/devices/cpu/m6800/m6800.h b/src/devices/cpu/m6800/m6800.h
index e5b5135bfb5..38679e32e2b 100644
--- a/src/devices/cpu/m6800/m6800.h
+++ b/src/devices/cpu/m6800/m6800.h
@@ -85,7 +85,7 @@ protected:
/* Memory spaces */
address_space *m_program, *m_decrypted_opcodes;
- direct_read_data *m_direct, *m_decrypted_opcodes_direct;
+ direct_read_data<0> *m_direct, *m_decrypted_opcodes_direct;
const op_func *m_insn;
const uint8_t *m_cycles; /* clock cycle of instruction table */
diff --git a/src/devices/cpu/m68000/m68000.h b/src/devices/cpu/m68000/m68000.h
index 628fed61de8..a6a885d6f54 100644
--- a/src/devices/cpu/m68000/m68000.h
+++ b/src/devices/cpu/m68000/m68000.h
@@ -312,7 +312,7 @@ public:
// m68k_memory_interface memory;
address_space *m_space, *m_ospace;
- direct_read_data *m_direct, *m_odirect;
+ direct_read_data<0> *m_direct, *m_odirect;
uint32_t iotemp;
diff --git a/src/devices/cpu/m68000/m68kcpu.cpp b/src/devices/cpu/m68000/m68kcpu.cpp
index 44e1fd60446..e387f946784 100644
--- a/src/devices/cpu/m68000/m68kcpu.cpp
+++ b/src/devices/cpu/m68000/m68kcpu.cpp
@@ -1236,9 +1236,9 @@ uint16_t m68000_base_device::m68008_read_immediate_16(offs_t address)
void m68000_base_device::init8(address_space &space, address_space &ospace)
{
m_space = &space;
- m_direct = &space.direct();
+ m_direct = space.direct<0>();
m_ospace = &ospace;
- m_odirect = &ospace.direct();
+ m_odirect = ospace.direct<0>();
// m_cpustate = this;
opcode_xor = 0;
@@ -1275,9 +1275,9 @@ void m68000_base_device::m68000_write_byte(offs_t address, uint8_t data)
void m68000_base_device::init16(address_space &space, address_space &ospace)
{
m_space = &space;
- m_direct = &space.direct();
+ m_direct = space.direct<0>();
m_ospace = &ospace;
- m_odirect = &ospace.direct();
+ m_odirect = ospace.direct<0>();
opcode_xor = 0;
@@ -1302,9 +1302,9 @@ void m68000_base_device::init16(address_space &space, address_space &ospace)
void m68000_base_device::init32(address_space &space, address_space &ospace)
{
m_space = &space;
- m_direct = &space.direct();
+ m_direct = space.direct<0>();
m_ospace = &ospace;
- m_odirect = &ospace.direct();
+ m_odirect = ospace.direct<0>();
opcode_xor = WORD_XOR_BE(0);
readimm16 = m68k_readimm16_delegate(&m68000_base_device::read_immediate_16, this);
@@ -1521,9 +1521,9 @@ void m68000_base_device::writelong_d32_mmu(offs_t address, uint32_t data)
void m68000_base_device::init32mmu(address_space &space, address_space &ospace)
{
m_space = &space;
- m_direct = &space.direct();
+ m_direct = space.direct<0>();
m_ospace = &ospace;
- m_odirect = &ospace.direct();
+ m_odirect = ospace.direct<0>();
opcode_xor = WORD_XOR_BE(0);
readimm16 = m68k_readimm16_delegate(&m68000_base_device::read_immediate_16_mmu, this);
@@ -1649,9 +1649,9 @@ void m68000_base_device::writelong_d32_hmmu(offs_t address, uint32_t data)
void m68000_base_device::init32hmmu(address_space &space, address_space &ospace)
{
m_space = &space;
- m_direct = &space.direct();
+ m_direct = space.direct<0>();
m_ospace = &ospace;
- m_odirect = &ospace.direct();
+ m_odirect = ospace.direct<0>();
opcode_xor = WORD_XOR_BE(0);
readimm16 = m68k_readimm16_delegate(&m68000_base_device::read_immediate_16_hmmu, this);
diff --git a/src/devices/cpu/m6805/m6805.cpp b/src/devices/cpu/m6805/m6805.cpp
index 48f93719e7a..0b8a9b42eb1 100644
--- a/src/devices/cpu/m6805/m6805.cpp
+++ b/src/devices/cpu/m6805/m6805.cpp
@@ -263,7 +263,7 @@ m6805_base_device::m6805_base_device(
void m6805_base_device::device_start()
{
m_program = &space(AS_PROGRAM);
- m_direct = &m_program->direct();
+ m_direct = m_program->direct<0>();
// set our instruction counter
m_icountptr = &m_icount;
@@ -304,9 +304,6 @@ void m6805_base_device::device_reset()
m_nmi_state = 0;
- m_program = &space(AS_PROGRAM);
- m_direct = &m_program->direct();
-
/* IRQ disabled */
SEI;
diff --git a/src/devices/cpu/m6805/m6805.h b/src/devices/cpu/m6805/m6805.h
index 9ffe035a730..643b1617991 100644
--- a/src/devices/cpu/m6805/m6805.h
+++ b/src/devices/cpu/m6805/m6805.h
@@ -277,7 +277,7 @@ protected:
// address spaces
address_space *m_program;
- direct_read_data *m_direct;
+ direct_read_data<0> *m_direct;
};
diff --git a/src/devices/cpu/m6809/m6809.cpp b/src/devices/cpu/m6809/m6809.cpp
index 9c27d4680a3..42f64d5e5b2 100644
--- a/src/devices/cpu/m6809/m6809.cpp
+++ b/src/devices/cpu/m6809/m6809.cpp
@@ -134,8 +134,8 @@ void m6809_base_device::device_start()
m_mintf->m_program = &space(AS_PROGRAM);
m_mintf->m_sprogram = has_space(AS_OPCODES) ? &space(AS_OPCODES) : m_mintf->m_program;
- m_mintf->m_direct = &m_mintf->m_program->direct();
- m_mintf->m_sdirect = &m_mintf->m_sprogram->direct();
+ m_mintf->m_direct = m_mintf->m_program->direct<0>();
+ m_mintf->m_sdirect = m_mintf->m_sprogram->direct<0>();
m_lic_func.resolve_safe();
diff --git a/src/devices/cpu/m6809/m6809.h b/src/devices/cpu/m6809/m6809.h
index 3bab3e17b57..759e37113a5 100644
--- a/src/devices/cpu/m6809/m6809.h
+++ b/src/devices/cpu/m6809/m6809.h
@@ -34,7 +34,7 @@ protected:
class memory_interface {
public:
address_space *m_program, *m_sprogram;
- direct_read_data *m_direct, *m_sdirect;
+ direct_read_data<0> *m_direct, *m_sdirect;
virtual ~memory_interface() {}
virtual uint8_t read(uint16_t adr) = 0;
diff --git a/src/devices/cpu/mb86233/mb86233.cpp b/src/devices/cpu/mb86233/mb86233.cpp
index 7c6bd87ae6a..32bdd8f2ea7 100644
--- a/src/devices/cpu/mb86233/mb86233.cpp
+++ b/src/devices/cpu/mb86233/mb86233.cpp
@@ -79,9 +79,9 @@ util::disasm_interface *mb86233_cpu_device::create_disassembler()
#define GETBRAM() m_BRAM
#define GETREPCNT() m_repcnt
-#define ROPCODE(a) m_direct->read_dword(a<<2)
-#define RDMEM(a) m_program->read_dword((a<<2))
-#define WRMEM(a,v) m_program->write_dword((a<<2), v)
+#define ROPCODE(a) m_direct->read_dword(a)
+#define RDMEM(a) m_program->read_dword(a)
+#define WRMEM(a,v) m_program->write_dword((a), v)
/***************************************************************************
Initialization and Shutdown
@@ -110,7 +110,7 @@ void mb86233_cpu_device::device_start()
m_fifo_write_cb.resolve_safe();
m_program = &space(AS_PROGRAM);
- m_direct = &m_program->direct();
+ m_direct = m_program->direct<-2>();
if ( m_tablergn )
{
diff --git a/src/devices/cpu/mb86233/mb86233.h b/src/devices/cpu/mb86233/mb86233.h
index 297b90f7382..49ba58d7ea8 100644
--- a/src/devices/cpu/mb86233/mb86233.h
+++ b/src/devices/cpu/mb86233/mb86233.h
@@ -109,7 +109,7 @@ private:
uint32_t m_extport[0x30];
address_space *m_program;
- direct_read_data *m_direct;
+ direct_read_data<-2> *m_direct;
int m_icount;
/* FIFO */
diff --git a/src/devices/cpu/mb86235/mb86235.cpp b/src/devices/cpu/mb86235/mb86235.cpp
index cac1f550035..77a24bc43a4 100644
--- a/src/devices/cpu/mb86235/mb86235.cpp
+++ b/src/devices/cpu/mb86235/mb86235.cpp
@@ -57,7 +57,7 @@ void mb86235_device::execute_run()
void mb86235_device::device_start()
{
m_program = &space(AS_PROGRAM);
- m_direct = &m_program->direct();
+ m_direct = m_program->direct<-3>();
m_dataa = &space(AS_DATA);
m_datab = &space(AS_IO);
diff --git a/src/devices/cpu/mb86235/mb86235.h b/src/devices/cpu/mb86235/mb86235.h
index ba174da7382..f1845bfce6f 100644
--- a/src/devices/cpu/mb86235/mb86235.h
+++ b/src/devices/cpu/mb86235/mb86235.h
@@ -73,7 +73,7 @@ protected:
// device_disasm_interface overrides
virtual util::disasm_interface *create_disassembler() override;
- direct_read_data *m_direct;
+ direct_read_data<-3> *m_direct;
private:
diff --git a/src/devices/cpu/mb86235/mb86235drc.cpp b/src/devices/cpu/mb86235/mb86235drc.cpp
index d3fa314b0ae..fa1f829a07b 100644
--- a/src/devices/cpu/mb86235/mb86235drc.cpp
+++ b/src/devices/cpu/mb86235/mb86235drc.cpp
@@ -498,7 +498,6 @@ void mb86235_device::static_generate_memory_accessors()
UML_CMP(block, I0, 0x400);
UML_JMPc(block, COND_GE, label);
// internal A-RAM
- UML_SHL(block, I0, I0, 2);
UML_READ(block, I1, I0, SIZE_DWORD, SPACE_DATA);
UML_RET(block);
// external
@@ -506,7 +505,6 @@ void mb86235_device::static_generate_memory_accessors()
UML_AND(block, I0, I0, 0x3fff);
UML_AND(block, I2, mem(&m_core->eb), ~0x3fff);
UML_OR(block, I0, I0, I2);
- UML_SHL(block, I0, I0, 2);
UML_READ(block, I1, I0, SIZE_DWORD, SPACE_DATA);
UML_RET(block);
@@ -523,7 +521,6 @@ void mb86235_device::static_generate_memory_accessors()
UML_CMP(block, I0, 0x400);
UML_JMPc(block, COND_GE, label);
// internal A-RAM
- UML_SHL(block, I0, I0, 2);
UML_WRITE(block, I0, I1, SIZE_DWORD, SPACE_DATA);
UML_RET(block);
// external
@@ -531,7 +528,6 @@ void mb86235_device::static_generate_memory_accessors()
UML_AND(block, I0, I0, 0x3fff);
UML_AND(block, I2, mem(&m_core->eb), ~0x3fff);
UML_OR(block, I0, I0, I2);
- UML_SHL(block, I0, I0, 2);
UML_WRITE(block, I0, I1, SIZE_DWORD, SPACE_DATA);
UML_RET(block);
@@ -1666,7 +1662,6 @@ void mb86235_device::generate_xfer1(drcuml_block *block, compiler_state *compile
generate_ea(block, compiler, desc, md, sr & 7, ary, disp5);
if (sr & 0x20) // RAM-B
{
- UML_SHL(block, I0, I0, 2);
UML_READ(block, I1, I0, SIZE_DWORD, SPACE_IO);
}
else // RAM-A
@@ -1684,7 +1679,6 @@ void mb86235_device::generate_xfer1(drcuml_block *block, compiler_state *compile
generate_ea(block, compiler, desc, md, dr & 7, ary, disp5);
if (dr & 0x20) // RAM-B
{
- UML_SHL(block, I0, I0, 2);
UML_WRITE(block, I0, I1, SIZE_DWORD, SPACE_IO);
}
else // RAM-A
@@ -1743,7 +1737,6 @@ void mb86235_device::generate_xfer2(drcuml_block *block, compiler_state *compile
generate_ea(block, compiler, desc, md, sr & 7, ary, disp14);
if (sr & 0x20) // RAM-B
{
- UML_SHL(block, I0, I0, 2);
UML_READ(block, I1, I0, SIZE_DWORD, SPACE_IO);
}
else // RAM-A
@@ -1761,7 +1754,6 @@ void mb86235_device::generate_xfer2(drcuml_block *block, compiler_state *compile
generate_ea(block, compiler, desc, md, dr & 7, ary, disp14);
if (dr & 0x20) // RAM-B
{
- UML_SHL(block, I0, I0, 2);
UML_WRITE(block, I0, I1, SIZE_DWORD, SPACE_IO);
}
else // RAM-A
@@ -1779,14 +1771,12 @@ void mb86235_device::generate_xfer2(drcuml_block *block, compiler_state *compile
generate_reg_read(block, compiler, desc, dr & 0x3f, I0);
UML_ADD(block, I1, mem(&m_core->eb), mem(&m_core->eo));
UML_ADD(block, I1, I1, disp14);
- UML_SHL(block, I1, I1, 2);
UML_WRITE(block, I1, I0, SIZE_DWORD, SPACE_DATA);
}
else
{
UML_ADD(block, I1, mem(&m_core->eb), mem(&m_core->eo));
UML_ADD(block, I1, I1, disp14);
- UML_SHL(block, I1, I1, 2);
UML_READ(block, I0, I1, SIZE_DWORD, SPACE_DATA);
generate_reg_write(block, compiler, desc, dr & 0x3f, I0);
}
@@ -1835,7 +1825,6 @@ void mb86235_device::generate_xfer3(drcuml_block *block, compiler_state *compile
case 3: // RAM-B
generate_ea(block, compiler, desc, md, dr & 7, ary, disp);
- UML_SHL(block, I0, I0, 2);
UML_WRITE(block, I0, imm, SIZE_DWORD, SPACE_IO);
break;
}
diff --git a/src/devices/cpu/mb86235/mb86235fe.cpp b/src/devices/cpu/mb86235/mb86235fe.cpp
index 854fd97abb7..5e60cfe6216 100644
--- a/src/devices/cpu/mb86235/mb86235fe.cpp
+++ b/src/devices/cpu/mb86235/mb86235fe.cpp
@@ -63,7 +63,7 @@ mb86235_frontend::mb86235_frontend(mb86235_device *core, uint32_t window_start,
bool mb86235_frontend::describe(opcode_desc &desc, const opcode_desc *prev)
{
- uint64_t opcode = desc.opptr.q[0] = m_core->m_direct->read_qword(desc.pc * 8, 0);
+ uint64_t opcode = desc.opptr.q[0] = m_core->m_direct->read_qword(desc.pc, 0);
desc.length = 1;
desc.cycles = 1;
diff --git a/src/devices/cpu/mb88xx/mb88xx.cpp b/src/devices/cpu/mb88xx/mb88xx.cpp
index f90dd868ee7..1473a3452ae 100644
--- a/src/devices/cpu/mb88xx/mb88xx.cpp
+++ b/src/devices/cpu/mb88xx/mb88xx.cpp
@@ -176,7 +176,7 @@ util::disasm_interface *mb88_cpu_device::create_disassembler()
void mb88_cpu_device::device_start()
{
m_program = &space(AS_PROGRAM);
- m_direct = &m_program->direct();
+ m_direct = m_program->direct<0>();
m_data = &space(AS_DATA);
m_read_k.resolve_safe(0);
diff --git a/src/devices/cpu/mb88xx/mb88xx.h b/src/devices/cpu/mb88xx/mb88xx.h
index ca40ac14fe6..0be1ac9b06e 100644
--- a/src/devices/cpu/mb88xx/mb88xx.h
+++ b/src/devices/cpu/mb88xx/mb88xx.h
@@ -210,7 +210,7 @@ private:
uint8_t m_pending_interrupt;
address_space *m_program;
- direct_read_data *m_direct;
+ direct_read_data<0> *m_direct;
address_space *m_data;
int m_icount;
diff --git a/src/devices/cpu/mc68hc11/mc68hc11.cpp b/src/devices/cpu/mc68hc11/mc68hc11.cpp
index 76da1fbaf8c..76d4ef56c56 100644
--- a/src/devices/cpu/mc68hc11/mc68hc11.cpp
+++ b/src/devices/cpu/mc68hc11/mc68hc11.cpp
@@ -397,7 +397,7 @@ void mc68hc11_cpu_device::device_start()
m_internal_ram.resize(m_internal_ram_size);
m_program = &space(AS_PROGRAM);
- m_direct = &m_program->direct();
+ m_direct = m_program->direct<0>();
m_io = &space(AS_IO);
save_item(NAME(m_pc));
diff --git a/src/devices/cpu/mc68hc11/mc68hc11.h b/src/devices/cpu/mc68hc11/mc68hc11.h
index cb8c0813e4d..35b0cb98170 100644
--- a/src/devices/cpu/mc68hc11/mc68hc11.h
+++ b/src/devices/cpu/mc68hc11/mc68hc11.h
@@ -100,7 +100,7 @@ private:
int m_ad_channel;
uint8_t m_irq_state[2];
- direct_read_data *m_direct;
+ direct_read_data<0> *m_direct;
address_space *m_program;
address_space *m_io;
int m_icount;
diff --git a/src/devices/cpu/mcs40/mcs40.cpp b/src/devices/cpu/mcs40/mcs40.cpp
index b954d292458..be4b60cde75 100644
--- a/src/devices/cpu/mcs40/mcs40.cpp
+++ b/src/devices/cpu/mcs40/mcs40.cpp
@@ -142,7 +142,7 @@ void mcs40_cpu_device_base::device_start()
m_spaces[AS_RAM_STATUS] = &space(AS_RAM_STATUS);
m_spaces[AS_RAM_PORTS] = &space(AS_RAM_PORTS);
m_spaces[AS_PROGRAM_MEMORY] = &space(AS_PROGRAM_MEMORY);
- m_direct = &m_spaces[AS_ROM]->direct();
+ m_direct = m_spaces[AS_ROM]->direct<0>();
m_bus_cycle_cb.bind_relative_to(*owner());
m_sync_cb.resolve_safe();
diff --git a/src/devices/cpu/mcs40/mcs40.h b/src/devices/cpu/mcs40/mcs40.h
index 5c2bab6a5ee..0e5b0c61126 100644
--- a/src/devices/cpu/mcs40/mcs40.h
+++ b/src/devices/cpu/mcs40/mcs40.h
@@ -291,7 +291,7 @@ private:
// address spaces
address_space_config const m_space_config[7];
address_space *m_spaces[7];
- direct_read_data *m_direct;
+ direct_read_data<0> *m_direct;
// bus snooping callback
bus_cycle_delegate m_bus_cycle_cb;
diff --git a/src/devices/cpu/mcs48/mcs48.cpp b/src/devices/cpu/mcs48/mcs48.cpp
index 75d70a93480..de499c23ac2 100644
--- a/src/devices/cpu/mcs48/mcs48.cpp
+++ b/src/devices/cpu/mcs48/mcs48.cpp
@@ -973,7 +973,7 @@ void mcs48_cpu_device::device_start()
m_ea = (m_int_rom_size ? 0 : 1);
m_program = &space(AS_PROGRAM);
- m_direct = &m_program->direct();
+ m_direct = m_program->direct<0>();
m_data = &space(AS_DATA);
m_io = &space(AS_IO);
diff --git a/src/devices/cpu/mcs48/mcs48.h b/src/devices/cpu/mcs48/mcs48.h
index 6594a837d5d..e0609621559 100644
--- a/src/devices/cpu/mcs48/mcs48.h
+++ b/src/devices/cpu/mcs48/mcs48.h
@@ -228,7 +228,7 @@ protected:
/* Memory spaces */
address_space *m_program;
- direct_read_data *m_direct;
+ direct_read_data<0> *m_direct;
address_space *m_data;
address_space *m_io;
diff --git a/src/devices/cpu/mcs51/mcs51.cpp b/src/devices/cpu/mcs51/mcs51.cpp
index a46c927be89..536565bbbe7 100644
--- a/src/devices/cpu/mcs51/mcs51.cpp
+++ b/src/devices/cpu/mcs51/mcs51.cpp
@@ -2102,7 +2102,7 @@ uint8_t mcs51_cpu_device::sfr_read(size_t offset)
void mcs51_cpu_device::device_start()
{
m_program = &space(AS_PROGRAM);
- m_direct = &m_program->direct();
+ m_direct = m_program->direct<0>();
m_data = &space(AS_DATA);
m_io = &space(AS_IO);
diff --git a/src/devices/cpu/mcs51/mcs51.h b/src/devices/cpu/mcs51/mcs51.h
index a789579867a..f324e428ad5 100644
--- a/src/devices/cpu/mcs51/mcs51.h
+++ b/src/devices/cpu/mcs51/mcs51.h
@@ -166,7 +166,7 @@ protected:
/* Memory spaces */
address_space *m_program;
- direct_read_data *m_direct;
+ direct_read_data<0> *m_direct;
address_space *m_data;
address_space *m_io;
diff --git a/src/devices/cpu/mcs96/i8x9x.cpp b/src/devices/cpu/mcs96/i8x9x.cpp
index a5faff3f258..cdb65bd3954 100644
--- a/src/devices/cpu/mcs96/i8x9x.cpp
+++ b/src/devices/cpu/mcs96/i8x9x.cpp
@@ -73,7 +73,7 @@ void i8x9x_device::commit_hso_cam()
void i8x9x_device::ad_start(uint64_t current_time)
{
- ad_result = (io->read_word(2*((ad_command & 7) + A0)) << 6) | 8 | (ad_command & 7);
+ ad_result = (io->read_word((ad_command & 7) + A0) << 6) | 8 | (ad_command & 7);
ad_done = current_time + 88;
internal_update(current_time);
}
@@ -87,7 +87,7 @@ void i8x9x_device::serial_send(uint8_t data)
void i8x9x_device::serial_send_done()
{
serial_send_timer = 0;
- io->write_word(SERIAL*2, serial_send_buf);
+ io->write_word(SERIAL, serial_send_buf);
pending_irq |= IRQ_SERIAL;
sp_stat |= 0x20;
check_irq();
@@ -134,11 +134,11 @@ void i8x9x_device::io_w8(uint8_t adr, uint8_t data)
break;
case 0x0f:
logerror("%s: io port 1 %02x (%04x)\n", tag(), data, PPC);
- io->write_word(P1*2, data);
+ io->write_word(P1, data);
break;
case 0x10:
logerror("%s: io port 2 %02x (%04x)\n", tag(), data, PPC);
- io->write_word(P2*2, data);
+ io->write_word(P2, data);
break;
case 0x11:
logerror("%s: sp con %02x (%04x)\n", tag(), data, PPC);
@@ -217,16 +217,16 @@ uint8_t i8x9x_device::io_r8(uint8_t adr)
return timer_value(2, total_cycles()) >> 8;
case 0x0e: {
static int last = -1;
- if(io->read_word(P0*2) != last) {
- last = io->read_word(P0*2);
+ if(io->read_word(P0) != last) {
+ last = io->read_word(P0);
logerror("%s: read p0 %02x\n", tag(), io->read_word(P0*2));
}
- return io->read_word(P0*2);
+ return io->read_word(P0);
}
case 0x0f:
- return io->read_word(P1*2);
+ return io->read_word(P1);
case 0x10:
- return io->read_word(P2*2);
+ return io->read_word(P2);
case 0x11: {
uint8_t res = sp_stat;
sp_stat &= 0x80;
diff --git a/src/devices/cpu/mcs96/mcs96.cpp b/src/devices/cpu/mcs96/mcs96.cpp
index d45d30153ac..fa7e75498b3 100644
--- a/src/devices/cpu/mcs96/mcs96.cpp
+++ b/src/devices/cpu/mcs96/mcs96.cpp
@@ -23,7 +23,7 @@ mcs96_device::mcs96_device(const machine_config &mconfig, device_type type, cons
void mcs96_device::device_start()
{
program = &space(AS_PROGRAM);
- direct = &program->direct();
+ direct = program->direct<0>();
m_icountptr = &icount;
state_add(STATE_GENPC, "GENPC", PC).noshow();
diff --git a/src/devices/cpu/mcs96/mcs96.h b/src/devices/cpu/mcs96/mcs96.h
index a9440b78ee4..3ff9f02d4d2 100644
--- a/src/devices/cpu/mcs96/mcs96.h
+++ b/src/devices/cpu/mcs96/mcs96.h
@@ -65,7 +65,7 @@ protected:
address_space_config program_config;
address_space *program;
- direct_read_data *direct;
+ direct_read_data<0> *direct;
int icount, bcount, inst_state, cycles_scaling;
uint8_t pending_irq;
diff --git a/src/devices/cpu/melps4/melps4.cpp b/src/devices/cpu/melps4/melps4.cpp
index c8c5b6e1cd7..a749f4bc5c6 100644
--- a/src/devices/cpu/melps4/melps4.cpp
+++ b/src/devices/cpu/melps4/melps4.cpp
@@ -454,7 +454,7 @@ void melps4_cpu_device::execute_run()
// fetch next opcode
debugger_instruction_hook(this, m_pc);
m_icount--;
- m_op = m_program->read_word(m_pc << 1) & 0x1ff;
+ m_op = m_program->read_word(m_pc) & 0x1ff;
m_bitmask = 1 << (m_op & 3);
m_pc = (m_pc & ~0x7f) | ((m_pc + 1) & 0x7f); // stays in the same page
diff --git a/src/devices/cpu/mips/mips3.cpp b/src/devices/cpu/mips/mips3.cpp
index ddb02775162..f71f4bb738c 100644
--- a/src/devices/cpu/mips/mips3.cpp
+++ b/src/devices/cpu/mips/mips3.cpp
@@ -337,7 +337,7 @@ void mips3_device::device_start()
m_cpu_clock = clock();
m_program = &space(AS_PROGRAM);
- m_direct = &m_program->direct();
+ m_direct = m_program->direct<0>();
/* set up the endianness */
m_program->accessors(m_memory);
diff --git a/src/devices/cpu/mips/mips3.h b/src/devices/cpu/mips/mips3.h
index 5f4cb632743..dd0bac966d9 100644
--- a/src/devices/cpu/mips/mips3.h
+++ b/src/devices/cpu/mips/mips3.h
@@ -372,7 +372,7 @@ private:
loadstore_func m_sdr;
address_space *m_program;
- direct_read_data *m_direct;
+ direct_read_data<0> *m_direct;
uint32_t c_system_clock;
uint32_t m_cpu_clock;
emu_timer * m_compare_int_timer;
diff --git a/src/devices/cpu/mips/r3000.cpp b/src/devices/cpu/mips/r3000.cpp
index a63d04a511e..db1a35ec370 100644
--- a/src/devices/cpu/mips/r3000.cpp
+++ b/src/devices/cpu/mips/r3000.cpp
@@ -214,7 +214,7 @@ void r3000_device::device_start()
{
// get our address spaces
m_program = &space(AS_PROGRAM);
- m_direct = &m_program->direct();
+ m_direct = m_program->direct<0>();
// determine the cache sizes
switch (m_chip_type)
diff --git a/src/devices/cpu/mips/r3000.h b/src/devices/cpu/mips/r3000.h
index 088c54c26e0..a5f9998a23c 100644
--- a/src/devices/cpu/mips/r3000.h
+++ b/src/devices/cpu/mips/r3000.h
@@ -212,7 +212,7 @@ protected:
const address_space_config m_program_config_be;
const address_space_config m_program_config_le;
address_space *m_program;
- direct_read_data *m_direct;
+ direct_read_data<0> *m_direct;
// configuration
chip_type m_chip_type;
diff --git a/src/devices/cpu/nanoprocessor/nanoprocessor.cpp b/src/devices/cpu/nanoprocessor/nanoprocessor.cpp
index 37966d77168..8533ec2b102 100644
--- a/src/devices/cpu/nanoprocessor/nanoprocessor.cpp
+++ b/src/devices/cpu/nanoprocessor/nanoprocessor.cpp
@@ -80,7 +80,7 @@ void hp_nanoprocessor_device::device_start()
state_add(STATE_GENFLAGS, "GENFLAGS", m_flags).noshow().formatstr("%10s");
m_program = &space(AS_PROGRAM);
- m_direct = &m_program->direct();
+ m_direct = m_program->direct<0>();
m_io = &space(AS_IO);
save_item(NAME(m_reg_A));
diff --git a/src/devices/cpu/nanoprocessor/nanoprocessor.h b/src/devices/cpu/nanoprocessor/nanoprocessor.h
index 52f4cb3943f..98b717e6c07 100644
--- a/src/devices/cpu/nanoprocessor/nanoprocessor.h
+++ b/src/devices/cpu/nanoprocessor/nanoprocessor.h
@@ -114,7 +114,7 @@ private:
address_space_config m_io_config;
address_space *m_program;
- direct_read_data *m_direct;
+ direct_read_data<0> *m_direct;
address_space *m_io;
// device_t overrides
diff --git a/src/devices/cpu/nec/nec.cpp b/src/devices/cpu/nec/nec.cpp
index d36a2bfdd04..c3acf3b5be3 100644
--- a/src/devices/cpu/nec/nec.cpp
+++ b/src/devices/cpu/nec/nec.cpp
@@ -419,7 +419,7 @@ void nec_common_device::device_start()
save_item(NAME(m_prefetch_reset));
m_program = &space(AS_PROGRAM);
- m_direct = &m_program->direct();
+ m_direct = m_program->direct<0>();
m_io = &space(AS_IO);
state_add( NEC_PC, "PC", m_debugger_temp).callimport().callexport().formatstr("%05X");
diff --git a/src/devices/cpu/nec/nec.h b/src/devices/cpu/nec/nec.h
index fee1806c066..c868b58524e 100644
--- a/src/devices/cpu/nec/nec.h
+++ b/src/devices/cpu/nec/nec.h
@@ -88,7 +88,7 @@ private:
uint8_t m_halted;
address_space *m_program;
- direct_read_data *m_direct;
+ direct_read_data<0> *m_direct;
address_space *m_io;
int m_icount;
diff --git a/src/devices/cpu/nec/v25.cpp b/src/devices/cpu/nec/v25.cpp
index 8f9392a24ad..7c1dfb28731 100644
--- a/src/devices/cpu/nec/v25.cpp
+++ b/src/devices/cpu/nec/v25.cpp
@@ -511,7 +511,7 @@ void v25_common_device::device_start()
save_item(NAME(m_prefetch_reset));
m_program = &space(AS_PROGRAM);
- m_direct = &m_program->direct();
+ m_direct = m_program->direct<0>();
m_io = &space(AS_IO);
m_pt_in.resolve_safe(0xff);
diff --git a/src/devices/cpu/nec/v25.h b/src/devices/cpu/nec/v25.h
index 808b4ec3fc9..cda729e88ef 100644
--- a/src/devices/cpu/nec/v25.h
+++ b/src/devices/cpu/nec/v25.h
@@ -141,7 +141,7 @@ private:
uint32_t m_IDB;
address_space *m_program;
- direct_read_data *m_direct;
+ direct_read_data<0> *m_direct;
address_space *m_io;
int m_icount;
diff --git a/src/devices/cpu/pic16c5x/pic16c5x.cpp b/src/devices/cpu/pic16c5x/pic16c5x.cpp
index 0589f9dfadb..d92ae93d3c1 100644
--- a/src/devices/cpu/pic16c5x/pic16c5x.cpp
+++ b/src/devices/cpu/pic16c5x/pic16c5x.cpp
@@ -197,7 +197,7 @@ void pic16c5x_device::update_internalram_ptr()
-#define PIC16C5x_RDOP(A) (m_direct->read_word((A)<<1))
+#define PIC16C5x_RDOP(A) (m_direct->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))
@@ -883,7 +883,7 @@ enum
void pic16c5x_device::device_start()
{
m_program = &space(AS_PROGRAM);
- m_direct = &m_program->direct();
+ m_direct = m_program->direct<-1>();
m_data = &space(AS_DATA);
m_read_a.resolve_safe(0);
diff --git a/src/devices/cpu/pic16c5x/pic16c5x.h b/src/devices/cpu/pic16c5x/pic16c5x.h
index 918f251cdab..e51ef9a1c89 100644
--- a/src/devices/cpu/pic16c5x/pic16c5x.h
+++ b/src/devices/cpu/pic16c5x/pic16c5x.h
@@ -167,7 +167,7 @@ private:
int m_inst_cycles;
address_space *m_program;
- direct_read_data *m_direct;
+ direct_read_data<-1> *m_direct;
address_space *m_data;
// i/o handlers
diff --git a/src/devices/cpu/pic16c62x/pic16c62x.cpp b/src/devices/cpu/pic16c62x/pic16c62x.cpp
index cce876a045c..e01a7fda740 100644
--- a/src/devices/cpu/pic16c62x/pic16c62x.cpp
+++ b/src/devices/cpu/pic16c62x/pic16c62x.cpp
@@ -170,7 +170,7 @@ void pic16c62x_device::update_internalram_ptr()
m_internalram = (uint8_t *)m_data->get_write_ptr(0x00);
}
-#define PIC16C62x_RDOP(A) (m_direct->read_word((A)<<1))
+#define PIC16C62x_RDOP(A) (m_direct->read_word(A))
#define PIC16C62x_RAM_RDMEM(A) ((uint8_t)m_data->read_byte(A))
#define PIC16C62x_RAM_WRMEM(A,V) (m_data->write_byte(A,V))
#define PIC16C62x_In(Port) ((uint8_t)m_io->read_byte((Port)))
@@ -867,7 +867,7 @@ void pic16c62x_device::build_opcode_table(void)
void pic16c62x_device::device_start()
{
m_program = &space(AS_PROGRAM);
- m_direct = &m_program->direct();
+ m_direct = m_program->direct<-1>();
m_data = &space(AS_DATA);
m_io = &space(AS_IO);
diff --git a/src/devices/cpu/pic16c62x/pic16c62x.h b/src/devices/cpu/pic16c62x/pic16c62x.h
index 45e4be304f6..38596be6b29 100644
--- a/src/devices/cpu/pic16c62x/pic16c62x.h
+++ b/src/devices/cpu/pic16c62x/pic16c62x.h
@@ -113,7 +113,7 @@ private:
int m_inst_cycles;
address_space *m_program;
- direct_read_data *m_direct;
+ direct_read_data<-1> *m_direct;
address_space *m_data;
address_space *m_io;
diff --git a/src/devices/cpu/powerpc/ppc.h b/src/devices/cpu/powerpc/ppc.h
index fa3d79d916c..ba81a6055bb 100644
--- a/src/devices/cpu/powerpc/ppc.h
+++ b/src/devices/cpu/powerpc/ppc.h
@@ -490,7 +490,7 @@ protected:
int m_buffered_dma_rate[4];
/* internal stuff */
- direct_read_data *m_direct;
+ direct_read_data<0> *m_direct;
offs_t m_codexor;
uint32_t m_system_clock;
uint32_t m_cpu_clock;
diff --git a/src/devices/cpu/powerpc/ppccom.cpp b/src/devices/cpu/powerpc/ppccom.cpp
index 42b5be40ace..9e4aecd3ee2 100644
--- a/src/devices/cpu/powerpc/ppccom.cpp
+++ b/src/devices/cpu/powerpc/ppccom.cpp
@@ -710,7 +710,7 @@ void ppc_device::device_start()
m_cache_line_size = 32;
m_cpu_clock = clock();
m_program = &space(AS_PROGRAM);
- m_direct = &m_program->direct();
+ m_direct = m_program->direct<0>();
m_system_clock = c_bus_frequency != 0 ? c_bus_frequency : clock();
m_dcr_read_func = read32_delegate();
m_dcr_write_func = write32_delegate();
diff --git a/src/devices/cpu/pps4/pps4.cpp b/src/devices/cpu/pps4/pps4.cpp
index bddeddd6097..8decf412b8d 100644
--- a/src/devices/cpu/pps4/pps4.cpp
+++ b/src/devices/cpu/pps4/pps4.cpp
@@ -1570,7 +1570,7 @@ void pps4_device::execute_run()
void pps4_device::device_start()
{
m_program = &space(AS_PROGRAM);
- m_direct = &m_program->direct();
+ m_direct = m_program->direct<0>();
m_data = &space(AS_DATA);
m_io = &space(AS_IO);
diff --git a/src/devices/cpu/pps4/pps4.h b/src/devices/cpu/pps4/pps4.h
index dad4ba6fb5f..fcf1d790756 100644
--- a/src/devices/cpu/pps4/pps4.h
+++ b/src/devices/cpu/pps4/pps4.h
@@ -93,7 +93,7 @@ protected:
devcb_write8 m_do_cb;
address_space *m_program;
- direct_read_data *m_direct;
+ direct_read_data<0> *m_direct;
address_space *m_data;
address_space *m_io;
int m_icount;
diff --git a/src/devices/cpu/psx/psx.cpp b/src/devices/cpu/psx/psx.cpp
index 926a25103a8..2caef37ec85 100644
--- a/src/devices/cpu/psx/psx.cpp
+++ b/src/devices/cpu/psx/psx.cpp
@@ -1818,7 +1818,7 @@ void psxcpu_device::device_start()
{
// get our address spaces
m_program = &space( AS_PROGRAM );
- m_direct = &m_program->direct();
+ m_direct = m_program->direct<0>();
save_item( NAME( m_op ) );
save_item( NAME( m_pc ) );
diff --git a/src/devices/cpu/psx/psx.h b/src/devices/cpu/psx/psx.h
index 2b7d02df6e3..641a971c2ce 100644
--- a/src/devices/cpu/psx/psx.h
+++ b/src/devices/cpu/psx/psx.h
@@ -234,7 +234,7 @@ protected:
// address spaces
const address_space_config m_program_config;
address_space *m_program;
- direct_read_data *m_direct;
+ direct_read_data<0> *m_direct;
// other internal states
int m_icount;
diff --git a/src/devices/cpu/rsp/rsp.cpp b/src/devices/cpu/rsp/rsp.cpp
index 1c3eb4b694e..51e880d53d9 100644
--- a/src/devices/cpu/rsp/rsp.cpp
+++ b/src/devices/cpu/rsp/rsp.cpp
@@ -378,7 +378,7 @@ void rsp_device::device_start()
m_exec_output = fopen("rsp_execute.txt", "wt");
m_program = &space(AS_PROGRAM);
- m_direct = &m_program->direct();
+ m_direct = m_program->direct<0>();
resolve_cb();
if (m_isdrc)
diff --git a/src/devices/cpu/rsp/rsp.h b/src/devices/cpu/rsp/rsp.h
index 6c876671ab1..5f7b9ccb001 100644
--- a/src/devices/cpu/rsp/rsp.h
+++ b/src/devices/cpu/rsp/rsp.h
@@ -236,7 +236,7 @@ private:
address_space *m_program;
protected:
- direct_read_data *m_direct;
+ direct_read_data<0> *m_direct;
private:
std::unique_ptr<rsp_cop2> m_cop2;
diff --git a/src/devices/cpu/s2650/s2650.cpp b/src/devices/cpu/s2650/s2650.cpp
index 57aca5aec71..7b452907e03 100644
--- a/src/devices/cpu/s2650/s2650.cpp
+++ b/src/devices/cpu/s2650/s2650.cpp
@@ -826,7 +826,7 @@ void s2650_device::device_start()
m_flag_handler.resolve_safe();
m_intack_handler.resolve_safe();
- m_direct = &space(AS_PROGRAM).direct();
+ m_direct = space(AS_PROGRAM).direct<0>();
save_item(NAME(m_ppc));
save_item(NAME(m_page));
diff --git a/src/devices/cpu/s2650/s2650.h b/src/devices/cpu/s2650/s2650.h
index 9efb9fdd7e6..e329831690c 100644
--- a/src/devices/cpu/s2650/s2650.h
+++ b/src/devices/cpu/s2650/s2650.h
@@ -95,7 +95,7 @@ private:
uint8_t m_irq_state;
int m_icount;
- direct_read_data *m_direct;
+ direct_read_data<0> *m_direct;
// For debugger
uint16_t m_debugger_temp;
diff --git a/src/devices/cpu/saturn/saturn.cpp b/src/devices/cpu/saturn/saturn.cpp
index a1ebd111ec7..480f10a8c1f 100644
--- a/src/devices/cpu/saturn/saturn.cpp
+++ b/src/devices/cpu/saturn/saturn.cpp
@@ -93,7 +93,7 @@ util::disasm_interface *saturn_device::create_disassembler()
void saturn_device::device_start()
{
m_program = &space(AS_PROGRAM);
- m_direct = &m_program->direct();
+ m_direct = m_program->direct<0>();
m_out_func.resolve_safe();
m_in_func.resolve_safe(0);
diff --git a/src/devices/cpu/saturn/saturn.h b/src/devices/cpu/saturn/saturn.h
index d0f9628e49b..bd49ad18806 100644
--- a/src/devices/cpu/saturn/saturn.h
+++ b/src/devices/cpu/saturn/saturn.h
@@ -149,7 +149,7 @@ typedef uint8_t Saturn64[16];
int m_monitor_id;
int m_monitor_in;
address_space *m_program;
- direct_read_data *m_direct;
+ direct_read_data<0> *m_direct;
int m_icount;
int64_t m_debugger_temp;
diff --git a/src/devices/cpu/sc61860/sc61860.cpp b/src/devices/cpu/sc61860/sc61860.cpp
index 01b5533cfce..7277cbc444c 100644
--- a/src/devices/cpu/sc61860/sc61860.cpp
+++ b/src/devices/cpu/sc61860/sc61860.cpp
@@ -110,7 +110,7 @@ void sc61860_device::device_start()
m_2ms_tick_timer->adjust(attotime::from_hz(500), 0, attotime::from_hz(500));
m_program = &space(AS_PROGRAM);
- m_direct = &m_program->direct();
+ m_direct = m_program->direct<0>();
m_reset.resolve();
m_brk.resolve();
m_x.resolve();
diff --git a/src/devices/cpu/sc61860/sc61860.h b/src/devices/cpu/sc61860/sc61860.h
index 61eb370d404..3b9e6745e4d 100644
--- a/src/devices/cpu/sc61860/sc61860.h
+++ b/src/devices/cpu/sc61860/sc61860.h
@@ -135,7 +135,7 @@ private:
emu_timer *m_2ms_tick_timer;
address_space *m_program;
- direct_read_data *m_direct;
+ direct_read_data<0> *m_direct;
int m_icount;
uint8_t m_ram[0x100]; // internal special ram, should be 0x60, 0x100 to avoid memory corruption for now
diff --git a/src/devices/cpu/scmp/scmp.cpp b/src/devices/cpu/scmp/scmp.cpp
index 4ed579eb7b6..f85ca4d1ba5 100644
--- a/src/devices/cpu/scmp/scmp.cpp
+++ b/src/devices/cpu/scmp/scmp.cpp
@@ -502,7 +502,7 @@ void scmp_device::device_start()
}
m_program = &space(AS_PROGRAM);
- m_direct = &m_program->direct();
+ m_direct = m_program->direct<0>();
/* resolve callbacks */
m_flag_out_func.resolve_safe();
diff --git a/src/devices/cpu/scmp/scmp.h b/src/devices/cpu/scmp/scmp.h
index 85695a90c75..1ca7c699af5 100644
--- a/src/devices/cpu/scmp/scmp.h
+++ b/src/devices/cpu/scmp/scmp.h
@@ -68,7 +68,7 @@ private:
uint8_t m_SR;
address_space *m_program;
- direct_read_data *m_direct;
+ direct_read_data<0> *m_direct;
int m_icount;
devcb_write8 m_flag_out_func;
diff --git a/src/devices/cpu/score/score.cpp b/src/devices/cpu/score/score.cpp
index c3d9bba72d4..7f4eaff51dd 100644
--- a/src/devices/cpu/score/score.cpp
+++ b/src/devices/cpu/score/score.cpp
@@ -73,7 +73,7 @@ void score7_cpu_device::device_start()
{
// find address spaces
m_program = &space(AS_PROGRAM);
- m_direct = &m_program->direct();
+ m_direct = m_program->direct<0>();
// set our instruction counter
m_icountptr = &m_icount;
diff --git a/src/devices/cpu/score/score.h b/src/devices/cpu/score/score.h
index 1e85cbbf54f..392e2aaa4ac 100644
--- a/src/devices/cpu/score/score.h
+++ b/src/devices/cpu/score/score.h
@@ -108,7 +108,7 @@ private:
address_space_config m_program_config;
address_space * m_program;
- direct_read_data * m_direct;
+ direct_read_data<0> * m_direct;
// internal state
int m_icount;
diff --git a/src/devices/cpu/scudsp/scudsp.cpp b/src/devices/cpu/scudsp/scudsp.cpp
index 5a1b7c0eb99..b61c4aedf6d 100644
--- a/src/devices/cpu/scudsp/scudsp.cpp
+++ b/src/devices/cpu/scudsp/scudsp.cpp
@@ -125,10 +125,10 @@ DEFINE_DEVICE_TYPE(SCUDSP, scudsp_cpu_device, "scudsp", "Sega SCUDSP")
#define FLAGS_MASK 0x06ff8000
#define INSTA_DMA 1
-#define scudsp_readop(A) m_program->read_dword(A << 2)
-#define scudsp_writeop(A, B) m_program->write_dword(A << 2, B)
-#define scudsp_readmem(A,MD) m_data->read_dword((A | (MD << 6)) << 2)
-#define scudsp_writemem(A,MD,B) m_data->write_dword((A | (MD << 6)) << 2, B)
+#define scudsp_readop(A) m_program->read_dword(A)
+#define scudsp_writeop(A, B) m_program->write_dword(A, B)
+#define scudsp_readmem(A,MD) m_data->read_dword(A | (MD << 6))
+#define scudsp_writemem(A,MD,B) m_data->write_dword(A | (MD << 6), B)
uint32_t scudsp_cpu_device::scudsp_get_source_mem_reg_value( uint32_t mode )
{
diff --git a/src/devices/cpu/se3208/se3208.cpp b/src/devices/cpu/se3208/se3208.cpp
index a1a8b0ba546..fb188002bd8 100644
--- a/src/devices/cpu/se3208/se3208.cpp
+++ b/src/devices/cpu/se3208/se3208.cpp
@@ -1721,7 +1721,7 @@ void se3208_device::device_reset()
m_ER = 0;
m_PPC = 0;
m_program = &space(AS_PROGRAM);
- m_direct = &m_program->direct();
+ m_direct = m_program->direct<0>();
m_PC=SE3208_Read32(0);
m_SR=0;
m_IRQ=CLEAR_LINE;
@@ -1786,7 +1786,7 @@ void se3208_device::device_start()
BuildTable();
m_program = &space(AS_PROGRAM);
- m_direct = &m_program->direct();
+ m_direct = m_program->direct<0>();
save_item(NAME(m_R));
save_item(NAME(m_PC));
diff --git a/src/devices/cpu/se3208/se3208.h b/src/devices/cpu/se3208/se3208.h
index e08804f26df..a9fe4249922 100644
--- a/src/devices/cpu/se3208/se3208.h
+++ b/src/devices/cpu/se3208/se3208.h
@@ -54,7 +54,7 @@ private:
uint32_t m_PPC;
address_space *m_program;
- direct_read_data *m_direct;
+ direct_read_data<0> *m_direct;
uint8_t m_IRQ;
uint8_t m_NMI;
diff --git a/src/devices/cpu/sh/sh.h b/src/devices/cpu/sh/sh.h
index 0ba8a4b6b26..1e41d74385b 100644
--- a/src/devices/cpu/sh/sh.h
+++ b/src/devices/cpu/sh/sh.h
@@ -347,7 +347,7 @@ public:
void sh2drc_add_fastram(offs_t start, offs_t end, uint8_t readonly, void *base);
- direct_read_data *m_direct;
+ direct_read_data<0> *m_direct;
address_space *m_program;
std::unique_ptr<drcuml_state> m_drcuml; /* DRC UML generator state */
diff --git a/src/devices/cpu/sh/sh2.cpp b/src/devices/cpu/sh/sh2.cpp
index 4678ad5ffca..3d565fb3519 100644
--- a/src/devices/cpu/sh/sh2.cpp
+++ b/src/devices/cpu/sh/sh2.cpp
@@ -441,7 +441,7 @@ void sh2_device::device_start()
m_ftcsr_read_cb.bind_relative_to(*owner());
m_decrypted_program = has_space(AS_OPCODES) ? &space(AS_OPCODES) : &space(AS_PROGRAM);
- m_direct = &m_decrypted_program->direct();
+ m_direct = m_decrypted_program->direct<0>();
m_internal = &space(AS_PROGRAM);
save_item(NAME(m_cpu_off));
diff --git a/src/devices/cpu/sh/sh4.cpp b/src/devices/cpu/sh/sh4.cpp
index 881a1ddee94..e4e4429c132 100644
--- a/src/devices/cpu/sh/sh4.cpp
+++ b/src/devices/cpu/sh/sh4.cpp
@@ -2055,7 +2055,7 @@ void sh34_base_device::device_start()
m_internal = &space(AS_PROGRAM);
m_program = &space(AS_PROGRAM);
m_io = &space(AS_IO);
- m_direct = &m_program->direct();
+ m_direct = m_program->direct<0>();
sh4_default_exception_priorities();
m_irln = 15;
m_test_irq = 0;
diff --git a/src/devices/cpu/sharc/sharc.cpp b/src/devices/cpu/sharc/sharc.cpp
index bbcd194b47b..c85a915a2f7 100644
--- a/src/devices/cpu/sharc/sharc.cpp
+++ b/src/devices/cpu/sharc/sharc.cpp
@@ -400,7 +400,7 @@ void adsp21062_device::external_iop_write(uint32_t address, uint32_t data)
else
{
osd_printf_debug("SHARC IOP write %08X, %08X\n", address, data);
- m_data->write_dword(address << 2, data);
+ m_data->write_dword(address, data);
}
}
@@ -1031,7 +1031,7 @@ void adsp21062_device::execute_run()
debugger_instruction_hook(this, m_core->pc);
- m_core->opcode = m_program->read_qword(m_core->pc << 3);
+ m_core->opcode = m_program->read_qword(m_core->pc);
// handle looping
if (m_core->pc == m_core->laddr.addr)
diff --git a/src/devices/cpu/sharc/sharcdrc.cpp b/src/devices/cpu/sharc/sharcdrc.cpp
index b8ab1a1f975..c21a1c2e997 100644
--- a/src/devices/cpu/sharc/sharcdrc.cpp
+++ b/src/devices/cpu/sharc/sharcdrc.cpp
@@ -307,34 +307,28 @@ void adsp21062_device::static_generate_memory_accessor(MEM_ACCESSOR_TYPE type, c
switch (type)
{
case MEM_ACCESSOR_PM_READ48:
- UML_SHL(block, I1, I1, 3);
UML_DREAD(block, I0, I1, SIZE_QWORD, SPACE_PROGRAM);
break;
case MEM_ACCESSOR_PM_WRITE48:
- UML_SHL(block, I1, I1, 3);
UML_DWRITE(block, I1, I0, SIZE_QWORD, SPACE_PROGRAM);
UML_MOV(block, mem(&m_core->force_recompile), 1);
break;
case MEM_ACCESSOR_PM_READ32:
- UML_SHL(block, I1, I1, 3);
UML_READ(block, I0, I1, SIZE_DWORD, SPACE_PROGRAM);
break;
case MEM_ACCESSOR_PM_WRITE32:
- UML_SHL(block, I1, I1, 3);
UML_WRITE(block, I1, I0, SIZE_DWORD, SPACE_PROGRAM);
UML_MOV(block, mem(&m_core->force_recompile), 1);
break;
case MEM_ACCESSOR_DM_READ32:
- UML_SHL(block, I1, I1, 2);
UML_READ(block, I0, I1, SIZE_DWORD, SPACE_DATA);
break;
case MEM_ACCESSOR_DM_WRITE32:
- UML_SHL(block, I1, I1, 2);
UML_WRITE(block, I1, I0, SIZE_DWORD, SPACE_DATA);
break;
}
diff --git a/src/devices/cpu/sharc/sharcmem.hxx b/src/devices/cpu/sharc/sharcmem.hxx
index b297799c036..73bfa0e69f0 100644
--- a/src/devices/cpu/sharc/sharcmem.hxx
+++ b/src/devices/cpu/sharc/sharcmem.hxx
@@ -4,30 +4,30 @@
uint32_t adsp21062_device::pm_read32(uint32_t address)
{
- return m_program->read_dword(address << 3);
+ return m_program->read_dword(address);
}
void adsp21062_device::pm_write32(uint32_t address, uint32_t data)
{
- m_program->write_dword(address << 3, data);
+ m_program->write_dword(address, data);
}
uint64_t adsp21062_device::pm_read48(uint32_t address)
{
- return m_program->read_qword(address << 3);
+ return m_program->read_qword(address);
}
void adsp21062_device::pm_write48(uint32_t address, uint64_t data)
{
- m_program->write_qword(address << 3, data);
+ m_program->write_qword(address, data);
}
uint32_t adsp21062_device::dm_read32(uint32_t address)
{
- return m_data->read_dword(address << 2);
+ return m_data->read_dword(address);
}
void adsp21062_device::dm_write32(uint32_t address, uint32_t data)
{
- m_data->write_dword(address << 2, data);
+ m_data->write_dword(address, data);
}
diff --git a/src/devices/cpu/ssp1601/ssp1601.cpp b/src/devices/cpu/ssp1601/ssp1601.cpp
index 5ab63550275..b19766b72c5 100644
--- a/src/devices/cpu/ssp1601/ssp1601.cpp
+++ b/src/devices/cpu/ssp1601/ssp1601.cpp
@@ -45,8 +45,8 @@
#define PPC m_ppc.w.h
-#define FETCH() m_direct->read_word(rPC++ << 1)
-#define PROGRAM_WORD(a) m_program->read_word((a) << 1)
+#define FETCH() m_direct->read_word(rPC++)
+#define PROGRAM_WORD(a) m_program->read_word(a)
#define GET_PPC_OFFS() PPC
#define REG_READ(r) (((r) <= 4) ? m_gr[r].w.h : (this->*reg_read_handlers[r])(r))
@@ -522,7 +522,7 @@ void ssp1601_device::device_start()
m_gr[0].w.h = 0xffff; // constant reg
m_program = &space(AS_PROGRAM);
- m_direct = &m_program->direct();
+ m_direct = m_program->direct<-1>();
m_io = &space(AS_IO);
state_add( SSP_R0, "REG0", m_gr[0].w.h).formatstr("%04X");
diff --git a/src/devices/cpu/ssp1601/ssp1601.h b/src/devices/cpu/ssp1601/ssp1601.h
index fd1fb82d84b..a44615b16f3 100644
--- a/src/devices/cpu/ssp1601/ssp1601.h
+++ b/src/devices/cpu/ssp1601/ssp1601.h
@@ -72,7 +72,7 @@ private:
int m_g_cycles;
address_space *m_program;
- direct_read_data *m_direct;
+ direct_read_data<-1> *m_direct;
address_space *m_io;
void update_P();
diff --git a/src/devices/cpu/t11/t11.cpp b/src/devices/cpu/t11/t11.cpp
index 156486a2f75..1747c79b64a 100644
--- a/src/devices/cpu/t11/t11.cpp
+++ b/src/devices/cpu/t11/t11.cpp
@@ -261,7 +261,7 @@ void t11_device::device_start()
m_initial_pc = initial_pc[c_initial_mode >> 13];
m_program = &space(AS_PROGRAM);
- m_direct = &m_program->direct();
+ m_direct = m_program->direct<0>();
m_out_reset_func.resolve_safe();
save_item(NAME(m_ppc.w.l));
diff --git a/src/devices/cpu/t11/t11.h b/src/devices/cpu/t11/t11.h
index 1b547c4cc92..27f1177b03f 100644
--- a/src/devices/cpu/t11/t11.h
+++ b/src/devices/cpu/t11/t11.h
@@ -80,7 +80,7 @@ protected:
uint8_t m_irq_state;
int m_icount;
address_space *m_program;
- direct_read_data *m_direct;
+ direct_read_data<0> *m_direct;
devcb_write_line m_out_reset_func;
inline int ROPCODE();
diff --git a/src/devices/cpu/tms1000/tms0980.cpp b/src/devices/cpu/tms1000/tms0980.cpp
index fa8d274c559..622d8ca5be4 100644
--- a/src/devices/cpu/tms1000/tms0980.cpp
+++ b/src/devices/cpu/tms1000/tms0980.cpp
@@ -174,7 +174,7 @@ u32 tms0980_cpu_device::read_micro()
void tms0980_cpu_device::read_opcode()
{
debugger_instruction_hook(this, m_rom_address);
- m_opcode = m_program->read_word(m_rom_address << 1) & 0x1ff;
+ m_opcode = m_program->read_word(m_rom_address) & 0x1ff;
m_c4 = BITSWAP8(m_opcode,7,6,5,4,0,1,2,3) & 0xf; // opcode operand is bitswapped for most opcodes
m_fixed = m_fixed_decode[m_opcode];
diff --git a/src/devices/cpu/tms32010/tms32010.cpp b/src/devices/cpu/tms32010/tms32010.cpp
index c5b203f74cf..968e7bde61f 100644
--- a/src/devices/cpu/tms32010/tms32010.cpp
+++ b/src/devices/cpu/tms32010/tms32010.cpp
@@ -165,14 +165,14 @@ util::disasm_interface *tms32010_device::create_disassembler()
* Input a word from given I/O port
*/
-#define TMS32010_In(Port) (m_io->read_word((Port)<<1))
+#define TMS32010_In(Port) (m_io->read_word(Port))
/****************************************************************************
* Output a word to given I/O port
*/
-#define TMS32010_Out(Port,Value) (m_io->write_word((Port)<<1,Value))
+#define TMS32010_Out(Port,Value) (m_io->write_word(Port,Value))
@@ -180,14 +180,14 @@ util::disasm_interface *tms32010_device::create_disassembler()
* Read a word from given ROM memory location
*/
-#define TMS32010_ROM_RDMEM(A) (m_program->read_word((A)<<1))
+#define TMS32010_ROM_RDMEM(A) (m_program->read_word(A))
/****************************************************************************
* Write a word to given ROM memory location
*/
-#define TMS32010_ROM_WRMEM(A,V) (m_program->write_word((A)<<1,V))
+#define TMS32010_ROM_WRMEM(A,V) (m_program->write_word(A,V))
@@ -195,14 +195,14 @@ util::disasm_interface *tms32010_device::create_disassembler()
* Read a word from given RAM memory location
*/
-#define TMS32010_RAM_RDMEM(A) (m_data->read_word((A)<<1))
+#define TMS32010_RAM_RDMEM(A) (m_data->read_word(A))
/****************************************************************************
* Write a word to given RAM memory location
*/
-#define TMS32010_RAM_WRMEM(A,V) (m_data->write_word((A)<<1,V))
+#define TMS32010_RAM_WRMEM(A,V) (m_data->write_word(A,V))
@@ -212,7 +212,7 @@ util::disasm_interface *tms32010_device::create_disassembler()
* used to greatly speed up emulation
*/
-#define TMS32010_RDOP(A) (m_direct->read_word((A)<<1))
+#define TMS32010_RDOP(A) (m_direct->read_word(A))
/****************************************************************************
@@ -221,7 +221,7 @@ util::disasm_interface *tms32010_device::create_disassembler()
* that use different encoding mechanisms for opcodes and opcode arguments
*/
-#define TMS32010_RDOP_ARG(A) (m_direct->read_word((A)<<1))
+#define TMS32010_RDOP_ARG(A) (m_direct->read_word(A))
/************************************************************************
@@ -523,7 +523,7 @@ void tms32010_device::eint()
}
void tms32010_device::in_p()
{
- m_ALU.w.l = P_IN( (m_opcode.b.h & 7) );
+ m_ALU.w.l = P_IN(m_opcode.b.h & 7);
putdata(m_ALU.w.l);
}
void tms32010_device::lac_sh()
@@ -834,7 +834,7 @@ void tms32010_device::device_start()
save_item(NAME(m_addr_mask));
m_program = &space(AS_PROGRAM);
- m_direct = &m_program->direct();
+ m_direct = m_program->direct<-1>();
m_data = &space(AS_DATA);
m_io = &space(AS_IO);
diff --git a/src/devices/cpu/tms32010/tms32010.h b/src/devices/cpu/tms32010/tms32010.h
index e3f955e6a05..eb1e40370e1 100644
--- a/src/devices/cpu/tms32010/tms32010.h
+++ b/src/devices/cpu/tms32010/tms32010.h
@@ -107,7 +107,7 @@ private:
int m_addr_mask;
address_space *m_program;
- direct_read_data *m_direct;
+ direct_read_data<-1> *m_direct;
address_space *m_data;
address_space *m_io;
diff --git a/src/devices/cpu/tms32025/tms32025.cpp b/src/devices/cpu/tms32025/tms32025.cpp
index 08a2dfbe180..74529d79894 100644
--- a/src/devices/cpu/tms32025/tms32025.cpp
+++ b/src/devices/cpu/tms32025/tms32025.cpp
@@ -513,7 +513,7 @@ void tms32025_device::GETDATA(int shift,int signext)
m_external_mem_access = 0;
}
- m_ALU.d = (uint16_t)m_data->read_word(m_memaccess << 1);
+ m_ALU.d = (uint16_t)m_data->read_word(m_memaccess);
if (signext) m_ALU.d = (int16_t)m_ALU.d;
m_ALU.d <<= shift;
@@ -527,14 +527,14 @@ void tms32025_device::PUTDATA(uint16_t data)
if (m_memaccess >= 0x800) m_external_mem_access = 1; /* Pause if hold pin is active */
else m_external_mem_access = 0;
- m_data->write_word(IND << 1, data);
+ m_data->write_word(IND, data);
MODIFY_AR_ARP();
}
else {
if (m_memaccess >= 0x800) m_external_mem_access = 1; /* Pause if hold pin is active */
else m_external_mem_access = 0;
- m_data->write_word(DMA << 1, data);
+ m_data->write_word(DMA, data);
}
}
void tms32025_device::PUTDATA_SST(uint16_t data)
@@ -549,7 +549,7 @@ void tms32025_device::PUTDATA_SST(uint16_t data)
m_opcode.b.l &= 0xf7; /* Stop ARP changes */
MODIFY_AR_ARP();
}
- m_data->write_word(m_memaccess << 1, data);
+ m_data->write_word(m_memaccess, data);
}
@@ -637,8 +637,8 @@ void tms32025_device::addt()
void tms32025_device::adlk()
{
m_oldacc.d = m_ACC.d;
- if (SXM) m_ALU.d = (int16_t)m_direct->read_word(m_PC << 1);
- else m_ALU.d = (uint16_t)m_direct->read_word(m_PC << 1);
+ if (SXM) m_ALU.d = (int16_t)m_direct->read_word(m_PC);
+ else m_ALU.d = (uint16_t)m_direct->read_word(m_PC);
m_PC++;
m_ALU.d <<= (m_opcode.b.h & 0xf);
m_ACC.d += m_ALU.d;
@@ -657,7 +657,7 @@ void tms32025_device::and_()
void tms32025_device::andk()
{
m_oldacc.d = m_ACC.d;
- m_ALU.d = (uint16_t)m_direct->read_word(m_PC << 1);
+ m_ALU.d = (uint16_t)m_direct->read_word(m_PC);
m_PC++;
m_ALU.d <<= (m_opcode.b.h & 0xf);
m_ACC.d &= m_ALU.d;
@@ -672,7 +672,7 @@ void tms32025_device::apac()
}
void tms32025_device::br()
{
- m_PC = m_direct->read_word(m_PC << 1);
+ m_PC = m_direct->read_word(m_PC);
MODIFY_AR_ARP();
}
void tms32025_device::bacc()
@@ -681,43 +681,43 @@ void tms32025_device::bacc()
}
void tms32025_device::banz()
{
- if (m_AR[ARP]) m_PC = m_direct->read_word(m_PC << 1);
+ if (m_AR[ARP]) m_PC = m_direct->read_word(m_PC);
else m_PC++ ;
MODIFY_AR_ARP();
}
void tms32025_device::bbnz()
{
- if (TC) m_PC = m_direct->read_word(m_PC << 1);
+ if (TC) m_PC = m_direct->read_word(m_PC);
else m_PC++ ;
MODIFY_AR_ARP();
}
void tms32025_device::bbz()
{
- if (TC == 0) m_PC = m_direct->read_word(m_PC << 1);
+ if (TC == 0) m_PC = m_direct->read_word(m_PC);
else m_PC++ ;
MODIFY_AR_ARP();
}
void tms32025_device::bc()
{
- if (CARRY) m_PC = m_direct->read_word(m_PC << 1);
+ if (CARRY) m_PC = m_direct->read_word(m_PC);
else m_PC++ ;
MODIFY_AR_ARP();
}
void tms32025_device::bgez()
{
- if ( (int32_t)(m_ACC.d) >= 0 ) m_PC = m_direct->read_word(m_PC << 1);
+ if ( (int32_t)(m_ACC.d) >= 0 ) m_PC = m_direct->read_word(m_PC);
else m_PC++ ;
MODIFY_AR_ARP();
}
void tms32025_device::bgz()
{
- if ( (int32_t)(m_ACC.d) > 0 ) m_PC = m_direct->read_word(m_PC << 1);
+ if ( (int32_t)(m_ACC.d) > 0 ) m_PC = m_direct->read_word(m_PC);
else m_PC++ ;
MODIFY_AR_ARP();
}
void tms32025_device::bioz()
{
- if (m_bio_in() != CLEAR_LINE) m_PC = m_direct->read_word(m_PC << 1);
+ if (m_bio_in() != CLEAR_LINE) m_PC = m_direct->read_word(m_PC);
else m_PC++ ;
MODIFY_AR_ARP();
}
@@ -735,17 +735,17 @@ void tms32025_device::bitt()
}
void tms32025_device::blez()
{
- if ( (int32_t)(m_ACC.d) <= 0 ) m_PC = m_direct->read_word(m_PC << 1);
+ if ( (int32_t)(m_ACC.d) <= 0 ) m_PC = m_direct->read_word(m_PC);
else m_PC++ ;
MODIFY_AR_ARP();
}
void tms32025_device::blkd()
{ /** Fix cycle timing **/
if (m_init_load_addr) {
- m_PFC = m_direct->read_word(m_PC << 1);
+ m_PFC = m_direct->read_word(m_PC);
m_PC++;
}
- m_ALU.d = m_data->read_word(m_PFC << 1);
+ m_ALU.d = m_data->read_word(m_PFC);
PUTDATA(m_ALU.d);
m_PFC++;
m_tms32025_dec_cycles += (1*CLK);
@@ -753,29 +753,29 @@ void tms32025_device::blkd()
void tms32025_device::blkp()
{ /** Fix cycle timing **/
if (m_init_load_addr) {
- m_PFC = m_direct->read_word(m_PC << 1);
+ m_PFC = m_direct->read_word(m_PC);
m_PC++;
}
- m_ALU.d = m_direct->read_word(m_PFC << 1);
+ m_ALU.d = m_direct->read_word(m_PFC);
PUTDATA(m_ALU.d);
m_PFC++;
m_tms32025_dec_cycles += (2*CLK);
}
void tms32025_device::blz()
{
- if ( (int32_t)(m_ACC.d) < 0 ) m_PC = m_direct->read_word(m_PC << 1);
+ if ( (int32_t)(m_ACC.d) < 0 ) m_PC = m_direct->read_word(m_PC);
else m_PC++ ;
MODIFY_AR_ARP();
}
void tms32025_device::bnc()
{
- if (CARRY == 0) m_PC = m_direct->read_word(m_PC << 1);
+ if (CARRY == 0) m_PC = m_direct->read_word(m_PC);
else m_PC++ ;
MODIFY_AR_ARP();
}
void tms32025_device::bnv()
{
- if (OV == 0) m_PC = m_direct->read_word(m_PC << 1);
+ if (OV == 0) m_PC = m_direct->read_word(m_PC);
else {
m_PC++ ;
CLR0(OV_FLAG);
@@ -784,14 +784,14 @@ void tms32025_device::bnv()
}
void tms32025_device::bnz()
{
- if (m_ACC.d != 0) m_PC = m_direct->read_word(m_PC << 1);
+ if (m_ACC.d != 0) m_PC = m_direct->read_word(m_PC);
else m_PC++ ;
MODIFY_AR_ARP();
}
void tms32025_device::bv()
{
if (OV) {
- m_PC = m_direct->read_word(m_PC << 1);
+ m_PC = m_direct->read_word(m_PC);
CLR0(OV_FLAG);
}
else m_PC++ ;
@@ -799,7 +799,7 @@ void tms32025_device::bv()
}
void tms32025_device::bz()
{
- if (m_ACC.d == 0) m_PC = m_direct->read_word(m_PC << 1);
+ if (m_ACC.d == 0) m_PC = m_direct->read_word(m_PC);
else m_PC++ ;
MODIFY_AR_ARP();
}
@@ -812,7 +812,7 @@ void tms32025_device::call()
{
m_PC++ ;
PUSH_STACK(m_PC);
- m_PC = m_direct->read_word((m_PC - 1) << 1);
+ m_PC = m_direct->read_word(m_PC - 1);
MODIFY_AR_ARP();
}
void tms32025_device::cmpl()
@@ -915,7 +915,7 @@ void tms32025_device::dint()
void tms32025_device::dmov() /** Careful with how memory is configured !! */
{
GETDATA(0, 0);
- m_data->write_word((m_memaccess + 1) << 1, m_ALU.w.l);
+ m_data->write_word(m_memaccess + 1, m_ALU.w.l);
}
void tms32025_device::eint()
{
@@ -933,7 +933,7 @@ void tms32025_device::idle()
}
void tms32025_device::in()
{
- m_ALU.w.l = m_io->read_word( (m_opcode.b.h & 0xf) << 1 );
+ m_ALU.w.l = m_io->read_word(m_opcode.b.h & 0xf);
PUTDATA(m_ALU.w.l);
}
void tms32025_device::lac()
@@ -952,8 +952,8 @@ void tms32025_device::lact()
}
void tms32025_device::lalk()
{
- if (SXM) m_ALU.d = (int16_t)m_direct->read_word(m_PC << 1);
- else m_ALU.d = (uint16_t)m_direct->read_word(m_PC << 1);
+ if (SXM) m_ALU.d = (int16_t)m_direct->read_word(m_PC);
+ else m_ALU.d = (uint16_t)m_direct->read_word(m_PC);
m_PC++;
m_ALU.d <<= (m_opcode.b.h & 0xf);
m_ACC.d = m_ALU.d;
@@ -990,7 +990,7 @@ void tms32025_device::lph()
}
void tms32025_device::lrlk()
{
- m_ALU.d = (uint16_t)m_direct->read_word(m_PC << 1);
+ m_ALU.d = (uint16_t)m_direct->read_word(m_PC);
m_PC++;
m_AR[m_opcode.b.h & 7] = m_ALU.w.l;
}
@@ -1035,7 +1035,7 @@ void tms32025_device::ltd() /** Careful with how memory is configured !! */
m_oldacc.d = m_ACC.d;
GETDATA(0, 0);
m_Treg = m_ALU.w.l;
- m_data->write_word((m_memaccess+1) << 1, m_ALU.w.l);
+ m_data->write_word(m_memaccess+1, m_ALU.w.l);
SHIFT_Preg_TO_ALU();
m_ACC.d += m_ALU.d;
CALCULATE_ADD_OVERFLOW(m_ALU.d);
@@ -1063,7 +1063,7 @@ void tms32025_device::mac() /** RAM blocks B0,B1,B2 may be important !
{ /** Fix cycle timing **/
m_oldacc.d = m_ACC.d;
if (m_init_load_addr) {
- m_PFC = m_direct->read_word(m_PC << 1);
+ m_PFC = m_direct->read_word(m_PC);
m_PC++;
}
SHIFT_Preg_TO_ALU();
@@ -1072,7 +1072,7 @@ void tms32025_device::mac() /** RAM blocks B0,B1,B2 may be important !
CALCULATE_ADD_CARRY();
GETDATA(0, 0);
m_Treg = m_ALU.w.l;
- m_Preg.d = ( (int16_t)m_ALU.w.l * (int16_t)m_direct->read_word(m_PFC << 1) );
+ m_Preg.d = ( (int16_t)m_ALU.w.l * (int16_t)m_direct->read_word(m_PFC) );
m_PFC++;
m_tms32025_dec_cycles += (2*CLK);
}
@@ -1080,7 +1080,7 @@ void tms32025_device::macd() /** RAM blocks B0,B1,B2 may be important !
{ /** Fix cycle timing **/
m_oldacc.d = m_ACC.d;
if (m_init_load_addr) {
- m_PFC = m_direct->read_word(m_PC << 1);
+ m_PFC = m_direct->read_word(m_PC);
m_PC++;
}
SHIFT_Preg_TO_ALU();
@@ -1089,10 +1089,10 @@ void tms32025_device::macd() /** RAM blocks B0,B1,B2 may be important !
CALCULATE_ADD_CARRY();
GETDATA(0, 0);
if ( (m_opcode.b.l & 0x80) || m_init_load_addr ) { /* No writing during repetition, or DMA mode */
- m_data->write_word((m_memaccess+1) << 1, m_ALU.w.l);
+ m_data->write_word(m_memaccess+1, m_ALU.w.l);
}
m_Treg = m_ALU.w.l;
- m_Preg.d = ( (int16_t)m_ALU.w.l * (int16_t)m_direct->read_word(m_PFC << 1) );
+ m_Preg.d = ( (int16_t)m_ALU.w.l * (int16_t)m_direct->read_word(m_PFC) );
m_PFC++;
m_tms32025_dec_cycles += (2*CLK);
}
@@ -1165,7 +1165,7 @@ void tms32025_device::or_()
}
void tms32025_device::ork()
{
- m_ALU.d = (uint16_t)m_direct->read_word(m_PC << 1);
+ m_ALU.d = (uint16_t)m_direct->read_word(m_PC);
m_PC++;
m_ALU.d <<= (m_opcode.b.h & 0xf);
m_ACC.d |= (m_ALU.d);
@@ -1173,7 +1173,7 @@ void tms32025_device::ork()
void tms32025_device::out()
{
GETDATA(0, 0);
- m_io->write_word( (m_opcode.b.h & 0xf) << 1, m_ALU.w.l );
+ m_io->write_word(m_opcode.b.h & 0xf, m_ALU.w.l );
}
void tms32025_device::pac()
{
@@ -1284,8 +1284,8 @@ void tms32025_device::sar_ar7() { PUTDATA(m_AR[7]); }
void tms32025_device::sblk()
{
m_oldacc.d = m_ACC.d;
- if (SXM) m_ALU.d = (int16_t)m_direct->read_word(m_PC << 1);
- else m_ALU.d = (uint16_t)m_direct->read_word(m_PC << 1);
+ if (SXM) m_ALU.d = (int16_t)m_direct->read_word(m_PC);
+ else m_ALU.d = (uint16_t)m_direct->read_word(m_PC);
m_PC++;
m_ALU.d <<= (m_opcode.b.h & 0xf);
m_ACC.d -= m_ALU.d;
@@ -1476,7 +1476,7 @@ void tms32025_device::tblr()
if (m_init_load_addr) {
m_PFC = m_ACC.w.l;
}
- m_ALU.w.l = m_direct->read_word(m_PFC << 1);
+ m_ALU.w.l = m_direct->read_word(m_PFC);
if ( (CNF0) && ( (uint16_t)(m_PFC) >= 0xff00 ) ) {} /** TMS32025 only */
else m_tms32025_dec_cycles += (1*CLK);
PUTDATA(m_ALU.w.l);
@@ -1490,7 +1490,7 @@ void tms32025_device::tblw()
m_tms32025_dec_cycles += (1*CLK);
GETDATA(0, 0);
if (m_external_mem_access) m_tms32025_dec_cycles += (1*CLK);
- m_program->write_word(m_PFC << 1, m_ALU.w.l);
+ m_program->write_word(m_PFC, m_ALU.w.l);
m_PFC++;
}
void tms32025_device::trap()
@@ -1505,7 +1505,7 @@ void tms32025_device::xor_()
}
void tms32025_device::xork()
{
- m_ALU.d = m_direct->read_word(m_PC << 1);
+ m_ALU.d = m_direct->read_word(m_PC);
m_PC++;
m_ALU.d <<= (m_opcode.b.h & 0xf);
m_ACC.d ^= m_ALU.d;
@@ -1619,7 +1619,7 @@ const tms32025_device::tms32025_opcode tms32025_device::s_opcode_Dx_subset[8]=
void tms32025_device::device_start()
{
m_program = &space(AS_PROGRAM);
- m_direct = &m_program->direct();
+ m_direct = m_program->direct<-1>();
m_data = &space(AS_DATA);
m_io = &space(AS_IO);
@@ -1967,7 +1967,7 @@ void tms32025_device::execute_run()
debugger_instruction_hook(this, m_PC);
- m_opcode.d = m_direct->read_word(m_PC << 1);
+ m_opcode.d = m_direct->read_word(m_PC);
m_PC++;
if (m_opcode.b.h == 0xCE) /* Opcode 0xCExx has many sub-opcodes in its minor byte */
@@ -2001,7 +2001,7 @@ void tms32025_device::execute_run()
debugger_instruction_hook(this, m_PC);
- m_opcode.d = m_direct->read_word(m_PC << 1);
+ m_opcode.d = m_direct->read_word(m_PC);
m_PC++;
m_tms32025_dec_cycles += (1*CLK);
diff --git a/src/devices/cpu/tms32025/tms32025.h b/src/devices/cpu/tms32025/tms32025.h
index 6e8c2ab627a..66c76bc001b 100644
--- a/src/devices/cpu/tms32025/tms32025.h
+++ b/src/devices/cpu/tms32025/tms32025.h
@@ -139,7 +139,7 @@ protected:
optional_shared_ptr<uint16_t> m_b3;
address_space *m_program;
- direct_read_data *m_direct;
+ direct_read_data<-1> *m_direct;
address_space *m_data;
address_space *m_io;
@@ -202,10 +202,6 @@ protected:
inline void MODIFY_DP(int data);
inline void MODIFY_PM(int data);
inline void MODIFY_ARP(int data);
- inline uint16_t M_RDROM(offs_t addr);
- inline void M_WRTROM(offs_t addr, uint16_t data);
- inline uint16_t M_RDRAM(offs_t addr);
- inline void M_WRTRAM(offs_t addr, uint16_t data);
uint16_t reverse_carry_add(uint16_t arg0, uint16_t arg1 );
inline void MODIFY_AR_ARP();
inline void CALCULATE_ADD_CARRY();
diff --git a/src/devices/cpu/tms32031/tms32031.cpp b/src/devices/cpu/tms32031/tms32031.cpp
index fd8c92af63e..6f75d3a82cb 100644
--- a/src/devices/cpu/tms32031/tms32031.cpp
+++ b/src/devices/cpu/tms32031/tms32031.cpp
@@ -329,7 +329,7 @@ inline uint32_t tms3203x_device::ROPCODE(offs_t pc)
if (m_mcbl_mode && pc < 0x1000)
return m_bootrom[pc];
- return m_direct->read_dword(pc << 2);
+ return m_direct->read_dword(pc);
}
@@ -342,7 +342,7 @@ inline uint32_t tms3203x_device::RMEM(offs_t addr)
if (m_mcbl_mode && addr < 0x1000)
return m_bootrom[addr];
- return m_program->read_dword(addr << 2);
+ return m_program->read_dword(addr);
}
@@ -352,7 +352,7 @@ inline uint32_t tms3203x_device::RMEM(offs_t addr)
inline void tms3203x_device::WMEM(offs_t addr, uint32_t data)
{
- m_program->write_dword(addr << 2, data);
+ m_program->write_dword(addr, data);
}
@@ -364,7 +364,7 @@ void tms3203x_device::device_start()
{
// find address spaces
m_program = &space(AS_PROGRAM);
- m_direct = &m_program->direct();
+ m_direct = m_program->direct<-2>();
// resolve devcb handlers
m_xf0_cb.resolve_safe();
diff --git a/src/devices/cpu/tms32031/tms32031.h b/src/devices/cpu/tms32031/tms32031.h
index fcc05db55bc..14ac97cd6d0 100644
--- a/src/devices/cpu/tms32031/tms32031.h
+++ b/src/devices/cpu/tms32031/tms32031.h
@@ -764,7 +764,7 @@ protected:
uint32_t m_iotemp;
address_space * m_program;
- direct_read_data * m_direct;
+ direct_read_data<-2> *m_direct;
uint32_t * m_bootrom;
bool m_mcbl_mode;
diff --git a/src/devices/cpu/tms32051/tms32051.cpp b/src/devices/cpu/tms32051/tms32051.cpp
index f1a38012f24..721d1fd1bcb 100644
--- a/src/devices/cpu/tms32051/tms32051.cpp
+++ b/src/devices/cpu/tms32051/tms32051.cpp
@@ -126,7 +126,7 @@ util::disasm_interface *tms32051_device::create_disassembler()
#define CYCLES(x) (m_icount -= x)
-#define ROPCODE() m_direct->read_word((m_pc++) << 1)
+#define ROPCODE() m_direct->read_word(m_pc++)
void tms32051_device::CHANGE_PC(uint16_t new_pc)
{
@@ -135,22 +135,22 @@ void tms32051_device::CHANGE_PC(uint16_t new_pc)
uint16_t tms32051_device::PM_READ16(uint16_t address)
{
- return m_program->read_word(address << 1);
+ return m_program->read_word(address);
}
void tms32051_device::PM_WRITE16(uint16_t address, uint16_t data)
{
- m_program->write_word(address << 1, data);
+ m_program->write_word(address, data);
}
uint16_t tms32051_device::DM_READ16(uint16_t address)
{
- return m_data->read_word(address << 1);
+ return m_data->read_word(address);
}
void tms32051_device::DM_WRITE16(uint16_t address, uint16_t data)
{
- m_data->write_word(address << 1, data);
+ m_data->write_word(address, data);
}
#include "32051ops.hxx"
@@ -183,7 +183,7 @@ void tms32051_device::delay_slot(uint16_t startpc)
void tms32051_device::device_start()
{
m_program = &space(AS_PROGRAM);
- m_direct = &m_program->direct();
+ m_direct = m_program->direct<-1>();
m_data = &space(AS_DATA);
m_io = &space(AS_IO);
@@ -515,7 +515,7 @@ READ16_MEMBER( tms32051_device::cpuregs_r )
case 0x5d:
case 0x5e:
case 0x5f:
- return m_io->read_word(offset << 1);
+ return m_io->read_word(offset);
default:
if (!machine().side_effect_disabled())
@@ -626,7 +626,7 @@ WRITE16_MEMBER( tms32051_device::cpuregs_w )
case 0x5d:
case 0x5e:
case 0x5f:
- m_io->write_word(offset << 1, data);
+ m_io->write_word(offset, data);
break;
default:
diff --git a/src/devices/cpu/tms32051/tms32051.h b/src/devices/cpu/tms32051/tms32051.h
index bd365dc4da2..2f64822d62c 100644
--- a/src/devices/cpu/tms32051/tms32051.h
+++ b/src/devices/cpu/tms32051/tms32051.h
@@ -159,7 +159,7 @@ protected:
} m_shadow;
address_space *m_program;
- direct_read_data *m_direct;
+ direct_read_data<-1> *m_direct;
address_space *m_data;
address_space *m_io;
int m_icount;
diff --git a/src/devices/cpu/tms32082/tms32082.cpp b/src/devices/cpu/tms32082/tms32082.cpp
index baf7289fe4b..392cd0d8738 100644
--- a/src/devices/cpu/tms32082/tms32082.cpp
+++ b/src/devices/cpu/tms32082/tms32082.cpp
@@ -221,7 +221,7 @@ void tms32082_mp_device::device_start()
state_add(STATE_GENPCBASE, "CURPC", m_pc).noshow();
m_program = &space(AS_PROGRAM);
- m_direct = &m_program->direct();
+ m_direct = m_program->direct<0>();
m_icountptr = &m_icount;
}
@@ -519,7 +519,7 @@ void tms32082_pp_device::device_start()
state_add(STATE_GENPCBASE, "CURPC", m_pc).noshow();
m_program = &space(AS_PROGRAM);
- m_direct = &m_program->direct();
+ m_direct = m_program->direct<0>();
m_icountptr = &m_icount;
}
diff --git a/src/devices/cpu/tms32082/tms32082.h b/src/devices/cpu/tms32082/tms32082.h
index de7949ec29f..88f968584a7 100644
--- a/src/devices/cpu/tms32082/tms32082.h
+++ b/src/devices/cpu/tms32082/tms32082.h
@@ -130,7 +130,7 @@ protected:
int m_icount;
address_space *m_program;
- direct_read_data* m_direct;
+ direct_read_data<0> * m_direct;
write32_delegate m_cmd_callback;
@@ -189,7 +189,7 @@ protected:
int m_icount;
address_space *m_program;
- direct_read_data* m_direct;
+ direct_read_data<0> * m_direct;
};
diff --git a/src/devices/cpu/tms34010/34010fld.hxx b/src/devices/cpu/tms34010/34010fld.hxx
index 7d55bca3b7b..79c2caa5c50 100644
--- a/src/devices/cpu/tms34010/34010fld.hxx
+++ b/src/devices/cpu/tms34010/34010fld.hxx
@@ -98,7 +98,7 @@ void tms340x0_device::wfield_16(offs_t offset, uint32_t data)
}
else
{
- TMS34010_WRMEM_WORD(TOBYTE(offset),data);
+ TMS34010_WRMEM_WORD(offset,data);
}
}
@@ -313,7 +313,7 @@ uint32_t tms340x0_device::rfield_z_16(offs_t offset)
}
else
- ret = TMS34010_RDMEM_WORD(TOBYTE(offset));
+ ret = TMS34010_RDMEM_WORD(offset);
return ret;
}
@@ -490,7 +490,7 @@ uint32_t tms340x0_device::rfield_s_08(offs_t offset)
}
else
- ret = TMS34010_RDMEM(TOBYTE(offset));
+ ret = TMS34010_RDMEM(offset);
return (int32_t)(int8_t)ret;
}
@@ -553,7 +553,7 @@ uint32_t tms340x0_device::rfield_s_16(offs_t offset)
else
{
- ret = TMS34010_RDMEM_WORD(TOBYTE(offset));
+ ret = TMS34010_RDMEM_WORD(offset);
}
return (int32_t)(int16_t)ret;
diff --git a/src/devices/cpu/tms34010/34010gfx.hxx b/src/devices/cpu/tms34010/34010gfx.hxx
index 72c32b8a227..410b2d3a06a 100644
--- a/src/devices/cpu/tms34010/34010gfx.hxx
+++ b/src/devices/cpu/tms34010/34010gfx.hxx
@@ -224,7 +224,7 @@ void tms340x0_device::shiftreg_w(address_space &space, offs_t offset,uint16_t da
{
logerror("shiftreg_w %08x %04x\n", offset << 3, data);
if (!m_from_shiftreg_cb.isnull())
- m_from_shiftreg_cb(space, (uint32_t)(offset << 3) & ~15, &m_shiftreg[0]);
+ m_from_shiftreg_cb(space, offset, &m_shiftreg[0]);
else
logerror("From ShiftReg function not set. PC = %08X\n", m_pc);
}
@@ -232,7 +232,7 @@ void tms340x0_device::shiftreg_w(address_space &space, offs_t offset,uint16_t da
uint16_t tms340x0_device::shiftreg_r(address_space &space, offs_t offset)
{
if (!m_to_shiftreg_cb.isnull())
- m_to_shiftreg_cb(space, (uint32_t)(offset << 3) & ~15, &m_shiftreg[0]);
+ m_to_shiftreg_cb(space, offset, &m_shiftreg[0]);
else
logerror("To ShiftReg function not set. PC = %08X\n", m_pc);
return m_shiftreg[0];
@@ -1034,13 +1034,13 @@ void FUNCTION_NAME(tms340x0_device::pixblt)(int src_is_linear, int dst_is_linear
uint32_t srcword, dstword = 0;
/* fetch the initial source word */
- srcword = (this->*word_read)(*m_program, srcwordaddr++ << 1);
+ srcword = (this->*word_read)(*m_program, srcwordaddr++ << 4);
readwrites++;
/* fetch the initial dest word */
if (PIXEL_OP_REQUIRES_SOURCE || TRANSPARENCY || (daddr & 0x0f) != 0)
{
- dstword = (this->*word_read)(*m_program, dstwordaddr << 1);
+ dstword = (this->*word_read)(*m_program, dstwordaddr << 4);
readwrites++;
}
@@ -1053,7 +1053,7 @@ void FUNCTION_NAME(tms340x0_device::pixblt)(int src_is_linear, int dst_is_linear
/* fetch more words if necessary */
if (srcbit + BITS_PER_PIXEL > 16)
{
- srcword |= (this->*word_read)(*m_program, srcwordaddr++ << 1) << 16;
+ srcword |= (this->*word_read)(*m_program, srcwordaddr++ << 4) << 16;
readwrites++;
}
@@ -1070,7 +1070,7 @@ void FUNCTION_NAME(tms340x0_device::pixblt)(int src_is_linear, int dst_is_linear
if (PIXEL_OP_REQUIRES_SOURCE || TRANSPARENCY)
if (dstbit + BITS_PER_PIXEL > 16)
{
- dstword |= (this->*word_read)(*m_program, (dstwordaddr + 1) << 1) << 16;
+ dstword |= (this->*word_read)(*m_program, (dstwordaddr + 1) << 4) << 16;
readwrites++;
}
@@ -1085,7 +1085,7 @@ void FUNCTION_NAME(tms340x0_device::pixblt)(int src_is_linear, int dst_is_linear
dstbit += BITS_PER_PIXEL;
if (dstbit > 16)
{
- (this->*word_write)(*m_program, dstwordaddr++ << 1, dstword);
+ (this->*word_write)(*m_program, dstwordaddr++ << 4, dstword);
readwrites++;
dstbit -= 16;
dstword >>= 16;
@@ -1098,13 +1098,13 @@ void FUNCTION_NAME(tms340x0_device::pixblt)(int src_is_linear, int dst_is_linear
/* if we're right-partial, read and mask the remaining bits */
if (dstbit != 16)
{
- uint16_t origdst = (this->*word_read)(*m_program, dstwordaddr << 1);
+ uint16_t origdst = (this->*word_read)(*m_program, dstwordaddr << 4);
uint16_t mask = 0xffff << dstbit;
dstword = (dstword & ~mask) | (origdst & mask);
readwrites++;
}
- (this->*word_write)(*m_program, dstwordaddr++ << 1, dstword);
+ (this->*word_write)(*m_program, dstwordaddr++ << 4, dstword);
readwrites++;
}
@@ -1136,14 +1136,14 @@ void FUNCTION_NAME(tms340x0_device::pixblt)(int src_is_linear, int dst_is_linear
dwordaddr = daddr >> 4;
/* fetch the initial source word */
- srcword = (this->*word_read)(*m_program, swordaddr++ << 1);
+ srcword = (this->*word_read)(*m_program, swordaddr++ << 4);
srcmask = PIXEL_MASK << (saddr & 15);
/* handle the left partial word */
if (left_partials != 0)
{
/* fetch the destination word */
- dstword = (this->*word_read)(*m_program, dwordaddr << 1);
+ dstword = (this->*word_read)(*m_program, dwordaddr << 4);
dstmask = PIXEL_MASK << (daddr & 15);
/* loop over partials */
@@ -1152,7 +1152,7 @@ void FUNCTION_NAME(tms340x0_device::pixblt)(int src_is_linear, int dst_is_linear
/* fetch another word if necessary */
if (srcmask == 0)
{
- srcword = (this->*word_read)(*m_program, swordaddr++ << 1);
+ srcword = (this->*word_read)(*m_program, swordaddr++ << 4);
srcmask = PIXEL_MASK;
}
@@ -1174,7 +1174,7 @@ void FUNCTION_NAME(tms340x0_device::pixblt)(int src_is_linear, int dst_is_linear
}
/* write the result */
- (this->*word_write)(*m_program, dwordaddr++ << 1, dstword);
+ (this->*word_write)(*m_program, dwordaddr++ << 4, dstword);
}
/* loop over full words */
@@ -1182,7 +1182,7 @@ void FUNCTION_NAME(tms340x0_device::pixblt)(int src_is_linear, int dst_is_linear
{
/* fetch the destination word (if necessary) */
if (PIXEL_OP_REQUIRES_SOURCE || TRANSPARENCY)
- dstword = (this->*word_read)(*m_program, dwordaddr << 1);
+ dstword = (this->*word_read)(*m_program, dwordaddr << 4);
else
dstword = 0;
dstmask = PIXEL_MASK;
@@ -1193,7 +1193,7 @@ void FUNCTION_NAME(tms340x0_device::pixblt)(int src_is_linear, int dst_is_linear
/* fetch another word if necessary */
if (srcmask == 0)
{
- srcword = (this->*word_read)(*m_program, swordaddr++ << 1);
+ srcword = (this->*word_read)(*m_program, swordaddr++ << 4);
srcmask = PIXEL_MASK;
}
@@ -1215,14 +1215,14 @@ void FUNCTION_NAME(tms340x0_device::pixblt)(int src_is_linear, int dst_is_linear
}
/* write the result */
- (this->*word_write)(*m_program, dwordaddr++ << 1, dstword);
+ (this->*word_write)(*m_program, dwordaddr++ << 4, dstword);
}
/* handle the right partial word */
if (right_partials != 0)
{
/* fetch the destination word */
- dstword = (this->*word_read)(*m_program, dwordaddr << 1);
+ dstword = (this->*word_read)(*m_program, dwordaddr << 4);
dstmask = PIXEL_MASK;
/* loop over partials */
@@ -1232,7 +1232,7 @@ void FUNCTION_NAME(tms340x0_device::pixblt)(int src_is_linear, int dst_is_linear
if (srcmask == 0)
{
LOGGFX((" right fetch @ %08x\n", swordaddr));
- srcword = (this->*word_read)(*m_program, swordaddr++ << 1);
+ srcword = (this->*word_read)(*m_program, swordaddr++ << 4);
srcmask = PIXEL_MASK;
}
@@ -1254,7 +1254,7 @@ void FUNCTION_NAME(tms340x0_device::pixblt)(int src_is_linear, int dst_is_linear
}
/* write the result */
- (this->*word_write)(*m_program, dwordaddr++ << 1, dstword);
+ (this->*word_write)(*m_program, dwordaddr++ << 4, dstword);
}
#endif
@@ -1405,14 +1405,14 @@ if ((daddr & (BITS_PER_PIXEL - 1)) != 0) osd_printf_debug("PIXBLT_R%d with odd d
dwordaddr = (daddr + 15) >> 4;
/* fetch the initial source word */
- srcword = (this->*word_read)(*m_program, --swordaddr << 1);
+ srcword = (this->*word_read)(*m_program, --swordaddr << 4);
srcmask = PIXEL_MASK << ((saddr - BITS_PER_PIXEL) & 15);
/* handle the right partial word */
if (right_partials != 0)
{
/* fetch the destination word */
- dstword = (this->*word_read)(*m_program, --dwordaddr << 1);
+ dstword = (this->*word_read)(*m_program, --dwordaddr << 4);
dstmask = PIXEL_MASK << ((daddr - BITS_PER_PIXEL) & 15);
/* loop over partials */
@@ -1421,7 +1421,7 @@ if ((daddr & (BITS_PER_PIXEL - 1)) != 0) osd_printf_debug("PIXBLT_R%d with odd d
/* fetch source pixel if necessary */
if (srcmask == 0)
{
- srcword = (this->*word_read)(*m_program, --swordaddr << 1);
+ srcword = (this->*word_read)(*m_program, --swordaddr << 4);
srcmask = PIXEL_MASK << (16 - BITS_PER_PIXEL);
}
@@ -1448,7 +1448,7 @@ if ((daddr & (BITS_PER_PIXEL - 1)) != 0) osd_printf_debug("PIXBLT_R%d with odd d
}
/* write the result */
- (this->*word_write)(*m_program, dwordaddr << 1, dstword);
+ (this->*word_write)(*m_program, dwordaddr << 4, dstword);
}
/* loop over full words */
@@ -1457,7 +1457,7 @@ if ((daddr & (BITS_PER_PIXEL - 1)) != 0) osd_printf_debug("PIXBLT_R%d with odd d
/* fetch the destination word (if necessary) */
dwordaddr--;
if (PIXEL_OP_REQUIRES_SOURCE || TRANSPARENCY)
- dstword = (this->*word_read)(*m_program, dwordaddr << 1);
+ dstword = (this->*word_read)(*m_program, dwordaddr << 4);
else
dstword = 0;
dstmask = PIXEL_MASK << (16 - BITS_PER_PIXEL);
@@ -1468,7 +1468,7 @@ if ((daddr & (BITS_PER_PIXEL - 1)) != 0) osd_printf_debug("PIXBLT_R%d with odd d
/* fetch source pixel if necessary */
if (srcmask == 0)
{
- srcword = (this->*word_read)(*m_program, --swordaddr << 1);
+ srcword = (this->*word_read)(*m_program, --swordaddr << 4);
srcmask = PIXEL_MASK << (16 - BITS_PER_PIXEL);
}
@@ -1495,14 +1495,14 @@ if ((daddr & (BITS_PER_PIXEL - 1)) != 0) osd_printf_debug("PIXBLT_R%d with odd d
}
/* write the result */
- (this->*word_write)(*m_program, dwordaddr << 1, dstword);
+ (this->*word_write)(*m_program, dwordaddr << 4, dstword);
}
/* handle the left partial word */
if (left_partials != 0)
{
/* fetch the destination word */
- dstword = (this->*word_read)(*m_program, --dwordaddr << 1);
+ dstword = (this->*word_read)(*m_program, --dwordaddr << 4);
dstmask = PIXEL_MASK << (16 - BITS_PER_PIXEL);
/* loop over partials */
@@ -1511,7 +1511,7 @@ if ((daddr & (BITS_PER_PIXEL - 1)) != 0) osd_printf_debug("PIXBLT_R%d with odd d
/* fetch the source pixel if necessary */
if (srcmask == 0)
{
- srcword = (this->*word_read)(*m_program, --swordaddr << 1);
+ srcword = (this->*word_read)(*m_program, --swordaddr << 4);
srcmask = PIXEL_MASK << (16 - BITS_PER_PIXEL);
}
@@ -1538,7 +1538,7 @@ if ((daddr & (BITS_PER_PIXEL - 1)) != 0) osd_printf_debug("PIXBLT_R%d with odd d
}
/* write the result */
- (this->*word_write)(*m_program, dwordaddr << 1, dstword);
+ (this->*word_write)(*m_program, dwordaddr << 4, dstword);
}
/* update for next row */
@@ -1663,14 +1663,14 @@ void FUNCTION_NAME(tms340x0_device::pixblt_b)(int dst_is_linear)
dwordaddr = daddr >> 4;
/* fetch the initial source word */
- srcword = (this->*word_read)(*m_program, swordaddr++ << 1);
+ srcword = (this->*word_read)(*m_program, swordaddr++ << 4);
srcmask = 1 << (saddr & 15);
/* handle the left partial word */
if (left_partials != 0)
{
/* fetch the destination word */
- dstword = (this->*word_read)(*m_program, dwordaddr << 1);
+ dstword = (this->*word_read)(*m_program, dwordaddr << 4);
dstmask = PIXEL_MASK << (daddr & 15);
/* loop over partials */
@@ -1687,7 +1687,7 @@ void FUNCTION_NAME(tms340x0_device::pixblt_b)(int dst_is_linear)
srcmask <<= 1;
if (srcmask == 0)
{
- srcword = (this->*word_read)(*m_program, swordaddr++ << 1);
+ srcword = (this->*word_read)(*m_program, swordaddr++ << 4);
srcmask = 0x0001;
}
@@ -1696,7 +1696,7 @@ void FUNCTION_NAME(tms340x0_device::pixblt_b)(int dst_is_linear)
}
/* write the result */
- (this->*word_write)(*m_program, dwordaddr++ << 1, dstword);
+ (this->*word_write)(*m_program, dwordaddr++ << 4, dstword);
}
/* loop over full words */
@@ -1704,7 +1704,7 @@ void FUNCTION_NAME(tms340x0_device::pixblt_b)(int dst_is_linear)
{
/* fetch the destination word (if necessary) */
if (PIXEL_OP_REQUIRES_SOURCE || TRANSPARENCY)
- dstword = (this->*word_read)(*m_program, dwordaddr << 1);
+ dstword = (this->*word_read)(*m_program, dwordaddr << 4);
else
dstword = 0;
dstmask = PIXEL_MASK;
@@ -1723,7 +1723,7 @@ void FUNCTION_NAME(tms340x0_device::pixblt_b)(int dst_is_linear)
srcmask <<= 1;
if (srcmask == 0)
{
- srcword = (this->*word_read)(*m_program, swordaddr++ << 1);
+ srcword = (this->*word_read)(*m_program, swordaddr++ << 4);
srcmask = 0x0001;
}
@@ -1732,14 +1732,14 @@ void FUNCTION_NAME(tms340x0_device::pixblt_b)(int dst_is_linear)
}
/* write the result */
- (this->*word_write)(*m_program, dwordaddr++ << 1, dstword);
+ (this->*word_write)(*m_program, dwordaddr++ << 4, dstword);
}
/* handle the right partial word */
if (right_partials != 0)
{
/* fetch the destination word */
- dstword = (this->*word_read)(*m_program, dwordaddr << 1);
+ dstword = (this->*word_read)(*m_program, dwordaddr << 4);
dstmask = PIXEL_MASK;
/* loop over partials */
@@ -1756,7 +1756,7 @@ void FUNCTION_NAME(tms340x0_device::pixblt_b)(int dst_is_linear)
srcmask <<= 1;
if (srcmask == 0)
{
- srcword = (this->*word_read)(*m_program, swordaddr++ << 1);
+ srcword = (this->*word_read)(*m_program, swordaddr++ << 4);
srcmask = 0x0001;
}
@@ -1765,7 +1765,7 @@ void FUNCTION_NAME(tms340x0_device::pixblt_b)(int dst_is_linear)
}
/* write the result */
- (this->*word_write)(*m_program, dwordaddr++ << 1, dstword);
+ (this->*word_write)(*m_program, dwordaddr++ << 4, dstword);
}
/* update for next row */
@@ -1879,7 +1879,7 @@ void FUNCTION_NAME(tms340x0_device::fill)(int dst_is_linear)
if (left_partials != 0)
{
/* fetch the destination word */
- dstword = (this->*word_read)(*m_program, dwordaddr << 1);
+ dstword = (this->*word_read)(*m_program, dwordaddr << 4);
dstmask = PIXEL_MASK << (daddr & 15);
/* loop over partials */
@@ -1896,7 +1896,7 @@ void FUNCTION_NAME(tms340x0_device::fill)(int dst_is_linear)
}
/* write the result */
- (this->*word_write)(*m_program, dwordaddr++ << 1, dstword);
+ (this->*word_write)(*m_program, dwordaddr++ << 4, dstword);
}
/* loop over full words */
@@ -1904,7 +1904,7 @@ void FUNCTION_NAME(tms340x0_device::fill)(int dst_is_linear)
{
/* fetch the destination word (if necessary) */
if (PIXEL_OP_REQUIRES_SOURCE || TRANSPARENCY)
- dstword = (this->*word_read)(*m_program, dwordaddr << 1);
+ dstword = (this->*word_read)(*m_program, dwordaddr << 4);
else
dstword = 0;
dstmask = PIXEL_MASK;
@@ -1923,14 +1923,14 @@ void FUNCTION_NAME(tms340x0_device::fill)(int dst_is_linear)
}
/* write the result */
- (this->*word_write)(*m_program, dwordaddr++ << 1, dstword);
+ (this->*word_write)(*m_program, dwordaddr++ << 4, dstword);
}
/* handle the right partial word */
if (right_partials != 0)
{
/* fetch the destination word */
- dstword = (this->*word_read)(*m_program, dwordaddr << 1);
+ dstword = (this->*word_read)(*m_program, dwordaddr << 4);
dstmask = PIXEL_MASK;
/* loop over partials */
@@ -1947,7 +1947,7 @@ void FUNCTION_NAME(tms340x0_device::fill)(int dst_is_linear)
}
/* write the result */
- (this->*word_write)(*m_program, dwordaddr++ << 1, dstword);
+ (this->*word_write)(*m_program, dwordaddr++ << 4, dstword);
}
/* update for next row */
diff --git a/src/devices/cpu/tms34010/34010ops.h b/src/devices/cpu/tms34010/34010ops.h
index 901e9b56888..41481212804 100644
--- a/src/devices/cpu/tms34010/34010ops.h
+++ b/src/devices/cpu/tms34010/34010ops.h
@@ -26,7 +26,7 @@
inline uint32_t tms340x0_device::TMS34010_RDMEM_DWORD(offs_t A)
{
uint32_t result = m_program->read_word(A);
- return result | (m_program->read_word(A+2)<<16);
+ return result | (m_program->read_word(A+16)<<16);
}
#define TMS34010_WRMEM(A,V) (m_program->write_byte(A,V))
@@ -34,7 +34,7 @@ inline uint32_t tms340x0_device::TMS34010_RDMEM_DWORD(offs_t A)
inline void tms340x0_device::TMS34010_WRMEM_DWORD(offs_t A, uint32_t V)
{
m_program->write_word(A,V);
- m_program->write_word(A+2,V>>16);
+ m_program->write_word(A+16,V>>16);
}
@@ -52,36 +52,36 @@ inline void tms340x0_device::TMS34010_WRMEM_DWORD(offs_t A, uint32_t V)
***************************************************************************/
#define WFIELDMAC(MASK,MAX) \
- uint32_t shift = offset & 0x0f; \
- uint32_t masked_data = data & (MASK); \
- uint32_t old; \
+ uint32_t shift = offset & 0x0f; \
+ uint32_t masked_data = data & (MASK); \
+ uint32_t old; \
\
- offset = TOBYTE(offset & 0xfffffff0); \
+ offset = offset & 0xfffffff0; \
\
if (shift >= MAX) \
{ \
- old = (uint32_t)TMS34010_RDMEM_DWORD(offset) & ~((MASK) << shift); \
+ old = (uint32_t)TMS34010_RDMEM_DWORD(offset) & ~((MASK) << shift); \
TMS34010_WRMEM_DWORD(offset, (masked_data << shift) | old); \
} \
else \
{ \
- old = (uint32_t)TMS34010_RDMEM_WORD(offset) & ~((MASK) << shift); \
+ old = (uint32_t)TMS34010_RDMEM_WORD(offset) & ~((MASK) << shift); \
TMS34010_WRMEM_WORD(offset, ((masked_data & (MASK)) << shift) | old); \
}
#define WFIELDMAC_BIG(MASK,MAX) \
- uint32_t shift = offset & 0x0f; \
- uint32_t masked_data = data & (MASK); \
- uint32_t old; \
+ uint32_t shift = offset & 0x0f; \
+ uint32_t masked_data = data & (MASK); \
+ uint32_t old; \
\
- offset = TOBYTE(offset & 0xfffffff0); \
+ offset = offset & 0xfffffff0; \
\
- old = (uint32_t)TMS34010_RDMEM_DWORD(offset) & ~(uint32_t)((MASK) << shift); \
- TMS34010_WRMEM_DWORD(offset, (uint32_t)(masked_data << shift) | old); \
+ old = (uint32_t)TMS34010_RDMEM_DWORD(offset) & ~(uint32_t)((MASK) << shift); \
+ TMS34010_WRMEM_DWORD(offset, (uint32_t)(masked_data << shift) | old); \
if (shift >= MAX) \
{ \
shift = 32 - shift; \
- old = (uint32_t)TMS34010_RDMEM_WORD(offset + 4) & ~((MASK) >> shift); \
+ old = (uint32_t)TMS34010_RDMEM_WORD(offset + 0x20) & ~((MASK) >> shift); \
TMS34010_WRMEM_WORD(offset, (masked_data >> shift) | old); \
}
@@ -91,7 +91,7 @@ inline void tms340x0_device::TMS34010_WRMEM_DWORD(offs_t A, uint32_t V)
WFIELDMAC(0xff,9); \
} \
else \
- TMS34010_WRMEM(TOBYTE(offset), data);
+ TMS34010_WRMEM(offset, data);
#define RFIELDMAC_8() \
if (offset & 0x07) \
@@ -99,22 +99,22 @@ inline void tms340x0_device::TMS34010_WRMEM_DWORD(offs_t A, uint32_t V)
RFIELDMAC(0xff,9); \
} \
else \
- return TMS34010_RDMEM(TOBYTE(offset));
+ ret = TMS34010_RDMEM(offset);
#define WFIELDMAC_32() \
if (offset & 0x0f) \
{ \
- uint32_t shift = offset&0x0f; \
- uint32_t old; \
- uint32_t hiword; \
+ uint32_t shift = offset&0x0f; \
+ uint32_t old; \
+ uint32_t hiword; \
offset &= 0xfffffff0; \
- old = ((uint32_t) TMS34010_RDMEM_DWORD (TOBYTE(offset ))&(0xffffffff>>(0x20-shift))); \
- hiword = ((uint32_t) TMS34010_RDMEM_DWORD (TOBYTE(offset+0x20))&(0xffffffff<<shift)); \
- TMS34010_WRMEM_DWORD(TOBYTE(offset ),(data<< shift) |old); \
- TMS34010_WRMEM_DWORD(TOBYTE(offset+0x20),(data>>(0x20-shift))|hiword); \
+ old = ((uint32_t) TMS34010_RDMEM_DWORD (offset )&(0xffffffff>>(0x20-shift))); \
+ hiword = ((uint32_t) TMS34010_RDMEM_DWORD (offset+0x20)&(0xffffffff<<shift)); \
+ TMS34010_WRMEM_DWORD(offset ,(data<< shift) |old); \
+ TMS34010_WRMEM_DWORD(offset+0x20,(data>>(0x20-shift))|hiword); \
} \
else \
- TMS34010_WRMEM_DWORD(TOBYTE(offset),data);
+ TMS34010_WRMEM_DWORD(offset,data);
/***************************************************************************
@@ -122,33 +122,33 @@ inline void tms340x0_device::TMS34010_WRMEM_DWORD(offs_t A, uint32_t V)
***************************************************************************/
#define RFIELDMAC(MASK,MAX) \
- uint32_t shift = offset & 0x0f; \
- offset = TOBYTE(offset & 0xfffffff0); \
+ uint32_t shift = offset & 0x0f; \
+ offset = offset & 0xfffffff0; \
\
if (shift >= MAX) \
- ret = (TMS34010_RDMEM_DWORD(offset) >> shift) & (MASK); \
+ ret = (TMS34010_RDMEM_DWORD(offset) >> shift) & (MASK); \
else \
ret = (TMS34010_RDMEM_WORD(offset) >> shift) & (MASK);
#define RFIELDMAC_BIG(MASK,MAX) \
- uint32_t shift = offset & 0x0f; \
- offset = TOBYTE(offset & 0xfffffff0); \
+ uint32_t shift = offset & 0x0f; \
+ offset = offset & 0xfffffff0; \
\
- ret = (uint32_t)TMS34010_RDMEM_DWORD(offset) >> shift; \
+ ret = (uint32_t)TMS34010_RDMEM_DWORD(offset) >> shift; \
if (shift >= MAX) \
- ret |= (TMS34010_RDMEM_WORD(offset + 4) << (32 - shift)); \
+ ret |= (TMS34010_RDMEM_WORD(offset + 0x20) << (32 - shift)); \
ret &= MASK;
#define RFIELDMAC_32() \
if (offset&0x0f) \
{ \
- uint32_t shift = offset&0x0f; \
+ uint32_t shift = offset&0x0f; \
offset &= 0xfffffff0; \
- return (((uint32_t)TMS34010_RDMEM_DWORD (TOBYTE(offset ))>> shift) | \
- (TMS34010_RDMEM_DWORD (TOBYTE(offset+0x20))<<(0x20-shift)));\
+ return (((uint32_t)TMS34010_RDMEM_DWORD (offset )>> shift) | \
+ (TMS34010_RDMEM_DWORD (offset+0x20)<<(0x20-shift))); \
} \
else \
- return TMS34010_RDMEM_DWORD(TOBYTE(offset));
+ return TMS34010_RDMEM_DWORD(offset);
#endif // MAME_CPU_TMS34010_34010OPS_H
diff --git a/src/devices/cpu/tms34010/34010ops.hxx b/src/devices/cpu/tms34010/34010ops.hxx
index 57b5cca536e..85a1b932747 100644
--- a/src/devices/cpu/tms34010/34010ops.hxx
+++ b/src/devices/cpu/tms34010/34010ops.hxx
@@ -80,13 +80,13 @@ void tms340x0_device::unimpl(uint16_t op)
{
/* kludge for Super High Impact -- this doesn't seem to cause */
/* an illegal opcode exception */
- if (m_direct->read_word(TOBYTE(m_pc - 0x10)) == 0x0007)
+ if (m_direct->read_word(m_pc - 0x10) == 0x0007)
return;
/* 9 Ball Shootout calls to FFDF7468, expecting it */
/* to execute the next instruction from FFDF7470 */
/* but the instruction at FFDF7460 is an 0x0001 */
- if (m_direct->read_word(TOBYTE(m_pc - 0x10)) == 0x0001)
+ if (m_direct->read_word(m_pc - 0x10) == 0x0001)
return;
PUSH(m_pc);
@@ -96,7 +96,7 @@ void tms340x0_device::unimpl(uint16_t op)
COUNT_UNKNOWN_CYCLES(16);
/* extra check to prevent bad things */
- if (m_pc == 0 || s_opcode_table[m_direct->read_word(TOBYTE(m_pc)) >> 4] == &tms34010_device::unimpl)
+ if (m_pc == 0 || s_opcode_table[m_direct->read_word(m_pc) >> 4] == &tms34010_device::unimpl)
{
set_input_line(INPUT_LINE_HALT, ASSERT_LINE);
machine().debug_break();
@@ -2055,7 +2055,7 @@ void tms340x0_device::blmove(uint16_t op)
{
while (bits >= 16 && m_icount > 0)
{
- TMS34010_WRMEM_WORD(TOBYTE(dst), TMS34010_RDMEM_WORD(TOBYTE(src)));
+ TMS34010_WRMEM_WORD(dst, TMS34010_RDMEM_WORD(src));
src += 0x10;
dst += 0x10;
bits -= 0x10;
diff --git a/src/devices/cpu/tms34010/tms34010.cpp b/src/devices/cpu/tms34010/tms34010.cpp
index aecdca5debe..770777b03fb 100644
--- a/src/devices/cpu/tms34010/tms34010.cpp
+++ b/src/devices/cpu/tms34010/tms34010.cpp
@@ -180,34 +180,34 @@ inline void tms340x0_device::RESET_ST()
/* shortcuts for reading opcodes */
inline uint32_t tms340x0_device::ROPCODE()
{
- uint32_t pc = TOBYTE(m_pc);
+ uint32_t pc = m_pc;
m_pc += 2 << 3;
return m_direct->read_word(pc);
}
inline int16_t tms340x0_device::PARAM_WORD()
{
- uint32_t pc = TOBYTE(m_pc);
+ uint32_t pc = m_pc;
m_pc += 2 << 3;
return m_direct->read_word(pc);
}
inline int32_t tms340x0_device::PARAM_LONG()
{
- uint32_t pc = TOBYTE(m_pc);
+ uint32_t pc = m_pc;
m_pc += 4 << 3;
- return (uint16_t)m_direct->read_word(pc) | (m_direct->read_word(pc + 2) << 16);
+ return (uint16_t)m_direct->read_word(pc) | (m_direct->read_word(pc + 16) << 16);
}
inline int16_t tms340x0_device::PARAM_WORD_NO_INC()
{
- return m_direct->read_word(TOBYTE(m_pc));
+ return m_direct->read_word(m_pc);
}
inline int32_t tms340x0_device::PARAM_LONG_NO_INC()
{
- uint32_t pc = TOBYTE(m_pc);
- return (uint16_t)m_direct->read_word(pc) | (m_direct->read_word(pc + 2) << 16);
+ uint32_t pc = m_pc;
+ return (uint16_t)m_direct->read_word(pc) | (m_direct->read_word(pc + 16) << 16);
}
/* read memory byte */
@@ -258,7 +258,7 @@ inline int32_t tms340x0_device::POP()
#define RP(m1,m2) \
/* TODO: Plane masking */ \
- return (TMS34010_RDMEM_WORD(TOBYTE(offset & 0xfffffff0)) >> (offset & m1)) & m2;
+ return (TMS34010_RDMEM_WORD(offset & 0xfffffff0) >> (offset & m1)) & m2;
uint32_t tms340x0_device::read_pixel_1(offs_t offset) { RP(0x0f,0x01) }
uint32_t tms340x0_device::read_pixel_2(offs_t offset) { RP(0x0e,0x03) }
@@ -267,12 +267,12 @@ uint32_t tms340x0_device::read_pixel_8(offs_t offset) { RP(0x08,0xff) }
uint32_t tms340x0_device::read_pixel_16(offs_t offset)
{
/* TODO: Plane masking */
- return TMS34010_RDMEM_WORD(TOBYTE(offset & 0xfffffff0));
+ return TMS34010_RDMEM_WORD(offset & 0xfffffff0);
}
uint32_t tms340x0_device::read_pixel_32(offs_t offset)
{
/* TODO: Plane masking */
- return TMS34010_RDMEM_DWORD(TOBYTE(offset & 0xffffffe0));
+ return TMS34010_RDMEM_DWORD(offset & 0xffffffe0);
}
/* Shift register read */
@@ -293,9 +293,9 @@ uint32_t tms340x0_device::read_pixel_shiftreg(offs_t offset)
/* No Raster Op + No Transparency */
#define WP(m1,m2) \
- uint32_t a = TOBYTE(offset & 0xfffffff0); \
- uint32_t pix = TMS34010_RDMEM_WORD(a); \
- uint32_t shiftcount = offset & m1; \
+ uint32_t a = offset & 0xfffffff0; \
+ uint32_t pix = TMS34010_RDMEM_WORD(a); \
+ uint32_t shiftcount = offset & m1; \
\
/* TODO: plane masking */ \
data &= m2; \
@@ -308,9 +308,9 @@ uint32_t tms340x0_device::read_pixel_shiftreg(offs_t offset)
data &= m2; \
if (data) \
{ \
- uint32_t a = TOBYTE(offset & 0xfffffff0); \
- uint32_t pix = TMS34010_RDMEM_WORD(a); \
- uint32_t shiftcount = offset & m1; \
+ uint32_t a = offset & 0xfffffff0; \
+ uint32_t pix = TMS34010_RDMEM_WORD(a); \
+ uint32_t shiftcount = offset & m1; \
\
/* TODO: plane masking */ \
pix = (pix & ~(m2 << shiftcount)) | (data << shiftcount); \
@@ -318,9 +318,9 @@ uint32_t tms340x0_device::read_pixel_shiftreg(offs_t offset)
}
/* Raster Op + No Transparency */
#define WP_R(m1,m2) \
- uint32_t a = TOBYTE(offset & 0xfffffff0); \
- uint32_t pix = TMS34010_RDMEM_WORD(a); \
- uint32_t shiftcount = offset & m1; \
+ uint32_t a = offset & 0xfffffff0; \
+ uint32_t pix = TMS34010_RDMEM_WORD(a); \
+ uint32_t shiftcount = offset & m1; \
\
/* TODO: plane masking */ \
data = (this->*m_raster_op)(data & m2, (pix >> shiftcount) & m2) & m2; \
@@ -329,9 +329,9 @@ uint32_t tms340x0_device::read_pixel_shiftreg(offs_t offset)
/* Raster Op + Transparency */
#define WP_R_T(m1,m2) \
- uint32_t a = TOBYTE(offset & 0xfffffff0); \
- uint32_t pix = TMS34010_RDMEM_WORD(a); \
- uint32_t shiftcount = offset & m1; \
+ uint32_t a = offset & 0xfffffff0; \
+ uint32_t pix = TMS34010_RDMEM_WORD(a); \
+ uint32_t shiftcount = offset & m1; \
\
/* TODO: plane masking */ \
data = (this->*m_raster_op)(data & m2, (pix >> shiftcount) & m2) & m2; \
@@ -349,12 +349,12 @@ void tms340x0_device::write_pixel_8(offs_t offset, uint32_t data) { WP(0x08, 0xf
void tms340x0_device::write_pixel_16(offs_t offset, uint32_t data)
{
/* TODO: plane masking */
- TMS34010_WRMEM_WORD(TOBYTE(offset & 0xfffffff0), data);
+ TMS34010_WRMEM_WORD(offset & 0xfffffff0, data);
}
void tms340x0_device::write_pixel_32(offs_t offset, uint32_t data)
{
/* TODO: plane masking */
- TMS34010_WRMEM_WORD(TOBYTE(offset & 0xffffffe0), data);
+ TMS34010_WRMEM_WORD(offset & 0xffffffe0, data);
}
/* No Raster Op + Transparency */
@@ -366,13 +366,13 @@ void tms340x0_device::write_pixel_t_16(offs_t offset, uint32_t data)
{
/* TODO: plane masking */
if (data)
- TMS34010_WRMEM_WORD(TOBYTE(offset & 0xfffffff0), data);
+ TMS34010_WRMEM_WORD(offset & 0xfffffff0, data);
}
void tms340x0_device::write_pixel_t_32(offs_t offset, uint32_t data)
{
/* TODO: plane masking */
if (data)
- TMS34010_WRMEM_DWORD(TOBYTE(offset & 0xffffffe0), data);
+ TMS34010_WRMEM_DWORD(offset & 0xffffffe0, data);
}
/* Raster Op + No Transparency */
@@ -383,13 +383,13 @@ void tms340x0_device::write_pixel_r_8(offs_t offset, uint32_t data) { WP_R(0x08,
void tms340x0_device::write_pixel_r_16(offs_t offset, uint32_t data)
{
/* TODO: plane masking */
- uint32_t a = TOBYTE(offset & 0xfffffff0);
+ uint32_t a = offset & 0xfffffff0;
TMS34010_WRMEM_WORD(a, (this->*m_raster_op)(data, TMS34010_RDMEM_WORD(a)));
}
void tms340x0_device::write_pixel_r_32(offs_t offset, uint32_t data)
{
/* TODO: plane masking */
- uint32_t a = TOBYTE(offset & 0xffffffe0);
+ uint32_t a = offset & 0xffffffe0;
TMS34010_WRMEM_DWORD(a, (this->*m_raster_op)(data, TMS34010_RDMEM_DWORD(a)));
}
@@ -401,7 +401,7 @@ void tms340x0_device::write_pixel_r_t_8(offs_t offset, uint32_t data) { WP_R_T(0
void tms340x0_device::write_pixel_r_t_16(offs_t offset, uint32_t data)
{
/* TODO: plane masking */
- uint32_t a = TOBYTE(offset & 0xfffffff0);
+ uint32_t a = offset & 0xfffffff0;
data = (this->*m_raster_op)(data, TMS34010_RDMEM_WORD(a));
if (data)
@@ -410,7 +410,7 @@ void tms340x0_device::write_pixel_r_t_16(offs_t offset, uint32_t data)
void tms340x0_device::write_pixel_r_t_32(offs_t offset, uint32_t data)
{
/* TODO: plane masking */
- uint32_t a = TOBYTE(offset & 0xffffffe0);
+ uint32_t a = offset & 0xffffffe0;
data = (this->*m_raster_op)(data, TMS34010_RDMEM_DWORD(a));
if (data)
@@ -588,7 +588,7 @@ void tms340x0_device::device_start()
m_external_host_access = false;
m_program = &space(AS_PROGRAM);
- m_direct = &m_program->direct();
+ m_direct = m_program->direct<03>();
/* set up the state table */
{
@@ -1512,7 +1512,7 @@ WRITE16_MEMBER( tms340x0_device::host_w )
/* write to the address */
addr = (IOREG(REG_HSTADRH) << 16) | IOREG(REG_HSTADRL);
- TMS34010_WRMEM_WORD(TOBYTE(addr & 0xfffffff0), data);
+ TMS34010_WRMEM_WORD(addr & 0xfffffff0, data);
/* optional postincrement */
if (IOREG(REG_HSTCTLH) & 0x0800)
@@ -1571,7 +1571,7 @@ READ16_MEMBER( tms340x0_device::host_r )
/* read from the address */
addr = (IOREG(REG_HSTADRH) << 16) | IOREG(REG_HSTADRL);
- result = TMS34010_RDMEM_WORD(TOBYTE(addr & 0xfffffff0));
+ result = TMS34010_RDMEM_WORD(addr & 0xfffffff0);
/* optional postincrement (it says preincrement, but data is preloaded, so it
is effectively a postincrement */
diff --git a/src/devices/cpu/tms34010/tms34010.h b/src/devices/cpu/tms34010/tms34010.h
index 40aeedb9fd4..0f9c3a27a57 100644
--- a/src/devices/cpu/tms34010/tms34010.h
+++ b/src/devices/cpu/tms34010/tms34010.h
@@ -323,7 +323,7 @@ protected:
uint8_t m_external_host_access;
uint8_t m_executing;
address_space *m_program;
- direct_read_data *m_direct;
+ direct_read_data<3> *m_direct;
uint32_t m_pixclock; /* the pixel clock (0 means don't adjust screen size) */
int m_pixperclock; /* pixels per clock */
emu_timer *m_scantimer;
@@ -1051,8 +1051,4 @@ DECLARE_DEVICE_TYPE(TMS34020, tms34020_device)
#define TMS34010_HOST_DATA 2
#define TMS34010_HOST_CONTROL 3
-/* Use this macro in the memory definitions to specify bit-based addresses */
-#define TOBYTE(bitaddr) ((offs_t)(bitaddr) >> 3)
-#define TOWORD(bitaddr) ((offs_t)(bitaddr) >> 4)
-
#endif // MAME_CPU_TMS34010_TMS34010_H
diff --git a/src/devices/cpu/tms57002/tms57002.cpp b/src/devices/cpu/tms57002/tms57002.cpp
index 0d4aea34c14..f98e0497acf 100644
--- a/src/devices/cpu/tms57002/tms57002.cpp
+++ b/src/devices/cpu/tms57002/tms57002.cpp
@@ -108,7 +108,7 @@ WRITE8_MEMBER(tms57002_device::data_w)
sti = (sti & ~SU_MASK) | SU_PRG;
break;
case SU_PRG:
- program->write_dword(pc++ << 2, val);
+ program->write_dword(pc++, val);
break;
}
}
@@ -689,7 +689,7 @@ int tms57002_device::decode_get_pc()
for(;;) {
short ipc;
- uint32_t opcode = program->read_dword(adr << 2);
+ uint32_t opcode = program->read_dword(adr);
cs.inc = 0;
diff --git a/src/devices/cpu/tms7000/tms7000.cpp b/src/devices/cpu/tms7000/tms7000.cpp
index c9cb89debd8..25265218735 100644
--- a/src/devices/cpu/tms7000/tms7000.cpp
+++ b/src/devices/cpu/tms7000/tms7000.cpp
@@ -188,7 +188,7 @@ void tms7000_device::device_start()
{
// init/zerofill
m_program = &space(AS_PROGRAM);
- m_direct = &m_program->direct();
+ m_direct = m_program->direct<0>();
m_icountptr = &m_icount;
diff --git a/src/devices/cpu/tms7000/tms7000.h b/src/devices/cpu/tms7000/tms7000.h
index c79007df9d3..bd941fbf9ca 100644
--- a/src/devices/cpu/tms7000/tms7000.h
+++ b/src/devices/cpu/tms7000/tms7000.h
@@ -120,7 +120,7 @@ protected:
uint32_t m_info_flags;
address_space *m_program;
- direct_read_data *m_direct;
+ direct_read_data<0> *m_direct;
int m_icount;
bool m_irq_state[2];
diff --git a/src/devices/cpu/unsp/unsp.cpp b/src/devices/cpu/unsp/unsp.cpp
index c9e346cf981..8ee2111af65 100644
--- a/src/devices/cpu/unsp/unsp.cpp
+++ b/src/devices/cpu/unsp/unsp.cpp
@@ -116,12 +116,12 @@ void unsp_device::unimplemented_opcode(uint16_t op)
uint16_t unsp_device::READ16(uint32_t address)
{
- return m_program->read_word(address<<1);
+ return m_program->read_word(address);
}
void unsp_device::WRITE16(uint32_t address, uint16_t data)
{
- m_program->write_word(address<<1, data);
+ m_program->write_word(address, data);
}
/*****************************************************************************/
diff --git a/src/devices/cpu/unsp/unspdasm.cpp b/src/devices/cpu/unsp/unspdasm.cpp
index b4a731f5fcf..bdea7a729a5 100644
--- a/src/devices/cpu/unsp/unspdasm.cpp
+++ b/src/devices/cpu/unsp/unspdasm.cpp
@@ -55,8 +55,6 @@ offs_t unsp_disassembler::disassemble(std::ostream &stream, offs_t pc, const dat
{
uint16_t op = opcodes.r16(pc);
uint16_t imm16 = opcodes.r16(pc+1);
- op = big_endianize_int16(op);
- imm16 = big_endianize_int16(imm16);
if(OP0 < 0xf && OPA == 0x7 && OP1 < 2)
{
diff --git a/src/devices/cpu/upd7725/upd7725.cpp b/src/devices/cpu/upd7725/upd7725.cpp
index b509c302aa0..716fa45ccf9 100644
--- a/src/devices/cpu/upd7725/upd7725.cpp
+++ b/src/devices/cpu/upd7725/upd7725.cpp
@@ -68,7 +68,7 @@ void necdsp_device::device_start()
// get our address spaces
m_program = &space(AS_PROGRAM);
m_data = &space(AS_DATA);
- m_direct = &m_program->direct();
+ m_direct = m_program->direct<-2>();
// register our state for the debugger
state_add(STATE_GENPC, "GENPC", regs.pc).noshow();
@@ -340,7 +340,7 @@ void necdsp_device::execute_run()
if (m_irq_firing == 0) // normal opcode
{
- opcode = m_direct->read_dword(regs.pc<<2)>>8;
+ opcode = m_direct->read_dword(regs.pc) >> 8;
regs.pc++;
}
else if (m_irq_firing == 1) // if we're in an interrupt cycle, execute a op 'nop' first...
@@ -392,7 +392,7 @@ void necdsp_device::exec_op(uint32_t opcode) {
case 3: regs.idb = regs.tr; break;
case 4: regs.idb = regs.dp; break;
case 5: regs.idb = regs.rp; break;
- case 6: regs.idb = m_data->read_word(regs.rp<<1); break;
+ case 6: regs.idb = m_data->read_word(regs.rp); break;
case 7: regs.idb = 0x8000 - regs.flaga.s1; break; //SGN
case 8: regs.idb = regs.dr; regs.sr.rqm = 1; break;
case 9: regs.idb = regs.dr; break;
@@ -589,7 +589,7 @@ void necdsp_device::exec_ld(uint32_t opcode) {
case 8: regs.so = BITSWAP16(id, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15); break; //LSB first output, output tapped at bit 15 shifting left
case 9: regs.so = id; break; //MSB first output, output tapped at bit 15 shifting left
case 10: regs.k = id; break;
- case 11: regs.k = id; regs.l = m_data->read_word(regs.rp<<1); break;
+ case 11: regs.k = id; regs.l = m_data->read_word(regs.rp); break;
case 12: regs.l = id; regs.k = dataRAM[regs.dp | 0x40]; break;
case 13: regs.l = id; break;
case 14: regs.trb = id; break;
diff --git a/src/devices/cpu/upd7725/upd7725.h b/src/devices/cpu/upd7725/upd7725.h
index 63f7b888ef8..c52959124a1 100644
--- a/src/devices/cpu/upd7725/upd7725.h
+++ b/src/devices/cpu/upd7725/upd7725.h
@@ -189,7 +189,7 @@ private:
// 2 = next opcode is the second half of int firing 'CALL 0100'
int m_irq_firing;
address_space *m_program, *m_data;
- direct_read_data *m_direct;
+ direct_read_data<-2> *m_direct;
protected:
// device callbacks
diff --git a/src/devices/cpu/upd7810/upd7810.cpp b/src/devices/cpu/upd7810/upd7810.cpp
index 3c23ebb5ebb..4871aaebcbd 100644
--- a/src/devices/cpu/upd7810/upd7810.cpp
+++ b/src/devices/cpu/upd7810/upd7810.cpp
@@ -1568,7 +1568,7 @@ void upd78c05_device::handle_timers(int cycles)
void upd7810_device::base_device_start()
{
m_program = &space(AS_PROGRAM);
- m_direct = &m_program->direct();
+ m_direct = m_program->direct<0>();
m_to_func.resolve_safe();
m_co0_func.resolve_safe();
diff --git a/src/devices/cpu/upd7810/upd7810.h b/src/devices/cpu/upd7810/upd7810.h
index f446cf6bc43..427a4d2d52b 100644
--- a/src/devices/cpu/upd7810/upd7810.h
+++ b/src/devices/cpu/upd7810/upd7810.h
@@ -411,7 +411,7 @@ protected:
const struct opcode_s *m_op70;
const struct opcode_s *m_op74;
address_space *m_program;
- direct_read_data *m_direct;
+ direct_read_data<0> *m_direct;
int m_icount;
uint8_t RP(offs_t port);
diff --git a/src/devices/cpu/v30mz/v30mz.cpp b/src/devices/cpu/v30mz/v30mz.cpp
index 3b62098bf5c..de393ea5f9f 100644
--- a/src/devices/cpu/v30mz/v30mz.cpp
+++ b/src/devices/cpu/v30mz/v30mz.cpp
@@ -147,7 +147,7 @@ device_memory_interface::space_config_vector v30mz_cpu_device::memory_space_conf
void v30mz_cpu_device::device_start()
{
m_program = &space(AS_PROGRAM);
- m_direct = &m_program->direct();
+ m_direct = m_program->direct<0>();
m_io = &space(AS_IO);
save_item(NAME(m_regs.w));
diff --git a/src/devices/cpu/v30mz/v30mz.h b/src/devices/cpu/v30mz/v30mz.h
index d19d29fa6fd..7afee5907b0 100644
--- a/src/devices/cpu/v30mz/v30mz.h
+++ b/src/devices/cpu/v30mz/v30mz.h
@@ -187,7 +187,7 @@ protected:
uint8_t m_fire_trap;
address_space *m_program;
- direct_read_data *m_direct;
+ direct_read_data<0> *m_direct;
address_space *m_io;
int m_icount;
diff --git a/src/devices/cpu/v60/v60.cpp b/src/devices/cpu/v60/v60.cpp
index 33184a0c776..7891f5daa25 100644
--- a/src/devices/cpu/v60/v60.cpp
+++ b/src/devices/cpu/v60/v60.cpp
@@ -421,7 +421,7 @@ void v60_device::device_start()
m_moddim = 0;
m_program = &space(AS_PROGRAM);
- m_direct = &m_program->direct();
+ m_direct = m_program->direct<0>();
m_io = &space(AS_IO);
save_item(NAME(m_fetch_xor));
diff --git a/src/devices/cpu/v60/v60.h b/src/devices/cpu/v60/v60.h
index b0d51f9e867..727972d7d99 100644
--- a/src/devices/cpu/v60/v60.h
+++ b/src/devices/cpu/v60/v60.h
@@ -162,7 +162,7 @@ private:
uint8_t m_irq_line;
uint8_t m_nmi_line;
address_space *m_program;
- direct_read_data * m_direct;
+ direct_read_data<0> *m_direct;
address_space *m_io;
uint32_t m_PPC;
int m_icount;
diff --git a/src/devices/cpu/v810/v810.cpp b/src/devices/cpu/v810/v810.cpp
index 7b12378961f..a7662cb251d 100644
--- a/src/devices/cpu/v810/v810.cpp
+++ b/src/devices/cpu/v810/v810.cpp
@@ -1256,7 +1256,7 @@ const v810_device::opcode_func v810_device::s_OpCodeTable[64] =
void v810_device::device_start()
{
m_program = &space(AS_PROGRAM);
- m_direct = &m_program->direct();
+ m_direct = m_program->direct<0>();
m_io = &space(AS_IO);
m_irq_line = 0;
diff --git a/src/devices/cpu/v810/v810.h b/src/devices/cpu/v810/v810.h
index 2794c629a16..ad2e91a6617 100644
--- a/src/devices/cpu/v810/v810.h
+++ b/src/devices/cpu/v810/v810.h
@@ -118,7 +118,7 @@ private:
uint8_t m_irq_state;
uint8_t m_nmi_line;
address_space *m_program;
- direct_read_data *m_direct;
+ direct_read_data<0> *m_direct;
address_space *m_io;
uint32_t m_PPC;
int m_icount;
diff --git a/src/devices/cpu/z180/z180.cpp b/src/devices/cpu/z180/z180.cpp
index 41c73e6e09c..ba25e51152e 100644
--- a/src/devices/cpu/z180/z180.cpp
+++ b/src/devices/cpu/z180/z180.cpp
@@ -2016,9 +2016,9 @@ void z180_device::device_start()
}
m_program = &space(AS_PROGRAM);
- m_direct = &m_program->direct();
+ m_direct = m_program->direct<0>();
m_oprogram = has_space(AS_OPCODES) ? &space(AS_OPCODES) : m_program;
- m_odirect = &m_oprogram->direct();
+ m_odirect = m_oprogram->direct<0>();
m_iospace = &space(AS_IO);
/* set up the state table */
diff --git a/src/devices/cpu/z180/z180.h b/src/devices/cpu/z180/z180.h
index 2b753b17419..57ee654efa8 100644
--- a/src/devices/cpu/z180/z180.h
+++ b/src/devices/cpu/z180/z180.h
@@ -186,9 +186,9 @@ private:
uint8_t m_dma0_cnt; /* dma0 counter / divide by 20 */
uint8_t m_dma1_cnt; /* dma1 counter / divide by 20 */
address_space *m_program;
- direct_read_data *m_direct;
+ direct_read_data<0> *m_direct;
address_space *m_oprogram;
- direct_read_data *m_odirect;
+ direct_read_data<0> *m_odirect;
address_space *m_iospace;
uint8_t m_rtemp;
uint32_t m_ioltemp;
diff --git a/src/devices/cpu/z8/z8.cpp b/src/devices/cpu/z8/z8.cpp
index 8a81643a4e2..1f21ebbab49 100644
--- a/src/devices/cpu/z8/z8.cpp
+++ b/src/devices/cpu/z8/z8.cpp
@@ -778,7 +778,7 @@ void z8_device::device_start()
/* find address spaces */
m_program = &space(AS_PROGRAM);
- m_direct = &m_program->direct();
+ m_direct = m_program->direct<0>();
m_data = has_space(AS_DATA) ? &space(AS_DATA) : m_program;
/* allocate timers */
diff --git a/src/devices/cpu/z8/z8.h b/src/devices/cpu/z8/z8.h
index c5aad5f4e6f..1f6f8a7c890 100644
--- a/src/devices/cpu/z8/z8.h
+++ b/src/devices/cpu/z8/z8.h
@@ -101,7 +101,7 @@ private:
address_space_config m_data_config;
address_space *m_program;
- direct_read_data *m_direct;
+ direct_read_data<0> *m_direct;
address_space *m_data;
// callbacks
diff --git a/src/devices/cpu/z80/z80.cpp b/src/devices/cpu/z80/z80.cpp
index 64f6cebfd11..3b2fcd99761 100644
--- a/src/devices/cpu/z80/z80.cpp
+++ b/src/devices/cpu/z80/z80.cpp
@@ -3407,8 +3407,8 @@ void z80_device::device_start()
m_program = &space(AS_PROGRAM);
m_decrypted_opcodes = has_space(AS_OPCODES) ? &space(AS_OPCODES) : m_program;
- m_direct = &m_program->direct();
- m_decrypted_opcodes_direct = &m_decrypted_opcodes->direct();
+ m_direct = m_program->direct<0>();
+ m_decrypted_opcodes_direct = m_decrypted_opcodes->direct<0>();
m_io = &space(AS_IO);
IX = IY = 0xffff; /* IX and IY are FFFF after a reset! */
diff --git a/src/devices/cpu/z80/z80.h b/src/devices/cpu/z80/z80.h
index 2ad3f865d7e..732e425fd86 100644
--- a/src/devices/cpu/z80/z80.h
+++ b/src/devices/cpu/z80/z80.h
@@ -244,8 +244,8 @@ protected:
address_space *m_program;
address_space *m_decrypted_opcodes;
address_space *m_io;
- direct_read_data *m_direct;
- direct_read_data *m_decrypted_opcodes_direct;
+ direct_read_data<0> *m_direct;
+ direct_read_data<0> *m_decrypted_opcodes_direct;
devcb_write_line m_irqack_cb;
devcb_write16 m_refresh_cb;
devcb_write_line m_halt_cb;
diff --git a/src/devices/cpu/z8000/z8000.cpp b/src/devices/cpu/z8000/z8000.cpp
index 251dbfa9a99..ce2751723a8 100644
--- a/src/devices/cpu/z8000/z8000.cpp
+++ b/src/devices/cpu/z8000/z8000.cpp
@@ -663,7 +663,7 @@ void z8001_device::device_start()
m_data = &space(AS_DATA);
else
m_data = &space(AS_PROGRAM);
- m_direct = &m_program->direct();
+ m_direct = m_program->direct<0>();
m_io = &space(AS_IO);
init_tables();
@@ -686,7 +686,7 @@ void z8002_device::device_start()
m_data = &space(AS_DATA);
else
m_data = &space(AS_PROGRAM);
- m_direct = &m_program->direct();
+ m_direct = m_program->direct<0>();
m_io = &space(AS_IO);
init_tables();
diff --git a/src/devices/cpu/z8000/z8000.h b/src/devices/cpu/z8000/z8000.h
index 4f46eaf76e6..4e3f69e5858 100644
--- a/src/devices/cpu/z8000/z8000.h
+++ b/src/devices/cpu/z8000/z8000.h
@@ -96,7 +96,7 @@ protected:
int m_mi;
address_space *m_program;
address_space *m_data;
- direct_read_data *m_direct;
+ direct_read_data<0> *m_direct;
address_space *m_io;
int m_icount;
int m_vector_mult;
diff --git a/src/devices/machine/68307.cpp b/src/devices/machine/68307.cpp
index 0e15dfdd167..adc65ce199b 100644
--- a/src/devices/machine/68307.cpp
+++ b/src/devices/machine/68307.cpp
@@ -158,7 +158,7 @@ void m68307_cpu_device::write_dword_m68307(offs_t address, uint32_t data)
void m68307_cpu_device::init16_m68307(address_space &space)
{
m_space = &space;
- m_direct = &space.direct();
+ m_direct = space.direct<0>();
opcode_xor = 0;
readimm16 = m68k_readimm16_delegate(&m68307_cpu_device::simple_read_immediate_16_m68307, this);
diff --git a/src/devices/video/hd63484.cpp b/src/devices/video/hd63484.cpp
index 854222d1efe..0b383bd927b 100644
--- a/src/devices/video/hd63484.cpp
+++ b/src/devices/video/hd63484.cpp
@@ -367,7 +367,7 @@ const tiny_rom_entry *hd63484_device::device_rom_region() const
inline uint16_t hd63484_device::readword(offs_t address)
{
- return space().read_word(address << 1);
+ return space().read_word(address);
}
@@ -377,7 +377,7 @@ inline uint16_t hd63484_device::readword(offs_t address)
inline void hd63484_device::writeword(offs_t address, uint16_t data)
{
- space().write_word(address << 1, data);
+ space().write_word(address, data);
}
diff --git a/src/emu/addrmap.cpp b/src/emu/addrmap.cpp
index 0d8d7bc4eef..63f093cebb6 100644
--- a/src/emu/addrmap.cpp
+++ b/src/emu/addrmap.cpp
@@ -41,11 +41,7 @@ address_map_entry::address_map_entry(device_t &device, address_map &map, offs_t
m_region(nullptr),
m_rgnoffs(0),
m_submap_bits(0),
- m_memory(nullptr),
- m_bytestart(0),
- m_byteend(0),
- m_bytemirror(0),
- m_bytemask(0)
+ m_memory(nullptr)
{
}
@@ -56,6 +52,7 @@ address_map_entry::address_map_entry(device_t &device, address_map &map, offs_t
address_map_entry &address_map_entry::mask(offs_t _mask)
{
+ printf("mask %x\n", _mask);
m_addrmask = _mask;
if (m_map.m_globalmask != 0)
m_addrmask &= m_map.m_globalmask;
@@ -404,7 +401,7 @@ address_map::address_map(const address_space &space, offs_t start, offs_t end, i
m_device(&device),
m_databits(space.data_width()),
m_unmapval(space.unmap()),
- m_globalmask(space.bytemask())
+ m_globalmask(space.addrmask())
{
range(start, end).set_submap(DEVICE_SELF, submap_delegate, bits, unitmask);
}
@@ -610,7 +607,7 @@ void address_map::map_validity_check(validity_checker &valid, int spacenum) cons
// it's safe to assume here that the device has a memory interface and a config for this space
const address_space_config &spaceconfig = *m_device->memory().space_config(spacenum);
int datawidth = spaceconfig.m_databus_width;
- int alignunit = datawidth / 8;
+ int alignunit = spaceconfig.alignment();
bool detected_overlap = DETECT_OVERLAPPING_MEMORY ? false : true;
@@ -631,9 +628,6 @@ void address_map::map_validity_check(validity_checker &valid, int spacenum) cons
// loop over entries and look for errors
for (address_map_entry &entry : m_entrylist)
{
- u32 bytestart = spaceconfig.addr2byte(entry.m_addrstart);
- u32 byteend = spaceconfig.addr2byte_end(entry.m_addrend);
-
// look for overlapping entries
if (!detected_overlap)
{
@@ -653,7 +647,7 @@ void address_map::map_validity_check(validity_checker &valid, int spacenum) cons
}
// look for inverted start/end pairs
- if (byteend < bytestart)
+ if (entry.m_addrend < entry.m_addrstart)
osd_printf_error("Wrong %s memory read handler start = %08x > end = %08x\n", spaceconfig.m_name, entry.m_addrstart, entry.m_addrend);
// look for ranges outside the global mask
@@ -663,7 +657,7 @@ void address_map::map_validity_check(validity_checker &valid, int spacenum) cons
osd_printf_error("In %s memory range %x-%x, end address is outside of the global address mask %x\n", spaceconfig.m_name, entry.m_addrstart, entry.m_addrend, globalmask);
// look for misaligned entries
- if ((bytestart & (alignunit - 1)) != 0 || (byteend & (alignunit - 1)) != (alignunit - 1))
+ if ((entry.m_addrstart & (alignunit - 1)) != 0 || (entry.m_addrend & (alignunit - 1)) != (alignunit - 1))
osd_printf_error("Wrong %s memory read handler start = %08x, end = %08x ALIGN = %d\n", spaceconfig.m_name, entry.m_addrstart, entry.m_addrend, alignunit);
// verify mask/mirror/select
@@ -715,7 +709,7 @@ void address_map::map_validity_check(validity_checker &valid, int spacenum) cons
{
// verify the address range is within the region's bounds
offs_t const length = region.get_length();
- if (entry.m_rgnoffs + (byteend - bytestart + 1) > length)
+ if (entry.m_rgnoffs + spaceconfig.addr2byte(entry.m_addrend - entry.m_addrstart + 1) > length)
osd_printf_error("%s space memory map entry %X-%X extends beyond region '%s' size (%X)\n", spaceconfig.m_name, entry.m_addrstart, entry.m_addrend, entry.m_region, length);
found = true;
}
diff --git a/src/emu/addrmap.h b/src/emu/addrmap.h
index c56c9257d47..587f9a16e33 100644
--- a/src/emu/addrmap.h
+++ b/src/emu/addrmap.h
@@ -154,10 +154,6 @@ public:
// information used during processing
void * m_memory; // pointer to memory backing this entry
- offs_t m_bytestart; // byte-adjusted start address
- offs_t m_byteend; // byte-adjusted end address
- offs_t m_bytemirror; // byte-adjusted mirror bits
- offs_t m_bytemask; // byte-adjusted mask bits
// handler setters for 8-bit functions
address_map_entry &set_handler(read8_delegate func, u64 mask = 0);
diff --git a/src/emu/debug/debugbuf.cpp b/src/emu/debug/debugbuf.cpp
index e181c859a51..779b91f84ac 100644
--- a/src/emu/debug/debugbuf.cpp
+++ b/src/emu/debug/debugbuf.cpp
@@ -209,7 +209,7 @@ void debug_disasm_buffer::debug_data_buffer::setup_methods()
for(offs_t lpc = lstart; lpc != lend; lpc = (lpc + 1) & m_pc_mask) {
offs_t tpc = m_intf->pc_linear_to_real(lpc);
if (m_space->device().memory().translate(m_space->spacenum(), TRANSLATE_FETCH_DEBUG, tpc))
- *dest++ = m_space->read_word(tpc << 1);
+ *dest++ = m_space->read_word(tpc);
else
*dest++ = 0;
}
@@ -241,7 +241,7 @@ void debug_disasm_buffer::debug_data_buffer::setup_methods()
for(offs_t lpc = lstart; lpc != lend; lpc = (lpc + 1) & m_pc_mask) {
offs_t tpc = lpc;
if (m_space->device().memory().translate(m_space->spacenum(), TRANSLATE_FETCH_DEBUG, tpc))
- *dest++ = m_space->read_qword(tpc << 3);
+ *dest++ = m_space->read_qword(tpc);
else
*dest++ = 0;
}
@@ -255,7 +255,7 @@ void debug_disasm_buffer::debug_data_buffer::setup_methods()
for(offs_t lpc = lstart; lpc != lend; lpc = (lpc + 1) & m_pc_mask) {
offs_t tpc = lpc;
if (m_space->device().memory().translate(m_space->spacenum(), TRANSLATE_FETCH_DEBUG, tpc))
- *dest++ = m_space->read_dword(tpc << 2);
+ *dest++ = m_space->read_dword(tpc);
else
*dest++ = 0;
}
@@ -269,7 +269,7 @@ void debug_disasm_buffer::debug_data_buffer::setup_methods()
for(offs_t lpc = lstart; lpc != lend; lpc = (lpc + 1) & m_pc_mask) {
offs_t tpc = lpc;
if (m_space->device().memory().translate(m_space->spacenum(), TRANSLATE_FETCH_DEBUG, tpc))
- *dest++ = m_space->read_word(tpc << 1);
+ *dest++ = m_space->read_word(tpc);
else
*dest++ = 0;
}
@@ -297,7 +297,7 @@ void debug_disasm_buffer::debug_data_buffer::setup_methods()
for(offs_t lpc = lstart; lpc != lend; lpc = (lpc + 0x10) & m_pc_mask) {
offs_t tpc = lpc;
if (m_space->device().memory().translate(m_space->spacenum(), TRANSLATE_FETCH_DEBUG, tpc))
- *dest++ = m_space->read_word(tpc >> 3);
+ *dest++ = m_space->read_word(tpc);
else
*dest++ = 0;
}
diff --git a/src/emu/debug/debugcmd.cpp b/src/emu/debug/debugcmd.cpp
index c5afe1b366c..bc43182b2b1 100644
--- a/src/emu/debug/debugcmd.cpp
+++ b/src/emu/debug/debugcmd.cpp
@@ -1645,7 +1645,6 @@ void debugger_commands::execute_save(int ref, const std::vector<std::string> &pa
u64 offset, endoffset, length;
address_space *space;
FILE *f;
- u64 i;
/* validate parameters */
if (!validate_number_parameter(params[1], offset))
@@ -1656,8 +1655,8 @@ void debugger_commands::execute_save(int ref, const std::vector<std::string> &pa
return;
/* determine the addresses to write */
- endoffset = space->address_to_byte(offset + length - 1) & space->bytemask();
- offset = space->address_to_byte(offset) & space->bytemask();
+ endoffset = (offset + length - 1) & space->addrmask();
+ offset = offset & space->addrmask();
/* open the file */
f = fopen(params[0].c_str(), "wb");
@@ -1668,10 +1667,46 @@ void debugger_commands::execute_save(int ref, const std::vector<std::string> &pa
}
/* now write the data out */
- for (i = offset; i <= endoffset; i++)
+ auto dis = space->machine().disable_side_effect();
+ switch (space->addrbus_shift())
{
- u8 byte = m_cpu.read_byte(*space, i, true);
- fwrite(&byte, 1, 1, f);
+ case -3:
+ for (offs_t i = offset; i != endoffset; i++)
+ {
+ u64 data = space->read_qword(i);
+ fwrite(&data, 8, 1, f);
+ }
+ break;
+ case -2:
+ for (offs_t i = offset; i != endoffset; i++)
+ {
+ u32 data = space->read_dword(i);
+ fwrite(&data, 4, 1, f);
+ }
+ break;
+ case -1:
+ for (offs_t i = offset; i != endoffset; i++)
+ {
+ u16 byte = space->read_word(i);
+ fwrite(&byte, 2, 1, f);
+ }
+ break;
+ case 0:
+ for (offs_t i = offset; i != endoffset; i++)
+ {
+ u8 byte = space->read_word(i);
+ fwrite(&byte, 1, 1, f);
+ }
+ break;
+ case 3:
+ offset &= ~15;
+ endoffset &= ~15;
+ for (offs_t i = offset; i != endoffset; i+=16)
+ {
+ u16 byte = space->read_word(i >> 4);
+ fwrite(&byte, 2, 1, f);
+ }
+ break;
}
/* close the file */
@@ -1688,7 +1723,6 @@ void debugger_commands::execute_load(int ref, const std::vector<std::string> &pa
{
u64 offset, endoffset, length = 0;
address_space *space;
- u64 i;
// validate parameters
if (!validate_number_parameter(params[1], offset))
@@ -1713,19 +1747,66 @@ void debugger_commands::execute_load(int ref, const std::vector<std::string> &pa
f.seekg(0, std::ios::end);
length = f.tellg();
f.seekg(0);
+ if (space->addrbus_shift() < 0)
+ length >>= -space->addrbus_shift();
+ else if (space->addrbus_shift() > 0)
+ length <<= space->addrbus_shift();
}
// determine the addresses to read
- endoffset = space->address_to_byte(offset + length - 1) & space->bytemask();
- offset = space->address_to_byte(offset) & space->bytemask();
-
+ endoffset = (offset + length - 1) & space->addrmask();
+ offset = offset & space->addrmask();
+ offs_t i = 0;
// now read the data in, ignore endoffset and load entire file if length has been set to zero (offset-1)
- for (i = offset; f.good() && (i <= endoffset || endoffset == offset - 1); i++)
+ switch (space->addrbus_shift())
{
- char byte;
- f.read(&byte, 1);
- if (f)
- m_cpu.write_byte(*space, i, byte, true);
+ case -3:
+ for (i = offset; f.good() && (i <= endoffset || endoffset == offset - 1); i++)
+ {
+ u64 data;
+ f.read((char *)&data, 8);
+ if (f)
+ space->write_qword(i, data);
+ }
+ break;
+ case -2:
+ for (i = offset; f.good() && (i <= endoffset || endoffset == offset - 1); i++)
+ {
+ u32 data;
+ f.read((char *)&data, 4);
+ if (f)
+ space->write_dword(i, data);
+ }
+ break;
+ case -1:
+ for (i = offset; f.good() && (i <= endoffset || endoffset == offset - 1); i++)
+ {
+ u16 data;
+ f.read((char *)&data, 2);
+ if (f)
+ space->write_word(i, data);
+ }
+ break;
+ case 0:
+ for (i = offset; f.good() && (i <= endoffset || endoffset == offset - 1); i++)
+ {
+ u8 data;
+ f.read((char *)&data, 1);
+ if (f)
+ space->write_byte(i, data);
+ }
+ break;
+ case 3:
+ offset &= ~15;
+ endoffset &= ~15;
+ for (i = offset; f.good() && (i <= endoffset || endoffset == offset - 16); i+=16)
+ {
+ u16 data;
+ f.read((char *)&data, 2);
+ if (f)
+ space->write_word(i >> 4, data);
+ }
+ break;
}
if (!f.good())
@@ -1768,6 +1849,9 @@ void debugger_commands::execute_dump(int ref, const std::vector<std::string> &pa
if (!validate_cpu_space_parameter((params.size() > 6) ? params[6].c_str() : nullptr, ref, space))
return;
+ int shift = space->addrbus_shift();
+ u64 granularity = shift > 0 ? 2 : 1 << -shift;
+
/* further validation */
if (width == 0)
width = space->data_width() / 8;
@@ -1778,14 +1862,19 @@ void debugger_commands::execute_dump(int ref, const std::vector<std::string> &pa
m_console.printf("Invalid width! (must be 1,2,4 or 8)\n");
return;
}
+ if (width < granularity)
+ {
+ m_console.printf("Invalid width! (must be at least %d)\n", granularity);
+ return;
+ }
if (rowsize == 0 || (rowsize % width) != 0)
{
m_console.printf("Invalid row size! (must be a positive multiple of %d)\n", width);
return;
}
- u64 endoffset = space->address_to_byte(offset + length - 1) & space->bytemask();
- offset = space->address_to_byte(offset) & space->bytemask();
+ u64 endoffset = (offset + length - 1) & space->addrmask();
+ offset = offset & space->addrmask();
/* open the file */
FILE* f = fopen(params[0].c_str(), "w");
@@ -1798,13 +1887,22 @@ void debugger_commands::execute_dump(int ref, const std::vector<std::string> &pa
/* now write the data out */
util::ovectorstream output;
output.reserve(200);
- for (u64 i = offset; i <= endoffset; i += rowsize)
+
+ if (shift > 0)
+ width <<= shift;
+ else if(shift < 0)
+ width >>= -shift;
+
+ auto dis = space->machine().disable_side_effect();
+ bool be = space->endianness() == ENDIANNESS_BIG;
+
+ for (offs_t i = offset; i <= endoffset; i += rowsize)
{
output.clear();
output.rdbuf()->clear();
/* print the address */
- util::stream_format(output, "%0*X: ", space->logaddrchars(), u32(space->byte_to_address(i)));
+ util::stream_format(output, "%0*X: ", space->logaddrchars(), i);
/* print the bytes */
for (u64 j = 0; j < rowsize; j += width)
@@ -1814,8 +1912,21 @@ void debugger_commands::execute_dump(int ref, const std::vector<std::string> &pa
offs_t curaddr = i + j;
if (space->device().memory().translate(space->spacenum(), TRANSLATE_READ_DEBUG, curaddr))
{
- u64 value = m_cpu.read_memory(*space, i + j, width, true);
- util::stream_format(output, " %0*X", width * 2, value);
+ switch (width)
+ {
+ case 8:
+ util::stream_format(output, " %016X", space->read_qword(i+j));
+ break;
+ case 4:
+ util::stream_format(output, " %08X", space->read_dword(i+j));
+ break;
+ case 2:
+ util::stream_format(output, " %04X", space->read_word(i+j));
+ break;
+ case 1:
+ util::stream_format(output, " %02X", space->read_byte(i+j));
+ break;
+ }
}
else
{
@@ -1835,8 +1946,26 @@ void debugger_commands::execute_dump(int ref, const std::vector<std::string> &pa
offs_t curaddr = i + j;
if (space->device().memory().translate(space->spacenum(), TRANSLATE_READ_DEBUG, curaddr))
{
- u8 byte = m_cpu.read_byte(*space, i + j, true);
- util::stream_format(output, "%c", (byte >= 32 && byte < 127) ? byte : '.');
+ u64 data = 0;
+ switch (width)
+ {
+ case 8:
+ data = space->read_qword(i+j);
+ break;
+ case 4:
+ data = space->read_dword(i+j);
+ break;
+ case 2:
+ data = space->read_word(i+j);
+ break;
+ case 1:
+ data = space->read_byte(i+j);
+ break;
+ }
+ for (unsigned int b = 0; b != width; b++) {
+ u8 byte = data >> (8 * (be ? (width-i-b) : b));
+ util::stream_format(output, "%c", (byte >= 32 && byte < 127) ? byte : '.');
+ }
}
else
{
@@ -1921,8 +2050,8 @@ void debugger_commands::execute_cheatinit(int ref, const std::vector<std::string
{
for (address_map_entry &entry : space->map()->m_entrylist)
{
- cheat_region[region_count].offset = space->address_to_byte(entry.m_addrstart) & space->bytemask();
- cheat_region[region_count].endoffset = space->address_to_byte(entry.m_addrend) & space->bytemask();
+ cheat_region[region_count].offset = entry.m_addrstart & space->addrmask();
+ cheat_region[region_count].endoffset = entry.m_addrend & space->addrmask();
cheat_region[region_count].share = entry.m_share;
cheat_region[region_count].disabled = (entry.m_write.m_type == AMH_RAM) ? false : true;
@@ -1945,8 +2074,8 @@ void debugger_commands::execute_cheatinit(int ref, const std::vector<std::string
return;
/* force region to the specified range */
- cheat_region[region_count].offset = space->address_to_byte(offset) & space->bytemask();
- cheat_region[region_count].endoffset = space->address_to_byte(offset + length - 1) & space->bytemask();
+ cheat_region[region_count].offset = offset & space->addrmask();
+ cheat_region[region_count].endoffset = (offset + length - 1) & space->addrmask();
cheat_region[region_count].share = nullptr;
cheat_region[region_count].disabled = false;
region_count++;
@@ -2321,9 +2450,9 @@ void debugger_commands::execute_find(int ref, const std::vector<std::string> &pa
return;
/* further validation */
- endoffset = space->address_to_byte(offset + length - 1) & space->bytemask();
- offset = space->address_to_byte(offset) & space->bytemask();
- cur_data_size = space->address_to_byte(1);
+ endoffset = (offset + length - 1) & space->addrmask();
+ offset = offset & space->addrmask();
+ cur_data_size = space->addrbus_shift() > 0 ? 2 : 1 << -space->addrbus_shift();
if (cur_data_size == 0)
cur_data_size = 1;
@@ -2834,7 +2963,7 @@ void debugger_commands::execute_map(int ref, const std::vector<std::string> &par
for (intention = TRANSLATE_READ_DEBUG; intention <= TRANSLATE_FETCH_DEBUG; intention++)
{
static const char *const intnames[] = { "Read", "Write", "Fetch" };
- taddress = space->address_to_byte(address) & space->bytemask();
+ taddress = address & space->addrmask();
if (space->device().memory().translate(space->spacenum(), intention, taddress))
{
const char *mapname = space->get_handler_string((intention == TRANSLATE_WRITE_DEBUG) ? read_or_write::WRITE : read_or_write::READ, taddress);
@@ -2842,7 +2971,7 @@ void debugger_commands::execute_map(int ref, const std::vector<std::string> &par
"%7s: %0*X logical == %0*X physical -> %s\n",
intnames[intention & 3],
space->logaddrchars(), address,
- space->addrchars(), space->byte_to_address(taddress),
+ space->addrchars(), taddress,
mapname);
}
else
diff --git a/src/emu/debug/debugcpu.cpp b/src/emu/debug/debugcpu.cpp
index 216a5ca0603..c5f5a532599 100644
--- a/src/emu/debug/debugcpu.cpp
+++ b/src/emu/debug/debugcpu.cpp
@@ -364,7 +364,7 @@ u8 debugger_cpu::read_byte(address_space &space, offs_t address, bool apply_tran
device_memory_interface &memory = space.device().memory();
/* mask against the logical byte mask */
- address &= space.logbytemask();
+ address &= space.logaddrmask();
/* translate if necessary; if not mapped, return 0xff */
u8 result;
@@ -389,7 +389,7 @@ u8 debugger_cpu::read_byte(address_space &space, offs_t address, bool apply_tran
u16 debugger_cpu::read_word(address_space &space, offs_t address, bool apply_translation)
{
/* mask against the logical byte mask */
- address &= space.logbytemask();
+ address &= space.logaddrmask();
u16 result;
if (!WORD_ALIGNED(address))
@@ -430,7 +430,7 @@ u16 debugger_cpu::read_word(address_space &space, offs_t address, bool apply_tra
u32 debugger_cpu::read_dword(address_space &space, offs_t address, bool apply_translation)
{
/* mask against the logical byte mask */
- address &= space.logbytemask();
+ address &= space.logaddrmask();
u32 result;
if (!DWORD_ALIGNED(address))
@@ -470,7 +470,7 @@ u32 debugger_cpu::read_dword(address_space &space, offs_t address, bool apply_tr
u64 debugger_cpu::read_qword(address_space &space, offs_t address, bool apply_translation)
{
/* mask against the logical byte mask */
- address &= space.logbytemask();
+ address &= space.logaddrmask();
u64 result;
if (!QWORD_ALIGNED(address))
@@ -532,7 +532,7 @@ void debugger_cpu::write_byte(address_space &space, offs_t address, u8 data, boo
device_memory_interface &memory = space.device().memory();
/* mask against the logical byte mask */
- address &= space.logbytemask();
+ address &= space.logaddrmask();
/* translate if necessary; if not mapped, we're done */
if (apply_translation && !memory.translate(space.spacenum(), TRANSLATE_WRITE_DEBUG, address))
@@ -554,7 +554,7 @@ void debugger_cpu::write_byte(address_space &space, offs_t address, u8 data, boo
void debugger_cpu::write_word(address_space &space, offs_t address, u16 data, bool apply_translation)
{
/* mask against the logical byte mask */
- address &= space.logbytemask();
+ address &= space.logaddrmask();
/* if this is a misaligned write, or if there are no word writers, just read two bytes */
if (!WORD_ALIGNED(address))
@@ -597,7 +597,7 @@ void debugger_cpu::write_word(address_space &space, offs_t address, u16 data, bo
void debugger_cpu::write_dword(address_space &space, offs_t address, u32 data, bool apply_translation)
{
/* mask against the logical byte mask */
- address &= space.logbytemask();
+ address &= space.logaddrmask();
/* if this is a misaligned write, or if there are no dword writers, just read two words */
if (!DWORD_ALIGNED(address))
@@ -640,7 +640,7 @@ void debugger_cpu::write_dword(address_space &space, offs_t address, u32 data, b
void debugger_cpu::write_qword(address_space &space, offs_t address, u64 data, bool apply_translation)
{
/* mask against the logical byte mask */
- address &= space.logbytemask();
+ address &= space.logaddrmask();
/* if this is a misaligned write, or if there are no qword writers, just read two dwords */
if (!QWORD_ALIGNED(address))
@@ -704,7 +704,7 @@ u64 debugger_cpu::read_opcode(address_space &space, offs_t address, int size)
u64 result = ~u64(0) & (~u64(0) >> (64 - 8*size));
/* keep in logical range */
- address &= space.logbytemask();
+ address &= space.logaddrmask();
/* if we're bigger than the address bus, break into smaller pieces */
if (size > space.data_width() / 8)
@@ -724,7 +724,7 @@ u64 debugger_cpu::read_opcode(address_space &space, offs_t address, int size)
return result;
/* keep in physical range */
- address &= space.bytemask();
+ address &= space.addrmask();
/* switch off the size and handle unaligned accesses */
switch (size)
@@ -3048,8 +3048,8 @@ device_debug::watchpoint::watchpoint(device_debug* debugInterface,
m_index(index),
m_enabled(true),
m_type(type),
- m_address(space.address_to_byte(address) & space.bytemask()),
- m_length(space.address_to_byte(length)),
+ m_address(address & space.addrmask()),
+ m_length(length),
m_condition(&symbols, (condition != nullptr) ? condition : "1"),
m_action((action != nullptr) ? action : "")
{
diff --git a/src/emu/debug/dvmemory.cpp b/src/emu/debug/dvmemory.cpp
index a5de89adb30..e32d576fa65 100644
--- a/src/emu/debug/dvmemory.cpp
+++ b/src/emu/debug/dvmemory.cpp
@@ -531,7 +531,7 @@ void debug_view_memory::recompute()
int addrchars;
if (source.m_space != nullptr)
{
- m_maxaddr = m_no_translation ? source.m_space->bytemask() : source.m_space->logbytemask();
+ m_maxaddr = m_no_translation ? source.m_space->addrmask() : source.m_space->logaddrmask();
addrchars = m_no_translation ? source.m_space->addrchars() : source.m_space->logaddrchars();
}
else
@@ -547,6 +547,8 @@ void debug_view_memory::recompute()
m_addrformat = string_format("%%0%dX%*s", addrchars, 8 - addrchars, "");
// if we are viewing a space with a minimum chunk size, clamp the bytes per chunk
+ // BAD
+#if 0
if (source.m_space != nullptr && source.m_space->byte_to_address(1) > 1)
{
u32 min_bytes_per_chunk = source.m_space->byte_to_address(1);
@@ -557,6 +559,7 @@ void debug_view_memory::recompute()
}
m_chunks_per_row = std::max(1U, m_chunks_per_row);
}
+#endif
// recompute the byte offset based on the most recent expression result
m_bytes_per_row = m_bytes_per_chunk * m_chunks_per_row;
@@ -617,7 +620,7 @@ bool debug_view_memory::needs_recompute()
const debug_view_memory_source &source = downcast<const debug_view_memory_source &>(*m_source);
offs_t resultbyte;
if (source.m_space != nullptr)
- resultbyte = source.m_space->address_to_byte(m_expression.value()) & source.m_space->logbytemask();
+ resultbyte = m_expression.value() & source.m_space->logaddrmask();
else
resultbyte = m_expression.value();
diff --git a/src/emu/dirom.cpp b/src/emu/dirom.cpp
index 161b7770c75..3a0ed23692f 100644
--- a/src/emu/dirom.cpp
+++ b/src/emu/dirom.cpp
@@ -85,7 +85,7 @@ void device_rom_interface::set_rom(const void *base, u32 size)
void device_rom_interface::interface_pre_start()
{
- m_rom_direct = &space().direct();
+ m_rom_direct = space().direct<0>();
m_bank = nullptr;
m_cur_bank = -1;
device().save_item(NAME(m_cur_bank));
diff --git a/src/emu/dirom.h b/src/emu/dirom.h
index 1e9efcca037..2ea7edca810 100644
--- a/src/emu/dirom.h
+++ b/src/emu/dirom.h
@@ -42,7 +42,7 @@ protected:
private:
const char *m_rom_tag;
const address_space_config m_rom_config;
- direct_read_data *m_rom_direct;
+ direct_read_data<0> *m_rom_direct;
memory_bank *m_bank;
int m_cur_bank, m_bank_count;
diff --git a/src/emu/emucore.h b/src/emu/emucore.h
index 1461dcbb272..04b67869546 100644
--- a/src/emu/emucore.h
+++ b/src/emu/emucore.h
@@ -431,4 +431,14 @@ inline u64 d2u(double d)
return u.vv;
}
+
+// constexpr absolute value of an integer
+inline constexpr int iabs(int v)
+{
+ if(v < 0)
+ return -v;
+ else
+ return v;
+}
+
#endif /* MAME_EMU_EMUCORE_H */
diff --git a/src/emu/emufwd.h b/src/emu/emufwd.h
index cd7de9fecb9..0ab280adbf4 100644
--- a/src/emu/emufwd.h
+++ b/src/emu/emufwd.h
@@ -130,7 +130,7 @@ class driver_device;
// declared in emumem.h
class address_space;
-class direct_read_data;
+template<int addr_shift> class direct_read_data;
class memory_bank;
class memory_block;
class memory_manager;
diff --git a/src/emu/emumem.cpp b/src/emu/emumem.cpp
index c6ad1349d23..36636fe6495 100644
--- a/src/emu/emumem.cpp
+++ b/src/emu/emumem.cpp
@@ -269,8 +269,9 @@ protected:
public:
// getters
bool populated() const { return m_populated; }
- offs_t bytestart() const { return m_bytestart; }
- offs_t byteend() const { return m_byteend; }
+ offs_t addrstart() const { return m_addrstart; }
+ offs_t addrend() const { return m_addrend; }
+ offs_t addrmask() const { return m_addrmask; }
offs_t bytemask() const { return m_bytemask; }
virtual const char *name() const = 0;
virtual const char *subunit_name(int entry) const = 0;
@@ -279,44 +280,45 @@ public:
virtual void copy(handler_entry *entry);
// return offset within the range referenced by this handler
- offs_t byteoffset(offs_t byteaddress) const { return (byteaddress - m_bytestart) & m_bytemask; }
+ offs_t offset(offs_t address) const { return (address - m_addrstart) & m_addrmask; }
// return a pointer to the backing RAM at the given offset
u8 *ramptr(offs_t offset = 0) const { return *m_rambaseptr + offset; }
// see if we are an exact match to the given parameters
- bool matches_exactly(offs_t bytestart, offs_t byteend, offs_t bytemask) const
+ bool matches_exactly(offs_t addrstart, offs_t addrend, offs_t addrmask) const
{
- return (m_populated && m_bytestart == bytestart && m_byteend == byteend && m_bytemask == bytemask);
+ return (m_populated && m_addrstart == addrstart && m_addrend == addrend && m_addrmask == addrmask);
}
// get the start/end address with the given mirror
- void mirrored_start_end(offs_t byteaddress, offs_t &start, offs_t &end) const
+ void mirrored_start_end(offs_t address, offs_t &start, offs_t &end) const
{
- offs_t mirrorbits = (byteaddress - m_bytestart) & ~m_bytemask;
- start = m_bytestart | mirrorbits;
- end = m_byteend | mirrorbits;
+ offs_t mirrorbits = (address - m_addrstart) & ~m_addrmask;
+ start = m_addrstart | mirrorbits;
+ end = m_addrend | mirrorbits;
}
// configure the handler addresses, and mark as populated
- void configure(offs_t bytestart, offs_t byteend, offs_t bytemask)
+ void configure(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t bytemask)
{
if (m_populated && m_subunits)
- reconfigure_subunits(bytestart);
+ reconfigure_subunits(addrstart);
m_populated = true;
- m_bytestart = bytestart;
- m_byteend = byteend;
+ m_addrstart = addrstart;
+ m_addrend = addrend;
+ m_addrmask = addrmask;
m_bytemask = bytemask;
}
- // Re-expand the bytemask after subunit fun
+ // Re-expand the addrmask after subunit fun
void expand_bytemask(offs_t previous_mask)
{
m_bytemask |= previous_mask;
}
// reconfigure the subunits on a base address change
- void reconfigure_subunits(offs_t bytestart);
+ void reconfigure_subunits(offs_t addrstart);
// depopulate an handler
void deconfigure()
@@ -326,7 +328,7 @@ public:
}
// apply a global mask
- void apply_mask(offs_t bytemask) { m_bytemask &= bytemask; }
+ void apply_mask(offs_t addrmask) { m_addrmask &= addrmask; }
void clear_conflicting_subunits(u64 handlermask);
bool overriden_by_mask(u64 handlermask);
@@ -335,7 +337,7 @@ protected:
// Subunit description information
struct subunit_info
{
- offs_t m_bytemask; // bytemask for this subunit
+ offs_t m_addrmask; // addrmask for this subunit
u32 m_mask; // mask (ff, ffff or ffffffff)
s32 m_offset; // offset to add to the address
u32 m_multiplier; // multiplier to the pre-split address
@@ -351,9 +353,10 @@ protected:
bool m_populated; // populated?
u8 m_datawidth;
endianness_t m_endianness;
- offs_t m_bytestart; // byte-adjusted start address for handler
- offs_t m_byteend; // byte-adjusted end address for handler
- offs_t m_bytemask; // byte-adjusted mask against the final address
+ offs_t m_addrstart; // start address for handler
+ offs_t m_addrend; // end address for handler
+ offs_t m_addrmask; // mask against the final address
+ offs_t m_bytemask; // mask against the final address, byte resolution
u8 ** m_rambaseptr; // pointer to the bank base
u8 m_subunits; // for width stubs, the number of subunits
subunit_info m_subunit_infos[8]; // for width stubs, the associated subunit info
@@ -568,33 +571,33 @@ public:
bool watchpoints_enabled() const { return (m_live_lookup == s_watchpoint_table); }
// address lookups
- u32 lookup_live(offs_t byteaddress) const { return m_large ? lookup_live_large(byteaddress) : lookup_live_small(byteaddress); }
- u32 lookup_live_small(offs_t byteaddress) const { return m_live_lookup[byteaddress]; }
+ u32 lookup_live(offs_t address) const { return m_large ? lookup_live_large(address) : lookup_live_small(address); }
+ u32 lookup_live_small(offs_t address) const { return m_live_lookup[address]; }
- u32 lookup_live_large(offs_t byteaddress) const
+ u32 lookup_live_large(offs_t address) const
{
- u32 entry = m_live_lookup[level1_index_large(byteaddress)];
+ u32 entry = m_live_lookup[level1_index_large(address)];
if (entry >= SUBTABLE_BASE)
- entry = m_live_lookup[level2_index_large(entry, byteaddress)];
+ entry = m_live_lookup[level2_index_large(entry, address)];
return entry;
}
- u32 lookup_live_nowp(offs_t byteaddress) const { return m_large ? lookup_live_large_nowp(byteaddress) : lookup_live_small_nowp(byteaddress); }
- u32 lookup_live_small_nowp(offs_t byteaddress) const { return m_table[byteaddress]; }
+ u32 lookup_live_nowp(offs_t address) const { return m_large ? lookup_live_large_nowp(address) : lookup_live_small_nowp(address); }
+ u32 lookup_live_small_nowp(offs_t address) const { return m_table[address]; }
- u32 lookup_live_large_nowp(offs_t byteaddress) const
+ u32 lookup_live_large_nowp(offs_t address) const
{
- u32 entry = m_table[level1_index_large(byteaddress)];
+ u32 entry = m_table[level1_index_large(address)];
if (entry >= SUBTABLE_BASE)
- entry = m_table[level2_index_large(entry, byteaddress)];
+ entry = m_table[level2_index_large(entry, address)];
return entry;
}
- u32 lookup(offs_t byteaddress) const
+ u32 lookup(offs_t address) const
{
- u32 entry = m_live_lookup[level1_index(byteaddress)];
+ u32 entry = m_live_lookup[level1_index(address)];
if (entry >= SUBTABLE_BASE)
- entry = m_live_lookup[level2_index(entry, byteaddress)];
+ entry = m_live_lookup[level2_index(entry, address)];
return entry;
}
@@ -602,9 +605,9 @@ public:
void enable_watchpoints(bool enable = true) { m_live_lookup = enable ? s_watchpoint_table : &m_table[0]; }
// table mapping helpers
- void map_range(offs_t bytestart, offs_t byteend, offs_t bytemask, offs_t bytemirror, u16 staticentry);
- void setup_range(offs_t bytestart, offs_t byteend, offs_t bytemask, offs_t bytemirror, u64 mask, std::list<u32> &entries);
- u16 derive_range(offs_t byteaddress, offs_t &bytestart, offs_t &byteend) const;
+ void map_range(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, u16 staticentry);
+ void setup_range(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, u64 mask, std::list<u32> &entries);
+ u16 derive_range(offs_t address, offs_t &addrstart, offs_t &addrend) const;
// misc helpers
void mask_all_handlers(offs_t mask);
@@ -618,8 +621,8 @@ protected:
u32 level2_index(u16 l1entry, offs_t address) const { return m_large ? level2_index_large(l1entry, address) : 0; }
// table population/depopulation
- void populate_range_mirrored(offs_t bytestart, offs_t byteend, offs_t bytemirror, u16 handler);
- void populate_range(offs_t bytestart, offs_t byteend, u16 handler);
+ void populate_range_mirrored(offs_t addrstart, offs_t addrend, offs_t addrmirror, u16 handler);
+ void populate_range(offs_t addrstart, offs_t addrend, u16 handler);
// subtable management
u16 subtable_alloc();
@@ -700,9 +703,9 @@ public:
handler_entry_read &handler_read(u32 index) const { assert(index < ARRAY_LENGTH(m_handlers)); return *m_handlers[index]; }
// range getter
- handler_entry_proxy<handler_entry_read> handler_map_range(offs_t bytestart, offs_t byteend, offs_t bytemask, offs_t bytemirror, u64 mask = 0) {
+ handler_entry_proxy<handler_entry_read> handler_map_range(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, u64 mask = 0) {
std::list<u32> entries;
- setup_range(bytestart, byteend, bytemask, bytemirror, mask, entries);
+ setup_range(addrstart, addrend, addrmask, addrmirror, mask, entries);
std::list<handler_entry_read *> handlers;
for (std::list<u32>::const_iterator i = entries.begin(); i != entries.end(); ++i)
handlers.push_back(&handler_read(*i));
@@ -771,9 +774,9 @@ public:
handler_entry_write &handler_write(u32 index) const { assert(index < ARRAY_LENGTH(m_handlers)); return *m_handlers[index]; }
// range getter
- handler_entry_proxy<handler_entry_write> handler_map_range(offs_t bytestart, offs_t byteend, offs_t bytemask, offs_t bytemirror, u64 mask = 0) {
+ handler_entry_proxy<handler_entry_write> handler_map_range(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, u64 mask = 0) {
std::list<u32> entries;
- setup_range(bytestart, byteend, bytemask, bytemirror, mask, entries);
+ setup_range(addrstart, addrend, addrmask, addrmirror, mask, entries);
std::list<handler_entry_write *> handlers;
for (std::list<u32>::const_iterator i = entries.begin(); i != entries.end(); ++i)
handlers.push_back(&handler_write(*i));
@@ -836,7 +839,7 @@ public:
// Watchpoints and unmap states do not make sense for setoffset
m_handlers[STATIC_NOP]->set_delegate(setoffset_delegate(FUNC(address_table_setoffset::nop_so), this));
- m_handlers[STATIC_NOP]->configure(0, space.bytemask(), ~0);
+ m_handlers[STATIC_NOP]->configure(0, space.addrmask(), ~0, ~0);
}
~address_table_setoffset()
@@ -847,9 +850,9 @@ public:
handler_entry_setoffset &handler_setoffset(u32 index) const { assert(index < ARRAY_LENGTH(m_handlers)); return *m_handlers[index]; }
// range getter
- handler_entry_proxy<handler_entry_setoffset> handler_map_range(offs_t bytestart, offs_t byteend, offs_t bytemask, offs_t bytemirror, u64 mask = 0) {
+ handler_entry_proxy<handler_entry_setoffset> handler_map_range(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, u64 mask = 0) {
std::list<u32> entries;
- setup_range(bytestart, byteend, bytemask, bytemirror, mask, entries);
+ setup_range(addrstart, addrend, addrmask, addrmirror, mask, entries);
std::list<handler_entry_setoffset *> handlers;
for (std::list<u32>::const_iterator i = entries.begin(); i != entries.end(); ++i)
handlers.push_back(&handler_setoffset(*i));
@@ -875,20 +878,23 @@ private:
// ======================> address_space_specific
// this is a derived class of address_space with specific width, endianness, and table size
-template<typename _NativeType, endianness_t _Endian, bool _Large>
+template<typename _NativeType, endianness_t _Endian, int _Shift, bool _Large>
class address_space_specific : public address_space
{
- typedef address_space_specific<_NativeType, _Endian, _Large> this_type;
+ typedef address_space_specific<_NativeType, _Endian, _Shift, _Large> this_type;
// constants describing the native size
static const u32 NATIVE_BYTES = sizeof(_NativeType);
- static const u32 NATIVE_MASK = NATIVE_BYTES - 1;
+ static const u32 NATIVE_STEP = _Shift >= 0 ? NATIVE_BYTES << _Shift : NATIVE_BYTES >> -_Shift;
+ static const u32 NATIVE_MASK = NATIVE_STEP - 1;
static const u32 NATIVE_BITS = 8 * NATIVE_BYTES;
// helpers to simplify core code
- u32 read_lookup(offs_t byteaddress) const { return _Large ? m_read.lookup_live_large(byteaddress) : m_read.lookup_live_small(byteaddress); }
- u32 write_lookup(offs_t byteaddress) const { return _Large ? m_write.lookup_live_large(byteaddress) : m_write.lookup_live_small(byteaddress); }
- u32 setoffset_lookup(offs_t byteaddress) const { return _Large ? m_setoffset.lookup_live_large(byteaddress) : m_setoffset.lookup_live_small(byteaddress); }
+ u32 read_lookup(offs_t address) const { return _Large ? m_read.lookup_live_large(address) : m_read.lookup_live_small(address); }
+ u32 write_lookup(offs_t address) const { return _Large ? m_write.lookup_live_large(address) : m_write.lookup_live_small(address); }
+ u32 setoffset_lookup(offs_t address) const { return _Large ? m_setoffset.lookup_live_large(address) : m_setoffset.lookup_live_small(address); }
+
+ static inline offs_t offset_to_byte(offs_t offset) { return _Shift < 0 ? offset << -_Shift : offset >> _Shift; }
public:
// construction/destruction
@@ -1064,31 +1070,31 @@ public:
}
// return a pointer to the read bank, or nullptr if none
- virtual void *get_read_ptr(offs_t byteaddress) override
+ virtual void *get_read_ptr(offs_t address) override
{
// perform the lookup
- byteaddress &= m_bytemask;
- u32 entry = read_lookup(byteaddress);
+ address &= m_addrmask;
+ u32 entry = read_lookup(address);
const handler_entry_read &handler = m_read.handler_read(entry);
// 8-bit case: RAM/ROM
if (entry > STATIC_BANKMAX)
return nullptr;
- return handler.ramptr(handler.byteoffset(byteaddress));
+ return handler.ramptr(handler.offset(address));
}
// return a pointer to the write bank, or nullptr if none
- virtual void *get_write_ptr(offs_t byteaddress) override
+ virtual void *get_write_ptr(offs_t address) override
{
// perform the lookup
- byteaddress &= m_bytemask;
- u32 entry = write_lookup(byteaddress);
+ address &= m_addrmask;
+ u32 entry = write_lookup(address);
const handler_entry_write &handler = m_write.handler_write(entry);
// 8-bit case: RAM/ROM
if (entry > STATIC_BANKMAX)
return nullptr;
- return handler.ramptr(handler.byteoffset(byteaddress));
+ return handler.ramptr(handler.offset(address));
}
// native read
@@ -1099,12 +1105,12 @@ public:
if (TEST_HANDLER) printf("[r%X,%s]", offset, core_i64_hex_format(mask, sizeof(_NativeType) * 2));
// look up the handler
- offs_t byteaddress = offset & m_bytemask;
- u32 entry = read_lookup(byteaddress);
+ offs_t address = offset & m_addrmask;
+ u32 entry = read_lookup(address);
const handler_entry_read &handler = m_read.handler_read(entry);
// either read directly from RAM, or call the delegate
- offset = handler.byteoffset(byteaddress);
+ offset = offset_to_byte(handler.offset(address));
_NativeType result;
if (entry <= STATIC_BANKMAX) result = *reinterpret_cast<_NativeType *>(handler.ramptr(offset));
else if (sizeof(_NativeType) == 1) result = handler.read8(*this, offset, mask);
@@ -1124,12 +1130,12 @@ public:
if (TEST_HANDLER) printf("[r%X]", offset);
// look up the handler
- offs_t byteaddress = offset & m_bytemask;
- u32 entry = read_lookup(byteaddress);
+ offs_t address = offset & m_addrmask;
+ u32 entry = read_lookup(address);
const handler_entry_read &handler = m_read.handler_read(entry);
// either read directly from RAM, or call the delegate
- offset = handler.byteoffset(byteaddress);
+ offset = offset_to_byte(handler.offset(address));
_NativeType result;
if (entry <= STATIC_BANKMAX) result = *reinterpret_cast<_NativeType *>(handler.ramptr(offset));
else if (sizeof(_NativeType) == 1) result = handler.read8(*this, offset, 0xff);
@@ -1147,12 +1153,12 @@ public:
g_profiler.start(PROFILER_MEMWRITE);
// look up the handler
- offs_t byteaddress = offset & m_bytemask;
- u32 entry = write_lookup(byteaddress);
+ offs_t address = offset & m_addrmask;
+ u32 entry = write_lookup(address);
const handler_entry_write &handler = m_write.handler_write(entry);
// either write directly to RAM, or call the delegate
- offset = handler.byteoffset(byteaddress);
+ offset = offset_to_byte(handler.offset(address));
if (entry <= STATIC_BANKMAX)
{
_NativeType *dest = reinterpret_cast<_NativeType *>(handler.ramptr(offset));
@@ -1172,12 +1178,12 @@ public:
g_profiler.start(PROFILER_MEMWRITE);
// look up the handler
- offs_t byteaddress = offset & m_bytemask;
- u32 entry = write_lookup(byteaddress);
+ offs_t address = offset & m_addrmask;
+ u32 entry = write_lookup(address);
const handler_entry_write &handler = m_write.handler_write(entry);
// either write directly to RAM, or call the delegate
- offset = handler.byteoffset(byteaddress);
+ offset = offset_to_byte(handler.offset(address));
if (entry <= STATIC_BANKMAX) *reinterpret_cast<_NativeType *>(handler.ramptr(offset)) = data;
else if (sizeof(_NativeType) == 1) handler.write8(*this, offset, data, 0xff);
else if (sizeof(_NativeType) == 2) handler.write16(*this, offset >> 1, data, 0xffff);
@@ -1201,7 +1207,7 @@ public:
// if native size is larger, see if we can do a single masked read (guaranteed if we're aligned)
if (NATIVE_BYTES > TARGET_BYTES)
{
- u32 offsbits = 8 * (address & (NATIVE_BYTES - (_Aligned ? TARGET_BYTES : 1)));
+ u32 offsbits = 8 * (offset_to_byte(address) & (NATIVE_BYTES - (_Aligned ? TARGET_BYTES : 1)));
if (_Aligned || (offsbits + TARGET_BITS <= NATIVE_BITS))
{
if (_Endian != ENDIANNESS_LITTLE) offsbits = NATIVE_BITS - TARGET_BITS - offsbits;
@@ -1210,7 +1216,7 @@ public:
}
// determine our alignment against the native boundaries, and mask the address
- u32 offsbits = 8 * (address & (NATIVE_BYTES - 1));
+ u32 offsbits = 8 * (offset_to_byte(address) & (NATIVE_BYTES - 1));
address &= ~NATIVE_MASK;
// if we're here, and native size is larger or equal to the target, we need exactly 2 reads
@@ -1227,7 +1233,7 @@ public:
// read upper bits from upper address
offsbits = NATIVE_BITS - offsbits;
curmask = mask >> offsbits;
- if (curmask != 0) result |= read_native(address + NATIVE_BYTES, curmask) << offsbits;
+ if (curmask != 0) result |= read_native(address + NATIVE_STEP, curmask) << offsbits;
return result;
}
@@ -1246,7 +1252,7 @@ public:
// read lower bits from upper address
curmask = ljmask << offsbits;
- if (curmask != 0) result |= read_native(address + NATIVE_BYTES, curmask) >> offsbits;
+ if (curmask != 0) result |= read_native(address + NATIVE_STEP, curmask) >> offsbits;
// return the un-justified result
return result >> LEFT_JUSTIFY_TARGET_TO_NATIVE_SHIFT;
@@ -1272,7 +1278,7 @@ public:
offsbits = NATIVE_BITS - offsbits;
for (u32 index = 0; index < MAX_SPLITS_MINUS_ONE; index++)
{
- address += NATIVE_BYTES;
+ address += NATIVE_STEP;
curmask = mask >> offsbits;
if (curmask != 0) result |= (_TargetType)read_native(address, curmask) << offsbits;
offsbits += NATIVE_BITS;
@@ -1282,7 +1288,7 @@ public:
if (!_Aligned && offsbits < TARGET_BITS)
{
curmask = mask >> offsbits;
- if (curmask != 0) result |= (_TargetType)read_native(address + NATIVE_BYTES, curmask) << offsbits;
+ if (curmask != 0) result |= (_TargetType)read_native(address + NATIVE_STEP, curmask) << offsbits;
}
}
@@ -1298,7 +1304,7 @@ public:
for (u32 index = 0; index < MAX_SPLITS_MINUS_ONE; index++)
{
offsbits -= NATIVE_BITS;
- address += NATIVE_BYTES;
+ address += NATIVE_STEP;
curmask = mask >> offsbits;
if (curmask != 0) result |= (_TargetType)read_native(address, curmask) << offsbits;
}
@@ -1308,7 +1314,7 @@ public:
{
offsbits = NATIVE_BITS - offsbits;
curmask = mask << offsbits;
- if (curmask != 0) result |= read_native(address + NATIVE_BYTES, curmask) >> offsbits;
+ if (curmask != 0) result |= read_native(address + NATIVE_STEP, curmask) >> offsbits;
}
}
return result;
@@ -1329,7 +1335,7 @@ public:
// if native size is larger, see if we can do a single masked write (guaranteed if we're aligned)
if (NATIVE_BYTES > TARGET_BYTES)
{
- u32 offsbits = 8 * (address & (NATIVE_BYTES - (_Aligned ? TARGET_BYTES : 1)));
+ u32 offsbits = 8 * (offset_to_byte(address) & (NATIVE_BYTES - (_Aligned ? TARGET_BYTES : 1)));
if (_Aligned || (offsbits + TARGET_BITS <= NATIVE_BITS))
{
if (_Endian != ENDIANNESS_LITTLE) offsbits = NATIVE_BITS - TARGET_BITS - offsbits;
@@ -1338,7 +1344,7 @@ public:
}
// determine our alignment against the native boundaries, and mask the address
- u32 offsbits = 8 * (address & (NATIVE_BYTES - 1));
+ u32 offsbits = 8 * (offset_to_byte(address) & (NATIVE_BYTES - 1));
address &= ~NATIVE_MASK;
// if we're here, and native size is larger or equal to the target, we need exactly 2 writes
@@ -1354,7 +1360,7 @@ public:
// write upper bits to upper address
offsbits = NATIVE_BITS - offsbits;
curmask = mask >> offsbits;
- if (curmask != 0) write_native(address + NATIVE_BYTES, data >> offsbits, curmask);
+ if (curmask != 0) write_native(address + NATIVE_STEP, data >> offsbits, curmask);
}
// big-endian case
@@ -1372,7 +1378,7 @@ public:
// write lower bits to upper address
offsbits = NATIVE_BITS - offsbits;
curmask = ljmask << offsbits;
- if (curmask != 0) write_native(address + NATIVE_BYTES, ljdata << offsbits, curmask);
+ if (curmask != 0) write_native(address + NATIVE_STEP, ljdata << offsbits, curmask);
}
}
@@ -1394,7 +1400,7 @@ public:
offsbits = NATIVE_BITS - offsbits;
for (u32 index = 0; index < MAX_SPLITS_MINUS_ONE; index++)
{
- address += NATIVE_BYTES;
+ address += NATIVE_STEP;
curmask = mask >> offsbits;
if (curmask != 0) write_native(address, data >> offsbits, curmask);
offsbits += NATIVE_BITS;
@@ -1404,7 +1410,7 @@ public:
if (!_Aligned && offsbits < TARGET_BITS)
{
curmask = mask >> offsbits;
- if (curmask != 0) write_native(address + NATIVE_BYTES, data >> offsbits, curmask);
+ if (curmask != 0) write_native(address + NATIVE_STEP, data >> offsbits, curmask);
}
}
@@ -1420,7 +1426,7 @@ public:
for (u32 index = 0; index < MAX_SPLITS_MINUS_ONE; index++)
{
offsbits -= NATIVE_BITS;
- address += NATIVE_BYTES;
+ address += NATIVE_STEP;
curmask = mask >> offsbits;
if (curmask != 0) write_native(address, data >> offsbits, curmask);
}
@@ -1430,7 +1436,7 @@ public:
{
offsbits = NATIVE_BITS - offsbits;
curmask = mask << offsbits;
- if (curmask != 0) write_native(address + NATIVE_BYTES, data << offsbits, curmask);
+ if (curmask != 0) write_native(address + NATIVE_STEP, data << offsbits, curmask);
}
}
}
@@ -1441,11 +1447,11 @@ public:
// to some particular set_offset operation for an entry in the address map.
void set_address(offs_t address) override
{
- offs_t byteaddress = address & m_bytemask;
- u32 entry = setoffset_lookup(byteaddress);
+ address &= m_addrmask;
+ u32 entry = setoffset_lookup(address);
const handler_entry_setoffset &handler = m_setoffset.handler_setoffset(entry);
- offs_t offset = handler.byteoffset(byteaddress);
+ offs_t offset = handler.offset(address);
handler.setoffset(*this, offset / sizeof(_NativeType));
}
@@ -1499,23 +1505,52 @@ public:
address_table_setoffset m_setoffset; // memory setoffset lookup table
};
-typedef address_space_specific<u8, ENDIANNESS_LITTLE, false> address_space_8le_small;
-typedef address_space_specific<u8, ENDIANNESS_BIG, false> address_space_8be_small;
-typedef address_space_specific<u16, ENDIANNESS_LITTLE, false> address_space_16le_small;
-typedef address_space_specific<u16, ENDIANNESS_BIG, false> address_space_16be_small;
-typedef address_space_specific<u32, ENDIANNESS_LITTLE, false> address_space_32le_small;
-typedef address_space_specific<u32, ENDIANNESS_BIG, false> address_space_32be_small;
-typedef address_space_specific<u64, ENDIANNESS_LITTLE, false> address_space_64le_small;
-typedef address_space_specific<u64, ENDIANNESS_BIG, false> address_space_64be_small;
+typedef address_space_specific<u8, ENDIANNESS_LITTLE, 0, false> address_space_8_8le_small;
+typedef address_space_specific<u8, ENDIANNESS_BIG, 0, false> address_space_8_8be_small;
+typedef address_space_specific<u16, ENDIANNESS_LITTLE, 3, false> address_space_16_1le_small;
+typedef address_space_specific<u16, ENDIANNESS_BIG, 3, false> address_space_16_1be_small;
+typedef address_space_specific<u16, ENDIANNESS_LITTLE, 0, false> address_space_16_8le_small;
+typedef address_space_specific<u16, ENDIANNESS_BIG, 0, false> address_space_16_8be_small;
+typedef address_space_specific<u16, ENDIANNESS_LITTLE, -1, false> address_space_16_16le_small;
+typedef address_space_specific<u16, ENDIANNESS_BIG, -1, false> address_space_16_16be_small;
+typedef address_space_specific<u32, ENDIANNESS_LITTLE, 0, false> address_space_32_8le_small;
+typedef address_space_specific<u32, ENDIANNESS_BIG, 0, false> address_space_32_8be_small;
+typedef address_space_specific<u32, ENDIANNESS_LITTLE, -1, false> address_space_32_16le_small;
+typedef address_space_specific<u32, ENDIANNESS_BIG, -1, false> address_space_32_16be_small;
+typedef address_space_specific<u32, ENDIANNESS_LITTLE, -2, false> address_space_32_32le_small;
+typedef address_space_specific<u32, ENDIANNESS_BIG, -2, false> address_space_32_32be_small;
+typedef address_space_specific<u64, ENDIANNESS_LITTLE, 0, false> address_space_64_8le_small;
+typedef address_space_specific<u64, ENDIANNESS_BIG, 0, false> address_space_64_8be_small;
+typedef address_space_specific<u64, ENDIANNESS_LITTLE, -1, false> address_space_64_16le_small;
+typedef address_space_specific<u64, ENDIANNESS_BIG, -1, false> address_space_64_16be_small;
+typedef address_space_specific<u64, ENDIANNESS_LITTLE, -2, false> address_space_64_32le_small;
+typedef address_space_specific<u64, ENDIANNESS_BIG, -2, false> address_space_64_32be_small;
+typedef address_space_specific<u64, ENDIANNESS_LITTLE, -3, false> address_space_64_64le_small;
+typedef address_space_specific<u64, ENDIANNESS_BIG, -3, false> address_space_64_64be_small;
+
+typedef address_space_specific<u8, ENDIANNESS_LITTLE, 0, true> address_space_8_8le_large;
+typedef address_space_specific<u8, ENDIANNESS_BIG, 0, true> address_space_8_8be_large;
+typedef address_space_specific<u16, ENDIANNESS_LITTLE, 3, true> address_space_16_1le_large;
+typedef address_space_specific<u16, ENDIANNESS_BIG, 3, true> address_space_16_1be_large;
+typedef address_space_specific<u16, ENDIANNESS_LITTLE, 0, true> address_space_16_8le_large;
+typedef address_space_specific<u16, ENDIANNESS_BIG, 0, true> address_space_16_8be_large;
+typedef address_space_specific<u16, ENDIANNESS_LITTLE, -1, true> address_space_16_16le_large;
+typedef address_space_specific<u16, ENDIANNESS_BIG, -1, true> address_space_16_16be_large;
+typedef address_space_specific<u32, ENDIANNESS_LITTLE, 0, true> address_space_32_8le_large;
+typedef address_space_specific<u32, ENDIANNESS_BIG, 0, true> address_space_32_8be_large;
+typedef address_space_specific<u32, ENDIANNESS_LITTLE, -1, true> address_space_32_16le_large;
+typedef address_space_specific<u32, ENDIANNESS_BIG, -1, true> address_space_32_16be_large;
+typedef address_space_specific<u32, ENDIANNESS_LITTLE, -2, true> address_space_32_32le_large;
+typedef address_space_specific<u32, ENDIANNESS_BIG, -2, true> address_space_32_32be_large;
+typedef address_space_specific<u64, ENDIANNESS_LITTLE, 0, true> address_space_64_8le_large;
+typedef address_space_specific<u64, ENDIANNESS_BIG, 0, true> address_space_64_8be_large;
+typedef address_space_specific<u64, ENDIANNESS_LITTLE, -1, true> address_space_64_16le_large;
+typedef address_space_specific<u64, ENDIANNESS_BIG, -1, true> address_space_64_16be_large;
+typedef address_space_specific<u64, ENDIANNESS_LITTLE, -2, true> address_space_64_32le_large;
+typedef address_space_specific<u64, ENDIANNESS_BIG, -2, true> address_space_64_32be_large;
+typedef address_space_specific<u64, ENDIANNESS_LITTLE, -3, true> address_space_64_64le_large;
+typedef address_space_specific<u64, ENDIANNESS_BIG, -3, true> address_space_64_64be_large;
-typedef address_space_specific<u8, ENDIANNESS_LITTLE, true> address_space_8le_large;
-typedef address_space_specific<u8, ENDIANNESS_BIG, true> address_space_8be_large;
-typedef address_space_specific<u16, ENDIANNESS_LITTLE, true> address_space_16le_large;
-typedef address_space_specific<u16, ENDIANNESS_BIG, true> address_space_16be_large;
-typedef address_space_specific<u32, ENDIANNESS_LITTLE, true> address_space_32le_large;
-typedef address_space_specific<u32, ENDIANNESS_BIG, true> address_space_32be_large;
-typedef address_space_specific<u64, ENDIANNESS_LITTLE, true> address_space_64le_large;
-typedef address_space_specific<u64, ENDIANNESS_BIG, true> address_space_64be_large;
@@ -1574,72 +1609,206 @@ void memory_manager::allocate(device_memory_interface &memory)
if (spaceconfig->endianness() == ENDIANNESS_LITTLE)
{
if (large)
- memory.allocate<address_space_8le_large>(*this, spacenum);
+ memory.allocate<address_space_8_8le_large>(*this, spacenum);
else
- memory.allocate<address_space_8le_small>(*this, spacenum);
+ memory.allocate<address_space_8_8le_small>(*this, spacenum);
}
else
{
if (large)
- memory.allocate<address_space_8be_large>(*this, spacenum);
+ memory.allocate<address_space_8_8be_large>(*this, spacenum);
else
- memory.allocate<address_space_8be_small>(*this, spacenum);
+ memory.allocate<address_space_8_8be_small>(*this, spacenum);
}
break;
-
+
case 16:
- if (spaceconfig->endianness() == ENDIANNESS_LITTLE)
+ switch (spaceconfig->addrbus_shift())
{
- if (large)
- memory.allocate<address_space_16le_large>(*this, spacenum);
+ case 3:
+ if (spaceconfig->endianness() == ENDIANNESS_LITTLE)
+ {
+ if (large)
+ memory.allocate<address_space_16_1le_large>(*this, spacenum);
+ else
+ memory.allocate<address_space_16_1le_small>(*this, spacenum);
+ }
else
- memory.allocate<address_space_16le_small>(*this, spacenum);
- }
- else
- {
- if (large)
- memory.allocate<address_space_16be_large>(*this, spacenum);
+ {
+ if (large)
+ memory.allocate<address_space_16_1be_large>(*this, spacenum);
+ else
+ memory.allocate<address_space_16_1be_small>(*this, spacenum);
+ }
+ break;
+
+ case 0:
+ if (spaceconfig->endianness() == ENDIANNESS_LITTLE)
+ {
+ if (large)
+ memory.allocate<address_space_16_8le_large>(*this, spacenum);
+ else
+ memory.allocate<address_space_16_8le_small>(*this, spacenum);
+ }
else
- memory.allocate<address_space_16be_small>(*this, spacenum);
+ {
+ if (large)
+ memory.allocate<address_space_16_8be_large>(*this, spacenum);
+ else
+ memory.allocate<address_space_16_8be_small>(*this, spacenum);
+ }
+ break;
+
+ case -1:
+ if (spaceconfig->endianness() == ENDIANNESS_LITTLE)
+ {
+ if (large)
+ memory.allocate<address_space_16_16le_large>(*this, spacenum);
+ else
+ memory.allocate<address_space_16_16le_small>(*this, spacenum);
+ }
+ else
+ {
+ if (large)
+ memory.allocate<address_space_16_16be_large>(*this, spacenum);
+ else
+ memory.allocate<address_space_16_16be_small>(*this, spacenum);
+ }
+ break;
}
break;
-
+
case 32:
- if (spaceconfig->endianness() == ENDIANNESS_LITTLE)
+ switch (spaceconfig->addrbus_shift())
{
- if (large)
- memory.allocate<address_space_32le_large>(*this, spacenum);
+ case 0:
+ if (spaceconfig->endianness() == ENDIANNESS_LITTLE)
+ {
+ if (large)
+ memory.allocate<address_space_32_8le_large>(*this, spacenum);
+ else
+ memory.allocate<address_space_32_8le_small>(*this, spacenum);
+ }
else
- memory.allocate<address_space_32le_small>(*this, spacenum);
- }
- else
- {
- if (large)
- memory.allocate<address_space_32be_large>(*this, spacenum);
+ {
+ if (large)
+ memory.allocate<address_space_32_8be_large>(*this, spacenum);
+ else
+ memory.allocate<address_space_32_8be_small>(*this, spacenum);
+ }
+ break;
+
+ case -1:
+ if (spaceconfig->endianness() == ENDIANNESS_LITTLE)
+ {
+ if (large)
+ memory.allocate<address_space_32_16le_large>(*this, spacenum);
+ else
+ memory.allocate<address_space_32_16le_small>(*this, spacenum);
+ }
else
- memory.allocate<address_space_32be_small>(*this, spacenum);
+ {
+ if (large)
+ memory.allocate<address_space_32_16be_large>(*this, spacenum);
+ else
+ memory.allocate<address_space_32_16be_small>(*this, spacenum);
+ }
+ break;
+
+ case -2:
+ if (spaceconfig->endianness() == ENDIANNESS_LITTLE)
+ {
+ if (large)
+ memory.allocate<address_space_32_32le_large>(*this, spacenum);
+ else
+ memory.allocate<address_space_32_32le_small>(*this, spacenum);
+ }
+ else
+ {
+ if (large)
+ memory.allocate<address_space_32_32be_large>(*this, spacenum);
+ else
+ memory.allocate<address_space_32_32be_small>(*this, spacenum);
+ }
+ break;
}
break;
-
+
case 64:
- if (spaceconfig->endianness() == ENDIANNESS_LITTLE)
+ switch (spaceconfig->addrbus_shift())
{
- if (large)
- memory.allocate<address_space_64le_large>(*this, spacenum);
+ case 0:
+ if (spaceconfig->endianness() == ENDIANNESS_LITTLE)
+ {
+ if (large)
+ memory.allocate<address_space_64_8le_large>(*this, spacenum);
+ else
+ memory.allocate<address_space_64_8le_small>(*this, spacenum);
+ }
else
- memory.allocate<address_space_64le_small>(*this, spacenum);
- }
- else
- {
- if (large)
- memory.allocate<address_space_64be_large>(*this, spacenum);
+ {
+ if (large)
+ memory.allocate<address_space_64_8be_large>(*this, spacenum);
+ else
+ memory.allocate<address_space_64_8be_small>(*this, spacenum);
+ }
+ break;
+
+ case -1:
+ if (spaceconfig->endianness() == ENDIANNESS_LITTLE)
+ {
+ if (large)
+ memory.allocate<address_space_64_16le_large>(*this, spacenum);
+ else
+ memory.allocate<address_space_64_16le_small>(*this, spacenum);
+ }
+ else
+ {
+ if (large)
+ memory.allocate<address_space_64_16be_large>(*this, spacenum);
+ else
+ memory.allocate<address_space_64_16be_small>(*this, spacenum);
+ }
+ break;
+
+ case -2:
+ if (spaceconfig->endianness() == ENDIANNESS_LITTLE)
+ {
+ if (large)
+ memory.allocate<address_space_64_32le_large>(*this, spacenum);
+ else
+ memory.allocate<address_space_64_32le_small>(*this, spacenum);
+ }
+ else
+ {
+ if (large)
+ memory.allocate<address_space_64_32be_large>(*this, spacenum);
+ else
+ memory.allocate<address_space_64_32be_small>(*this, spacenum);
+ }
+ break;
+
+ case -3:
+ if (spaceconfig->endianness() == ENDIANNESS_LITTLE)
+ {
+ if (large)
+ memory.allocate<address_space_64_64le_large>(*this, spacenum);
+ else
+ memory.allocate<address_space_64_64le_small>(*this, spacenum);
+ }
else
- memory.allocate<address_space_64be_small>(*this, spacenum);
+ {
+ if (large)
+ memory.allocate<address_space_64_64be_large>(*this, spacenum);
+ else
+ memory.allocate<address_space_64_64be_small>(*this, spacenum);
+ }
+ break;
}
break;
-
+
default:
- throw emu_fatalerror("Invalid width %d specified for memory_manager::allocate", spaceconfig->data_width());
+ throw emu_fatalerror("Invalid width %d specified for address_space::allocate", spaceconfig->data_width());
}
}
}
@@ -1786,19 +1955,24 @@ address_space::address_space(memory_manager &manager, device_memory_interface &m
: m_config(*memory.space_config(spacenum)),
m_device(memory.device()),
m_addrmask(0xffffffffUL >> (32 - m_config.m_addrbus_width)),
- m_bytemask(address_to_byte_end(m_addrmask)),
m_logaddrmask(0xffffffffUL >> (32 - m_config.m_logaddr_width)),
- m_logbytemask(address_to_byte_end(m_logaddrmask)),
m_unmap(0),
m_spacenum(spacenum),
m_log_unmap(true),
- m_direct(std::make_unique<direct_read_data>(*this)),
m_name(memory.space_config(spacenum)->name()),
m_addrchars((m_config.m_addrbus_width + 3) / 4),
m_logaddrchars((m_config.m_logaddr_width + 3) / 4),
m_manager(manager),
m_machine(memory.device().machine())
{
+ switch(m_config.addrbus_shift()) {
+ case 3: m_direct = static_cast<void *>(new direct_read_data< 3>(*this)); break;
+ case 0: m_direct = static_cast<void *>(new direct_read_data< 0>(*this)); break;
+ case -1: m_direct = static_cast<void *>(new direct_read_data<-1>(*this)); break;
+ case -2: m_direct = static_cast<void *>(new direct_read_data<-2>(*this)); break;
+ case -3: m_direct = static_cast<void *>(new direct_read_data<-3>(*this)); break;
+ default: fatalerror("Unsupported address shift %d\n", m_config.addrbus_shift());
+ }
}
@@ -1808,6 +1982,13 @@ address_space::address_space(memory_manager &manager, device_memory_interface &m
address_space::~address_space()
{
+ switch(m_config.addrbus_shift()) {
+ case 3: delete static_cast<direct_read_data< 3> *>(m_direct); break;
+ case 0: delete static_cast<direct_read_data< 0> *>(m_direct); break;
+ case -1: delete static_cast<direct_read_data<-1> *>(m_direct); break;
+ case -2: delete static_cast<direct_read_data<-2> *>(m_direct); break;
+ case -3: delete static_cast<direct_read_data<-3> *>(m_direct); break;
+ }
}
@@ -1822,12 +2003,6 @@ inline void address_space::adjust_addresses(offs_t &start, offs_t &end, offs_t &
mask &= m_addrmask;
start &= ~mirror & m_addrmask;
end &= ~mirror & m_addrmask;
-
- // adjust to byte values
- start = address_to_byte(start);
- end = address_to_byte_end(end);
- mask = address_to_byte_end(mask);
- mirror = address_to_byte(mirror);
}
void address_space::check_optimize_all(const char *function, offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, offs_t &nstart, offs_t &nend, offs_t &nmask, offs_t &nmirror)
@@ -1978,20 +2153,13 @@ void address_space::prepare_map()
// extract global parameters specified by the map
m_unmap = (m_map->m_unmapval == 0) ? 0 : ~0;
if (m_map->m_globalmask != 0)
- {
m_addrmask = m_map->m_globalmask;
- m_bytemask = address_to_byte_end(m_addrmask);
- }
// make a pass over the address map, adjusting for the device and getting memory pointers
for (address_map_entry &entry : m_map->m_entrylist)
{
// computed adjusted addresses first
- entry.m_bytestart = entry.m_addrstart;
- entry.m_byteend = entry.m_addrend;
- entry.m_bytemirror = entry.m_addrmirror;
- entry.m_bytemask = entry.m_addrmask ? entry.m_addrmask : ~entry.m_addrmirror;
- adjust_addresses(entry.m_bytestart, entry.m_byteend, entry.m_bytemask, entry.m_bytemirror);
+ adjust_addresses(entry.m_addrstart, entry.m_addrend, entry.m_addrmask, entry.m_addrmirror);
// if we have a share entry, add it to our map
if (entry.m_share != nullptr)
@@ -2000,8 +2168,8 @@ void address_space::prepare_map()
std::string fulltag = entry.m_devbase.subtag(entry.m_share);
if (manager().m_sharelist.find(fulltag.c_str()) == manager().m_sharelist.end())
{
- VPRINTF(("Creating share '%s' of length 0x%X\n", fulltag.c_str(), entry.m_byteend + 1 - entry.m_bytestart));
- manager().m_sharelist.emplace(fulltag.c_str(), std::make_unique<memory_share>(m_map->m_databits, entry.m_byteend + 1 - entry.m_bytestart, endianness()));
+ VPRINTF(("Creating share '%s' of length 0x%X\n", fulltag.c_str(), entry.m_addrend + 1 - entry.m_addrstart));
+ manager().m_sharelist.emplace(fulltag.c_str(), std::make_unique<memory_share>(m_map->m_databits, entry.m_addrend + 1 - entry.m_addrstart, endianness()));
}
}
@@ -2009,10 +2177,10 @@ void address_space::prepare_map()
if (m_spacenum == 0 && entry.m_read.m_type == AMH_ROM && entry.m_region == nullptr)
{
// make sure it fits within the memory region before doing so, however
- if (entry.m_byteend < devregionsize)
+ if (entry.m_addrend < devregionsize)
{
entry.m_region = m_device.tag();
- entry.m_rgnoffs = entry.m_bytestart;
+ entry.m_rgnoffs = address_to_byte(entry.m_addrstart);
}
}
@@ -2028,7 +2196,7 @@ void address_space::prepare_map()
fatalerror("device '%s' %s space memory map entry %X-%X references non-existant region \"%s\"\n", m_device.tag(), m_name, entry.m_addrstart, entry.m_addrend, entry.m_region);
// validate the region
- if (entry.m_rgnoffs + (entry.m_byteend - entry.m_bytestart + 1) > region->bytes())
+ if (entry.m_rgnoffs + m_config.addr2byte(entry.m_addrend - entry.m_addrstart + 1) > region->bytes())
fatalerror("device '%s' %s space memory map entry %X-%X extends beyond region \"%s\" size (%X)\n", m_device.tag(), m_name, entry.m_addrstart, entry.m_addrend, entry.m_region, region->bytes());
}
@@ -2044,8 +2212,8 @@ void address_space::prepare_map()
}
// now loop over all the handlers and enforce the address mask
- read().mask_all_handlers(m_bytemask);
- write().mask_all_handlers(m_bytemask);
+ read().mask_all_handlers(m_addrmask);
+ write().mask_all_handlers(m_addrmask);
}
@@ -2176,13 +2344,13 @@ void address_space::allocate_memory()
int tail = blocklist.size();
for (address_map_entry &entry : m_map->m_entrylist)
if (entry.m_memory != nullptr)
- blocklist.push_back(std::make_unique<memory_block>(*this, entry.m_bytestart, entry.m_byteend, entry.m_memory));
+ blocklist.push_back(std::make_unique<memory_block>(*this, entry.m_addrstart, entry.m_addrend, entry.m_memory));
// loop over all blocks just allocated and assign pointers from them
address_map_entry *unassigned = nullptr;
for (auto memblock = blocklist.begin() + tail; memblock != blocklist.end(); ++memblock)
- unassigned = block_assign_intersecting(memblock->get()->bytestart(), memblock->get()->byteend(), memblock->get()->data());
+ unassigned = block_assign_intersecting(memblock->get()->addrstart(), memblock->get()->addrend(), memblock->get()->data());
// if we don't have an unassigned pointer yet, try to find one
if (unassigned == nullptr)
@@ -2192,8 +2360,8 @@ void address_space::allocate_memory()
while (unassigned != nullptr)
{
// work in MEMORY_BLOCK_CHUNK-sized chunks
- offs_t curblockstart = unassigned->m_bytestart / MEMORY_BLOCK_CHUNK;
- offs_t curblockend = unassigned->m_byteend / MEMORY_BLOCK_CHUNK;
+ offs_t curblockstart = unassigned->m_addrstart / MEMORY_BLOCK_CHUNK;
+ offs_t curblockend = unassigned->m_addrend / MEMORY_BLOCK_CHUNK;
// loop while we keep finding unassigned blocks in neighboring MEMORY_BLOCK_CHUNK chunks
bool changed;
@@ -2206,8 +2374,8 @@ void address_space::allocate_memory()
if (entry.m_memory == nullptr && &entry != unassigned && needs_backing_store(entry))
{
// get block start/end blocks for this block
- offs_t blockstart = entry.m_bytestart / MEMORY_BLOCK_CHUNK;
- offs_t blockend = entry.m_byteend / MEMORY_BLOCK_CHUNK;
+ offs_t blockstart = entry.m_addrstart / MEMORY_BLOCK_CHUNK;
+ offs_t blockend = entry.m_addrend / MEMORY_BLOCK_CHUNK;
// if we intersect or are adjacent, adjust the start/end
if (blockstart <= curblockend + 1 && blockend >= curblockstart - 1)
@@ -2221,12 +2389,12 @@ void address_space::allocate_memory()
} while (changed);
// we now have a block to allocate; do it
- offs_t curbytestart = curblockstart * MEMORY_BLOCK_CHUNK;
- offs_t curbyteend = curblockend * MEMORY_BLOCK_CHUNK + (MEMORY_BLOCK_CHUNK - 1);
- auto block = std::make_unique<memory_block>(*this, curbytestart, curbyteend);
+ offs_t curaddrstart = curblockstart * MEMORY_BLOCK_CHUNK;
+ offs_t curaddrend = curblockend * MEMORY_BLOCK_CHUNK + (MEMORY_BLOCK_CHUNK - 1);
+ auto block = std::make_unique<memory_block>(*this, curaddrstart, curaddrend);
// assign memory that intersected the new block
- unassigned = block_assign_intersecting(curbytestart, curbyteend, block.get()->data());
+ unassigned = block_assign_intersecting(curaddrstart, curaddrend, block.get()->data());
blocklist.push_back(std::move(block));
}
}
@@ -2245,7 +2413,7 @@ void address_space::locate_memory()
{
// set the initial bank pointer
for (address_map_entry &entry : m_map->m_entrylist)
- if (entry.m_bytestart == bank.second->bytestart() && entry.m_memory != nullptr)
+ if (entry.m_addrstart == bank.second->addrstart() && entry.m_memory != nullptr)
{
bank.second->set_base(entry.m_memory);
VPRINTF(("assigned bank '%s' pointer to memory from range %08X-%08X [%p]\n", bank.second->tag(), entry.m_addrstart, entry.m_addrend, entry.m_memory));
@@ -2266,7 +2434,7 @@ void address_space::locate_memory()
// intersecting blocks and assign their pointers
//-------------------------------------------------
-address_map_entry *address_space::block_assign_intersecting(offs_t bytestart, offs_t byteend, u8 *base)
+address_map_entry *address_space::block_assign_intersecting(offs_t addrstart, offs_t addrend, u8 *base)
{
address_map_entry *unassigned = nullptr;
@@ -2290,10 +2458,10 @@ address_map_entry *address_space::block_assign_intersecting(offs_t bytestart, of
}
// otherwise, look for a match in this block
- if (entry.m_memory == nullptr && entry.m_bytestart >= bytestart && entry.m_byteend <= byteend)
+ if (entry.m_memory == nullptr && entry.m_addrstart >= addrstart && entry.m_addrend <= addrend)
{
- entry.m_memory = base + (entry.m_bytestart - bytestart);
- VPRINTF(("memory range %08X-%08X -> found in block from %08X-%08X [%p]\n", entry.m_addrstart, entry.m_addrend, bytestart, byteend, entry.m_memory));
+ entry.m_memory = base + m_config.addr2byte(entry.m_addrstart - addrstart);
+ VPRINTF(("memory range %08X-%08X -> found in block from %08X-%08X [%p]\n", entry.m_addrstart, entry.m_addrend, addrstart, addrend, entry.m_memory));
}
// if we're the first match on a shared pointer, assign it now
@@ -2322,12 +2490,12 @@ address_map_entry *address_space::block_assign_intersecting(offs_t bytestart, of
// describing the handler at a particular offset
//-------------------------------------------------
-const char *address_space::get_handler_string(read_or_write readorwrite, offs_t byteaddress)
+const char *address_space::get_handler_string(read_or_write readorwrite, offs_t address)
{
if (readorwrite == read_or_write::READ)
- return read().handler_name(read().lookup(byteaddress));
+ return read().handler_name(read().lookup(address));
else
- return write().handler_name(write().lookup(byteaddress));
+ return write().handler_name(write().lookup(address));
}
@@ -2343,17 +2511,17 @@ void address_space::dump_map(FILE *file, read_or_write readorwrite)
// dump generic information
fprintf(file, " Address bits = %d\n", m_config.m_addrbus_width);
fprintf(file, " Data bits = %d\n", m_config.m_databus_width);
- fprintf(file, " Address mask = %X\n", m_bytemask);
+ fprintf(file, " Address mask = %X\n", m_addrmask);
fprintf(file, "\n");
// iterate over addresses
- offs_t bytestart, byteend;
- for (offs_t byteaddress = 0; byteaddress <= m_bytemask; byteaddress = byteend)
+ offs_t addrstart, addrend;
+ for (offs_t address = 0; address <= m_addrmask; address = addrend)
{
- u16 entry = table.derive_range(byteaddress, bytestart, byteend);
+ u16 entry = table.derive_range(address, addrstart, addrend);
fprintf(file, "%08X-%08X = %02X: %s [offset=%08X]\n",
- bytestart, byteend, entry, table.handler_name(entry), table.handler(entry).bytestart());
- if (++byteend == 0)
+ addrstart, addrend, entry, table.handler_name(entry), table.handler(entry).addrstart());
+ if (++addrend == 0)
break;
}
}
@@ -2549,7 +2717,7 @@ void address_space::install_ram_generic(offs_t addrstart, offs_t addrend, offs_t
{
if (machine().phase() >= machine_phase::RESET)
fatalerror("Attempted to call install_ram_generic() after initialization time without a baseptr!\n");
- auto block = std::make_unique<memory_block>(*this, address_to_byte(addrstart), address_to_byte_end(addrend));
+ auto block = std::make_unique<memory_block>(*this, addrstart, addrend);
bank.set_base(block.get()->data());
manager().m_blocklist.push_back(std::move(block));
}
@@ -2739,10 +2907,7 @@ void address_space::install_setoffset_handler(offs_t addrstart, offs_t addrend,
void *address_space::find_backing_memory(offs_t addrstart, offs_t addrend)
{
- offs_t bytestart = address_to_byte(addrstart);
- offs_t byteend = address_to_byte_end(addrend);
-
- VPRINTF(("address_space::find_backing_memory('%s',%s,%08X-%08X) -> ", m_device.tag(), m_name, bytestart, byteend));
+ VPRINTF(("address_space::find_backing_memory('%s',%s,%08X-%08X) -> ", m_device.tag(), m_name, addrstart, addrend));
if (m_map == nullptr)
return nullptr;
@@ -2750,21 +2915,19 @@ void *address_space::find_backing_memory(offs_t addrstart, offs_t addrend)
// look in the address map first
for (address_map_entry &entry : m_map->m_entrylist)
{
- offs_t maskstart = bytestart & entry.m_bytemask;
- offs_t maskend = byteend & entry.m_bytemask;
- if (entry.m_memory != nullptr && maskstart >= entry.m_bytestart && maskend <= entry.m_byteend)
+ if (entry.m_memory != nullptr && addrstart >= entry.m_addrstart && addrend <= entry.m_addrend)
{
- VPRINTF(("found in entry %08X-%08X [%p]\n", entry.m_addrstart, entry.m_addrend, (u8 *)entry.m_memory + (maskstart - entry.m_bytestart)));
- return (u8 *)entry.m_memory + (maskstart - entry.m_bytestart);
+ VPRINTF(("found in entry %08X-%08X [%p]\n", entry.m_addrstart, entry.m_addrend, (u8 *)entry.m_memory + address_to_byte(addrstart - entry.m_addrstart)));
+ return (u8 *)entry.m_memory + address_to_byte(addrstart - entry.m_addrstart);
}
}
// if not found there, look in the allocated blocks
for (auto &block : manager().m_blocklist)
- if (block->contains(*this, bytestart, byteend))
+ if (block->contains(*this, addrstart, addrend))
{
- VPRINTF(("found in allocated memory block %08X-%08X [%p]\n", block->bytestart(), block->byteend(), block->data() + (bytestart - block->bytestart())));
- return block->data() + bytestart - block->bytestart();
+ VPRINTF(("found in allocated memory block %08X-%08X [%p]\n", block->addrstart(), block->addrend(), block->data() + address_to_byte(addrstart - block->addrstart())));
+ return block->data() + address_to_byte(addrstart - block->addrstart());
}
VPRINTF(("did not find\n"));
@@ -2818,11 +2981,8 @@ bool address_space::needs_backing_store(const address_map_entry &entry)
memory_bank &address_space::bank_find_or_allocate(const char *tag, offs_t addrstart, offs_t addrend, offs_t addrmirror, read_or_write readorwrite)
{
// adjust the addresses, handling mirrors and such
- offs_t bytemirror = addrmirror;
- offs_t bytestart = addrstart;
- offs_t bytemask = ~addrmirror;
- offs_t byteend = addrend;
- adjust_addresses(bytestart, byteend, bytemask, bytemirror);
+ offs_t addrmask = ~addrmirror;
+ adjust_addresses(addrstart, addrend, addrmask, addrmirror);
// look up the bank by name, or else by byte range
memory_bank *membank = nullptr;
@@ -2832,7 +2992,7 @@ memory_bank &address_space::bank_find_or_allocate(const char *tag, offs_t addrst
membank = bank->second.get();
}
else {
- membank = bank_find_anonymous(bytestart, byteend);
+ membank = bank_find_anonymous(addrstart, addrend);
}
// if we don't have a bank yet, find a free one
@@ -2845,11 +3005,11 @@ memory_bank &address_space::bank_find_or_allocate(const char *tag, offs_t addrst
if (tag != nullptr)
throw emu_fatalerror("Unable to allocate new bank '%s'", tag);
else
- throw emu_fatalerror("Unable to allocate bank for RAM/ROM area %X-%X\n", bytestart, byteend);
+ throw emu_fatalerror("Unable to allocate bank for RAM/ROM area %X-%X\n", addrstart, addrend);
}
// if no tag, create a unique one
- auto bank = std::make_unique<memory_bank>(*this, banknum, bytestart, byteend, tag);
+ auto bank = std::make_unique<memory_bank>(*this, banknum, addrstart, addrend, tag);
std::string temptag;
if (tag == nullptr) {
temptag = string_format("anon_%p", bank.get());
@@ -2869,17 +3029,56 @@ memory_bank &address_space::bank_find_or_allocate(const char *tag, offs_t addrst
// bank_find_anonymous - try to find an anonymous
// bank matching the given byte range
//-------------------------------------------------
-memory_bank *address_space::bank_find_anonymous(offs_t bytestart, offs_t byteend) const
+memory_bank *address_space::bank_find_anonymous(offs_t addrstart, offs_t addrend) const
{
// try to find an exact match
for (auto &bank : manager().banks())
- if (bank.second->anonymous() && bank.second->references_space(*this, read_or_write::READWRITE) && bank.second->matches_exactly(bytestart, byteend))
+ if (bank.second->anonymous() && bank.second->references_space(*this, read_or_write::READWRITE) && bank.second->matches_exactly(addrstart, addrend))
return bank.second.get();
// not found
return nullptr;
}
+//-------------------------------------------------
+// address_space::invalidate_read_caches -- clear
+// the read cache (direct) for a specific entry
+// or all of them
+//-------------------------------------------------
+
+void address_space::invalidate_read_caches()
+{
+ switch(m_config.addrbus_shift()) {
+ case 3: static_cast<direct_read_data< 3> *>(m_direct)->force_update(); break;
+ case 0: static_cast<direct_read_data< 0> *>(m_direct)->force_update(); break;
+ case -1: static_cast<direct_read_data<-1> *>(m_direct)->force_update(); break;
+ case -2: static_cast<direct_read_data<-2> *>(m_direct)->force_update(); break;
+ case -3: static_cast<direct_read_data<-3> *>(m_direct)->force_update(); break;
+ }
+}
+
+void address_space::invalidate_read_caches(u16 entry)
+{
+ switch(m_config.addrbus_shift()) {
+ case 3: static_cast<direct_read_data< 3> *>(m_direct)->force_update(entry); break;
+ case 0: static_cast<direct_read_data< 0> *>(m_direct)->force_update(entry); break;
+ case -1: static_cast<direct_read_data<-1> *>(m_direct)->force_update(entry); break;
+ case -2: static_cast<direct_read_data<-2> *>(m_direct)->force_update(entry); break;
+ case -3: static_cast<direct_read_data<-3> *>(m_direct)->force_update(entry); break;
+ }
+}
+
+void address_space::invalidate_read_caches(offs_t start, offs_t end)
+{
+ switch(m_config.addrbus_shift()) {
+ case 3: static_cast<direct_read_data< 3> *>(m_direct)->remove_intersecting_ranges(start, end); break;
+ case 0: static_cast<direct_read_data< 0> *>(m_direct)->remove_intersecting_ranges(start, end); break;
+ case -1: static_cast<direct_read_data<-1> *>(m_direct)->remove_intersecting_ranges(start, end); break;
+ case -2: static_cast<direct_read_data<-2> *>(m_direct)->remove_intersecting_ranges(start, end); break;
+ case -3: static_cast<direct_read_data<-3> *>(m_direct)->remove_intersecting_ranges(start, end); break;
+ }
+}
+
//**************************************************************************
// TABLE MANAGEMENT
@@ -2935,27 +3134,23 @@ address_table::~address_table()
void address_table::map_range(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, u16 entry)
{
// convert addresses to bytes
- offs_t bytestart = addrstart;
- offs_t byteend = addrend;
- offs_t bytemask = addrmask;
- offs_t bytemirror = addrmirror;
- m_space.adjust_addresses(bytestart, byteend, bytemask, bytemirror);
+ m_space.adjust_addresses(addrstart, addrend, addrmask, addrmirror);
// validity checks
assert_always(addrstart <= addrend, "address_table::map_range called with start greater than end");
- assert_always((bytestart & (m_space.data_width() / 8 - 1)) == 0, "address_table::map_range called with misaligned start address");
- assert_always((byteend & (m_space.data_width() / 8 - 1)) == (m_space.data_width() / 8 - 1), "address_table::map_range called with misaligned end address");
+ assert_always((addrstart & (m_space.alignment() - 1)) == 0, "address_table::map_range called with misaligned start address");
+ assert_always((addrend & (m_space.alignment() - 1)) == (m_space.alignment() - 1), "address_table::map_range called with misaligned end address");
// configure the entry to our parameters (but not for static non-banked cases)
handler_entry &curentry = handler(entry);
if (entry <= STATIC_BANKMAX || entry >= STATIC_COUNT)
- curentry.configure(bytestart, byteend, bytemask);
+ curentry.configure(addrstart, addrend, addrmask, m_space.address_to_byte_end(addrmask));
// populate it
- populate_range_mirrored(bytestart, byteend, bytemirror, entry);
+ populate_range_mirrored(addrstart, addrend, addrmirror, entry);
// recompute any direct access on this space if it is a read modification
- m_space.m_direct->force_update(entry);
+ m_space.invalidate_read_caches(entry);
// verify_reference_counts();
}
@@ -3022,16 +3217,14 @@ namespace {
void address_table::setup_range_masked(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, u64 mask, std::list<u32> &entries)
{
// convert addresses to bytes
- offs_t bytestart = addrstart;
- offs_t byteend = addrend;
- offs_t bytemask = addrmask;
- offs_t bytemirror = addrmirror;
- m_space.adjust_addresses(bytestart, byteend, bytemask, bytemirror);
+ m_space.adjust_addresses(addrstart, addrend, addrmask, addrmirror);
// Validity checks
assert_always(addrstart <= addrend, "address_table::setup_range called with start greater than end");
- assert_always((bytestart & (m_space.data_width() / 8 - 1)) == 0, "address_table::setup_range called with misaligned start address");
- assert_always((byteend & (m_space.data_width() / 8 - 1)) == (m_space.data_width() / 8 - 1), "address_table::setup_range called with misaligned end address");
+ assert_always((addrstart & (m_space.alignment() - 1)) == 0, "address_table::setup_range called with misaligned start address");
+ assert_always((addrend & (m_space.alignment() - 1)) == (m_space.alignment() - 1), "address_table::setup_range called with misaligned end address");
+
+ offs_t bytemask = m_space.address_to_byte_end(addrmask);
// Scan the memory to see what has to be done
std::list<subrange> range_override;
@@ -3040,8 +3233,8 @@ void address_table::setup_range_masked(offs_t addrstart, offs_t addrend, offs_t
offs_t base_mirror = 0;
do
{
- offs_t base_address = base_mirror | bytestart;
- offs_t end_address = base_mirror | byteend;
+ offs_t base_address = base_mirror | addrstart;
+ offs_t end_address = base_mirror | addrend;
do
{
@@ -3059,7 +3252,7 @@ void address_table::setup_range_masked(offs_t addrstart, offs_t addrend, offs_t
while (base_address != end_address + 1);
// Efficient method to go to the next range start given a mirroring mask
- base_mirror = (base_mirror + 1 + ~bytemirror) & bytemirror;
+ base_mirror = (base_mirror + 1 + ~addrmirror) & addrmirror;
}
while (base_mirror);
@@ -3071,7 +3264,7 @@ void address_table::setup_range_masked(offs_t addrstart, offs_t addrend, offs_t
// configure the entry to our parameters
handler_entry &curentry = handler(entry);
- curentry.configure(bytestart, byteend, bytemask);
+ curentry.configure(addrstart, addrend, addrmask, bytemask);
// Populate it wherever needed
for (std::list<subrange>::const_iterator i = range_override.begin(); i != range_override.end(); ++i)
@@ -3081,7 +3274,7 @@ void address_table::setup_range_masked(offs_t addrstart, offs_t addrend, offs_t
entries.push_back(entry);
// recompute any direct access on this space if it is a read modification
- m_space.m_direct->force_update(entry);
+ m_space.invalidate_read_caches(entry);
}
// Ranges in range_partial must be duplicated then partially changed
@@ -3111,7 +3304,7 @@ void address_table::setup_range_masked(offs_t addrstart, offs_t addrend, offs_t
curentry.clear_conflicting_subunits(mask);
// Reconfigure the base addresses
- curentry.configure(bytestart, byteend, bytemask);
+ curentry.configure(addrstart, addrend, addrmask, bytemask);
// Populate it wherever needed
for (const auto & elem : i->second)
@@ -3123,7 +3316,7 @@ void address_table::setup_range_masked(offs_t addrstart, offs_t addrend, offs_t
entries.push_back(entry);
// recompute any direct access on this space if it is a read modification
- m_space.m_direct->force_update(entry);
+ m_space.invalidate_read_caches(entry);
}
}
@@ -3182,16 +3375,16 @@ void address_table::verify_reference_counts()
// range of addresses
//-------------------------------------------------
-void address_table::populate_range(offs_t bytestart, offs_t byteend, u16 handlerindex)
+void address_table::populate_range(offs_t addrstart, offs_t addrend, u16 handlerindex)
{
offs_t l2mask = (1 << level2_bits()) - 1;
- offs_t l1start = bytestart >> level2_bits();
- offs_t l2start = bytestart & l2mask;
- offs_t l1stop = byteend >> level2_bits();
- offs_t l2stop = byteend & l2mask;
+ offs_t l1start = addrstart >> level2_bits();
+ offs_t l2start = addrstart & l2mask;
+ offs_t l1stop = addrend >> level2_bits();
+ offs_t l2stop = addrend & l2mask;
// sanity check
- if (bytestart > byteend)
+ if (addrstart > addrend)
return;
// handle the starting edge if it's not on a block boundary
@@ -3267,19 +3460,19 @@ void address_table::populate_range(offs_t bytestart, offs_t byteend, u16 handler
// mirrors
//-------------------------------------------------
-void address_table::populate_range_mirrored(offs_t bytestart, offs_t byteend, offs_t bytemirror, u16 handlerindex)
+void address_table::populate_range_mirrored(offs_t addrstart, offs_t addrend, offs_t addrmirror, u16 handlerindex)
{
// determine the mirror bits
offs_t lmirrorbits = 0;
offs_t lmirrorbit[32];
for (int bit = 0; bit < level2_bits(); bit++)
- if (bytemirror & (1 << bit))
+ if (addrmirror & (1 << bit))
lmirrorbit[lmirrorbits++] = 1 << bit;
offs_t hmirrorbits = 0;
offs_t hmirrorbit[32];
for (int bit = level2_bits(); bit < 32; bit++)
- if (bytemirror & (1 << bit))
+ if (addrmirror & (1 << bit))
hmirrorbit[hmirrorbits++] = 1 << bit;
// loop over mirrors in the level 2 table
@@ -3301,14 +3494,14 @@ void address_table::populate_range_mirrored(offs_t bytestart, offs_t byteend, of
for (int bit = 0; bit < lmirrorbits; bit++)
if (lmirrorcount & (1 << bit))
lmirrorbase |= lmirrorbit[bit];
- m_space.m_direct->remove_intersecting_ranges(bytestart + lmirrorbase, byteend + lmirrorbase);
+ m_space.invalidate_read_caches(addrstart + lmirrorbase, addrend + lmirrorbase);
}
// if this is not our first time through, and the level 2 entry matches the previous
// level 2 entry, just do a quick map and get out; note that this only works for entries
// which don't span multiple level 1 table entries
- int cur_index = level1_index(bytestart + hmirrorbase);
- if (cur_index == level1_index(byteend + hmirrorbase))
+ int cur_index = level1_index(addrstart + hmirrorbase);
+ if (cur_index == level1_index(addrend + hmirrorbase))
{
if (hmirrorcount != 0 && prev_entry == m_table[cur_index])
{
@@ -3344,7 +3537,7 @@ void address_table::populate_range_mirrored(offs_t bytestart, offs_t byteend, of
lmirrorbase |= lmirrorbit[bit];
// populate the tables
- populate_range(bytestart + lmirrorbase, byteend + lmirrorbase, handlerindex);
+ populate_range(addrstart + lmirrorbase, addrend + lmirrorbase, handlerindex);
}
}
}
@@ -3356,22 +3549,22 @@ void address_table::populate_range_mirrored(offs_t bytestart, offs_t byteend, of
// range based on the lookup tables
//-------------------------------------------------
-u16 address_table::derive_range(offs_t byteaddress, offs_t &bytestart, offs_t &byteend) const
+u16 address_table::derive_range(offs_t address, offs_t &addrstart, offs_t &addrend) const
{
// look up the initial address to get the entry we care about
u16 l1entry;
- u16 entry = l1entry = m_table[level1_index(byteaddress)];
+ u16 entry = l1entry = m_table[level1_index(address)];
if (l1entry >= SUBTABLE_BASE)
- entry = m_table[level2_index(l1entry, byteaddress)];
+ entry = m_table[level2_index(l1entry, address)];
- // use the bytemask of the entry to set minimum and maximum bounds
+ // use the addrmask of the entry to set minimum and maximum bounds
offs_t minscan, maxscan;
- handler(entry).mirrored_start_end(byteaddress, minscan, maxscan);
+ handler(entry).mirrored_start_end(address, minscan, maxscan);
// first scan backwards to find the start address
u16 curl1entry = l1entry;
u16 curentry = entry;
- bytestart = byteaddress;
+ addrstart = address;
while (1)
{
// if we need to scan the subtable, do it
@@ -3381,7 +3574,7 @@ u16 address_table::derive_range(offs_t byteaddress, offs_t &bytestart, offs_t &b
u32 index;
// scan backwards from the current address, until the previous entry doesn't match
- for (index = level2_index(curl1entry, bytestart); index > minindex; index--, bytestart -= 1)
+ for (index = level2_index(curl1entry, addrstart); index > minindex; index--, addrstart -= 1)
if (m_table[index - 1] != entry)
break;
@@ -3391,25 +3584,25 @@ u16 address_table::derive_range(offs_t byteaddress, offs_t &bytestart, offs_t &b
}
// move to the beginning of this L1 entry; stop at the minimum address
- bytestart &= ~((1 << level2_bits()) - 1);
- if (bytestart <= minscan)
+ addrstart &= ~((1 << level2_bits()) - 1);
+ if (addrstart <= minscan)
break;
// look up the entry of the byte at the end of the previous L1 entry; if it doesn't match, stop
- curentry = curl1entry = m_table[level1_index(bytestart - 1)];
+ curentry = curl1entry = m_table[level1_index(addrstart - 1)];
if (curl1entry >= SUBTABLE_BASE)
- curentry = m_table[level2_index(curl1entry, bytestart - 1)];
+ curentry = m_table[level2_index(curl1entry, addrstart - 1)];
if (curentry != entry)
break;
// move into the previous entry and resume searching
- bytestart -= 1;
+ addrstart -= 1;
}
// then scan forwards to find the end address
curl1entry = l1entry;
curentry = entry;
- byteend = byteaddress;
+ addrend = address;
while (1)
{
// if we need to scan the subtable, do it
@@ -3419,7 +3612,7 @@ u16 address_table::derive_range(offs_t byteaddress, offs_t &bytestart, offs_t &b
u32 index;
// scan forwards from the current address, until the next entry doesn't match
- for (index = level2_index(curl1entry, byteend); index < maxindex; index++, byteend += 1)
+ for (index = level2_index(curl1entry, addrend); index < maxindex; index++, addrend += 1)
if (m_table[index + 1] != entry)
break;
@@ -3429,19 +3622,19 @@ u16 address_table::derive_range(offs_t byteaddress, offs_t &bytestart, offs_t &b
}
// move to the end of this L1 entry; stop at the maximum address
- byteend |= (1 << level2_bits()) - 1;
- if (byteend >= maxscan)
+ addrend |= (1 << level2_bits()) - 1;
+ if (addrend >= maxscan)
break;
// look up the entry of the byte at the start of the next L1 entry; if it doesn't match, stop
- curentry = curl1entry = m_table[level1_index(byteend + 1)];
+ curentry = curl1entry = m_table[level1_index(addrend + 1)];
if (curl1entry >= SUBTABLE_BASE)
- curentry = m_table[level2_index(curl1entry, byteend + 1)];
+ curentry = m_table[level2_index(curl1entry, addrend + 1)];
if (curentry != entry)
break;
// move into the next entry and resume searching
- byteend += 1;
+ addrend += 1;
}
return entry;
@@ -3746,9 +3939,9 @@ address_table_read::address_table_read(address_space &space, bool large)
}
// reset the byte masks on the special handlers to open up the full address space for proper reporting
- m_handlers[STATIC_UNMAP]->configure(0, space.bytemask(), ~0);
- m_handlers[STATIC_NOP]->configure(0, space.bytemask(), ~0);
- m_handlers[STATIC_WATCHPOINT]->configure(0, space.bytemask(), ~0);
+ m_handlers[STATIC_UNMAP]->configure(0, space.addrmask(), ~0, ~0);
+ m_handlers[STATIC_NOP]->configure(0, space.addrmask(), ~0, ~0);
+ m_handlers[STATIC_WATCHPOINT]->configure(0, space.addrmask(), ~0, ~0);
}
@@ -3820,9 +4013,9 @@ address_table_write::address_table_write(address_space &space, bool large)
}
// reset the byte masks on the special handlers to open up the full address space for proper reporting
- m_handlers[STATIC_UNMAP]->configure(0, space.bytemask(), ~0);
- m_handlers[STATIC_NOP]->configure(0, space.bytemask(), ~0);
- m_handlers[STATIC_WATCHPOINT]->configure(0, space.bytemask(), ~0);
+ m_handlers[STATIC_UNMAP]->configure(0, space.addrmask(), ~0, ~0);
+ m_handlers[STATIC_NOP]->configure(0, space.addrmask(), ~0, ~0);
+ m_handlers[STATIC_WATCHPOINT]->configure(0, space.addrmask(), ~0, ~0);
}
@@ -3856,12 +4049,12 @@ handler_entry &address_table_write::handler(u32 index) const
// direct_read_data - constructor
//-------------------------------------------------
-direct_read_data::direct_read_data(address_space &space)
+template<int addr_shift> direct_read_data<addr_shift>::direct_read_data(address_space &space)
: m_space(space),
m_ptr(nullptr),
- m_bytemask(space.bytemask()),
- m_bytestart(1),
- m_byteend(0),
+ m_addrmask(space.addrmask()),
+ m_addrstart(1),
+ m_addrend(0),
m_entry(STATIC_UNMAP)
{
}
@@ -3871,7 +4064,7 @@ direct_read_data::direct_read_data(address_space &space)
// ~direct_read_data - destructor
//-------------------------------------------------
-direct_read_data::~direct_read_data()
+template<int addr_shift> direct_read_data<addr_shift>::~direct_read_data()
{
}
@@ -3881,29 +4074,35 @@ direct_read_data::~direct_read_data()
// update the opcode base for the given address
//-------------------------------------------------
-bool direct_read_data::set_direct_region(offs_t byteaddress)
+template<int addr_shift> bool direct_read_data<addr_shift>::set_direct_region(offs_t address)
{
// find or allocate a matching range
- direct_range *range = find_range(byteaddress, m_entry);
+ direct_range *range = find_range(address, m_entry);
// if we don't map to a bank, return false
if (m_entry < STATIC_BANK1 || m_entry > STATIC_BANKMAX)
{
// ensure future updates to land here as well until we get back into a bank
- m_byteend = 0;
- m_bytestart = 1;
+ m_addrend = 0;
+ m_addrstart = 1;
return false;
}
u8 *base = *m_space.manager().bank_pointer_addr(m_entry);
// compute the adjusted base
- offs_t maskedbits = byteaddress & ~m_space.bytemask();
+ offs_t maskedbits = address & ~m_space.addrmask();
const handler_entry_read &handler = m_space.read().handler_read(m_entry);
- m_bytemask = handler.bytemask();
- m_ptr = base - (handler.bytestart() & m_bytemask);
- m_bytestart = maskedbits | range->m_bytestart;
- m_byteend = maskedbits | range->m_byteend;
+ m_addrmask = handler.addrmask();
+ u32 delta = handler.addrstart() & m_addrmask;
+ if(addr_shift < 0)
+ delta = delta << iabs(addr_shift);
+ else if(addr_shift > 0)
+ delta = delta >> iabs(addr_shift);
+
+ m_ptr = base - delta;
+ m_addrstart = maskedbits | range->m_addrstart;
+ m_addrend = maskedbits | range->m_addrend;
return true;
}
@@ -3912,20 +4111,20 @@ bool direct_read_data::set_direct_region(offs_t byteaddress)
// find_range - find a byte address in a range
//-------------------------------------------------
-direct_read_data::direct_range *direct_read_data::find_range(offs_t byteaddress, u16 &entry)
+template<int addr_shift> typename direct_read_data<addr_shift>::direct_range *direct_read_data<addr_shift>::find_range(offs_t address, u16 &entry)
{
// determine which entry
- byteaddress &= m_space.m_bytemask;
- entry = m_space.read().lookup_live_nowp(byteaddress);
+ address &= m_space.m_addrmask;
+ entry = m_space.read().lookup_live_nowp(address);
// scan our table
for (auto &range : m_rangelist[entry])
- if (byteaddress >= range.m_bytestart && byteaddress <= range.m_byteend)
+ if (address >= range.m_addrstart && address <= range.m_addrend)
return &range;
// didn't find out; create a new one
direct_range range;
- m_space.read().derive_range(byteaddress, range.m_bytestart, range.m_byteend);
+ m_space.read().derive_range(address, range.m_addrstart, range.m_addrend);
m_rangelist[entry].push_front(range);
return &m_rangelist[entry].front();
@@ -3937,7 +4136,7 @@ direct_read_data::direct_range *direct_read_data::find_range(offs_t byteaddress,
// ranges that intersect the given address range
//-------------------------------------------------
-void direct_read_data::remove_intersecting_ranges(offs_t bytestart, offs_t byteend)
+template<int addr_shift> void direct_read_data<addr_shift>::remove_intersecting_ranges(offs_t addrstart, offs_t addrend)
{
// loop over all entries
for (auto & elem : m_rangelist)
@@ -3946,7 +4145,7 @@ void direct_read_data::remove_intersecting_ranges(offs_t bytestart, offs_t bytee
for (auto range = elem.begin(); range!=elem.end();)
{
// if we intersect, remove
- if (bytestart <= range->m_byteend && byteend >= range->m_bytestart)
+ if (addrstart <= range->m_addrend && addrend >= range->m_addrstart)
range = elem.erase(range);
else
range ++;
@@ -3954,6 +4153,12 @@ void direct_read_data::remove_intersecting_ranges(offs_t bytestart, offs_t bytee
}
}
+template class direct_read_data<3>;
+template class direct_read_data<0>;
+template class direct_read_data<-1>;
+template class direct_read_data<-2>;
+template class direct_read_data<-3>;
+
//**************************************************************************
// MEMORY BLOCK
@@ -3963,15 +4168,15 @@ void direct_read_data::remove_intersecting_ranges(offs_t bytestart, offs_t bytee
// memory_block - constructor
//-------------------------------------------------
-memory_block::memory_block(address_space &space, offs_t bytestart, offs_t byteend, void *memory)
+memory_block::memory_block(address_space &space, offs_t addrstart, offs_t addrend, void *memory)
: m_machine(space.machine()),
m_space(space),
- m_bytestart(bytestart),
- m_byteend(byteend),
+ m_addrstart(addrstart),
+ m_addrend(addrend),
m_data(reinterpret_cast<u8 *>(memory))
{
- offs_t const length = byteend + 1 - bytestart;
- VPRINTF(("block_allocate('%s',%s,%08X,%08X,%p)\n", space.device().tag(), space.name(), bytestart, byteend, memory));
+ offs_t const length = space.address_to_byte(addrend + 1 - addrstart);
+ VPRINTF(("block_allocate('%s',%s,%08X,%08X,%p)\n", space.device().tag(), space.name(), addrstart, addrend, memory));
// allocate a block if needed
if (m_data == nullptr)
@@ -3996,8 +4201,8 @@ memory_block::memory_block(address_space &space, offs_t bytestart, offs_t byteen
else
{
int bytes_per_element = space.data_width() / 8;
- std::string name = string_format("%08x-%08x", bytestart, byteend);
- space.machine().save().save_memory(nullptr, "memory", space.device().tag(), space.spacenum(), name.c_str(), m_data, bytes_per_element, (u32)length / bytes_per_element);
+ std::string name = string_format("%08x-%08x", addrstart, addrend);
+ space.machine().save().save_memory(&space.device(), "memory", space.device().tag(), space.spacenum(), name.c_str(), m_data, bytes_per_element, (u32)length / bytes_per_element);
}
}
@@ -4020,13 +4225,13 @@ memory_block::~memory_block()
// memory_bank - constructor
//-------------------------------------------------
-memory_bank::memory_bank(address_space &space, int index, offs_t bytestart, offs_t byteend, const char *tag)
+memory_bank::memory_bank(address_space &space, int index, offs_t addrstart, offs_t addrend, const char *tag)
: m_machine(space.machine()),
m_baseptr(space.manager().bank_pointer_addr(index)),
m_index(index),
m_anonymous(tag == nullptr),
- m_bytestart(bytestart),
- m_byteend(byteend),
+ m_addrstart(addrstart),
+ m_addrend(addrend),
m_curentry(BANK_ENTRY_UNSPECIFIED)
{
// generate an internal tag if we don't have one
@@ -4042,7 +4247,7 @@ memory_bank::memory_bank(address_space &space, int index, offs_t bytestart, offs
}
if (!m_anonymous && space.machine().save().registration_allowed())
- space.machine().save().save_item(nullptr, "memory", m_tag.c_str(), 0, NAME(m_curentry));
+ space.machine().save().save_item(&space.device(), "memory", m_tag.c_str(), 0, NAME(m_curentry));
}
@@ -4093,7 +4298,7 @@ void memory_bank::invalidate_references()
{
// invalidate all the direct references to any referenced address spaces
for (auto &ref : m_reflist)
- ref->space().direct().force_update();
+ ref->space().invalidate_read_caches();
}
@@ -4218,8 +4423,9 @@ handler_entry::handler_entry(u8 width, endianness_t endianness, u8 **rambaseptr)
: m_populated(false),
m_datawidth(width),
m_endianness(endianness),
- m_bytestart(0),
- m_byteend(0),
+ m_addrstart(0),
+ m_addrend(0),
+ m_addrmask(~0),
m_bytemask(~0),
m_rambaseptr(rambaseptr),
m_subunits(0),
@@ -4253,8 +4459,9 @@ void handler_entry::copy(handler_entry *entry)
m_populated = true;
m_datawidth = entry->m_datawidth;
m_endianness = entry->m_endianness;
- m_bytestart = entry->m_bytestart;
- m_byteend = entry->m_byteend;
+ m_addrstart = entry->m_addrstart;
+ m_addrend = entry->m_addrend;
+ m_addrmask = entry->m_addrmask;
m_bytemask = entry->m_bytemask;
m_rambaseptr = nullptr;
m_subunits = entry->m_subunits;
@@ -4267,9 +4474,9 @@ void handler_entry::copy(handler_entry *entry)
// reconfigure_subunits - reconfigure the subunits
// to handle a new base address
//-------------------------------------------------
-void handler_entry::reconfigure_subunits(offs_t bytestart)
+void handler_entry::reconfigure_subunits(offs_t addrstart)
{
- s32 delta = bytestart - m_bytestart;
+ s32 delta = addrstart - m_addrstart;
for (int i=0; i != m_subunits; i++)
m_subunit_infos[i].m_offset += delta / (m_subunit_infos[i].m_size / 8);
}
@@ -4319,7 +4526,7 @@ void handler_entry::configure_subunits(u64 handlermask, int handlerbits, int &st
u32 shift = (unitnum^shift_xor_mask) * handlerbits;
if (((handlermask >> shift) & unitmask) != 0)
{
- m_subunit_infos[m_subunits].m_bytemask = m_bytemask / (maxunits / multiplier);
+ m_subunit_infos[m_subunits].m_addrmask = m_bytemask / (maxunits / multiplier);
m_subunit_infos[m_subunits].m_mask = unitmask;
m_subunit_infos[m_subunits].m_offset = cur_offset++;
m_subunit_infos[m_subunits].m_size = handlerbits;
@@ -4413,7 +4620,7 @@ void handler_entry::description(char *buffer) const
m_subunit_infos[i].m_shift,
m_subunit_infos[i].m_offset,
m_subunit_infos[i].m_multiplier,
- m_subunit_infos[i].m_bytemask,
+ m_subunit_infos[i].m_addrmask,
subunit_name(i));
}
}
@@ -4660,7 +4867,7 @@ u16 handler_entry_read::read_stub_16(address_space &space, offs_t offset, u16 ma
{
offs_t aoffset = offset * si.m_multiplier + si.m_offset;
u8 val;
- val = m_subread[index].r8(space, aoffset & si.m_bytemask, submask);
+ val = m_subread[index].r8(space, aoffset & si.m_addrmask, submask);
result |= val << si.m_shift;
}
}
@@ -4687,10 +4894,10 @@ u32 handler_entry_read::read_stub_32(address_space &space, offs_t offset, u32 ma
switch (si.m_size)
{
case 8:
- val = m_subread[index].r8(space, aoffset & si.m_bytemask, submask);
+ val = m_subread[index].r8(space, aoffset & si.m_addrmask, submask);
break;
case 16:
- val = m_subread[index].r16(space, aoffset & si.m_bytemask, submask);
+ val = m_subread[index].r16(space, aoffset & si.m_addrmask, submask);
break;
}
result |= val << si.m_shift;
@@ -4719,13 +4926,13 @@ u64 handler_entry_read::read_stub_64(address_space &space, offs_t offset, u64 ma
switch (si.m_size)
{
case 8:
- val = m_subread[index].r8(space, aoffset & si.m_bytemask, submask);
+ val = m_subread[index].r8(space, aoffset & si.m_addrmask, submask);
break;
case 16:
- val = m_subread[index].r16(space, aoffset & si.m_bytemask, submask);
+ val = m_subread[index].r16(space, aoffset & si.m_addrmask, submask);
break;
case 32:
- val = m_subread[index].r32(space, aoffset & si.m_bytemask, submask);
+ val = m_subread[index].r32(space, aoffset & si.m_addrmask, submask);
break;
}
result |= u64(val) << si.m_shift;
@@ -4953,7 +5160,7 @@ void handler_entry_write::write_stub_16(address_space &space, offs_t offset, u16
{
offs_t aoffset = offset * si.m_multiplier + si.m_offset;
u8 adata = data >> si.m_shift;
- m_subwrite[index].w8(space, aoffset & si.m_bytemask, adata, submask);
+ m_subwrite[index].w8(space, aoffset & si.m_addrmask, adata, submask);
}
}
}
@@ -4977,10 +5184,10 @@ void handler_entry_write::write_stub_32(address_space &space, offs_t offset, u32
switch (si.m_size)
{
case 8:
- m_subwrite[index].w8(space, aoffset & si.m_bytemask, adata, submask);
+ m_subwrite[index].w8(space, aoffset & si.m_addrmask, adata, submask);
break;
case 16:
- m_subwrite[index].w16(space, aoffset & si.m_bytemask, adata, submask);
+ m_subwrite[index].w16(space, aoffset & si.m_addrmask, adata, submask);
break;
}
}
@@ -5006,13 +5213,13 @@ void handler_entry_write::write_stub_64(address_space &space, offs_t offset, u64
switch (si.m_size)
{
case 8:
- m_subwrite[index].w8(space, aoffset & si.m_bytemask, adata, submask);
+ m_subwrite[index].w8(space, aoffset & si.m_addrmask, adata, submask);
break;
case 16:
- m_subwrite[index].w16(space, aoffset & si.m_bytemask, adata, submask);
+ m_subwrite[index].w16(space, aoffset & si.m_addrmask, adata, submask);
break;
case 32:
- m_subwrite[index].w32(space, aoffset & si.m_bytemask, adata, submask);
+ m_subwrite[index].w32(space, aoffset & si.m_addrmask, adata, submask);
break;
}
}
diff --git a/src/emu/emumem.h b/src/emu/emumem.h
index 509144eb345..45e1a759138 100644
--- a/src/emu/emumem.h
+++ b/src/emu/emumem.h
@@ -17,6 +17,14 @@
#ifndef MAME_EMU_EMUMEM_H
#define MAME_EMU_EMUMEM_H
+using s8 = std::int8_t;
+using u8 = std::uint8_t;
+using s16 = std::int16_t;
+using u16 = std::uint16_t;
+using s32 = std::int32_t;
+using u32 = std::uint32_t;
+using s64 = std::int64_t;
+using u64 = std::uint64_t;
//**************************************************************************
@@ -63,21 +71,21 @@ typedef named_delegate<void (address_map &)> address_map_delegate;
// struct with function pointers for accessors; use is generally discouraged unless necessary
struct data_accessors
{
- u8 (*read_byte)(address_space &space, offs_t byteaddress);
- u16 (*read_word)(address_space &space, offs_t byteaddress);
- u16 (*read_word_masked)(address_space &space, offs_t byteaddress, u16 mask);
- u32 (*read_dword)(address_space &space, offs_t byteaddress);
- u32 (*read_dword_masked)(address_space &space, offs_t byteaddress, u32 mask);
- u64 (*read_qword)(address_space &space, offs_t byteaddress);
- u64 (*read_qword_masked)(address_space &space, offs_t byteaddress, u64 mask);
-
- void (*write_byte)(address_space &space, offs_t byteaddress, u8 data);
- void (*write_word)(address_space &space, offs_t byteaddress, u16 data);
- void (*write_word_masked)(address_space &space, offs_t byteaddress, u16 data, u16 mask);
- void (*write_dword)(address_space &space, offs_t byteaddress, u32 data);
- void (*write_dword_masked)(address_space &space, offs_t byteaddress, u32 data, u32 mask);
- void (*write_qword)(address_space &space, offs_t byteaddress, u64 data);
- void (*write_qword_masked)(address_space &space, offs_t byteaddress, u64 data, u64 mask);
+ u8 (*read_byte)(address_space &space, offs_t address);
+ u16 (*read_word)(address_space &space, offs_t address);
+ u16 (*read_word_masked)(address_space &space, offs_t address, u16 mask);
+ u32 (*read_dword)(address_space &space, offs_t address);
+ u32 (*read_dword_masked)(address_space &space, offs_t address, u32 mask);
+ u64 (*read_qword)(address_space &space, offs_t address);
+ u64 (*read_qword_masked)(address_space &space, offs_t address, u64 mask);
+
+ void (*write_byte)(address_space &space, offs_t address, u8 data);
+ void (*write_word)(address_space &space, offs_t address, u16 data);
+ void (*write_word_masked)(address_space &space, offs_t address, u16 data, u16 mask);
+ void (*write_dword)(address_space &space, offs_t address, u32 data);
+ void (*write_dword_masked)(address_space &space, offs_t address, u32 data, u32 mask);
+ void (*write_qword)(address_space &space, offs_t address, u64 data);
+ void (*write_qword_masked)(address_space &space, offs_t address, u64 data, u64 mask);
};
@@ -106,26 +114,28 @@ typedef device_delegate<void (address_space &, offs_t)> setoffset_delegate;
// ======================> direct_read_data
// direct_read_data contains state data for direct read access
-class direct_read_data
+template<int addr_shift> class direct_read_data
{
friend class address_table;
public:
+ using direct_update_delegate = delegate<offs_t (direct_read_data<addr_shift> &, offs_t)>;
+
// direct_range is an internal class that is part of a list of start/end ranges
class direct_range
{
public:
// construction
- direct_range(): m_bytestart(0),m_byteend(~0) { }
+ direct_range(): m_addrstart(0),m_addrend(~0) { }
inline bool operator==(direct_range val) noexcept
{ // return true if _Left and _Right identify the same thread
- return (m_bytestart == val.m_bytestart) && (m_byteend == val.m_byteend);
+ return (m_addrstart == val.m_addrstart) && (m_addrend == val.m_addrend);
}
// internal state
- offs_t m_bytestart; // starting byte offset of the range
- offs_t m_byteend; // ending byte offset of the range
+ offs_t m_addrstart; // starting offset of the range
+ offs_t m_addrend; // ending offset of the range
};
// construction/destruction
@@ -137,31 +147,32 @@ public:
u8 *ptr() const { return m_ptr; }
// see if an address is within bounds, or attempt to update it if not
- bool address_is_valid(offs_t byteaddress) { return EXPECTED(byteaddress >= m_bytestart && byteaddress <= m_byteend) || set_direct_region(byteaddress); }
+ bool address_is_valid(offs_t address) { return EXPECTED(address >= m_addrstart && address <= m_addrend) || set_direct_region(address); }
// force a recomputation on the next read
- void force_update() { m_byteend = 0; m_bytestart = 1; }
+ void force_update() { m_addrend = 0; m_addrstart = 1; }
void force_update(u16 if_match) { if (m_entry == if_match) force_update(); }
// accessor methods
- void *read_ptr(offs_t byteaddress, offs_t directxor = 0);
- u8 read_byte(offs_t byteaddress, offs_t directxor = 0);
- u16 read_word(offs_t byteaddress, offs_t directxor = 0);
- u32 read_dword(offs_t byteaddress, offs_t directxor = 0);
- u64 read_qword(offs_t byteaddress, offs_t directxor = 0);
+ void *read_ptr(offs_t address, offs_t directxor = 0);
+ u8 read_byte(offs_t address, offs_t directxor = 0);
+ u16 read_word(offs_t address, offs_t directxor = 0);
+ u32 read_dword(offs_t address, offs_t directxor = 0);
+ u64 read_qword(offs_t address, offs_t directxor = 0);
+
+ void remove_intersecting_ranges(offs_t start, offs_t end);
private:
// internal helpers
- bool set_direct_region(offs_t byteaddress);
- direct_range *find_range(offs_t byteaddress, u16 &entry);
- void remove_intersecting_ranges(offs_t bytestart, offs_t byteend);
+ bool set_direct_region(offs_t address);
+ direct_range *find_range(offs_t address, u16 &entry);
// internal state
address_space & m_space;
u8 * m_ptr; // direct access data pointer
- offs_t m_bytemask; // byte address mask
- offs_t m_bytestart; // minimum valid byte address
- offs_t m_byteend; // maximum valid byte address
+ offs_t m_addrmask; // address mask
+ offs_t m_addrstart; // minimum valid address
+ offs_t m_addrend; // maximum valid address
u16 m_entry; // live entry
std::list<direct_range> m_rangelist[TOTAL_MEMORY_BANKS]; // list of ranges for each entry
};
@@ -187,10 +198,15 @@ public:
int addr_width() const { return m_addrbus_width; }
int addrbus_shift() const { return m_addrbus_shift; }
- // address-to-byte conversion helpers
+ // Actual alignment of the bus addresses
+ int alignment() const { int bytes = m_databus_width / 8; return m_addrbus_shift < 0 ? bytes >> -m_addrbus_shift : bytes << m_addrbus_shift; }
+
+ // Address delta to byte delta helpers
inline offs_t addr2byte(offs_t address) const { return (m_addrbus_shift < 0) ? (address << -m_addrbus_shift) : (address >> m_addrbus_shift); }
- inline offs_t addr2byte_end(offs_t address) const { return (m_addrbus_shift < 0) ? ((address << -m_addrbus_shift) | ((1 << -m_addrbus_shift) - 1)) : (address >> m_addrbus_shift); }
inline offs_t byte2addr(offs_t address) const { return (m_addrbus_shift > 0) ? (address << m_addrbus_shift) : (address >> -m_addrbus_shift); }
+
+ // address-to-byte conversion helpers
+ inline offs_t addr2byte_end(offs_t address) const { return (m_addrbus_shift < 0) ? ((address << -m_addrbus_shift) | ((1 << -m_addrbus_shift) - 1)) : (address >> m_addrbus_shift); }
inline offs_t byte2addr_end(offs_t address) const { return (m_addrbus_shift > 0) ? ((address << m_addrbus_shift) | ((1 << m_addrbus_shift) - 1)) : (address >> -m_addrbus_shift); }
// state
@@ -219,7 +235,11 @@ class address_space
friend class address_table_read;
friend class address_table_write;
friend class address_table_setoffset;
- friend class direct_read_data;
+ friend class direct_read_data<3>;
+ friend class direct_read_data<0>;
+ friend class direct_read_data<-1>;
+ friend class direct_read_data<-2>;
+ friend class direct_read_data<-3>;
protected:
// construction/destruction
@@ -236,20 +256,24 @@ public:
int spacenum() const { return m_spacenum; }
address_map *map() const { return m_map.get(); }
- direct_read_data &direct() const { return *m_direct; }
+ template<int addr_shift> direct_read_data<addr_shift> *direct() const {
+ static_assert(addr_shift == 3 || addr_shift == 0 || addr_shift == -1 || addr_shift == -2 || addr_shift == -3, "Unsupported addr_shift in direct()");
+ if(addr_shift != m_config.addrbus_shift())
+ fatalerror("Requesing direct() with address shift %d while the config says %d\n", addr_shift, m_config.addrbus_shift());
+ return static_cast<direct_read_data<addr_shift> *>(m_direct);
+ }
int data_width() const { return m_config.data_width(); }
int addr_width() const { return m_config.addr_width(); }
+ int alignment() const { return m_config.alignment(); }
endianness_t endianness() const { return m_config.endianness(); }
int addrbus_shift() const { return m_config.addrbus_shift(); }
u64 unmap() const { return m_unmap; }
bool is_octal() const { return m_config.m_is_octal; }
offs_t addrmask() const { return m_addrmask; }
- offs_t bytemask() const { return m_bytemask; }
u8 addrchars() const { return m_addrchars; }
offs_t logaddrmask() const { return m_logaddrmask; }
- offs_t logbytemask() const { return m_logbytemask; }
u8 logaddrchars() const { return m_logaddrchars; }
// debug helpers
@@ -264,41 +288,41 @@ public:
// general accessors
virtual void accessors(data_accessors &accessors) const = 0;
- virtual void *get_read_ptr(offs_t byteaddress) = 0;
- virtual void *get_write_ptr(offs_t byteaddress) = 0;
+ virtual void *get_read_ptr(offs_t address) = 0;
+ virtual void *get_write_ptr(offs_t address) = 0;
// read accessors
- virtual u8 read_byte(offs_t byteaddress) = 0;
- virtual u16 read_word(offs_t byteaddress) = 0;
- virtual u16 read_word(offs_t byteaddress, u16 mask) = 0;
- virtual u16 read_word_unaligned(offs_t byteaddress) = 0;
- virtual u16 read_word_unaligned(offs_t byteaddress, u16 mask) = 0;
- virtual u32 read_dword(offs_t byteaddress) = 0;
- virtual u32 read_dword(offs_t byteaddress, u32 mask) = 0;
- virtual u32 read_dword_unaligned(offs_t byteaddress) = 0;
- virtual u32 read_dword_unaligned(offs_t byteaddress, u32 mask) = 0;
- virtual u64 read_qword(offs_t byteaddress) = 0;
- virtual u64 read_qword(offs_t byteaddress, u64 mask) = 0;
- virtual u64 read_qword_unaligned(offs_t byteaddress) = 0;
- virtual u64 read_qword_unaligned(offs_t byteaddress, u64 mask) = 0;
+ virtual u8 read_byte(offs_t address) = 0;
+ virtual u16 read_word(offs_t address) = 0;
+ virtual u16 read_word(offs_t address, u16 mask) = 0;
+ virtual u16 read_word_unaligned(offs_t address) = 0;
+ virtual u16 read_word_unaligned(offs_t address, u16 mask) = 0;
+ virtual u32 read_dword(offs_t address) = 0;
+ virtual u32 read_dword(offs_t address, u32 mask) = 0;
+ virtual u32 read_dword_unaligned(offs_t address) = 0;
+ virtual u32 read_dword_unaligned(offs_t address, u32 mask) = 0;
+ virtual u64 read_qword(offs_t address) = 0;
+ virtual u64 read_qword(offs_t address, u64 mask) = 0;
+ virtual u64 read_qword_unaligned(offs_t address) = 0;
+ virtual u64 read_qword_unaligned(offs_t address, u64 mask) = 0;
// write accessors
- virtual void write_byte(offs_t byteaddress, u8 data) = 0;
- virtual void write_word(offs_t byteaddress, u16 data) = 0;
- virtual void write_word(offs_t byteaddress, u16 data, u16 mask) = 0;
- virtual void write_word_unaligned(offs_t byteaddress, u16 data) = 0;
- virtual void write_word_unaligned(offs_t byteaddress, u16 data, u16 mask) = 0;
- virtual void write_dword(offs_t byteaddress, u32 data) = 0;
- virtual void write_dword(offs_t byteaddress, u32 data, u32 mask) = 0;
- virtual void write_dword_unaligned(offs_t byteaddress, u32 data) = 0;
- virtual void write_dword_unaligned(offs_t byteaddress, u32 data, u32 mask) = 0;
- virtual void write_qword(offs_t byteaddress, u64 data) = 0;
- virtual void write_qword(offs_t byteaddress, u64 data, u64 mask) = 0;
- virtual void write_qword_unaligned(offs_t byteaddress, u64 data) = 0;
- virtual void write_qword_unaligned(offs_t byteaddress, u64 data, u64 mask) = 0;
+ virtual void write_byte(offs_t address, u8 data) = 0;
+ virtual void write_word(offs_t address, u16 data) = 0;
+ virtual void write_word(offs_t address, u16 data, u16 mask) = 0;
+ virtual void write_word_unaligned(offs_t address, u16 data) = 0;
+ virtual void write_word_unaligned(offs_t address, u16 data, u16 mask) = 0;
+ virtual void write_dword(offs_t address, u32 data) = 0;
+ virtual void write_dword(offs_t address, u32 data, u32 mask) = 0;
+ virtual void write_dword_unaligned(offs_t address, u32 data) = 0;
+ virtual void write_dword_unaligned(offs_t address, u32 data, u32 mask) = 0;
+ virtual void write_qword(offs_t address, u64 data) = 0;
+ virtual void write_qword(offs_t address, u64 data, u64 mask) = 0;
+ virtual void write_qword_unaligned(offs_t address, u64 data) = 0;
+ virtual void write_qword_unaligned(offs_t address, u64 data, u64 mask) = 0;
// Set address. This will invoke setoffset handlers for the respective entries.
- virtual void set_address(offs_t byteaddress) = 0;
+ virtual void set_address(offs_t address) = 0;
// address-to-byte conversion helpers
offs_t address_to_byte(offs_t address) const { return m_config.addr2byte(address); }
@@ -388,6 +412,10 @@ public:
void allocate_memory();
void locate_memory();
+ void invalidate_read_caches();
+ void invalidate_read_caches(u16 entry);
+ void invalidate_read_caches(offs_t start, offs_t end);
+
private:
// internal helpers
virtual address_table_read &read() = 0;
@@ -414,15 +442,13 @@ protected:
// private state
const address_space_config &m_config; // configuration of this space
device_t & m_device; // reference to the owning device
- std::unique_ptr<address_map> m_map; // original memory map
+ std::unique_ptr<address_map> m_map; // original memory map
offs_t m_addrmask; // physical address mask
- offs_t m_bytemask; // byte-converted physical address mask
offs_t m_logaddrmask; // logical address mask
- offs_t m_logbytemask; // byte-converted logical address mask
u64 m_unmap; // unmapped value
int m_spacenum; // address space index
bool m_log_unmap; // log unmapped accesses in this space?
- std::unique_ptr<direct_read_data> m_direct; // fast direct-access read info
+ void * m_direct; // fast direct-access read info
const char * m_name; // friendly name of the address space
u8 m_addrchars; // number of characters to use for physical addresses
u8 m_logaddrchars; // number of characters to use for logical addresses
@@ -442,26 +468,26 @@ class memory_block
public:
// construction/destruction
- memory_block(address_space &space, offs_t bytestart, offs_t byteend, void *memory = nullptr);
+ memory_block(address_space &space, offs_t start, offs_t end, void *memory = nullptr);
~memory_block();
// getters
running_machine &machine() const { return m_machine; }
- offs_t bytestart() const { return m_bytestart; }
- offs_t byteend() const { return m_byteend; }
+ offs_t addrstart() const { return m_addrstart; }
+ offs_t addrend() const { return m_addrend; }
u8 *data() const { return m_data; }
// is the given range contained by this memory block?
- bool contains(address_space &space, offs_t bytestart, offs_t byteend) const
+ bool contains(address_space &space, offs_t addrstart, offs_t addrend) const
{
- return (&space == &m_space && m_bytestart <= bytestart && m_byteend >= byteend);
+ return (&space == &m_space && m_addrstart <= addrstart && m_addrend >= addrend);
}
private:
// internal state
running_machine & m_machine; // need the machine to free our memory
address_space & m_space; // which address space are we associated with?
- offs_t m_bytestart, m_byteend; // byte-normalized start/end for verifying a match
+ offs_t m_addrstart, m_addrend; // start/end for verifying a match
u8 * m_data; // pointer to the data for this block
std::vector<u8> m_allocated; // pointer to the actually allocated block
};
@@ -504,7 +530,7 @@ class memory_bank
public:
// construction/destruction
- memory_bank(address_space &space, int index, offs_t bytestart, offs_t byteend, const char *tag = nullptr);
+ memory_bank(address_space &space, int index, offs_t start, offs_t end, const char *tag = nullptr);
~memory_bank();
// getters
@@ -512,16 +538,16 @@ public:
int index() const { return m_index; }
int entry() const { return m_curentry; }
bool anonymous() const { return m_anonymous; }
- offs_t bytestart() const { return m_bytestart; }
+ offs_t addrstart() const { return m_addrstart; }
void *base() const { return *m_baseptr; }
const char *tag() const { return m_tag.c_str(); }
const char *name() const { return m_name.c_str(); }
// compare a range against our range
- bool matches_exactly(offs_t bytestart, offs_t byteend) const { return (m_bytestart == bytestart && m_byteend == byteend); }
- bool fully_covers(offs_t bytestart, offs_t byteend) const { return (m_bytestart <= bytestart && m_byteend >= byteend); }
- bool is_covered_by(offs_t bytestart, offs_t byteend) const { return (m_bytestart >= bytestart && m_byteend <= byteend); }
- bool straddles(offs_t bytestart, offs_t byteend) const { return (m_bytestart < byteend && m_byteend > bytestart); }
+ bool matches_exactly(offs_t addrstart, offs_t addrend) const { return (m_addrstart == addrstart && m_addrend == addrend); }
+ bool fully_covers(offs_t addrstart, offs_t addrend) const { return (m_addrstart <= addrstart && m_addrend >= addrend); }
+ bool is_covered_by(offs_t addrstart, offs_t addrend) const { return (m_addrstart >= addrstart && m_addrend <= addrend); }
+ bool straddles(offs_t addrstart, offs_t addrend) const { return (m_addrstart < addrend && m_addrend > addrstart); }
// track and verify address space references to this bank
bool references_space(const address_space &space, read_or_write readorwrite) const;
@@ -545,8 +571,8 @@ private:
u8 ** m_baseptr; // pointer to our base pointer in the global array
u16 m_index; // array index for this handler
bool m_anonymous; // are we anonymous or explicit?
- offs_t m_bytestart; // byte-adjusted start offset
- offs_t m_byteend; // byte-adjusted end offset
+ offs_t m_addrstart; // start offset
+ offs_t m_addrend; // end offset
int m_curentry; // current entry
std::vector<bank_entry> m_entry; // array of entries (dynamically allocated)
std::string m_name; // friendly name for this bank
@@ -793,10 +819,16 @@ private:
// backing that address
//-------------------------------------------------
-inline void *direct_read_data::read_ptr(offs_t byteaddress, offs_t directxor)
+template<int addr_shift> inline void *direct_read_data<addr_shift>::read_ptr(offs_t address, offs_t directxor)
{
- if (address_is_valid(byteaddress))
- return &m_ptr[(byteaddress ^ directxor) & m_bytemask];
+ if (address_is_valid(address)) {
+ if(addr_shift < 0)
+ return &m_ptr[((address ^ directxor) & m_addrmask) << iabs(addr_shift)];
+ else if(addr_shift == 0)
+ return &m_ptr[(address ^ directxor) & m_addrmask];
+ else
+ return &m_ptr[((address ^ directxor) & m_addrmask) >> iabs(addr_shift)];
+ }
return nullptr;
}
@@ -806,11 +838,17 @@ inline void *direct_read_data::read_ptr(offs_t byteaddress, offs_t directxor)
// direct_read_data class
//-------------------------------------------------
-inline u8 direct_read_data::read_byte(offs_t byteaddress, offs_t directxor)
+template<int addr_shift> inline u8 direct_read_data<addr_shift>::read_byte(offs_t address, offs_t directxor)
{
- if (address_is_valid(byteaddress))
- return m_ptr[(byteaddress ^ directxor) & m_bytemask];
- return m_space.read_byte(byteaddress);
+ if(addr_shift <= -1)
+ fatalerror("Can't direct_read_data::read_byte on a memory space with address shift %d", addr_shift);
+ if (address_is_valid(address)) {
+ if(addr_shift == 0)
+ return m_ptr[(address ^ directxor) & m_addrmask];
+ else
+ return m_ptr[((address ^ directxor) & m_addrmask) >> iabs(addr_shift)];
+ }
+ return m_space.read_byte(address);
}
@@ -819,11 +857,19 @@ inline u8 direct_read_data::read_byte(offs_t byteaddress, offs_t directxor)
// direct_read_data class
//-------------------------------------------------
-inline u16 direct_read_data::read_word(offs_t byteaddress, offs_t directxor)
+template<int addr_shift> inline u16 direct_read_data<addr_shift>::read_word(offs_t address, offs_t directxor)
{
- if (address_is_valid(byteaddress))
- return *reinterpret_cast<u16 *>(&m_ptr[(byteaddress ^ directxor) & m_bytemask]);
- return m_space.read_word(byteaddress);
+ if(addr_shift <= -2)
+ fatalerror("Can't direct_read_data::read_word on a memory space with address shift %d", addr_shift);
+ if (address_is_valid(address)) {
+ if(addr_shift < 0)
+ return *reinterpret_cast<u16 *>(&m_ptr[((address ^ directxor) & m_addrmask) << iabs(addr_shift)]);
+ else if(addr_shift == 0)
+ return *reinterpret_cast<u16 *>(&m_ptr[(address ^ directxor) & m_addrmask]);
+ else
+ return *reinterpret_cast<u16 *>(&m_ptr[((address ^ directxor) & m_addrmask) >> iabs(addr_shift)]);
+ }
+ return m_space.read_word(address);
}
@@ -832,11 +878,19 @@ inline u16 direct_read_data::read_word(offs_t byteaddress, offs_t directxor)
// direct_read_data class
//-------------------------------------------------
-inline u32 direct_read_data::read_dword(offs_t byteaddress, offs_t directxor)
+template<int addr_shift> inline u32 direct_read_data<addr_shift>::read_dword(offs_t address, offs_t directxor)
{
- if (address_is_valid(byteaddress))
- return *reinterpret_cast<u32 *>(&m_ptr[(byteaddress ^ directxor) & m_bytemask]);
- return m_space.read_dword(byteaddress);
+ if(addr_shift <= -3)
+ fatalerror("Can't direct_read_data::read_dword on a memory space with address shift %d", addr_shift);
+ if (address_is_valid(address)) {
+ if(addr_shift < 0)
+ return *reinterpret_cast<u32 *>(&m_ptr[((address ^ directxor) & m_addrmask) << iabs(addr_shift)]);
+ else if(addr_shift == 0)
+ return *reinterpret_cast<u32 *>(&m_ptr[(address ^ directxor) & m_addrmask]);
+ else
+ return *reinterpret_cast<u32 *>(&m_ptr[((address ^ directxor) & m_addrmask) >> iabs(addr_shift)]);
+ }
+ return m_space.read_dword(address);
}
@@ -845,11 +899,17 @@ inline u32 direct_read_data::read_dword(offs_t byteaddress, offs_t directxor)
// direct_read_data class
//-------------------------------------------------
-inline u64 direct_read_data::read_qword(offs_t byteaddress, offs_t directxor)
+template<int addr_shift> inline u64 direct_read_data<addr_shift>::read_qword(offs_t address, offs_t directxor)
{
- if (address_is_valid(byteaddress))
- return *reinterpret_cast<u64 *>(&m_ptr[(byteaddress ^ directxor) & m_bytemask]);
- return m_space.read_qword(byteaddress);
+ if (address_is_valid(address)) {
+ if(addr_shift < 0)
+ return *reinterpret_cast<u64 *>(&m_ptr[((address ^ directxor) & m_addrmask) << iabs(addr_shift)]);
+ else if(addr_shift == 0)
+ return *reinterpret_cast<u64 *>(&m_ptr[(address ^ directxor) & m_addrmask]);
+ else
+ return *reinterpret_cast<u64 *>(&m_ptr[((address ^ directxor) & m_addrmask) >> iabs(addr_shift)]);
+ }
+ return m_space.read_qword(address);
}
#endif /* MAME_EMU_EMUMEM_H */
diff --git a/src/frontend/mame/luaengine.cpp b/src/frontend/mame/luaengine.cpp
index 9d79d1f635d..2c81f5f9a4b 100644
--- a/src/frontend/mame/luaengine.cpp
+++ b/src/frontend/mame/luaengine.cpp
@@ -1454,8 +1454,8 @@ void lua_engine::initialize()
for (address_map_entry &entry : space.map()->m_entrylist)
{
sol::table mapentry = sol().create_table();
- mapentry["offset"] = space.address_to_byte(entry.m_addrstart) & space.bytemask();
- mapentry["endoff"] = space.address_to_byte(entry.m_addrend) & space.bytemask();
+ mapentry["offset"] = space.address_to_byte(entry.m_addrstart) & space.addrmask();
+ mapentry["endoff"] = space.address_to_byte(entry.m_addrend) & space.addrmask();
mapentry["readtype"] = entry.m_read.m_type;
mapentry["writetype"] = entry.m_write.m_type;
map.add(mapentry);
diff --git a/src/mame/audio/dcs.cpp b/src/mame/audio/dcs.cpp
index e2aeae153c8..d065f4a53b4 100644
--- a/src/mame/audio/dcs.cpp
+++ b/src/mame/audio/dcs.cpp
@@ -1736,19 +1736,19 @@ void dcs_audio_device::reset_timer()
{
/* Road Burners: @ 28: JMP $0032 18032F, same code at $32 */
- if (m_program->read_dword(0x18*4) == 0x0c0030 && /* ENA SEC_REG */
- m_program->read_dword(0x19*4) == 0x804828 && /* SI = DM($0482) */
- m_program->read_dword(0x1a*4) == 0x904828 && /* DM($0482) = SI */
- m_program->read_dword(0x1b*4) == 0x0C0020 && /* DIS SEC_REG */
- m_program->read_dword(0x1c*4) == 0x0A001F) /* RTI */
+ if (m_program->read_dword(0x18) == 0x0c0030 && /* ENA SEC_REG */
+ m_program->read_dword(0x19) == 0x804828 && /* SI = DM($0482) */
+ m_program->read_dword(0x1a) == 0x904828 && /* DM($0482) = SI */
+ m_program->read_dword(0x1b) == 0x0C0020 && /* DIS SEC_REG */
+ m_program->read_dword(0x1c) == 0x0A001F) /* RTI */
{
m_timer_ignore = true;
} else if (
// ADSP 2181 (DSIO and DENVER)
- m_program->read_dword(0x28*4) == 0x18032F && /* JUMP $0032 */
- m_program->read_dword(0x32*4) == 0x0c0030 && /* ENA SEC_REG */
- m_program->read_dword(0x33*4) == 0x014828 && /* SI = IO($482) */
- m_program->read_dword(0x34*4) == 0x01C828) /* IO($482) = SI */
+ m_program->read_dword(0x28) == 0x18032F && /* JUMP $0032 */
+ m_program->read_dword(0x32) == 0x0c0030 && /* ENA SEC_REG */
+ m_program->read_dword(0x33) == 0x014828 && /* SI = IO($482) */
+ m_program->read_dword(0x34) == 0x01C828) /* IO($482) = SI */
{
m_timer_ignore = true;
}
@@ -1944,7 +1944,7 @@ TIMER_DEVICE_CALLBACK_MEMBER( dcs_audio_device::dcs_irq )
for (i = 0; i < count; i++)
{
- buffer[i] = m_data->read_word(reg * 2);
+ buffer[i] = m_data->read_word(reg);
reg += m_incs;
}
@@ -2280,10 +2280,10 @@ int dcs_audio_device::preprocess_stage_1(uint16_t data)
if (transfer.writes_left & 1)
transfer.temp = data;
else
- m_program->write_dword(transfer.start++ * 4, (transfer.temp << 8) | (data & 0xff));
+ m_program->write_dword(transfer.start++, (transfer.temp << 8) | (data & 0xff));
}
else
- m_data->write_word(transfer.start++ * 2, data);
+ m_data->write_word(transfer.start++, data);
/* if we're done, start a timer to send the response words */
if (transfer.state == 0)
diff --git a/src/mame/audio/turrett.cpp b/src/mame/audio/turrett.cpp
index f875bfe3cf1..760e98259a4 100644
--- a/src/mame/audio/turrett.cpp
+++ b/src/mame/audio/turrett.cpp
@@ -44,7 +44,7 @@ device_memory_interface::space_config_vector turrett_device::memory_space_config
void turrett_device::device_start()
{
// Find our direct access
- m_direct = &space().direct();
+ m_direct = space().direct<0>();
// Create the sound stream
m_stream = machine().sound().stream_alloc(*this, 0, 2, 44100);
diff --git a/src/mame/drivers/atarisy4.cpp b/src/mame/drivers/atarisy4.cpp
index d9e9f9a3d6e..e574272d416 100644
--- a/src/mame/drivers/atarisy4.cpp
+++ b/src/mame/drivers/atarisy4.cpp
@@ -847,6 +847,7 @@ void atarisy4_state::load_ldafile(address_space &space, const uint8_t *file)
uint8_t sum = 1;
uint16_t len;
uint16_t addr;
+ uint8_t pval = 0;
if (READ_CHAR() != 0x01)
fatalerror("Bad .LDA file\n");
@@ -879,7 +880,11 @@ void atarisy4_state::load_ldafile(address_space &space, const uint8_t *file)
{
uint8_t data = READ_CHAR();
sum += data;
- space.write_byte(addr++, data);
+ if (addr & 1)
+ space.write_word(addr >> 1, (pval << 8) | data);
+ else
+ pval = data;
+ addr ++;
} while (--len);
sum += READ_CHAR();
diff --git a/src/mame/drivers/coolpool.cpp b/src/mame/drivers/coolpool.cpp
index ef09bce91c0..80cab473371 100644
--- a/src/mame/drivers/coolpool.cpp
+++ b/src/mame/drivers/coolpool.cpp
@@ -112,13 +112,13 @@ TMS340X0_SCANLINE_RGB32_CB_MEMBER(coolpool_state::coolpool_scanline)
TMS340X0_TO_SHIFTREG_CB_MEMBER(coolpool_state::to_shiftreg)
{
- memcpy(shiftreg, &m_vram_base[TOWORD(address) & ~TOWORD(0xfff)], TOBYTE(0x1000));
+ memcpy(shiftreg, &m_vram_base[(address & ~0xfff) >> 4], 0x200);
}
TMS340X0_FROM_SHIFTREG_CB_MEMBER(coolpool_state::from_shiftreg)
{
- memcpy(&m_vram_base[TOWORD(address) & ~TOWORD(0xfff)], shiftreg, TOBYTE(0x1000));
+ memcpy(&m_vram_base[(address & ~0xfff) >> 4], shiftreg, 0x2000);
}
diff --git a/src/mame/drivers/exterm.cpp b/src/mame/drivers/exterm.cpp
index b2e54ffc8af..d99cc694f23 100644
--- a/src/mame/drivers/exterm.cpp
+++ b/src/mame/drivers/exterm.cpp
@@ -93,13 +93,13 @@ void exterm_state::machine_start()
WRITE16_MEMBER(exterm_state::exterm_host_data_w)
{
- m_slave->host_w(space,offset / TOWORD(0x00100000), data, 0xffff);
+ m_slave->host_w(space,offset / 0x0010000, data, 0xffff);
}
READ16_MEMBER(exterm_state::exterm_host_data_r)
{
- return m_slave->host_r(space,offset / TOWORD(0x00100000), 0xffff);
+ return m_slave->host_r(space,offset / 0x0010000, 0xffff);
}
diff --git a/src/mame/drivers/skimaxx.cpp b/src/mame/drivers/skimaxx.cpp
index 524ab14ba95..3c621dc4329 100644
--- a/src/mame/drivers/skimaxx.cpp
+++ b/src/mame/drivers/skimaxx.cpp
@@ -175,12 +175,12 @@ void skimaxx_state::video_start()
// TODO: Might not be used
TMS340X0_TO_SHIFTREG_CB_MEMBER(skimaxx_state::to_shiftreg)
{
- memcpy(shiftreg, &m_fg_buffer[TOWORD(address)], 512 * sizeof(uint16_t));
+ memcpy(shiftreg, &m_fg_buffer[address >> 4], 512 * sizeof(uint16_t));
}
TMS340X0_FROM_SHIFTREG_CB_MEMBER(skimaxx_state::from_shiftreg)
{
- memcpy(&m_fg_buffer[TOWORD(address)], shiftreg, 512 * sizeof(uint16_t));
+ memcpy(&m_fg_buffer[address >> 4], shiftreg, 512 * sizeof(uint16_t));
}
diff --git a/src/mame/drivers/tickee.cpp b/src/mame/drivers/tickee.cpp
index 6686a4c1457..b4c4a60ed92 100644
--- a/src/mame/drivers/tickee.cpp
+++ b/src/mame/drivers/tickee.cpp
@@ -303,14 +303,14 @@ READ16_MEMBER(tickee_state::rapidfir_transparent_r)
TMS340X0_TO_SHIFTREG_CB_MEMBER(tickee_state::rapidfir_to_shiftreg)
{
if (address < 0x800000)
- memcpy(shiftreg, &m_vram[TOWORD(address)], TOBYTE(0x2000));
+ memcpy(shiftreg, &m_vram[address >> 4], 0x400);
}
TMS340X0_FROM_SHIFTREG_CB_MEMBER(tickee_state::rapidfir_from_shiftreg)
{
if (address < 0x800000)
- memcpy(&m_vram[TOWORD(address)], shiftreg, TOBYTE(0x2000));
+ memcpy(&m_vram[address >> 4], shiftreg, 0x400);
}
diff --git a/src/mame/drivers/unichamp.cpp b/src/mame/drivers/unichamp.cpp
index c6f23d02f62..301c03d49fd 100644
--- a/src/mame/drivers/unichamp.cpp
+++ b/src/mame/drivers/unichamp.cpp
@@ -77,6 +77,8 @@ public:
DECLARE_READ16_MEMBER(unichamp_trapl_r);
DECLARE_WRITE16_MEMBER(unichamp_trapl_w);
+ DECLARE_READ16_MEMBER(read_ff);
+
uint32_t screen_update_unichamp(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
protected:
@@ -106,7 +108,7 @@ static ADDRESS_MAP_START( unichamp_mem, AS_PROGRAM, 16, unichamp_state )
ADDRESS_MAP_GLOBAL_MASK(0x1FFF) //B13/B14/B15 are grounded!
AM_RANGE(0x0000, 0x00FF) AM_READWRITE8(unichamp_gicram_r, unichamp_gicram_w, 0x00ff)
AM_RANGE(0x0100, 0x07FF) AM_READWRITE(unichamp_trapl_r, unichamp_trapl_w)
- AM_RANGE(0x0800, 0x17FF) AM_ROM AM_REGION("maincpu", 0x0800 << 1) // Carts and EXE ROM, 10-bits wide
+ AM_RANGE(0x0800, 0x0FFF) AM_ROM AM_REGION("maincpu", 0) // Carts and EXE ROM, 10-bits wide
ADDRESS_MAP_END
@@ -134,7 +136,7 @@ READ8_MEMBER(unichamp_state::bext_r)
//The BEXT instruction pushes a user-defined nibble out on the four EBCA pins (EBCA0 to EBCA3)
//and reads the ECBI input pin for HIGH or LOW signal to know whether or not to branch
- //The unisonic control system couldnt be simpler in desing.
+ //The unisonic control system couldnt be simpler in design.
//Each of the two player controllers has three buttons:
//one tying !RESET(GIC pin 21) to ground when closed - resetting the WHOLE system.
//a YES button (connecting EBCA0 to EBCI for Player1 and EBC2 to EBCI for Player2)
@@ -154,6 +156,11 @@ DRIVER_INIT_MEMBER(unichamp_state,unichamp)
{
}
+READ16_MEMBER(unichamp_state::read_ff)
+{
+ return 0xffff;
+}
+
void unichamp_state::machine_start()
{
if (m_cart->exists()){
@@ -166,10 +173,11 @@ void unichamp_state::machine_start()
ptr[i] = ptr[i+1];
ptr[i+1] = TEMP;
}
-
- m_maincpu->space(AS_PROGRAM).install_read_handler(0x1000, 0x1800,
+ m_maincpu->space(AS_PROGRAM).install_read_handler(0x1000, 0x17ff,
read16_delegate(FUNC(generic_slot_device::read16_rom),(generic_slot_device*)m_cart));
- }
+ } else
+ m_maincpu->space(AS_PROGRAM).install_read_handler(0x1000, 0x17ff,
+ read16_delegate(FUNC(unichamp_state::read_ff), this));
}
/* Set Reset and INTR/INTRM Vector */
@@ -193,8 +201,9 @@ void unichamp_state::machine_reset()
/* Set initial PC */
m_maincpu->set_state_int(cp1610_cpu_device::CP1610_R7, 0x0800);
-}
+ memset(m_ram, 0, sizeof(m_ram));
+}
uint32_t unichamp_state::screen_update_unichamp(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
@@ -265,9 +274,9 @@ MACHINE_CONFIG_END
ROM_START(unichamp)
- ROM_REGION(0x10000<<1,"maincpu", ROMREGION_ERASEFF)
+ ROM_REGION(0x1000,"maincpu", ROMREGION_ERASEFF)
- ROM_LOAD16_WORD( "9501-01009.u2", 0x0800<<1, 0x1000, CRC(49a0bd8f) SHA1(f4d126d3462ad351da4b75d76c75942d5a6f27ef))
+ ROM_LOAD16_WORD( "9501-01009.u2", 0, 0x1000, CRC(49a0bd8f) SHA1(f4d126d3462ad351da4b75d76c75942d5a6f27ef))
//these below are for local tests. you can use them in softlist or -cart
//ROM_LOAD16_WORD( "pac-02.bin", 0x1000<<1, 0x1000, CRC(fe3213be) SHA1(5b9c407fe86865f3454d4be824a7f2bf53478f73))
diff --git a/src/mame/drivers/vii.cpp b/src/mame/drivers/vii.cpp
index 7b3475a62a2..cce05e5d358 100644
--- a/src/mame/drivers/vii.cpp
+++ b/src/mame/drivers/vii.cpp
@@ -294,7 +294,7 @@ void vii_state::blit(bitmap_rgb32 &bitmap, const rectangle &cliprect, uint32_t x
bits <<= nc;
if(nbits < nc)
{
- uint16_t b = space.read_word((m++ & 0x3fffff) << 1);
+ uint16_t b = space.read_word(m++ & 0x3fffff);
b = (b << 8) | (b >> 8);
bits |= b << (nc - nbits);
nbits += 16;
@@ -360,7 +360,7 @@ void vii_state::blit_page(bitmap_rgb32 &bitmap, const rectangle &cliprect, int d
{
for(x0 = 0; x0 < wn; x0++)
{
- uint16_t tile = space.read_word((tilemap + x0 + wn * y0) << 1);
+ uint16_t tile = space.read_word(tilemap + x0 + wn * y0);
uint16_t palette = 0;
uint32_t xx, yy;
@@ -369,7 +369,7 @@ void vii_state::blit_page(bitmap_rgb32 &bitmap, const rectangle &cliprect, int d
continue;
}
- palette = space.read_word((palette_map + (x0 + wn * y0) / 2) << 1);
+ palette = space.read_word(palette_map + (x0 + wn * y0) / 2);
if(x0 & 1)
{
palette >>= 8;
@@ -405,10 +405,10 @@ void vii_state::blit_sprite(bitmap_rgb32 &bitmap, const rectangle &cliprect, int
uint32_t h, w;
uint32_t bitmap_addr = 0x40 * m_video_regs[0x22];
- tile = space.read_word((base_addr + 0) << 1);
- x = space.read_word((base_addr + 1) << 1);
- y = space.read_word((base_addr + 2) << 1);
- attr = space.read_word((base_addr + 3) << 1);
+ tile = space.read_word(base_addr + 0);
+ x = space.read_word(base_addr + 1);
+ y = space.read_word(base_addr + 2);
+ attr = space.read_word(base_addr + 3);
if(!tile)
{
@@ -449,7 +449,7 @@ void vii_state::blit_sprites(bitmap_rgb32 &bitmap, const rectangle &cliprect, in
for(n = 0; n < 256; n++)
{
- //if(space.read_word((0x2c00 + 4*n) << 1))
+ //if(space.read_word(0x2c00 + 4*n)
{
blit_sprite(bitmap, cliprect, depth, 0x2c00 + 4*n);
}
@@ -495,7 +495,7 @@ void vii_state::do_dma(uint32_t len)
for(j = 0; j < len; j++)
{
- mem.write_word((dst+j) << 1, mem.read_word((src+j) << 1));
+ mem.write_word(dst+j, mem.read_word(src+j));
}
m_video_regs[0x72] = 0;
@@ -697,7 +697,7 @@ void vii_state::spg_do_dma(uint32_t len)
uint32_t j;
for(j = 0; j < len; j++)
- mem.write_word((dst+j) << 1, mem.read_word((src+j) << 1));
+ mem.write_word(dst+j, mem.read_word(src+j));
m_io_regs[0x102] = 0;
}
diff --git a/src/mame/drivers/xtheball.cpp b/src/mame/drivers/xtheball.cpp
index 4f2044f4461..e0551653dc0 100644
--- a/src/mame/drivers/xtheball.cpp
+++ b/src/mame/drivers/xtheball.cpp
@@ -120,9 +120,9 @@ TMS340X0_SCANLINE_RGB32_CB_MEMBER(xtheball_state::scanline_update)
TMS340X0_TO_SHIFTREG_CB_MEMBER(xtheball_state::to_shiftreg)
{
if (address >= 0x01000000 && address <= 0x010fffff)
- memcpy(shiftreg, &m_vram_bg[TOWORD(address & 0xff000)], TOBYTE(0x1000));
+ memcpy(shiftreg, &m_vram_bg[(address & 0xff000) >> 4], 0x200);
else if (address >= 0x02000000 && address <= 0x020fffff)
- memcpy(shiftreg, &m_vram_fg[TOWORD(address & 0xff000)], TOBYTE(0x1000));
+ memcpy(shiftreg, &m_vram_fg[(address & 0xff000) >> 4], 0x200);
else
logerror("%s:to_shiftreg(%08X)\n", space.machine().describe_context(), address);
}
@@ -131,9 +131,9 @@ TMS340X0_TO_SHIFTREG_CB_MEMBER(xtheball_state::to_shiftreg)
TMS340X0_FROM_SHIFTREG_CB_MEMBER(xtheball_state::from_shiftreg)
{
if (address >= 0x01000000 && address <= 0x010fffff)
- memcpy(&m_vram_bg[TOWORD(address & 0xff000)], shiftreg, TOBYTE(0x1000));
+ memcpy(&m_vram_bg[(address & 0xff000) >> 4], shiftreg, 0x200);
else if (address >= 0x02000000 && address <= 0x020fffff)
- memcpy(&m_vram_fg[TOWORD(address & 0xff000)], shiftreg, TOBYTE(0x1000));
+ memcpy(&m_vram_fg[(address & 0xff000) >> 4], shiftreg, 0x200);
else
logerror("%s:from_shiftreg(%08X)\n", space.machine().describe_context(), address);
}
diff --git a/src/mame/includes/turrett.h b/src/mame/includes/turrett.h
index 334219c23a8..4de2ec6a290 100644
--- a/src/mame/includes/turrett.h
+++ b/src/mame/includes/turrett.h
@@ -118,7 +118,7 @@ protected:
const address_space_config m_space_config;
private:
- direct_read_data *m_direct;
+ direct_read_data<0> *m_direct;
sound_stream *m_stream;
struct
diff --git a/src/mame/machine/c117.cpp b/src/mame/machine/c117.cpp
index 421974254a3..94576cf9832 100644
--- a/src/mame/machine/c117.cpp
+++ b/src/mame/machine/c117.cpp
@@ -79,8 +79,8 @@ void namco_c117_device::device_start()
m_cpuexec[0] = maincpu;
m_cpuexec[1] = subcpu;
- m_cpudirect[0] = &maincpu->space(AS_PROGRAM).direct();
- m_cpudirect[1] = &subcpu->space(AS_PROGRAM).direct();
+ m_cpudirect[0] = maincpu->space(AS_PROGRAM).direct<0>();
+ m_cpudirect[1] = subcpu->space(AS_PROGRAM).direct<0>();
memset(&m_offsets, 0, sizeof(m_offsets));
m_subres = m_wdog = 0;
diff --git a/src/mame/machine/c117.h b/src/mame/machine/c117.h
index cd35155823c..0e26b8aba0d 100644
--- a/src/mame/machine/c117.h
+++ b/src/mame/machine/c117.h
@@ -74,7 +74,7 @@ private:
// cpu interfaces
device_execute_interface * m_cpuexec[2];
- direct_read_data * m_cpudirect[2];
+ direct_read_data<0> * m_cpudirect[2];
// configuration
const char * m_maincpu_tag;
diff --git a/src/mame/machine/inder_vid.cpp b/src/mame/machine/inder_vid.cpp
index 1ed764cfa58..3b7cd017c17 100644
--- a/src/mame/machine/inder_vid.cpp
+++ b/src/mame/machine/inder_vid.cpp
@@ -57,18 +57,18 @@ TMS340X0_TO_SHIFTREG_CB_MEMBER(inder_vid_device::to_shiftreg)
{
if (m_shiftfull == 0)
{
- //printf("read to shift regs address %08x (%08x)\n", address, TOWORD(address) * 2);
+ //printf("read to shift regs address %08x\n", address);
- memcpy(shiftreg, &m_vram[TOWORD(address) & ~TOWORD(0x1fff)], TOBYTE(0x2000)); // & ~TOWORD(0x1fff) is needed for round 6
+ memcpy(shiftreg, &m_vram[(address & ~0x1fff) >> 4], 0x400); // & ~0x1fff is needed for round 6
m_shiftfull = 1;
}
}
TMS340X0_FROM_SHIFTREG_CB_MEMBER(inder_vid_device::from_shiftreg)
{
-// printf("write from shift regs address %08x (%08x)\n", address, TOWORD(address) * 2);
+// printf("write from shift regs address %08x\n", address);
- memcpy(&m_vram[TOWORD(address) & ~TOWORD(0x1fff)], shiftreg, TOBYTE(0x2000));
+ memcpy(&m_vram[(address & ~0x1fff) >> 4], shiftreg, 0x400);
m_shiftfull = 0;
}
diff --git a/src/mame/machine/midtunit.cpp b/src/mame/machine/midtunit.cpp
index 283ccdca76a..7c03273ab9f 100644
--- a/src/mame/machine/midtunit.cpp
+++ b/src/mame/machine/midtunit.cpp
@@ -298,35 +298,35 @@ WRITE16_MEMBER(midtunit_state::jdredd_prot_w)
switch (offset)
{
- case TOWORD(0x10740):
+ case 0x1074:
m_jdredd_prot_index = 0;
m_jdredd_prot_table = jdredd_prot_values_10740;
m_jdredd_prot_max = sizeof(jdredd_prot_values_10740);
logerror("-- reset prot table 10740\n");
break;
- case TOWORD(0x13240):
+ case 0x1324:
m_jdredd_prot_index = 0;
m_jdredd_prot_table = jdredd_prot_values_13240;
m_jdredd_prot_max = sizeof(jdredd_prot_values_13240);
logerror("-- reset prot table 13240\n");
break;
- case TOWORD(0x76540):
+ case 0x7654:
m_jdredd_prot_index = 0;
m_jdredd_prot_table = jdredd_prot_values_76540;
m_jdredd_prot_max = sizeof(jdredd_prot_values_76540);
logerror("-- reset prot table 76540\n");
break;
- case TOWORD(0x77760):
+ case 0x7776:
m_jdredd_prot_index = 0;
m_jdredd_prot_table = jdredd_prot_values_77760;
m_jdredd_prot_max = sizeof(jdredd_prot_values_77760);
logerror("-- reset prot table 77760\n");
break;
- case TOWORD(0x80020):
+ case 0x8002:
m_jdredd_prot_index = 0;
m_jdredd_prot_table = jdredd_prot_values_80020;
m_jdredd_prot_max = sizeof(jdredd_prot_values_80020);
diff --git a/src/mame/machine/midyunit.cpp b/src/mame/machine/midyunit.cpp
index 03fc9a53f1d..58020541da3 100644
--- a/src/mame/machine/midyunit.cpp
+++ b/src/mame/machine/midyunit.cpp
@@ -69,7 +69,7 @@ WRITE16_MEMBER(midyunit_state::midyunit_cmos_enable_w)
{
if (data == 0x500)
{
- m_prot_result = space.read_word(TOBYTE(0x10a4390)) << 4;
+ m_prot_result = space.read_word(0x10a4390) << 4;
logerror(" desired result = %04X\n", m_prot_result);
}
}
diff --git a/src/mame/machine/slapstic.cpp b/src/mame/machine/slapstic.cpp
index cffbaa13d91..28f12fb7821 100644
--- a/src/mame/machine/slapstic.cpp
+++ b/src/mame/machine/slapstic.cpp
@@ -835,7 +835,7 @@ int atari_slapstic_device::alt2_kludge(address_space &space, offs_t offset)
if (MATCHES_MASK_VALUE(space.device().safe_pc() >> 1, slapstic.alt1))
{
/* now look for a move.w (An),(An) or cmpm.w (An)+,(An)+ */
- uint16_t opcode = space.direct().read_word(space.device().safe_pcbase() & 0xffffff);
+ uint16_t opcode = space.read_word(space.device().safe_pcbase() & 0xffffff);
if ((opcode & 0xf1f8) == 0x3090 || (opcode & 0xf1f8) == 0xb148)
{
/* fetch the value of the register for the second operand, and see */
diff --git a/src/mame/video/artmagic.cpp b/src/mame/video/artmagic.cpp
index b755f15932b..d15d3925c5e 100644
--- a/src/mame/video/artmagic.cpp
+++ b/src/mame/video/artmagic.cpp
@@ -24,7 +24,7 @@
inline uint16_t *artmagic_state::address_to_vram(offs_t *address)
{
offs_t original = *address;
- *address = TOWORD(original & 0x001fffff);
+ *address = (original & 0x001fffff) >> 4;
if (original < 0x001fffff)
return m_vram0;
else if (original >= 0x00400000 && original < 0x005fffff)
@@ -63,7 +63,7 @@ TMS340X0_TO_SHIFTREG_CB_MEMBER(artmagic_state::to_shiftreg)
{
uint16_t *vram = address_to_vram(&address);
if (vram)
- memcpy(shiftreg, &vram[address], TOBYTE(0x2000));
+ memcpy(shiftreg, &vram[address], 0x400);
}
@@ -71,7 +71,7 @@ TMS340X0_FROM_SHIFTREG_CB_MEMBER(artmagic_state::from_shiftreg)
{
uint16_t *vram = address_to_vram(&address);
if (vram)
- memcpy(&vram[address], shiftreg, TOBYTE(0x2000));
+ memcpy(&vram[address], shiftreg, 0x400);
}
@@ -194,7 +194,7 @@ void artmagic_state::execute_blit()
{
if (sy >= 0 && sy < 256)
{
- int tsy = sy * TOWORD(0x2000);
+ int tsy = sy * 0x200;
sx = x;
/* The first pixel of every line doesn't have a previous pixel
diff --git a/src/mame/video/btoads.cpp b/src/mame/video/btoads.cpp
index cfe472773c8..d2bdf140454 100644
--- a/src/mame/video/btoads.cpp
+++ b/src/mame/video/btoads.cpp
@@ -267,19 +267,19 @@ TMS340X0_TO_SHIFTREG_CB_MEMBER(btoads_state::to_shiftreg)
/* reads from this first region are usual shift register reads */
if (address >= 0xa0000000 && address <= 0xa3ffffff)
- memcpy(shiftreg, &m_vram_fg_display[TOWORD(address & 0x3fffff)], TOBYTE(0x1000));
+ memcpy(shiftreg, &m_vram_fg_display[(address & 0x3fffff) >> 4], 0x200);
/* reads from this region set the sprite destination address */
else if (address >= 0xa4000000 && address <= 0xa7ffffff)
{
- m_sprite_dest_base = &m_vram_fg_draw[TOWORD(address & 0x3fc000)];
+ m_sprite_dest_base = &m_vram_fg_draw[(address & 0x3fc000) >> 4];
m_sprite_dest_offs = (address & 0x003fff) >> 5;
}
/* reads from this region set the sprite source address */
else if (address >= 0xa8000000 && address <= 0xabffffff)
{
- memcpy(shiftreg, &m_vram_fg_data[TOWORD(address & 0x7fc000)], TOBYTE(0x2000));
+ memcpy(shiftreg, &m_vram_fg_data[(address & 0x7fc000) >> 4], 0x400);
m_sprite_source_offs = (address & 0x003fff) >> 3;
}
@@ -294,7 +294,7 @@ TMS340X0_FROM_SHIFTREG_CB_MEMBER(btoads_state::from_shiftreg)
/* writes to this first region are usual shift register writes */
if (address >= 0xa0000000 && address <= 0xa3ffffff)
- memcpy(&m_vram_fg_display[TOWORD(address & 0x3fc000)], shiftreg, TOBYTE(0x1000));
+ memcpy(&m_vram_fg_display[(address & 0x3fc000) >> 4], shiftreg, 0x200);
/* writes to this region are ignored for our purposes */
else if (address >= 0xa4000000 && address <= 0xa7ffffff)
@@ -302,7 +302,7 @@ TMS340X0_FROM_SHIFTREG_CB_MEMBER(btoads_state::from_shiftreg)
/* writes to this region copy standard data */
else if (address >= 0xa8000000 && address <= 0xabffffff)
- memcpy(&m_vram_fg_data[TOWORD(address & 0x7fc000)], shiftreg, TOBYTE(0x2000));
+ memcpy(&m_vram_fg_data[(address & 0x7fc000) >> 4], shiftreg, 0x400);
/* writes to this region render the current sprite data */
else if (address >= 0xac000000 && address <= 0xafffffff)
diff --git a/src/mame/video/exterm.cpp b/src/mame/video/exterm.cpp
index 5327fcbd1db..331a62e627a 100644
--- a/src/mame/video/exterm.cpp
+++ b/src/mame/video/exterm.cpp
@@ -35,25 +35,25 @@ PALETTE_INIT_MEMBER(exterm_state, exterm)
TMS340X0_TO_SHIFTREG_CB_MEMBER(exterm_state::to_shiftreg_master)
{
- memcpy(shiftreg, &m_master_videoram[TOWORD(address)], 256 * sizeof(uint16_t));
+ memcpy(shiftreg, &m_master_videoram[address >> 4], 256 * sizeof(uint16_t));
}
TMS340X0_FROM_SHIFTREG_CB_MEMBER(exterm_state::from_shiftreg_master)
{
- memcpy(&m_master_videoram[TOWORD(address)], shiftreg, 256 * sizeof(uint16_t));
+ memcpy(&m_master_videoram[address >> 4], shiftreg, 256 * sizeof(uint16_t));
}
TMS340X0_TO_SHIFTREG_CB_MEMBER(exterm_state::to_shiftreg_slave)
{
- memcpy(shiftreg, &m_slave_videoram[TOWORD(address)], 256 * 2 * sizeof(uint8_t));
+ memcpy(shiftreg, &m_slave_videoram[address >> 4], 256 * 2 * sizeof(uint8_t));
}
TMS340X0_FROM_SHIFTREG_CB_MEMBER(exterm_state::from_shiftreg_slave)
{
- memcpy(&m_slave_videoram[TOWORD(address)], shiftreg, 256 * 2 * sizeof(uint8_t));
+ memcpy(&m_slave_videoram[address >> 4], shiftreg, 256 * 2 * sizeof(uint8_t));
}
diff --git a/src/mame/video/jpmimpct.cpp b/src/mame/video/jpmimpct.cpp
index 3df9527c011..8d68a44bd49 100644
--- a/src/mame/video/jpmimpct.cpp
+++ b/src/mame/video/jpmimpct.cpp
@@ -90,12 +90,12 @@ READ16_MEMBER(jpmimpct_state::jpmimpct_bt477_r)
TMS340X0_TO_SHIFTREG_CB_MEMBER(jpmimpct_state::to_shiftreg)
{
- memcpy(shiftreg, &m_vram[TOWORD(address)], 512 * sizeof(uint16_t));
+ memcpy(shiftreg, &m_vram[address >> 4], 512 * sizeof(uint16_t));
}
TMS340X0_FROM_SHIFTREG_CB_MEMBER(jpmimpct_state::from_shiftreg)
{
- memcpy(&m_vram[TOWORD(address)], shiftreg, 512 * sizeof(uint16_t));
+ memcpy(&m_vram[address >> 4], shiftreg, 512 * sizeof(uint16_t));
}