summaryrefslogtreecommitdiffstatshomepage
path: root/src/emu
diff options
context:
space:
mode:
author Aaron Giles <aaron@aarongiles.com>2010-08-19 08:27:05 +0000
committer Aaron Giles <aaron@aarongiles.com>2010-08-19 08:27:05 +0000
commit0edda6dda2011891345f33f0f77c256b059abebf (patch)
tree90ba2b62ff911ff1bc737a56025e58155e9ce4dc /src/emu
parent3598b772bc80b2efb6396c65996462b38eedc593 (diff)
Remove memory_read/write_byte/word/dword/qword* variants. Again, this is mostly
bulk search & replace: S: memory_read_([bytewordq]+)_[0-9lbe_maskd]+( *)\(( *)([^,]+)( *),( *) R: \4->read_\1\2\(\3 S: memory_read_([bytewordq]+)( *)\(( *)([^,]+)( *),( *) R: \4->read_\1\2\(\3 S: memory_write_([bytewordq]+)_[0-9lbe_maskd]+( *)\(( *)([^,]+)( *),( *) R: \4->write_\1\2\(\3 S: memory_write_([bytewordq]+)( *)\(( *)([^,]+)( *),( *) R: \4->write_\1\2\(\3 Gets 99% of the cases.
Diffstat (limited to 'src/emu')
-rw-r--r--src/emu/cpu/adsp2100/adsp2100.c12
-rw-r--r--src/emu/cpu/alph8201/alph8201.c4
-rw-r--r--src/emu/cpu/am29000/am29ops.h10
-rw-r--r--src/emu/cpu/apexc/apexc.c8
-rw-r--r--src/emu/cpu/arm/arm.c16
-rw-r--r--src/emu/cpu/arm7/arm7.c4
-rw-r--r--src/emu/cpu/arm7/arm7core.c28
-rw-r--r--src/emu/cpu/asap/asap.c30
-rw-r--r--src/emu/cpu/avr8/avr8.c12
-rw-r--r--src/emu/cpu/ccpu/ccpu.c8
-rw-r--r--src/emu/cpu/cdp1802/cdp1802.c8
-rw-r--r--src/emu/cpu/cop400/cop400.c8
-rw-r--r--src/emu/cpu/cp1610/cp1610.c6
-rw-r--r--src/emu/cpu/drcbec.c56
-rw-r--r--src/emu/cpu/dsp32/dsp32.c20
-rw-r--r--src/emu/cpu/dsp56k/dsp56k.c2
-rw-r--r--src/emu/cpu/dsp56k/dsp56ops.c46
-rw-r--r--src/emu/cpu/dsp56k/dsp56pcu.c6
-rw-r--r--src/emu/cpu/e132xs/e132xs.h16
-rw-r--r--src/emu/cpu/f8/f8.c12
-rw-r--r--src/emu/cpu/g65816/g65816cm.h6
-rw-r--r--src/emu/cpu/h6280/h6280ops.h30
-rw-r--r--src/emu/cpu/h83002/h8_16.c16
-rw-r--r--src/emu/cpu/h83002/h8_8.c88
-rw-r--r--src/emu/cpu/h83002/h8periph.c104
-rw-r--r--src/emu/cpu/hd6309/hd6309.c4
-rw-r--r--src/emu/cpu/i386/i386priv.h38
-rw-r--r--src/emu/cpu/i4004/i4004.c22
-rw-r--r--src/emu/cpu/i8008/i8008.c8
-rw-r--r--src/emu/cpu/i8085/i8085.c4
-rw-r--r--src/emu/cpu/i8085/i8085cpu.h12
-rw-r--r--src/emu/cpu/i86/i86mem.c31
-rw-r--r--src/emu/cpu/i86/i86priv.h26
-rw-r--r--src/emu/cpu/i860/i860dec.c96
-rw-r--r--src/emu/cpu/i960/i960.c104
-rw-r--r--src/emu/cpu/jaguar/jaguar.c12
-rw-r--r--src/emu/cpu/konami/konami.c4
-rw-r--r--src/emu/cpu/lh5801/5801tbl.c242
-rw-r--r--src/emu/cpu/lh5801/lh5801.c2
-rw-r--r--src/emu/cpu/lr35902/lr35902.c4
-rw-r--r--src/emu/cpu/m37710/m37710.c68
-rw-r--r--src/emu/cpu/m37710/m37710cm.h10
-rw-r--r--src/emu/cpu/m6502/m4510.c4
-rw-r--r--src/emu/cpu/m6502/m6502.c4
-rw-r--r--src/emu/cpu/m6502/m6509.c4
-rw-r--r--src/emu/cpu/m6502/m65ce02.c4
-rw-r--r--src/emu/cpu/m6502/minc4510.h4
-rw-r--r--src/emu/cpu/m6502/mincce02.h4
-rw-r--r--src/emu/cpu/m6502/ops02.h4
-rw-r--r--src/emu/cpu/m6502/ops09.h4
-rw-r--r--src/emu/cpu/m6502/tdeco16.c6
-rw-r--r--src/emu/cpu/m6800/m6800.c68
-rw-r--r--src/emu/cpu/m68000/m68kcpu.c111
-rw-r--r--src/emu/cpu/m68000/m68kmmu.h18
-rw-r--r--src/emu/cpu/m6805/m6805.c4
-rw-r--r--src/emu/cpu/m6809/m6809.c4
-rw-r--r--src/emu/cpu/mb86233/mb86233.c4
-rw-r--r--src/emu/cpu/mb88xx/mb88xx.c8
-rw-r--r--src/emu/cpu/mc68hc11/mc68hc11.c52
-rw-r--r--src/emu/cpu/mcs48/mcs48.c26
-rw-r--r--src/emu/cpu/mcs51/mcs51.c34
-rw-r--r--src/emu/cpu/minx/minx.c4
-rw-r--r--src/emu/cpu/mips/psx.c22
-rw-r--r--src/emu/cpu/mn10200/mn10200.c30
-rw-r--r--src/emu/cpu/nec/nec.c34
-rw-r--r--src/emu/cpu/nec/necmodrm.h18
-rw-r--r--src/emu/cpu/nec/necpriv.h24
-rw-r--r--src/emu/cpu/pdp1/pdp1.c4
-rw-r--r--src/emu/cpu/pdp1/tx0.c4
-rw-r--r--src/emu/cpu/pic16c5x/pic16c5x.c10
-rw-r--r--src/emu/cpu/pic16c62x/pic16c62x.c10
-rw-r--r--src/emu/cpu/powerpc/ppc403.c8
-rw-r--r--src/emu/cpu/powerpc/ppc_mem.c42
-rw-r--r--src/emu/cpu/powerpc/ppccom.c14
-rw-r--r--src/emu/cpu/rsp/rsp.c34
-rw-r--r--src/emu/cpu/s2650/s2650.c24
-rw-r--r--src/emu/cpu/saturn/satops.c4
-rw-r--r--src/emu/cpu/sc61860/scops.c4
-rw-r--r--src/emu/cpu/scmp/scmp.c4
-rw-r--r--src/emu/cpu/se3208/se3208.c28
-rw-r--r--src/emu/cpu/sh2/sh2.c24
-rw-r--r--src/emu/cpu/sh2/sh2comn.c36
-rw-r--r--src/emu/cpu/sh2/sh2drc.c12
-rw-r--r--src/emu/cpu/sh4/sh4.c26
-rw-r--r--src/emu/cpu/sh4/sh4comn.c36
-rw-r--r--src/emu/cpu/sharc/sharcmem.c4
-rw-r--r--src/emu/cpu/sm8500/sm8500.c4
-rw-r--r--src/emu/cpu/spc700/spc700.c8
-rw-r--r--src/emu/cpu/ssem/ssem.c18
-rw-r--r--src/emu/cpu/ssp1601/ssp1601.c6
-rw-r--r--src/emu/cpu/superfx/superfx.c4
-rw-r--r--src/emu/cpu/t11/t11.c8
-rw-r--r--src/emu/cpu/tlcs90/tlcs90.c12
-rw-r--r--src/emu/cpu/tlcs900/tlcs900.c4
-rw-r--r--src/emu/cpu/tms0980/tms0980.c14
-rw-r--r--src/emu/cpu/tms32010/tms32010.c14
-rw-r--r--src/emu/cpu/tms32025/tms32025.c16
-rw-r--r--src/emu/cpu/tms32031/tms32031.c4
-rw-r--r--src/emu/cpu/tms32051/tms32051.c8
-rw-r--r--src/emu/cpu/tms34010/34010gfx.c26
-rw-r--r--src/emu/cpu/tms34010/34010ops.h16
-rw-r--r--src/emu/cpu/tms57002/tms57002.c10
-rw-r--r--src/emu/cpu/tms7000/tms7000.c16
-rw-r--r--src/emu/cpu/tms9900/99xxcore.h134
-rw-r--r--src/emu/cpu/unsp/unsp.c4
-rw-r--r--src/emu/cpu/upd7810/upd7810.c26
-rw-r--r--src/emu/cpu/v30mz/v30mz.h18
-rw-r--r--src/emu/cpu/v60/v60mem.c79
-rw-r--r--src/emu/cpu/v810/v810.c24
-rw-r--r--src/emu/cpu/z180/z180.c36
-rw-r--r--src/emu/cpu/z180/z180ops.h8
-rw-r--r--src/emu/cpu/z8/z8.c26
-rw-r--r--src/emu/cpu/z8/z8ops.c4
-rw-r--r--src/emu/cpu/z80/z80.c8
-rw-r--r--src/emu/cpu/z8000/z8000.c28
-rw-r--r--src/emu/machine/at28c16.c16
-rw-r--r--src/emu/machine/eeprom.c30
-rw-r--r--src/emu/machine/i2cmem.c14
-rw-r--r--src/emu/machine/idectrl.c36
-rw-r--r--src/emu/memory.h198
-rw-r--r--src/emu/sound/nes_apu.c2
-rw-r--r--src/emu/sound/scsp.c4
-rw-r--r--src/emu/sound/vrender0.c4
123 files changed, 1396 insertions, 1561 deletions
diff --git a/src/emu/cpu/adsp2100/adsp2100.c b/src/emu/cpu/adsp2100/adsp2100.c
index d147b719fa8..369ffad523f 100644
--- a/src/emu/cpu/adsp2100/adsp2100.c
+++ b/src/emu/cpu/adsp2100/adsp2100.c
@@ -318,32 +318,32 @@ INLINE adsp2100_state *get_safe_token(running_device *device)
INLINE UINT16 RWORD_DATA(adsp2100_state *adsp, UINT32 addr)
{
- return memory_read_word_16le(adsp->data, addr << 1);
+ return adsp->data->read_word(addr << 1);
}
INLINE void WWORD_DATA(adsp2100_state *adsp, UINT32 addr, UINT16 data)
{
- memory_write_word_16le(adsp->data, addr << 1, data);
+ adsp->data->write_word(addr << 1, data);
}
INLINE UINT16 RWORD_IO(adsp2100_state *adsp, UINT32 addr)
{
- return memory_read_word_16le(adsp->io, addr << 1);
+ return adsp->io->read_word(addr << 1);
}
INLINE void WWORD_IO(adsp2100_state *adsp, UINT32 addr, UINT16 data)
{
- memory_write_word_16le(adsp->io, addr << 1, data);
+ adsp->io->write_word(addr << 1, data);
}
INLINE UINT32 RWORD_PGM(adsp2100_state *adsp, UINT32 addr)
{
- return memory_read_dword_32le(adsp->program, addr << 2);
+ return adsp->program->read_dword(addr << 2);
}
INLINE void WWORD_PGM(adsp2100_state *adsp, UINT32 addr, UINT32 data)
{
- memory_write_dword_32le(adsp->program, addr << 2, data & 0xffffff);
+ adsp->program->write_dword(addr << 2, data & 0xffffff);
}
#define ROPCODE(a) memory_decrypted_read_dword((a)->program, (a)->pc << 2)
diff --git a/src/emu/cpu/alph8201/alph8201.c b/src/emu/cpu/alph8201/alph8201.c
index 17f78d5968f..0469377e166 100644
--- a/src/emu/cpu/alph8201/alph8201.c
+++ b/src/emu/cpu/alph8201/alph8201.c
@@ -165,8 +165,8 @@ Timming
/* MAME is unnecessary */
#define HANDLE_HALT_LINE 0
-#define M_RDMEM(A) memory_read_byte_8le(cpustate->program, A)
-#define M_WRMEM(A,V) memory_write_byte_8le(cpustate->program, A, V)
+#define M_RDMEM(A) cpustate->program->read_byte(A)
+#define M_WRMEM(A,V) cpustate->program->write_byte(A, V)
#define M_RDOP(A) memory_decrypted_read_byte(cpustate->program, A)
#define M_RDOP_ARG(A) memory_raw_read_byte(cpustate->program, A)
diff --git a/src/emu/cpu/am29000/am29ops.h b/src/emu/cpu/am29000/am29ops.h
index 1ee9f337f81..24ebfa0e539 100644
--- a/src/emu/cpu/am29000/am29ops.h
+++ b/src/emu/cpu/am29000/am29ops.h
@@ -956,7 +956,7 @@ static void LOAD(am29000_state *am29000)
return;
}
- r = memory_read_dword_32be(am29000->data, addr);
+ r = am29000->data->read_dword(addr);
}
}
@@ -1020,7 +1020,7 @@ static void LOADM(am29000_state *am29000)
return;
}
- r = memory_read_dword_32be(am29000->data, addr);
+ r = am29000->data->read_dword(addr);
}
}
@@ -1045,7 +1045,7 @@ static void LOADM(am29000_state *am29000)
int cnt;
for (cnt = 0; cnt <= GET_CHC_CR; ++cnt)
{
- am29000->r[r] = memory_read_dword_32be(am29000->data, addr);
+ am29000->r[r] = am29000->data->read_dword(addr);
// SET_CHC_CR(cnt - 1);
addr += 4;
@@ -1086,7 +1086,7 @@ static void STORE(am29000_state *am29000)
}
}
- memory_write_dword_32be(am29000->data, addr, am29000->r[RA]);
+ am29000->data->write_dword(addr, am29000->r[RA]);
if (!FREEZE_MODE)
{
@@ -1159,7 +1159,7 @@ static void STOREM(am29000_state *am29000)
int cnt;
for (cnt = 0; cnt <= GET_CHC_CR; ++cnt)
{
- memory_write_dword_32be(am29000->data, addr, am29000->r[r]);
+ am29000->data->write_dword(addr, am29000->r[r]);
// SET_CHC_CR(cnt - 1);
addr += 4;
diff --git a/src/emu/cpu/apexc/apexc.c b/src/emu/cpu/apexc/apexc.c
index d218e77eb5d..a7d6bfff8c9 100644
--- a/src/emu/cpu/apexc/apexc.c
+++ b/src/emu/cpu/apexc/apexc.c
@@ -328,8 +328,8 @@ field: X address D Function Y address D (part 2)
#include "apexc.h"
#ifndef SUPPORT_ODD_WORD_SIZES
-#define apexc_readmem(address) memory_read_dword_32be(cpustate->program, (address)<<2)
-#define apexc_writemem(address, data) memory_write_dword_32be(cpustate->program, (address)<<2, (data))
+#define apexc_readmem(address) cpustate->program->read_dword((address)<<2)
+#define apexc_writemem(address, data) cpustate->program->write_dword((address)<<2, (data))
/* eewww ! - Fortunately, there is no memory mapped I/O, so we can simulate masked write
without danger */
#define apexc_writemem_masked(address, data, mask) \
@@ -474,12 +474,12 @@ static void word_write(apexc_state *cpustate, int address, UINT32 data, UINT32 m
static int papertape_read(apexc_state *cpustate)
{
- return memory_read_byte_8be(cpustate->io, 0) & 0x1f;
+ return cpustate->io->read_byte(0) & 0x1f;
}
static void papertape_punch(apexc_state *cpustate, int data)
{
- memory_write_byte_8be(cpustate->io, 0, data);
+ cpustate->io->write_byte(0, data);
}
/*
diff --git a/src/emu/cpu/arm/arm.c b/src/emu/cpu/arm/arm.c
index 814410ead26..843e098cef0 100644
--- a/src/emu/cpu/arm/arm.c
+++ b/src/emu/cpu/arm/arm.c
@@ -263,18 +263,18 @@ INLINE void cpu_write32( ARM_REGS* cpustate, int addr, UINT32 data )
{
/* Unaligned writes are treated as normal writes */
if ( cpustate->endian == ENDIANNESS_BIG )
- memory_write_dword_32be(cpustate->program, addr&ADDRESS_MASK,data);
+ cpustate->program->write_dword(addr&ADDRESS_MASK,data);
else
- memory_write_dword_32le(cpustate->program, addr&ADDRESS_MASK,data);
+ cpustate->program->write_dword(addr&ADDRESS_MASK,data);
if (ARM_DEBUG_CORE && addr&3) logerror("%08x: Unaligned write %08x\n",R15,addr);
}
INLINE void cpu_write8( ARM_REGS* cpustate, int addr, UINT8 data )
{
if ( cpustate->endian == ENDIANNESS_BIG )
- memory_write_byte_32be(cpustate->program,addr,data);
+ cpustate->program->write_byte(addr,data);
else
- memory_write_byte_32le(cpustate->program,addr,data);
+ cpustate->program->write_byte(addr,data);
}
INLINE UINT32 cpu_read32( ARM_REGS* cpustate, int addr )
@@ -282,9 +282,9 @@ INLINE UINT32 cpu_read32( ARM_REGS* cpustate, int addr )
UINT32 result;
if ( cpustate->endian == ENDIANNESS_BIG )
- result = memory_read_dword_32be(cpustate->program,addr&ADDRESS_MASK);
+ result = cpustate->program->read_dword(addr&ADDRESS_MASK);
else
- result = memory_read_dword_32le(cpustate->program,addr&ADDRESS_MASK);
+ result = cpustate->program->read_dword(addr&ADDRESS_MASK);
/* Unaligned reads rotate the word, they never combine words */
if (addr&3) {
@@ -305,9 +305,9 @@ INLINE UINT32 cpu_read32( ARM_REGS* cpustate, int addr )
INLINE UINT8 cpu_read8( ARM_REGS* cpustate, int addr )
{
if ( cpustate->endian == ENDIANNESS_BIG )
- return memory_read_byte_32be(cpustate->program, addr);
+ return cpustate->program->read_byte(addr);
else
- return memory_read_byte_32le(cpustate->program, addr);
+ return cpustate->program->read_byte(addr);
}
INLINE UINT32 GetRegister( ARM_REGS* cpustate, int rIndex )
diff --git a/src/emu/cpu/arm7/arm7.c b/src/emu/cpu/arm7/arm7.c
index 7881ec3b25f..c0d878cdcb2 100644
--- a/src/emu/cpu/arm7/arm7.c
+++ b/src/emu/cpu/arm7/arm7.c
@@ -104,7 +104,7 @@ enum
INLINE UINT32 arm7_tlb_get_first_level_descriptor( arm_state *cpustate, UINT32 vaddr )
{
UINT32 entry_paddr = ( COPRO_TLB_BASE & COPRO_TLB_BASE_MASK ) | ( ( vaddr & COPRO_TLB_VADDR_FLTI_MASK ) >> COPRO_TLB_VADDR_FLTI_MASK_SHIFT );
- return memory_read_dword_32le( cpustate->program, entry_paddr );
+ return cpustate->program->read_dword( entry_paddr );
}
INLINE UINT32 arm7_tlb_get_second_level_descriptor( arm_state *cpustate, UINT32 granularity, UINT32 first_desc, UINT32 vaddr )
@@ -125,7 +125,7 @@ INLINE UINT32 arm7_tlb_get_second_level_descriptor( arm_state *cpustate, UINT32
break;
}
- return memory_read_dword_32le( cpustate->program, desc_lvl2 );
+ return cpustate->program->read_dword( desc_lvl2 );
}
INLINE UINT32 arm7_tlb_translate(arm_state *cpustate, UINT32 vaddr)
diff --git a/src/emu/cpu/arm7/arm7core.c b/src/emu/cpu/arm7/arm7core.c
index f367a2b7307..d96ffb3c378 100644
--- a/src/emu/cpu/arm7/arm7core.c
+++ b/src/emu/cpu/arm7/arm7core.c
@@ -136,9 +136,9 @@ INLINE void arm7_cpu_write32(arm_state *cpustate, UINT32 addr, UINT32 data)
addr &= ~3;
if ( cpustate->endian == ENDIANNESS_BIG )
- memory_write_dword_32be(cpustate->program, addr, data);
+ cpustate->program->write_dword(addr, data);
else
- memory_write_dword_32le(cpustate->program, addr, data);
+ cpustate->program->write_dword(addr, data);
}
@@ -151,9 +151,9 @@ INLINE void arm7_cpu_write16(arm_state *cpustate, UINT32 addr, UINT16 data)
addr &= ~1;
if ( cpustate->endian == ENDIANNESS_BIG )
- memory_write_word_32be(cpustate->program, addr, data);
+ cpustate->program->write_word(addr, data);
else
- memory_write_word_32le(cpustate->program, addr, data);
+ cpustate->program->write_word(addr, data);
}
INLINE void arm7_cpu_write8(arm_state *cpustate, UINT32 addr, UINT8 data)
@@ -164,9 +164,9 @@ INLINE void arm7_cpu_write8(arm_state *cpustate, UINT32 addr, UINT8 data)
}
if ( cpustate->endian == ENDIANNESS_BIG )
- memory_write_byte_32be(cpustate->program, addr, data);
+ cpustate->program->write_byte(addr, data);
else
- memory_write_byte_32le(cpustate->program, addr, data);
+ cpustate->program->write_byte(addr, data);
}
INLINE UINT32 arm7_cpu_read32(arm_state *cpustate, offs_t addr)
@@ -181,17 +181,17 @@ INLINE UINT32 arm7_cpu_read32(arm_state *cpustate, offs_t addr)
if (addr & 3)
{
if ( cpustate->endian == ENDIANNESS_BIG )
- result = memory_read_dword_32be(cpustate->program, addr & ~3);
+ result = cpustate->program->read_dword(addr & ~3);
else
- result = memory_read_dword_32le(cpustate->program, addr & ~3);
+ result = cpustate->program->read_dword(addr & ~3);
result = (result >> (8 * (addr & 3))) | (result << (32 - (8 * (addr & 3))));
}
else
{
if ( cpustate->endian == ENDIANNESS_BIG )
- result = memory_read_dword_32be(cpustate->program, addr);
+ result = cpustate->program->read_dword(addr);
else
- result = memory_read_dword_32le(cpustate->program, addr);
+ result = cpustate->program->read_dword(addr);
}
return result;
@@ -207,9 +207,9 @@ INLINE UINT16 arm7_cpu_read16(arm_state *cpustate, offs_t addr)
}
if ( cpustate->endian == ENDIANNESS_BIG )
- result = memory_read_word_32be(cpustate->program, addr & ~1);
+ result = cpustate->program->read_word(addr & ~1);
else
- result = memory_read_word_32le(cpustate->program, addr & ~1);
+ result = cpustate->program->read_word(addr & ~1);
if (addr & 1)
{
@@ -228,9 +228,9 @@ INLINE UINT8 arm7_cpu_read8(arm_state *cpustate, offs_t addr)
// Handle through normal 8 bit handler (for 32 bit cpu)
if ( cpustate->endian == ENDIANNESS_BIG )
- return memory_read_byte_32be(cpustate->program, addr);
+ return cpustate->program->read_byte(addr);
else
- return memory_read_byte_32le(cpustate->program, addr);
+ return cpustate->program->read_byte(addr);
}
/***************
diff --git a/src/emu/cpu/asap/asap.c b/src/emu/cpu/asap/asap.c
index fe7f2393109..e04403cf247 100644
--- a/src/emu/cpu/asap/asap.c
+++ b/src/emu/cpu/asap/asap.c
@@ -287,33 +287,33 @@ INLINE asap_state *get_safe_token(running_device *device)
INLINE UINT8 READBYTE(asap_state *asap, offs_t address)
{
/* no alignment issues with bytes */
- return memory_read_byte_32le(asap->program, address);
+ return asap->program->read_byte(address);
}
INLINE UINT16 READWORD(asap_state *asap, offs_t address)
{
/* aligned reads are easy */
if (!(address & 1))
- return memory_read_word_32le(asap->program, address);
+ return asap->program->read_word(address);
/* misaligned reads are tricky */
- return memory_read_dword_32le(asap->program, address & ~3) >> (address & 3);
+ return asap->program->read_dword(address & ~3) >> (address & 3);
}
INLINE UINT32 READLONG(asap_state *asap, offs_t address)
{
/* aligned reads are easy */
if (!(address & 3))
- return memory_read_dword_32le(asap->program, address);
+ return asap->program->read_dword(address);
/* misaligned reads are tricky */
- return memory_read_dword_32le(asap->program, address & ~3) >> (address & 3);
+ return asap->program->read_dword(address & ~3) >> (address & 3);
}
INLINE void WRITEBYTE(asap_state *asap, offs_t address, UINT8 data)
{
/* no alignment issues with bytes */
- memory_write_byte_32le(asap->program, address, data);
+ asap->program->write_byte(address, data);
}
INLINE void WRITEWORD(asap_state *asap, offs_t address, UINT16 data)
@@ -321,18 +321,18 @@ INLINE void WRITEWORD(asap_state *asap, offs_t address, UINT16 data)
/* aligned writes are easy */
if (!(address & 1))
{
- memory_write_word_32le(asap->program, address, data);
+ asap->program->write_word(address, data);
return;
}
/* misaligned writes are tricky */
if (!(address & 2))
{
- memory_write_byte_32le(asap->program, address + 1, data);
- memory_write_byte_32le(asap->program, address + 2, data >> 8);
+ asap->program->write_byte(address + 1, data);
+ asap->program->write_byte(address + 2, data >> 8);
}
else
- memory_write_byte_32le(asap->program, address + 1, data);
+ asap->program->write_byte(address + 1, data);
}
INLINE void WRITELONG(asap_state *asap, offs_t address, UINT32 data)
@@ -340,7 +340,7 @@ INLINE void WRITELONG(asap_state *asap, offs_t address, UINT32 data)
/* aligned writes are easy */
if (!(address & 3))
{
- memory_write_dword_32le(asap->program, address, data);
+ asap->program->write_dword(address, data);
return;
}
@@ -348,14 +348,14 @@ INLINE void WRITELONG(asap_state *asap, offs_t address, UINT32 data)
switch (address & 3)
{
case 1:
- memory_write_byte_32le(asap->program, address, data);
- memory_write_word_32le(asap->program, address + 1, data >> 8);
+ asap->program->write_byte(address, data);
+ asap->program->write_word(address + 1, data >> 8);
break;
case 2:
- memory_write_word_32le(asap->program, address, data);
+ asap->program->write_word(address, data);
break;
case 3:
- memory_write_byte_32le(asap->program, address, data);
+ asap->program->write_byte(address, data);
break;
}
}
diff --git a/src/emu/cpu/avr8/avr8.c b/src/emu/cpu/avr8/avr8.c
index d154f13ef12..d660561269e 100644
--- a/src/emu/cpu/avr8/avr8.c
+++ b/src/emu/cpu/avr8/avr8.c
@@ -115,32 +115,32 @@ INLINE bool avr8_is_long_opcode(UINT16 op)
INLINE UINT8 READ_PRG_8(avr8_state *cpustate, UINT32 address)
{
- return memory_read_byte_16le(cpustate->program, address);
+ return cpustate->program->read_byte(address);
}
INLINE UINT16 READ_PRG_16(avr8_state *cpustate, UINT32 address)
{
- return memory_read_word_16le(cpustate->program, address << 1);
+ return cpustate->program->read_word(address << 1);
}
INLINE void WRITE_PRG_8(avr8_state *cpustate, UINT32 address, UINT8 data)
{
- memory_write_byte_16le(cpustate->program, address, data);
+ cpustate->program->write_byte(address, data);
}
INLINE void WRITE_PRG_16(avr8_state *cpustate, UINT32 address, UINT16 data)
{
- memory_write_word_16le(cpustate->program, address, data);
+ cpustate->program->write_word(address, data);
}
INLINE UINT8 READ_IO_8(avr8_state *cpustate, UINT16 address)
{
- return memory_read_byte(cpustate->io, address);
+ return cpustate->io->read_byte(address);
}
INLINE void WRITE_IO_8(avr8_state *cpustate, UINT16 address, UINT8 data)
{
- memory_write_byte(cpustate->io, address, data);
+ cpustate->io->write_byte(address, data);
}
INLINE void PUSH(avr8_state *cpustate, UINT8 val)
diff --git a/src/emu/cpu/ccpu/ccpu.c b/src/emu/cpu/ccpu/ccpu.c
index 2896937e1cf..174163e7f01 100644
--- a/src/emu/cpu/ccpu/ccpu.c
+++ b/src/emu/cpu/ccpu/ccpu.c
@@ -64,11 +64,11 @@ INLINE ccpu_state *get_safe_token(running_device *device)
#define READOP(C,a) (memory_decrypted_read_byte((C)->program, a))
-#define RDMEM(C,a) (memory_read_word_16be((C)->data, (a) * 2) & 0xfff)
-#define WRMEM(C,a,v) (memory_write_word_16be((C)->data, (a) * 2, (v)))
+#define RDMEM(C,a) ((C)->data->read_word((a) * 2) & 0xfff)
+#define WRMEM(C,a,v) ((C)->data->write_word((a) * 2, (v)))
-#define READPORT(C,a) (memory_read_byte_8be((C)->io, a))
-#define WRITEPORT(C,a,v) (memory_write_byte_8be((C)->io, (a), (v)))
+#define READPORT(C,a) ((C)->io->read_byte(a))
+#define WRITEPORT(C,a,v) ((C)->io->write_byte((a), (v)))
#define SET_A0(C) do { (C)->a0flag = (C)->A; } while (0)
#define SET_CMP_VAL(C,x) do { (C)->cmpacc = *(C)->acc; (C)->cmpval = (x) & 0xfff; } while (0)
diff --git a/src/emu/cpu/cdp1802/cdp1802.c b/src/emu/cpu/cdp1802/cdp1802.c
index 51b1e2c7412..6882efa7312 100644
--- a/src/emu/cpu/cdp1802/cdp1802.c
+++ b/src/emu/cpu/cdp1802/cdp1802.c
@@ -75,10 +75,10 @@ INLINE cdp1802_state *get_safe_token(running_device *device)
}
#define OPCODE_R(addr) memory_decrypted_read_byte(cpustate->program, addr)
-#define RAM_R(addr) memory_read_byte_8be(cpustate->program, addr)
-#define RAM_W(addr, data) memory_write_byte_8be(cpustate->program, addr, data)
-#define IO_R(addr) memory_read_byte_8be(cpustate->io, addr)
-#define IO_W(addr, data) memory_write_byte_8be(cpustate->io, addr, data)
+#define RAM_R(addr) cpustate->program->read_byte(addr)
+#define RAM_W(addr, data) cpustate->program->write_byte(addr, data)
+#define IO_R(addr) cpustate->io->read_byte(addr)
+#define IO_W(addr, data) cpustate->io->write_byte(addr, data)
#define P cpustate->p
#define X cpustate->x
diff --git a/src/emu/cpu/cop400/cop400.c b/src/emu/cpu/cop400/cop400.c
index 0983df05729..24ba3f87596 100644
--- a/src/emu/cpu/cop400/cop400.c
+++ b/src/emu/cpu/cop400/cop400.c
@@ -161,10 +161,10 @@ struct _cop400_opcode_map {
***************************************************************************/
#define ROM(a) memory_decrypted_read_byte(cpustate->program, a)
-#define RAM_R(a) memory_read_byte_8le(cpustate->data, a)
-#define RAM_W(a, v) memory_write_byte_8le(cpustate->data, a, v)
-#define IN(a) memory_read_byte_8le(cpustate->io, a)
-#define OUT(a, v) memory_write_byte_8le(cpustate->io, a, v)
+#define RAM_R(a) cpustate->data->read_byte(a)
+#define RAM_W(a, v) cpustate->data->write_byte(a, v)
+#define IN(a) cpustate->io->read_byte(a)
+#define OUT(a, v) cpustate->io->write_byte(a, v)
#define IN_G() (IN(COP400_PORT_G) & cpustate->g_mask)
#define IN_L() IN(COP400_PORT_L)
diff --git a/src/emu/cpu/cp1610/cp1610.c b/src/emu/cpu/cp1610/cp1610.c
index 1142d16b88e..8a6a81824a4 100644
--- a/src/emu/cpu/cp1610/cp1610.c
+++ b/src/emu/cpu/cp1610/cp1610.c
@@ -58,9 +58,9 @@ INLINE cp1610_state *get_safe_token(running_device *device)
return (cp1610_state *)downcast<legacy_cpu_device *>(device)->token();
}
-#define cp1610_readop(A) memory_read_word_16be(cpustate->program, (A)<<1)
-#define cp1610_readmem16(A) memory_read_word_16be(cpustate->program, (A)<<1)
-#define cp1610_writemem16(A,B) memory_write_word_16be(cpustate->program, (A)<<1,B)
+#define cp1610_readop(A) cpustate->program->read_word((A)<<1)
+#define cp1610_readmem16(A) cpustate->program->read_word((A)<<1)
+#define cp1610_writemem16(A,B) cpustate->program->write_word((A)<<1,B)
/* clear all flags */
#define CLR_SZOC \
diff --git a/src/emu/cpu/drcbec.c b/src/emu/cpu/drcbec.c
index 07d2c906637..485ae4feb17 100644
--- a/src/emu/cpu/drcbec.c
+++ b/src/emu/cpu/drcbec.c
@@ -903,43 +903,43 @@ static int drcbec_execute(drcbe_state *drcbe, drcuml_codehandle *entry)
break;
case MAKE_OPCODE_SHORT(DRCUML_OP_READ1, 4, 0): /* READ dst,src1,space_BYTE */
- PARAM0 = memory_read_byte(drcbe->space[PARAM2 / 16], PARAM1);
+ PARAM0 = drcbe->space[PARAM2 / 16]->read_byte(PARAM1);
break;
case MAKE_OPCODE_SHORT(DRCUML_OP_READ2, 4, 0): /* READ dst,src1,space_WORD */
- PARAM0 = memory_read_word(drcbe->space[PARAM2 / 16], PARAM1);
+ PARAM0 = drcbe->space[PARAM2 / 16]->read_word(PARAM1);
break;
case MAKE_OPCODE_SHORT(DRCUML_OP_READ4, 4, 0): /* READ dst,src1,space_DWORD */
- PARAM0 = memory_read_dword(drcbe->space[PARAM2 / 16], PARAM1);
+ PARAM0 = drcbe->space[PARAM2 / 16]->read_dword(PARAM1);
break;
case MAKE_OPCODE_SHORT(DRCUML_OP_READM2, 4, 0): /* READM dst,src1,mask,space_WORD */
- PARAM0 = memory_read_word_masked(drcbe->space[PARAM3 / 16], PARAM1, PARAM2);
+ PARAM0 = drcbe->space[PARAM3 / 16]->read_word(PARAM1, PARAM2);
break;
case MAKE_OPCODE_SHORT(DRCUML_OP_READM4, 4, 0): /* READM dst,src1,mask,space_DWORD */
- PARAM0 = memory_read_dword_masked(drcbe->space[PARAM3 / 16], PARAM1, PARAM2);
+ PARAM0 = drcbe->space[PARAM3 / 16]->read_dword(PARAM1, PARAM2);
break;
case MAKE_OPCODE_SHORT(DRCUML_OP_WRITE1, 4, 0): /* WRITE dst,src1,space_BYTE */
- memory_write_byte(drcbe->space[PARAM2 / 16], PARAM0, PARAM1);
+ drcbe->space[PARAM2 / 16]->write_byte(PARAM0, PARAM1);
break;
case MAKE_OPCODE_SHORT(DRCUML_OP_WRITE2, 4, 0): /* WRITE dst,src1,space_WORD */
- memory_write_word(drcbe->space[PARAM2 / 16], PARAM0, PARAM1);
+ drcbe->space[PARAM2 / 16]->write_word(PARAM0, PARAM1);
break;
case MAKE_OPCODE_SHORT(DRCUML_OP_WRITE4, 4, 0): /* WRITE dst,src1,space_DWORD */
- memory_write_dword(drcbe->space[PARAM2 / 16], PARAM0, PARAM1);
+ drcbe->space[PARAM2 / 16]->write_dword(PARAM0, PARAM1);
break;
case MAKE_OPCODE_SHORT(DRCUML_OP_WRITEM2, 4, 0): /* WRITEM dst,src1,mask,space_WORD */
- memory_write_word_masked(drcbe->space[PARAM3 / 16], PARAM0, PARAM1, PARAM2);
+ drcbe->space[PARAM3 / 16]->write_word(PARAM0, PARAM1, PARAM2);
break;
case MAKE_OPCODE_SHORT(DRCUML_OP_WRITEM4, 4, 0): /* WRITEM dst,src1,mask,space_DWORD */
- memory_write_dword_masked(drcbe->space[PARAM3 / 16], PARAM0, PARAM1, PARAM2);
+ drcbe->space[PARAM3 / 16]->write_dword(PARAM0, PARAM1, PARAM2);
break;
case MAKE_OPCODE_SHORT(DRCUML_OP_CARRY, 4, 1): /* CARRY src,bitnum */
@@ -1482,59 +1482,59 @@ static int drcbec_execute(drcbe_state *drcbe, drcuml_codehandle *entry)
break;
case MAKE_OPCODE_SHORT(DRCUML_OP_READ1, 8, 0): /* DREAD dst,src1,space_BYTE */
- DPARAM0 = memory_read_byte(drcbe->space[PARAM2 / 16], PARAM1);
+ DPARAM0 = drcbe->space[PARAM2 / 16]->read_byte(PARAM1);
break;
case MAKE_OPCODE_SHORT(DRCUML_OP_READ2, 8, 0): /* DREAD dst,src1,space_WORD */
- DPARAM0 = memory_read_word(drcbe->space[PARAM2 / 16], PARAM1);
+ DPARAM0 = drcbe->space[PARAM2 / 16]->read_word(PARAM1);
break;
case MAKE_OPCODE_SHORT(DRCUML_OP_READ4, 8, 0): /* DREAD dst,src1,space_DWORD */
- DPARAM0 = memory_read_dword(drcbe->space[PARAM2 / 16], PARAM1);
+ DPARAM0 = drcbe->space[PARAM2 / 16]->read_dword(PARAM1);
break;
case MAKE_OPCODE_SHORT(DRCUML_OP_READ8, 8, 0): /* DREAD dst,src1,space_QOWRD */
- DPARAM0 = memory_read_qword(drcbe->space[PARAM2 / 16], PARAM1);
+ DPARAM0 = drcbe->space[PARAM2 / 16]->read_qword(PARAM1);
break;
case MAKE_OPCODE_SHORT(DRCUML_OP_READM2, 8, 0): /* DREADM dst,src1,mask,space_WORD */
- DPARAM0 = memory_read_word_masked(drcbe->space[PARAM3 / 16], PARAM1, PARAM2);
+ DPARAM0 = drcbe->space[PARAM3 / 16]->read_word(PARAM1, PARAM2);
break;
case MAKE_OPCODE_SHORT(DRCUML_OP_READM4, 8, 0): /* DREADM dst,src1,mask,space_DWORD */
- DPARAM0 = memory_read_dword_masked(drcbe->space[PARAM3 / 16], PARAM1, PARAM2);
+ DPARAM0 = drcbe->space[PARAM3 / 16]->read_dword(PARAM1, PARAM2);
break;
case MAKE_OPCODE_SHORT(DRCUML_OP_READM8, 8, 0): /* DREADM dst,src1,mask,space_QWORD */
- DPARAM0 = memory_read_qword_masked(drcbe->space[PARAM3 / 16], PARAM1, PARAM2);
+ DPARAM0 = drcbe->space[PARAM3 / 16]->read_qword(PARAM1, PARAM2);
break;
case MAKE_OPCODE_SHORT(DRCUML_OP_WRITE1, 8, 0): /* DWRITE dst,src1,space_BYTE */
- memory_write_byte(drcbe->space[PARAM2 / 16], PARAM0, PARAM1);
+ drcbe->space[PARAM2 / 16]->write_byte(PARAM0, PARAM1);
break;
case MAKE_OPCODE_SHORT(DRCUML_OP_WRITE2, 8, 0): /* DWRITE dst,src1,space_WORD */
- memory_write_word(drcbe->space[PARAM2 / 16], PARAM0, PARAM1);
+ drcbe->space[PARAM2 / 16]->write_word(PARAM0, PARAM1);
break;
case MAKE_OPCODE_SHORT(DRCUML_OP_WRITE4, 8, 0): /* DWRITE dst,src1,space_DWORD */
- memory_write_dword(drcbe->space[PARAM2 / 16], PARAM0, PARAM1);
+ drcbe->space[PARAM2 / 16]->write_dword(PARAM0, PARAM1);
break;
case MAKE_OPCODE_SHORT(DRCUML_OP_WRITE8, 8, 0): /* DWRITE dst,src1,space_QWORD */
- memory_write_qword(drcbe->space[PARAM2 / 16], PARAM0, DPARAM1);
+ drcbe->space[PARAM2 / 16]->write_qword(PARAM0, DPARAM1);
break;
case MAKE_OPCODE_SHORT(DRCUML_OP_WRITEM2, 8, 0): /* DWRITEM dst,src1,mask,space_WORD */
- memory_write_word_masked(drcbe->space[PARAM3 / 16], PARAM0, DPARAM1, DPARAM2);
+ drcbe->space[PARAM3 / 16]->write_word(PARAM0, DPARAM1, DPARAM2);
break;
case MAKE_OPCODE_SHORT(DRCUML_OP_WRITEM4, 8, 0): /* DWRITEM dst,src1,mask,space_DWORD */
- memory_write_dword_masked(drcbe->space[PARAM3 / 16], PARAM0, DPARAM1, DPARAM2);
+ drcbe->space[PARAM3 / 16]->write_dword(PARAM0, DPARAM1, DPARAM2);
break;
case MAKE_OPCODE_SHORT(DRCUML_OP_WRITEM8, 8, 0): /* DWRITEM dst,src1,mask,space_QWORD */
- memory_write_qword_masked(drcbe->space[PARAM3 / 16], PARAM0, DPARAM1, DPARAM2);
+ drcbe->space[PARAM3 / 16]->write_qword(PARAM0, DPARAM1, DPARAM2);
break;
case MAKE_OPCODE_SHORT(DRCUML_OP_CARRY, 8, 0): /* DCARRY src,bitnum */
@@ -1895,11 +1895,11 @@ static int drcbec_execute(drcbe_state *drcbe, drcuml_codehandle *entry)
break;
case MAKE_OPCODE_SHORT(DRCUML_OP_FREAD, 4, 0): /* FSREAD dst,src1,space */
- PARAM0 = memory_read_dword(drcbe->space[PARAM2], PARAM1);
+ PARAM0 = drcbe->space[PARAM2]->read_dword(PARAM1);
break;
case MAKE_OPCODE_SHORT(DRCUML_OP_FWRITE, 4, 0): /* FSWRITE dst,src1,space */
- memory_write_dword(drcbe->space[PARAM2], PARAM0, PARAM1);
+ drcbe->space[PARAM2]->write_dword(PARAM0, PARAM1);
break;
case MAKE_OPCODE_SHORT(DRCUML_OP_FMOV, 4, 1): /* FSMOV dst,src[,c] */
@@ -2030,11 +2030,11 @@ static int drcbec_execute(drcbe_state *drcbe, drcuml_codehandle *entry)
break;
case MAKE_OPCODE_SHORT(DRCUML_OP_FREAD, 8, 0): /* FDREAD dst,src1,space */
- DPARAM0 = memory_read_qword(drcbe->space[PARAM2], PARAM1);
+ DPARAM0 = drcbe->space[PARAM2]->read_qword(PARAM1);
break;
case MAKE_OPCODE_SHORT(DRCUML_OP_FWRITE, 8, 0): /* FDWRITE dst,src1,space */
- memory_write_qword(drcbe->space[PARAM2], PARAM0, DPARAM1);
+ drcbe->space[PARAM2]->write_qword(PARAM0, DPARAM1);
break;
case MAKE_OPCODE_SHORT(DRCUML_OP_FMOV, 8, 1): /* FDMOV dst,src[,c] */
diff --git a/src/emu/cpu/dsp32/dsp32.c b/src/emu/cpu/dsp32/dsp32.c
index 4e60dec66ac..4f04bcb3d0e 100644
--- a/src/emu/cpu/dsp32/dsp32.c
+++ b/src/emu/cpu/dsp32/dsp32.c
@@ -217,15 +217,15 @@ INLINE dsp32_state *get_safe_token(running_device *device)
#define ROPCODE(cs,pc) memory_decrypted_read_dword((cs)->program, pc)
-#define RBYTE(cs,addr) memory_read_byte_32le((cs)->program, addr)
-#define WBYTE(cs,addr,data) memory_write_byte_32le((cs)->program, (addr), data)
+#define RBYTE(cs,addr) (cs)->program->read_byte(addr)
+#define WBYTE(cs,addr,data) (cs)->program->write_byte((addr), data)
#if (!DETECT_MISALIGNED_MEMORY)
-#define RWORD(cs,addr) memory_read_word_32le((cs)->program, addr)
-#define WWORD(cs,addr,data) memory_write_word_32le((cs)->program, (addr), data)
-#define RLONG(cs,addr) memory_read_dword_32le((cs)->program, addr)
-#define WLONG(cs,addr,data) memory_write_dword_32le((cs)->program, (addr), data)
+#define RWORD(cs,addr) (cs)->program->read_word(addr)
+#define WWORD(cs,addr,data) (cs)->program->write_word((addr), data)
+#define RLONG(cs,addr) (cs)->program->read_dword(addr)
+#define WLONG(cs,addr,data) (cs)->program->write_dword((addr), data)
#else
@@ -233,7 +233,7 @@ INLINE UINT16 RWORD(dsp32_state *cpustate, offs_t addr)
{
UINT16 data;
if (addr & 1) fprintf(stderr, "Unaligned word read @ %06X, PC=%06X\n", addr, cpustate->PC);
- data = memory_read_word_32le(cpustate->program, addr);
+ data = cpustate->program->read_word(addr);
return data;
}
@@ -241,20 +241,20 @@ INLINE UINT32 RLONG(dsp32_state *cpustate, offs_t addr)
{
UINT32 data;
if (addr & 3) fprintf(stderr, "Unaligned long read @ %06X, PC=%06X\n", addr, cpustate->PC);
- data = memory_write_word_32le(cpustate->program, addr);
+ data = cpustate->program->write_word(addr);
return data;
}
INLINE void WWORD(dsp32_state *cpustate, offs_t addr, UINT16 data)
{
if (addr & 1) fprintf(stderr, "Unaligned word write @ %06X, PC=%06X\n", addr, cpustate->PC);
- memory_read_dword_32le(cpustate->program, (addr), data);
+ cpustate->program->read_dword((addr), data);
}
INLINE void WLONG(dsp32_state *cpustate, offs_t addr, UINT32 data)
{
if (addr & 3) fprintf(stderr, "Unaligned long write @ %06X, PC=%06X\n", addr, cpustate->PC);
- memory_write_dword_32le(cpustate->program, (addr), data);
+ cpustate->program->write_dword((addr), data);
}
#endif
diff --git a/src/emu/cpu/dsp56k/dsp56k.c b/src/emu/cpu/dsp56k/dsp56k.c
index 5b3a8e0ae80..32ad1453dc4 100644
--- a/src/emu/cpu/dsp56k/dsp56k.c
+++ b/src/emu/cpu/dsp56k/dsp56k.c
@@ -290,7 +290,7 @@ static CPU_RESET( dsp56k )
alu_reset(cpustate);
/* HACK - Put a jump to 0x0000 at 0x0000 - this keeps the CPU locked to the instruction at address 0x0000 */
- memory_write_word_16le(cpustate->program, 0x0000, 0x0124);
+ cpustate->program->write_word(0x0000, 0x0124);
}
diff --git a/src/emu/cpu/dsp56k/dsp56ops.c b/src/emu/cpu/dsp56k/dsp56ops.c
index 3139cf934b6..f971abc0856 100644
--- a/src/emu/cpu/dsp56k/dsp56ops.c
+++ b/src/emu/cpu/dsp56k/dsp56ops.c
@@ -2306,7 +2306,7 @@ static size_t dsp56k_op_bfop(dsp56k_core* cpustate, const UINT16 op, const UINT1
decode_BBB_bitmask(cpustate, BITS(op2,0xe000), &iVal);
workAddr = assemble_address_from_Pppppp_table(cpustate, BITS(op,0x0020), BITS(op,0x001f));
- previousValue = memory_read_word_16le(cpustate->data, ADDRESS(workAddr));
+ previousValue = cpustate->data->read_word(ADDRESS(workAddr));
workingWord = previousValue;
switch(BITS(op2, 0x1f00))
@@ -2372,7 +2372,7 @@ static size_t dsp56k_op_bfop_1(dsp56k_core* cpustate, const UINT16 op, const UIN
decode_RR_table(cpustate, BITS(op,0x0003), &R);
workAddr = *((UINT16*)R.addr);
- previousValue = memory_read_word_16le(cpustate->data, ADDRESS(workAddr));
+ previousValue = cpustate->data->read_word(ADDRESS(workAddr));
workingWord = previousValue;
switch(BITS(op2, 0x1f00))
@@ -3280,7 +3280,7 @@ static size_t dsp56k_op_movec(dsp56k_core* cpustate, const UINT16 op, UINT8* cyc
if (W)
{
/* Write D */
- UINT16 value = memory_read_word_16le(cpustate->data, ADDRESS(*((UINT16*)R.addr))) ;
+ UINT16 value = cpustate->data->read_word(ADDRESS(*((UINT16*)R.addr))) ;
typed_pointer temp_src = { &value, DT_WORD };
SetDestinationValue(temp_src, SD);
}
@@ -3322,7 +3322,7 @@ static size_t dsp56k_op_movec_1(dsp56k_core* cpustate, const UINT16 op, UINT8* c
if (W)
{
/* Write D */
- UINT16 tempData = memory_read_word_16le(cpustate->data, ADDRESS(memOffset));
+ UINT16 tempData = cpustate->data->read_word(ADDRESS(memOffset));
typed_pointer temp_src = { (void*)&tempData, DT_WORD };
SetDestinationValue(temp_src, SD);
}
@@ -3366,7 +3366,7 @@ static size_t dsp56k_op_movec_2(dsp56k_core* cpustate, const UINT16 op, UINT8* c
if (W)
{
/* Write D */
- UINT16 tempData = memory_read_word_16le(cpustate->data, ADDRESS(memOffset));
+ UINT16 tempData = cpustate->data->read_word(ADDRESS(memOffset));
typed_pointer temp_src = { (void*)&tempData, DT_WORD };
SetDestinationValue(temp_src, SD);
}
@@ -3417,7 +3417,7 @@ static size_t dsp56k_op_movec_3(dsp56k_core* cpustate, const UINT16 op, const UI
else
{
/* 16-bit long address */
- UINT16 tempD = memory_read_word_16le(cpustate->data, ADDRESS(op2));
+ UINT16 tempD = cpustate->data->read_word(ADDRESS(op2));
typed_pointer tempTP = {&tempD, DT_WORD};
SetDestinationValue(tempTP, SD);
}
@@ -3495,7 +3495,7 @@ static size_t dsp56k_op_movec_5(dsp56k_core* cpustate, const UINT16 op, const UI
if (W)
{
/* Write D */
- UINT16 tempData = memory_read_word_16le(cpustate->data, ADDRESS(memOffset));
+ UINT16 tempData = cpustate->data->read_word(ADDRESS(memOffset));
typed_pointer temp_src = { (void*)&tempData, DT_WORD };
SetDestinationValue(temp_src, SD);
}
@@ -3558,7 +3558,7 @@ static size_t dsp56k_op_movem(dsp56k_core* cpustate, const UINT16 op, UINT8* cyc
{
/* Read from Program Memory */
typed_pointer data;
- UINT16 ldata = memory_read_word_16le(cpustate->program, ADDRESS(*((UINT16*)R.addr)));
+ UINT16 ldata = cpustate->program->read_word(ADDRESS(*((UINT16*)R.addr)));
data.addr = &ldata;
data.data_type = DT_WORD;
@@ -3612,7 +3612,7 @@ static size_t dsp56k_op_movep(dsp56k_core* cpustate, const UINT16 op, UINT8* cyc
if (W)
{
- UINT16 data = memory_read_word_16le(cpustate->data, ADDRESS(pp));
+ UINT16 data = cpustate->data->read_word(ADDRESS(pp));
typed_pointer tempTP;
tempTP.addr = &data;
@@ -3651,7 +3651,7 @@ static size_t dsp56k_op_movep_1(dsp56k_core* cpustate, const UINT16 op, UINT8* c
/* A little different than most W if's - opposite read and write */
if (W)
{
- UINT16 data = memory_read_word_16le(cpustate->data, ADDRESS(*((UINT16*)SD.addr)));
+ UINT16 data = cpustate->data->read_word(ADDRESS(*((UINT16*)SD.addr)));
typed_pointer tempTP;
tempTP.addr = &data;
@@ -4681,7 +4681,7 @@ static void execute_x_memory_data_move(dsp56k_core* cpustate, const UINT16 op, t
if (W)
{
/* From X:<ea> to SD */
- UINT16 data = memory_read_word_16le(cpustate->data, ADDRESS(*((UINT16*)R.addr)));
+ UINT16 data = cpustate->data->read_word(ADDRESS(*((UINT16*)R.addr)));
typed_pointer tempTP;
tempTP.addr = &data;
@@ -4729,7 +4729,7 @@ static void execute_x_memory_data_move2(dsp56k_core* cpustate, const UINT16 op,
if (W)
{
/* Write D */
- UINT16 value = memory_read_word_16le(cpustate->data, ADDRESS(*mem_offset));
+ UINT16 value = cpustate->data->read_word(ADDRESS(*mem_offset));
typed_pointer tempV = {&value, DT_WORD};
SetDestinationValue(tempV, SD);
}
@@ -4757,7 +4757,7 @@ static void execute_x_memory_data_move_with_short_displacement(dsp56k_core* cpus
if (W)
{
/* Write D */
- UINT16 tempData = memory_read_word_16le(cpustate->data, ADDRESS(memOffset));
+ UINT16 tempData = cpustate->data->read_word(ADDRESS(memOffset));
typed_pointer temp_src = { (void*)&tempData, DT_WORD };
SetDestinationValue(temp_src, SD);
}
@@ -4793,13 +4793,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.");
/* First memmove */
- srcVal1 = memory_read_word_16le(cpustate->data, ADDRESS(*((UINT16*)R.addr)));
+ srcVal1 = cpustate->data->read_word(ADDRESS(*((UINT16*)R.addr)));
tempV.addr = &srcVal1;
tempV.data_type = DT_WORD;
SetDestinationValue(tempV, D1);
/* Second memmove */
- srcVal2 = memory_read_word_16le(cpustate->data, ADDRESS(R3));
+ srcVal2 = cpustate->data->read_word(ADDRESS(R3));
tempV.addr = &srcVal2;
tempV.data_type = DT_WORD;
SetDestinationValue(tempV, D2);
@@ -4895,13 +4895,13 @@ static void SetDataMemoryValue(dsp56k_core* cpustate, typed_pointer source, UINT
{
switch(source.data_type)
{
- case DT_BYTE: memory_write_word_16le(cpustate->data, destinationAddr, (UINT16)( (*((UINT8*) source.addr) & 0xff) ) ) ; break ;
- case DT_WORD: memory_write_word_16le(cpustate->data, destinationAddr, (UINT16)( (*((UINT16*)source.addr) & 0xffff) ) ) ; break ;
- case DT_DOUBLE_WORD: memory_write_word_16le(cpustate->data, destinationAddr, (UINT16)( (*((UINT32*)source.addr) & 0x0000ffff) ) ) ; break ;
+ case DT_BYTE: cpustate->data->write_word(destinationAddr, (UINT16)( (*((UINT8*) source.addr) & 0xff) ) ) ; break ;
+ case DT_WORD: cpustate->data->write_word(destinationAddr, (UINT16)( (*((UINT16*)source.addr) & 0xffff) ) ) ; break ;
+ case DT_DOUBLE_WORD: cpustate->data->write_word(destinationAddr, (UINT16)( (*((UINT32*)source.addr) & 0x0000ffff) ) ) ; break ;
/* !!! Is this universal ??? */
/* !!! Forget not, yon shift-limiter !!! */
- case DT_LONG_WORD: memory_write_word_16le(cpustate->data, destinationAddr, (UINT16)( ((*((UINT64*)source.addr)) & U64(0x00000000ffff0000)) >> 16) ) ; break ;
+ case DT_LONG_WORD: cpustate->data->write_word(destinationAddr, (UINT16)( ((*((UINT64*)source.addr)) & U64(0x00000000ffff0000)) >> 16) ) ; break ;
}
}
@@ -4910,13 +4910,13 @@ static void SetProgramMemoryValue(dsp56k_core* cpustate, typed_pointer source, U
{
switch(source.data_type)
{
- case DT_BYTE: memory_write_word_16le(cpustate->program, destinationAddr, (UINT16)( (*((UINT8*) source.addr) & 0xff) ) ) ; break ;
- case DT_WORD: memory_write_word_16le(cpustate->program, destinationAddr, (UINT16)( (*((UINT16*)source.addr) & 0xffff) ) ) ; break ;
- case DT_DOUBLE_WORD: memory_write_word_16le(cpustate->program, destinationAddr, (UINT16)( (*((UINT32*)source.addr) & 0x0000ffff) ) ) ; break ;
+ case DT_BYTE: cpustate->program->write_word(destinationAddr, (UINT16)( (*((UINT8*) source.addr) & 0xff) ) ) ; break ;
+ case DT_WORD: cpustate->program->write_word(destinationAddr, (UINT16)( (*((UINT16*)source.addr) & 0xffff) ) ) ; break ;
+ case DT_DOUBLE_WORD: cpustate->program->write_word(destinationAddr, (UINT16)( (*((UINT32*)source.addr) & 0x0000ffff) ) ) ; break ;
/* !!! Is this universal ??? */
/* !!! Forget not, yon shift-limiter !!! */
- case DT_LONG_WORD: memory_write_word_16le(cpustate->program, destinationAddr, (UINT16)( ((*((UINT64*)source.addr)) & U64(0x00000000ffff0000)) >> 16) ) ; break ;
+ case DT_LONG_WORD: cpustate->program->write_word(destinationAddr, (UINT16)( ((*((UINT64*)source.addr)) & U64(0x00000000ffff0000)) >> 16) ) ; break ;
}
}
diff --git a/src/emu/cpu/dsp56k/dsp56pcu.c b/src/emu/cpu/dsp56k/dsp56pcu.c
index c004e68af52..cc43f6bfb32 100644
--- a/src/emu/cpu/dsp56k/dsp56pcu.c
+++ b/src/emu/cpu/dsp56k/dsp56pcu.c
@@ -144,8 +144,8 @@ void pcu_reset(dsp56k_core* cpustate)
/* ... */
/* P:$cffe -> Internal P:$07ff low byte */
/* P:$cfff -> Internal P:$07ff high byte */
- UINT8 mem_value_low = memory_read_byte_16le(cpustate->program, mem_offset); /* TODO: IS THIS READING RIGHT? */
- UINT8 mem_value_high = memory_read_byte_16be(cpustate->program, mem_offset);
+ UINT8 mem_value_low = cpustate->program->read_byte(mem_offset); /* TODO: IS THIS READING RIGHT? */
+ UINT8 mem_value_high = cpustate->program->read_byte(mem_offset);
cpustate->program_ram[i] = (mem_value_high << 8) || mem_value_low;
}
@@ -166,7 +166,7 @@ void pcu_reset(dsp56k_core* cpustate)
/* they need. Once they've had their fill, they turn bootstrap mode off */
/* and the CPU begins execution at 0x0000; */
/* HACK - Read bit 15 at 0xc000 to see if we're working with the SSIO or host interface. */
- if (memory_read_word_16le(cpustate->program, 0xc000<<1) & 0x8000)
+ if (cpustate->program->read_word(0xc000<<1) & 0x8000)
{
cpustate->bootstrap_mode = BOOTSTRAP_SSIX;
logerror("DSP56k : Currently in (hacked) bootstrap mode - reading from SSIx.\n");
diff --git a/src/emu/cpu/e132xs/e132xs.h b/src/emu/cpu/e132xs/e132xs.h
index b3f91f8ad36..73dbbc7c9a2 100644
--- a/src/emu/cpu/e132xs/e132xs.h
+++ b/src/emu/cpu/e132xs/e132xs.h
@@ -42,25 +42,25 @@ extern unsigned dasm_hyperstone(char *buffer, unsigned pc, const UINT8 *oprom, u
/* Memory access */
/* read byte */
-#define READ_B(H,addr) memory_read_byte((H)->program, (addr))
+#define READ_B(H,addr) (H)->program->read_byte((addr))
/* read half-word */
-#define READ_HW(H,addr) memory_read_word((H)->program, (addr) & ~1)
+#define READ_HW(H,addr) (H)->program->read_word((addr) & ~1)
/* read word */
-#define READ_W(H,addr) memory_read_dword((H)->program, (addr) & ~3)
+#define READ_W(H,addr) (H)->program->read_dword((addr) & ~3)
/* write byte */
-#define WRITE_B(H,addr, data) memory_write_byte((H)->program, addr, data)
+#define WRITE_B(H,addr, data) (H)->program->write_byte(addr, data)
/* write half-word */
-#define WRITE_HW(H,addr, data) memory_write_word((H)->program, (addr) & ~1, data)
+#define WRITE_HW(H,addr, data) (H)->program->write_word((addr) & ~1, data)
/* write word */
-#define WRITE_W(H,addr, data) memory_write_dword((H)->program, (addr) & ~3, data)
+#define WRITE_W(H,addr, data) (H)->program->write_dword((addr) & ~3, data)
/* I/O access */
/* read word */
-#define IO_READ_W(H,addr) memory_read_dword((H)->io, ((addr) >> 11) & 0x7ffc)
+#define IO_READ_W(H,addr) (H)->io->read_dword(((addr) >> 11) & 0x7ffc)
/* write word */
-#define IO_WRITE_W(H,addr, data) memory_write_dword((H)->io, ((addr) >> 11) & 0x7ffc, data)
+#define IO_WRITE_W(H,addr, data) (H)->io->write_dword(((addr) >> 11) & 0x7ffc, data)
#define READ_OP(H,addr) memory_decrypted_read_word((H)->program, (addr) ^ (H)->opcodexor)
diff --git a/src/emu/cpu/f8/f8.c b/src/emu/cpu/f8/f8.c
index 3abb75d0428..77622ee6189 100644
--- a/src/emu/cpu/f8/f8.c
+++ b/src/emu/cpu/f8/f8.c
@@ -145,7 +145,7 @@ static void ROMC_02(f8_Regs *cpustate)
* the memory location addressed by DC0; then all devices increment
* DC0.
*/
- cpustate->dbus = memory_read_byte_8be(cpustate->program, cpustate->dc0);
+ cpustate->dbus = cpustate->program->read_byte(cpustate->dc0);
cpustate->dc0 += 1;
cpustate->icount -= cL;
}
@@ -176,7 +176,7 @@ static void ROMC_05(f8_Regs *cpustate)
* Store the data bus contents into the memory location pointed
* to by DC0; increment DC0.
*/
- memory_write_byte_8be(cpustate->program, cpustate->dc0, cpustate->dbus);
+ cpustate->program->write_byte(cpustate->dc0, cpustate->dbus);
cpustate->dc0 += 1;
cpustate->icount -= cL;
}
@@ -412,7 +412,7 @@ static void ROMC_1A(f8_Regs *cpustate)
* register was addressed; the device containing the addressed port
* must place the contents of the data bus into the address port.
*/
- memory_write_byte_8be(cpustate->iospace, cpustate->io, cpustate->dbus);
+ cpustate->iospace->write_byte(cpustate->io, cpustate->dbus);
cpustate->icount -= cL;
}
@@ -425,7 +425,7 @@ static void ROMC_1B(f8_Regs *cpustate)
* contents of timer and interrupt control registers cannot be read
* back onto the data bus).
*/
- cpustate->dbus = memory_read_byte_8be(cpustate->iospace, cpustate->io);
+ cpustate->dbus = cpustate->iospace->read_byte(cpustate->io);
cpustate->icount -= cL;
}
@@ -1267,7 +1267,7 @@ static void f8_ins_0(f8_Regs *cpustate, int n)
{
ROMC_1C(cpustate, cS);
CLR_OZCS;
- cpustate->a = memory_read_byte_8be(cpustate->iospace, n);
+ cpustate->a = cpustate->iospace->read_byte(n);
SET_SZ(cpustate->a);
}
@@ -1292,7 +1292,7 @@ static void f8_ins_1(f8_Regs *cpustate, int n)
static void f8_outs_0(f8_Regs *cpustate, int n)
{
ROMC_1C(cpustate, cS);
- memory_write_byte_8be(cpustate->iospace, n, cpustate->a);
+ cpustate->iospace->write_byte(n, cpustate->a);
}
/***************************************************
diff --git a/src/emu/cpu/g65816/g65816cm.h b/src/emu/cpu/g65816/g65816cm.h
index 763e7576fe9..657279e9955 100644
--- a/src/emu/cpu/g65816/g65816cm.h
+++ b/src/emu/cpu/g65816/g65816cm.h
@@ -11,9 +11,9 @@
#undef G65816_CALL_DEBUGGER
#define G65816_CALL_DEBUGGER(x) debugger_instruction_hook(cpustate->device, x)
-#define g65816_read_8(addr) memory_read_byte_8be(cpustate->program, addr)
-#define g65816_write_8(addr,data) memory_write_byte_8be(cpustate->program, addr,data)
-#define g65816_read_8_immediate(A) memory_read_byte_8be(cpustate->program, A)
+#define g65816_read_8(addr) cpustate->program->read_byte(addr)
+#define g65816_write_8(addr,data) cpustate->program->write_byte(addr,data)
+#define g65816_read_8_immediate(A) cpustate->program->read_byte(A)
#define g65816_jumping(A)
#define g65816_branching(A)
diff --git a/src/emu/cpu/h6280/h6280ops.h b/src/emu/cpu/h6280/h6280ops.h
index 823f5dd4ae6..b887a5e4858 100644
--- a/src/emu/cpu/h6280/h6280ops.h
+++ b/src/emu/cpu/h6280/h6280ops.h
@@ -125,7 +125,7 @@
***************************************************************/
INLINE UINT8 RDMEM(h6280_Regs* cpustate, offs_t addr) {
CHECK_VDC_VCE_PENALTY(addr);
- return memory_read_byte_8le(cpustate->program, TRANSLATED(addr));
+ return cpustate->program->read_byte(TRANSLATED(addr));
}
/***************************************************************
@@ -133,48 +133,48 @@ INLINE UINT8 RDMEM(h6280_Regs* cpustate, offs_t addr) {
***************************************************************/
INLINE void WRMEM(h6280_Regs* cpustate, offs_t addr, UINT8 data) {
CHECK_VDC_VCE_PENALTY(addr);
- memory_write_byte_8le(cpustate->program, TRANSLATED(addr),data);
+ cpustate->program->write_byte(TRANSLATED(addr),data);
}
/***************************************************************
* RDMEMZ read memory - zero page
***************************************************************/
#define RDMEMZ(addr) \
- memory_read_byte_8le(cpustate->program, (cpustate->mmr[1] << 13) | ((addr)&0x1fff));
+ cpustate->program->read_byte((cpustate->mmr[1] << 13) | ((addr)&0x1fff));
/***************************************************************
* WRMEMZ write memory - zero page
***************************************************************/
#define WRMEMZ(addr,data) \
- memory_write_byte_8le(cpustate->program, (cpustate->mmr[1] << 13) | ((addr)&0x1fff),data);
+ cpustate->program->write_byte((cpustate->mmr[1] << 13) | ((addr)&0x1fff),data);
/***************************************************************
* RDMEMW read word from memory
***************************************************************/
#define RDMEMW(addr) \
- memory_read_byte_8le(cpustate->program, TRANSLATED(addr)) \
-| ( memory_read_byte_8le(cpustate->program, TRANSLATED(addr+1)) << 8 )
+ cpustate->program->read_byte(TRANSLATED(addr)) \
+| ( cpustate->program->read_byte(TRANSLATED(addr+1)) << 8 )
/***************************************************************
* RDZPWORD read a word from a zero page address
***************************************************************/
#define RDZPWORD(addr) \
((addr&0xff)==0xff) ? \
- memory_read_byte_8le(cpustate->program, (cpustate->mmr[1] << 13) | ((addr)&0x1fff)) \
- +(memory_read_byte_8le(cpustate->program, (cpustate->mmr[1] << 13) | ((addr-0xff)&0x1fff))<<8) : \
- memory_read_byte_8le(cpustate->program, (cpustate->mmr[1] << 13) | ((addr)&0x1fff)) \
- +(memory_read_byte_8le(cpustate->program, (cpustate->mmr[1] << 13) | ((addr+1)&0x1fff))<<8)
+ cpustate->program->read_byte((cpustate->mmr[1] << 13) | ((addr)&0x1fff)) \
+ +(cpustate->program->read_byte((cpustate->mmr[1] << 13) | ((addr-0xff)&0x1fff))<<8) : \
+ cpustate->program->read_byte((cpustate->mmr[1] << 13) | ((addr)&0x1fff)) \
+ +(cpustate->program->read_byte((cpustate->mmr[1] << 13) | ((addr+1)&0x1fff))<<8)
/***************************************************************
* push a register onto the stack
***************************************************************/
-#define PUSH(Rg) memory_write_byte_8le(cpustate->program, (cpustate->mmr[1] << 13) | cpustate->sp.d,Rg); S--
+#define PUSH(Rg) cpustate->program->write_byte((cpustate->mmr[1] << 13) | cpustate->sp.d,Rg); S--
/***************************************************************
* pull a register from the stack
***************************************************************/
-#define PULL(Rg) S++; Rg = memory_read_byte_8le(cpustate->program, (cpustate->mmr[1] << 13) | cpustate->sp.d)
+#define PULL(Rg) S++; Rg = cpustate->program->read_byte((cpustate->mmr[1] << 13) | cpustate->sp.d)
/***************************************************************
* RDOP read an opcode
@@ -1111,21 +1111,21 @@ INLINE void WRMEM(h6280_Regs* cpustate, offs_t addr, UINT8 data) {
***************************************************************/
#define ST0 \
CLEAR_T; \
- memory_write_byte_8le(cpustate->io,0x0000,tmp)
+ cpustate->io->write_byte(0x0000,tmp)
/* 6280 ********************************************************
* ST1 Store at hardware address 2
***************************************************************/
#define ST1 \
CLEAR_T; \
- memory_write_byte_8le(cpustate->io,0x0002,tmp)
+ cpustate->io->write_byte(0x0002,tmp)
/* 6280 ********************************************************
* ST2 Store at hardware address 3
***************************************************************/
#define ST2 \
CLEAR_T; \
- memory_write_byte_8le(cpustate->io,0x0003,tmp)
+ cpustate->io->write_byte(0x0003,tmp)
/* 6280 ********************************************************
* STA Store accumulator
diff --git a/src/emu/cpu/h83002/h8_16.c b/src/emu/cpu/h83002/h8_16.c
index 838bb3e16bf..703ead5c1b4 100644
--- a/src/emu/cpu/h83002/h8_16.c
+++ b/src/emu/cpu/h83002/h8_16.c
@@ -23,10 +23,10 @@ CPU_DISASSEMBLE(h8_32);
#define H8_SP (7)
-#define h8_mem_read8(x) memory_read_byte(h8->program, x)
-#define h8_mem_read16(z, x) memory_read_word(h8->program, x)
-#define h8_mem_write8(x, y) memory_write_byte(h8->program, x, y)
-#define h8_mem_write16(z, x, y) memory_write_word(h8->program, x, y)
+#define h8_mem_read8(x) h8->program->read_byte(x)
+#define h8_mem_read16(z, x) h8->program->read_word(x)
+#define h8_mem_write8(x, y) h8->program->write_byte(x, y)
+#define h8_mem_write16(z, x, y) h8->program->write_word(x, y)
#define h8_readop16(x, y) memory_decrypted_read_word(x->program, y)
// timing macros
@@ -41,14 +41,14 @@ CPU_DISASSEMBLE(h8_32);
INLINE UINT32 h8_mem_read32(h83xx_state *h8, offs_t address)
{
- UINT32 result = memory_read_word_16be(h8->program, address) << 16;
- return result | memory_read_word_16be(h8->program, address + 2);
+ UINT32 result = h8->program->read_word(address) << 16;
+ return result | h8->program->read_word(address + 2);
}
INLINE void h8_mem_write32(h83xx_state *h8, offs_t address, UINT32 data)
{
- memory_write_word_16be(h8->program, address, data >> 16);
- memory_write_word_16be(h8->program, address + 2, data);
+ h8->program->write_word(address, data >> 16);
+ h8->program->write_word(address + 2, data);
}
static void h8_check_irqs(h83xx_state *h8);
diff --git a/src/emu/cpu/h83002/h8_8.c b/src/emu/cpu/h83002/h8_8.c
index 2eded59d614..204721e8e64 100644
--- a/src/emu/cpu/h83002/h8_8.c
+++ b/src/emu/cpu/h83002/h8_8.c
@@ -18,8 +18,8 @@ CPU_DISASSEMBLE(h8);
#define H8_SP (7)
-#define h8_mem_read8(x) memory_read_byte(h8->program, x)
-#define h8_mem_write8(x, y) memory_write_byte(h8->program, x, y)
+#define h8_mem_read8(x) h8->program->read_byte(x)
+#define h8_mem_write8(x, y) h8->program->write_byte(x, y)
// timing macros
#define H8_IFETCH_TIMING(x) h8->cyccnt -= (x) * 4;
@@ -36,8 +36,8 @@ static TIMER_CALLBACK( h8_timer_3_cb );
INLINE UINT16 h8_mem_read16(h83xx_state *h8, offs_t address)
{
- UINT16 result = memory_read_byte(h8->program, address)<<8;
- return result | memory_read_byte(h8->program, address+1);
+ UINT16 result = h8->program->read_byte(address)<<8;
+ return result | h8->program->read_byte(address+1);
}
INLINE UINT16 h8_readop16(h83xx_state *h8, offs_t address)
@@ -48,26 +48,26 @@ INLINE UINT16 h8_readop16(h83xx_state *h8, offs_t address)
INLINE void h8_mem_write16(h83xx_state *h8, offs_t address, UINT16 data)
{
- memory_write_byte(h8->program, address, data >> 8);
- memory_write_byte(h8->program, address+1, data);
+ h8->program->write_byte(address, data >> 8);
+ h8->program->write_byte(address+1, data);
}
INLINE UINT32 h8_mem_read32(h83xx_state *h8, offs_t address)
{
- UINT32 result = memory_read_byte(h8->program, address) << 24;
- result |= memory_read_byte(h8->program, address+1) << 16;
- result |= memory_read_byte(h8->program, address+2) << 8;
- result |= memory_read_byte(h8->program, address+3);
+ UINT32 result = h8->program->read_byte(address) << 24;
+ result |= h8->program->read_byte(address+1) << 16;
+ result |= h8->program->read_byte(address+2) << 8;
+ result |= h8->program->read_byte(address+3);
return result;
}
INLINE void h8_mem_write32(h83xx_state *h8, offs_t address, UINT32 data)
{
- memory_write_byte(h8->program, address, data >> 24);
- memory_write_byte(h8->program, address+1, data >> 16);
- memory_write_byte(h8->program, address+2, data >> 8);
- memory_write_byte(h8->program, address+3, data);
+ h8->program->write_byte(address, data >> 24);
+ h8->program->write_byte(address+1, data >> 16);
+ h8->program->write_byte(address+2, data >> 8);
+ h8->program->write_byte(address+3, data);
}
static void h8_check_irqs(h83xx_state *h8);
@@ -522,7 +522,7 @@ static READ8_HANDLER( h8330_itu_r )
switch(reg)
{
case 0x8d: // serial Rx 1
- val = memory_read_byte(h8->io, H8_SERIAL_1);
+ val = h8->io->read_byte(H8_SERIAL_1);
break;
case 0x92: // FRC H
frc = h8->device->total_cycles() / divider[h8->per_regs[0x96]];
@@ -533,61 +533,61 @@ static READ8_HANDLER( h8330_itu_r )
frc %= 65536;
return frc&0xff;
case 0xb2: // port 1 data
- val = memory_read_byte(h8->io, H8_PORT_1);
+ val = h8->io->read_byte(H8_PORT_1);
break;
case 0xb3: // port 2 data
- val = memory_read_byte(h8->io, H8_PORT_2);
+ val = h8->io->read_byte(H8_PORT_2);
break;
case 0xb6: // port 3 data
- val = memory_read_byte(h8->io, H8_PORT_3);
+ val = h8->io->read_byte(H8_PORT_3);
break;
case 0xb7: // port 4 data
- val = memory_read_byte(h8->io, H8_PORT_4);
+ val = h8->io->read_byte(H8_PORT_4);
break;
case 0xba: // port 5 data
- val = memory_read_byte(h8->io, H8_PORT_5);
+ val = h8->io->read_byte(H8_PORT_5);
break;
case 0xbb: // port 6 data
- val = memory_read_byte(h8->io, H8_PORT_6);
+ val = h8->io->read_byte(H8_PORT_6);
break;
case 0xbe: // port 7 data
- val = memory_read_byte(h8->io, H8_PORT_7);
+ val = h8->io->read_byte(H8_PORT_7);
break;
case 0xbf: // port 8 data
- val = memory_read_byte(h8->io, H8_PORT_8);
+ val = h8->io->read_byte(H8_PORT_8);
break;
case 0xc1: // port 9 data
- val = memory_read_byte(h8->io, H8_PORT_9);
+ val = h8->io->read_byte(H8_PORT_9);
break;
case 0xdc: // serial status
val = 0x87;
break;
case 0xdd: // serial Rx 0
- val = memory_read_byte(h8->io, H8_SERIAL_0);
+ val = h8->io->read_byte(H8_SERIAL_0);
break;
case 0xe0: // ADC 0 low byte
- val = memory_read_byte(h8->io, H8_ADC_0_L);
+ val = h8->io->read_byte(H8_ADC_0_L);
break;
case 0xe1: // ADC 0 high byte
- val = memory_read_byte(h8->io, H8_ADC_0_H);
+ val = h8->io->read_byte(H8_ADC_0_H);
break;
case 0xe2: // ADC 1 low byte
- val = memory_read_byte(h8->io, H8_ADC_1_L);
+ val = h8->io->read_byte(H8_ADC_1_L);
break;
case 0xe3: // ADC 1 high byte
- val = memory_read_byte(h8->io, H8_ADC_1_H);
+ val = h8->io->read_byte(H8_ADC_1_H);
break;
case 0xe4: // ADC 2 low byte
- val = memory_read_byte(h8->io, H8_ADC_2_L);
+ val = h8->io->read_byte(H8_ADC_2_L);
break;
case 0xe5: // ADC 2 high byte
- val = memory_read_byte(h8->io, H8_ADC_2_H);
+ val = h8->io->read_byte(H8_ADC_2_H);
break;
case 0xe6: // ADC 3 low byte
- val = memory_read_byte(h8->io, H8_ADC_3_L);
+ val = h8->io->read_byte(H8_ADC_3_L);
break;
case 0xe7: // ADC 3 high byte
- val = memory_read_byte(h8->io, H8_ADC_3_H);
+ val = h8->io->read_byte(H8_ADC_3_H);
break;
case 0xe8: // ADCSR: A/D control/status
val = 0x80; // return conversion completed
@@ -613,37 +613,37 @@ static WRITE8_HANDLER( h8330_itu_w )
printf("%02x to flash control or external\n", data);
break;
case 0x8b: // serial Tx 1
- memory_write_byte(h8->io, H8_SERIAL_1, data);
+ h8->io->write_byte(H8_SERIAL_1, data);
break;
case 0xb2: // port 1 data
- memory_write_byte(h8->io, H8_PORT_1, data);
+ h8->io->write_byte(H8_PORT_1, data);
break;
case 0xb3: // port 2 data
- memory_write_byte(h8->io, H8_PORT_2, data);
+ h8->io->write_byte(H8_PORT_2, data);
break;
case 0xb6: // port 3 data
- memory_write_byte(h8->io, H8_PORT_3, data);
+ h8->io->write_byte(H8_PORT_3, data);
break;
case 0xb7: // port 4 data
- memory_write_byte(h8->io, H8_PORT_4, data);
+ h8->io->write_byte(H8_PORT_4, data);
break;
case 0xba: // port 5 data
- memory_write_byte(h8->io, H8_PORT_5, data);
+ h8->io->write_byte(H8_PORT_5, data);
break;
case 0xbb: // port 6 data
- memory_write_byte(h8->io, H8_PORT_6, data);
+ h8->io->write_byte(H8_PORT_6, data);
break;
case 0xbe: // port 7 data
- memory_write_byte(h8->io, H8_PORT_7, data);
+ h8->io->write_byte(H8_PORT_7, data);
break;
case 0xbf: // port 8 data
- memory_write_byte(h8->io, H8_PORT_8, data);
+ h8->io->write_byte(H8_PORT_8, data);
break;
case 0xc1: // port 9 data
- memory_write_byte(h8->io, H8_PORT_9, data);
+ h8->io->write_byte(H8_PORT_9, data);
break;
case 0xdb: // serial Tx 0
- memory_write_byte(h8->io, H8_SERIAL_0, data);
+ h8->io->write_byte(H8_SERIAL_0, data);
break;
case 0xd8:
diff --git a/src/emu/cpu/h83002/h8periph.c b/src/emu/cpu/h83002/h8periph.c
index e770d268224..a0cc7959431 100644
--- a/src/emu/cpu/h83002/h8periph.c
+++ b/src/emu/cpu/h83002/h8periph.c
@@ -328,62 +328,62 @@ UINT8 h8_register_read8(h83xx_state *h8, UINT32 address)
val |= 0xc4; // transmit finished, receive ready, no errors
break;
case 0xb5: // serial port A receive
- val = memory_read_byte(h8->io, H8_SERIAL_0);
+ val = h8->io->read_byte(H8_SERIAL_0);
break;
case 0xbc: // serial port B status
val = h8->per_regs[reg];
val |= 0xc4; // transmit finished, receive ready, no errors
break;
case 0xbd: // serial port B receive
- val = memory_read_byte(h8->io, H8_SERIAL_1);
+ val = h8->io->read_byte(H8_SERIAL_1);
break;
case 0xe0:
- val = memory_read_byte(h8->io, H8_ADC_0_H);
+ val = h8->io->read_byte(H8_ADC_0_H);
break;
case 0xe1:
- val = memory_read_byte(h8->io, H8_ADC_0_L);
+ val = h8->io->read_byte(H8_ADC_0_L);
break;
case 0xe2:
- val = memory_read_byte(h8->io, H8_ADC_1_H);
+ val = h8->io->read_byte(H8_ADC_1_H);
break;
case 0xe3:
- val = memory_read_byte(h8->io, H8_ADC_1_L);
+ val = h8->io->read_byte(H8_ADC_1_L);
break;
case 0xe4:
- val = memory_read_byte(h8->io, H8_ADC_2_H);
+ val = h8->io->read_byte(H8_ADC_2_H);
break;
case 0xe5:
- val = memory_read_byte(h8->io, H8_ADC_2_L);
+ val = h8->io->read_byte(H8_ADC_2_L);
break;
case 0xe6:
- val = memory_read_byte(h8->io, H8_ADC_3_H);
+ val = h8->io->read_byte(H8_ADC_3_H);
break;
case 0xe7:
- val = memory_read_byte(h8->io, H8_ADC_3_L);
+ val = h8->io->read_byte(H8_ADC_3_L);
break;
case 0xe8: // adc status
val = 0x80;
break;
case 0xc7: // port 4 data
- val = memory_read_byte(h8->io, H8_PORT_4);
+ val = h8->io->read_byte(H8_PORT_4);
break;
case 0xcb: // port 6 data
- val = memory_read_byte(h8->io, H8_PORT_6);
+ val = h8->io->read_byte(H8_PORT_6);
break;
case 0xce: // port 7 data
- val = memory_read_byte(h8->io, H8_PORT_7);
+ val = h8->io->read_byte(H8_PORT_7);
break;
case 0xcf: // port 8 data
- val = memory_read_byte(h8->io, H8_PORT_8);
+ val = h8->io->read_byte(H8_PORT_8);
break;
case 0xd2: // port 9 data
- val = memory_read_byte(h8->io, H8_PORT_9);
+ val = h8->io->read_byte(H8_PORT_9);
break;
case 0xd3: // port a data
- val = memory_read_byte(h8->io, H8_PORT_A);
+ val = h8->io->read_byte(H8_PORT_A);
break;
case 0xd6: // port b data
- val = memory_read_byte(h8->io, H8_PORT_B);
+ val = h8->io->read_byte(H8_PORT_B);
break;
case 0xf6:
val = h8_ISR_r(h8);
@@ -414,35 +414,35 @@ void h8_register_write8(h83xx_state *h8, UINT32 address, UINT8 val)
switch (reg)
{
case 0xb3: // serial 0 send
- memory_write_byte(h8->io, H8_SERIAL_0, val);
+ h8->io->write_byte(H8_SERIAL_0, val);
h8_3002_InterruptRequest(h8, 54, 1);
h8_3002_InterruptRequest(h8, 55, 1);
break;
case 0xbb: // serial 1 send
- memory_write_byte(h8->io, H8_SERIAL_1, val);
+ h8->io->write_byte(H8_SERIAL_1, val);
h8_3002_InterruptRequest(h8, 58, 1);
h8_3002_InterruptRequest(h8, 59, 1);
break;
case 0xc7:
- memory_write_byte(h8->io, H8_PORT_4, val);
+ h8->io->write_byte(H8_PORT_4, val);
break;
case 0xcb: // port 6 data
- memory_write_byte(h8->io, H8_PORT_6, val);
+ h8->io->write_byte(H8_PORT_6, val);
break;
case 0xce: // port 7 data
- memory_write_byte(h8->io, H8_PORT_7, val);
+ h8->io->write_byte(H8_PORT_7, val);
break;
case 0xcf: // port 8 data
- memory_write_byte(h8->io, H8_PORT_8, val);
+ h8->io->write_byte(H8_PORT_8, val);
break;
case 0xd2: // port 9 data
- memory_write_byte(h8->io, H8_PORT_9, val);
+ h8->io->write_byte(H8_PORT_9, val);
break;
case 0xd3: // port a data
- memory_write_byte(h8->io, H8_PORT_A, val);
+ h8->io->write_byte(H8_PORT_A, val);
break;
case 0xd6: // port b data
- memory_write_byte(h8->io, H8_PORT_B, val);
+ h8->io->write_byte(H8_PORT_B, val);
break;
case 0xf6:
h8_ISR_w(h8, val);
@@ -624,63 +624,63 @@ UINT8 h8_3007_register_read8(h83xx_state *h8, UINT32 address)
val |= 0xc4; // transmit finished, receive ready, no errors
break;
case 0xb5: // serial port A receive
- val = memory_read_byte(h8->io, H8_SERIAL_0);
+ val = h8->io->read_byte(H8_SERIAL_0);
break;
case 0xbc: // serial port B status
val = h8->per_regs[reg];
val |= 0xc4; // transmit finished, receive ready, no errors
break;
case 0xbd: // serial port B receive
- val = memory_read_byte(h8->io, H8_SERIAL_1);
+ val = h8->io->read_byte(H8_SERIAL_1);
break;
case 0xe0:
- val = memory_read_byte(h8->io, H8_ADC_0_H);
+ val = h8->io->read_byte(H8_ADC_0_H);
break;
case 0xe1:
- val = memory_read_byte(h8->io, H8_ADC_0_L);
+ val = h8->io->read_byte(H8_ADC_0_L);
break;
case 0xe2:
- val = memory_read_byte(h8->io, H8_ADC_1_H);
+ val = h8->io->read_byte(H8_ADC_1_H);
break;
case 0xe3:
- val = memory_read_byte(h8->io, H8_ADC_1_L);
+ val = h8->io->read_byte(H8_ADC_1_L);
break;
case 0xe4:
- val = memory_read_byte(h8->io, H8_ADC_2_H);
+ val = h8->io->read_byte(H8_ADC_2_H);
break;
case 0xe5:
- val = memory_read_byte(h8->io, H8_ADC_2_L);
+ val = h8->io->read_byte(H8_ADC_2_L);
break;
case 0xe6:
- val = memory_read_byte(h8->io, H8_ADC_3_H);
+ val = h8->io->read_byte(H8_ADC_3_H);
break;
case 0xe7:
- val = memory_read_byte(h8->io, H8_ADC_3_L);
+ val = h8->io->read_byte(H8_ADC_3_L);
break;
case 0xe8: // adc status
val = 0x80;
break;
case 0xd3: // port 4 data
- val = memory_read_byte(h8->io, H8_PORT_4);
+ val = h8->io->read_byte(H8_PORT_4);
break;
case 0xd5: // port 6 data
- val = memory_read_byte(h8->io, H8_PORT_6);
+ val = h8->io->read_byte(H8_PORT_6);
break;
case 0xd6: // port 7 data
- val = memory_read_byte(h8->io, H8_PORT_7);
+ val = h8->io->read_byte(H8_PORT_7);
break;
case 0xd7: // port 8 data
- val = memory_read_byte(h8->io, H8_PORT_8);
+ val = h8->io->read_byte(H8_PORT_8);
break;
case 0xd8: // port 9 data
- val = memory_read_byte(h8->io, H8_PORT_9);
+ val = h8->io->read_byte(H8_PORT_9);
break;
case 0xd9: // port a data
- val = memory_read_byte(h8->io, H8_PORT_A);
+ val = h8->io->read_byte(H8_PORT_A);
break;
case 0xda: // port b data
- val = memory_read_byte(h8->io, H8_PORT_B);
+ val = h8->io->read_byte(H8_PORT_B);
break;
default:
val = h8->per_regs[reg];
@@ -710,31 +710,31 @@ void h8_3007_register_write8(h83xx_state *h8, UINT32 address, UINT8 val)
switch (reg)
{
case 0xb3:
- memory_write_byte(h8->io, H8_SERIAL_0, val);
+ h8->io->write_byte(H8_SERIAL_0, val);
break;
case 0xbb:
- memory_write_byte(h8->io, H8_SERIAL_1, val);
+ h8->io->write_byte(H8_SERIAL_1, val);
break;
case 0xd3:
- memory_write_byte(h8->io, H8_PORT_4, val);
+ h8->io->write_byte(H8_PORT_4, val);
break;
case 0xd5: // port 6 data
- memory_write_byte(h8->io, H8_PORT_6, val);
+ h8->io->write_byte(H8_PORT_6, val);
break;
case 0xd6: // port 7 data
- memory_write_byte(h8->io, H8_PORT_7, val);
+ h8->io->write_byte(H8_PORT_7, val);
break;
case 0xd7: // port 8 data
- memory_write_byte(h8->io, H8_PORT_8, val);
+ h8->io->write_byte(H8_PORT_8, val);
break;
case 0xd8: // port 9 data
- memory_write_byte(h8->io, H8_PORT_9, val);
+ h8->io->write_byte(H8_PORT_9, val);
break;
case 0xd9: // port a data
- memory_write_byte(h8->io, H8_PORT_A, val);
+ h8->io->write_byte(H8_PORT_A, val);
break;
case 0xda: // port b data
- memory_write_byte(h8->io, H8_PORT_B, val);
+ h8->io->write_byte(H8_PORT_B, val);
break;
}
}
diff --git a/src/emu/cpu/hd6309/hd6309.c b/src/emu/cpu/hd6309/hd6309.c
index d567edbc043..588694d3cf0 100644
--- a/src/emu/cpu/hd6309/hd6309.c
+++ b/src/emu/cpu/hd6309/hd6309.c
@@ -229,12 +229,12 @@ INLINE void fetch_effective_address( m68_state_t *m68_state );
/****************************************************************************/
/* Read a byte from given memory location */
/****************************************************************************/
-#define RM(Addr) ((unsigned)memory_read_byte_8be(m68_state->program, Addr))
+#define RM(Addr) ((unsigned)m68_state->program->read_byte(Addr))
/****************************************************************************/
/* Write a byte to given memory location */
/****************************************************************************/
-#define WM(Addr,Value) (memory_write_byte_8be(m68_state->program, Addr,Value))
+#define WM(Addr,Value) (m68_state->program->write_byte(Addr,Value))
/****************************************************************************/
/* Z80_RDOP() is identical to Z80_RDMEM() except it is used for reading */
diff --git a/src/emu/cpu/i386/i386priv.h b/src/emu/cpu/i386/i386priv.h
index 8045ef1eab7..8a3587708e3 100644
--- a/src/emu/cpu/i386/i386priv.h
+++ b/src/emu/cpu/i386/i386priv.h
@@ -349,15 +349,15 @@ INLINE int translate_address(i386_state *cpustate, UINT32 *address)
UINT32 page_entry;
// TODO: 4MB pages
- UINT32 page_dir = memory_read_dword_32le(cpustate->program, pdbr + directory * 4);
+ UINT32 page_dir = cpustate->program->read_dword(pdbr + directory * 4);
if (!(cpustate->cr[4] & 0x10)) {
- page_entry = memory_read_dword_32le(cpustate->program, (page_dir & 0xfffff000) + (table * 4));
+ page_entry = cpustate->program->read_dword((page_dir & 0xfffff000) + (table * 4));
*address = (page_entry & 0xfffff000) | offset;
} else {
if (page_dir & 0x80)
*address = (page_dir & 0xffc00000) | (a & 0x003fffff);
else {
- page_entry = memory_read_dword_32le(cpustate->program, (page_dir & 0xfffff000) + (table * 4));
+ page_entry = cpustate->program->read_dword((page_dir & 0xfffff000) + (table * 4));
*address = (page_entry & 0xfffff000) | offset;
}
}
@@ -461,7 +461,7 @@ INLINE UINT8 READ8(i386_state *cpustate,UINT32 ea)
}
address &= cpustate->a20_mask;
- return memory_read_byte_32le(cpustate->program, address);
+ return cpustate->program->read_byte(address);
}
INLINE UINT16 READ16(i386_state *cpustate,UINT32 ea)
{
@@ -478,7 +478,7 @@ INLINE UINT16 READ16(i386_state *cpustate,UINT32 ea)
}
address &= cpustate->a20_mask;
- value = memory_read_word_32le( cpustate->program, address );
+ value = cpustate->program->read_word( address );
}
return value;
}
@@ -499,7 +499,7 @@ INLINE UINT32 READ32(i386_state *cpustate,UINT32 ea)
}
address &= cpustate->a20_mask;
- value = memory_read_dword_32le( cpustate->program, address );
+ value = cpustate->program->read_dword( address );
}
return value;
}
@@ -525,8 +525,8 @@ INLINE UINT64 READ64(i386_state *cpustate,UINT32 ea)
}
address &= cpustate->a20_mask;
- value = (((UINT64) memory_read_dword_32le( cpustate->program, address+0 )) << 0) |
- (((UINT64) memory_read_dword_32le( cpustate->program, address+4 )) << 32);
+ value = (((UINT64) cpustate->program->read_dword( address+0 )) << 0) |
+ (((UINT64) cpustate->program->read_dword( address+4 )) << 32);
}
return value;
}
@@ -541,7 +541,7 @@ INLINE void WRITE8(i386_state *cpustate,UINT32 ea, UINT8 value)
}
address &= cpustate->a20_mask;
- memory_write_byte_32le(cpustate->program, address, value);
+ cpustate->program->write_byte(address, value);
}
INLINE void WRITE16(i386_state *cpustate,UINT32 ea, UINT16 value)
{
@@ -557,7 +557,7 @@ INLINE void WRITE16(i386_state *cpustate,UINT32 ea, UINT16 value)
}
address &= cpustate->a20_mask;
- memory_write_word_32le(cpustate->program, address, value);
+ cpustate->program->write_word(address, value);
}
}
INLINE void WRITE32(i386_state *cpustate,UINT32 ea, UINT32 value)
@@ -576,7 +576,7 @@ INLINE void WRITE32(i386_state *cpustate,UINT32 ea, UINT32 value)
}
ea &= cpustate->a20_mask;
- memory_write_dword_32le(cpustate->program, address, value);
+ cpustate->program->write_dword(address, value);
}
}
@@ -600,8 +600,8 @@ INLINE void WRITE64(i386_state *cpustate,UINT32 ea, UINT64 value)
}
ea &= cpustate->a20_mask;
- memory_write_dword_32le(cpustate->program, address+0, value & 0xffffffff);
- memory_write_dword_32le(cpustate->program, address+4, (value >> 32) & 0xffffffff);
+ cpustate->program->write_dword(address+0, value & 0xffffffff);
+ cpustate->program->write_dword(address+4, (value >> 32) & 0xffffffff);
}
}
@@ -892,11 +892,11 @@ INLINE void BUMP_DI(i386_state *cpustate,int adjustment)
/***********************************************************************************/
-#define READPORT8(port) (memory_read_byte_32le(cpustate->io, port))
-#define READPORT16(port) (memory_read_word_32le(cpustate->io, port))
-#define READPORT32(port) (memory_read_dword_32le(cpustate->io, port))
-#define WRITEPORT8(port, value) (memory_write_byte_32le(cpustate->io, port, value))
-#define WRITEPORT16(port, value) (memory_write_word_32le(cpustate->io, port, value))
-#define WRITEPORT32(port, value) (memory_write_dword_32le(cpustate->io, port, value))
+#define READPORT8(port) (cpustate->io->read_byte(port))
+#define READPORT16(port) (cpustate->io->read_word(port))
+#define READPORT32(port) (cpustate->io->read_dword(port))
+#define WRITEPORT8(port, value) (cpustate->io->write_byte(port, value))
+#define WRITEPORT16(port, value) (cpustate->io->write_word(port, value))
+#define WRITEPORT32(port, value) (cpustate->io->write_dword(port, value))
#endif /* __I386_H__ */
diff --git a/src/emu/cpu/i4004/i4004.c b/src/emu/cpu/i4004/i4004.c
index c3f015abf15..27178f20534 100644
--- a/src/emu/cpu/i4004/i4004.c
+++ b/src/emu/cpu/i4004/i4004.c
@@ -73,8 +73,8 @@ INLINE UINT8 READ_ROM(i4004_state *cpustate)
INLINE void WPM(i4004_state *cpustate)
{
- UINT8 t = (memory_read_byte_8le(cpustate->program, cpustate->RAM.d) << 4) | cpustate->A;
- memory_write_byte_8le(cpustate->program, (GET_PC.w.l & 0x0f00) | cpustate->RAM.d, t);
+ UINT8 t = (cpustate->program->read_byte(cpustate->RAM.d) << 4) | cpustate->A;
+ cpustate->program->write_byte((GET_PC.w.l & 0x0f00) | cpustate->RAM.d, t);
}
@@ -88,40 +88,40 @@ INLINE UINT8 ARG(i4004_state *cpustate)
INLINE UINT8 RM(i4004_state *cpustate)
{
- return memory_read_byte_8le(cpustate->data, cpustate->RAM.d) & 0x0f;
+ return cpustate->data->read_byte(cpustate->RAM.d) & 0x0f;
}
INLINE UINT8 RMS(i4004_state *cpustate, UINT32 a)
{
- return memory_read_byte_8le(cpustate->data, (cpustate->RAM.d & 0xff0) + a) >> 4;
+ return cpustate->data->read_byte((cpustate->RAM.d & 0xff0) + a) >> 4;
}
INLINE void WM(i4004_state *cpustate, UINT8 v)
{
- UINT8 t = memory_read_byte_8le(cpustate->data, cpustate->RAM.d);
- memory_write_byte_8le(cpustate->data, cpustate->RAM.d, (t & 0xf0) | v);
+ UINT8 t = cpustate->data->read_byte(cpustate->RAM.d);
+ cpustate->data->write_byte(cpustate->RAM.d, (t & 0xf0) | v);
}
INLINE void WMP(i4004_state *cpustate, UINT8 v)
{
- memory_write_byte_8le(cpustate->io, (cpustate->RAM.d >> 6) | 0x10, v & 0x0f);
+ cpustate->io->write_byte((cpustate->RAM.d >> 6) | 0x10, v & 0x0f);
}
INLINE void WMS(i4004_state *cpustate, UINT32 a, UINT8 v)
{
- UINT8 t = memory_read_byte_8le(cpustate->data, (cpustate->RAM.d & 0xff0) + a);
- memory_write_byte_8le(cpustate->data,(cpustate->RAM.d & 0xff0) + a, (t & 0x0f) | (v<<4));
+ UINT8 t = cpustate->data->read_byte((cpustate->RAM.d & 0xff0) + a);
+ cpustate->data->write_byte((cpustate->RAM.d & 0xff0) + a, (t & 0x0f) | (v<<4));
}
INLINE UINT8 RIO(i4004_state *cpustate)
{
- return memory_read_byte_8le(cpustate->io, cpustate->RAM.b.l >> 4) & 0x0f;
+ return cpustate->io->read_byte(cpustate->RAM.b.l >> 4) & 0x0f;
}
INLINE void WIO(i4004_state *cpustate, UINT8 v)
{
- memory_write_byte_8le(cpustate->io, cpustate->RAM.b.l >> 4, v & 0x0f);
+ cpustate->io->write_byte(cpustate->RAM.b.l >> 4, v & 0x0f);
}
INLINE UINT8 GET_REG(i4004_state *cpustate, UINT8 num)
diff --git a/src/emu/cpu/i8008/i8008.c b/src/emu/cpu/i8008/i8008.c
index f173bf83007..d4889f6d716 100644
--- a/src/emu/cpu/i8008/i8008.c
+++ b/src/emu/cpu/i8008/i8008.c
@@ -91,7 +91,7 @@ INLINE UINT8 GET_REG(i8008_state *cpustate,UINT8 reg)
case 4 : retVal = cpustate->E; break;
case 5 : retVal = cpustate->H; break;
case 6 : retVal = cpustate->L; break;
- default: retVal = memory_read_byte_8le(cpustate->program, (cpustate->H << 8) + cpustate->L); break;
+ default: retVal = cpustate->program->read_byte((cpustate->H << 8) + cpustate->L); break;
}
return retVal;
}
@@ -106,7 +106,7 @@ INLINE void SET_REG(i8008_state *cpustate,UINT8 reg, UINT8 val)
case 4 : cpustate->E = val; break;
case 5 : cpustate->H = val; break;
case 6 : cpustate->L = val; break;
- default: memory_write_byte_8le(cpustate->program, (cpustate->H << 8) + cpustate->L, val); break;
+ default: cpustate->program->write_byte((cpustate->H << 8) + cpustate->L, val); break;
}
}
@@ -391,11 +391,11 @@ static void execute_one(i8008_state *cpustate, int opcode)
if (((opcode>>4)&3)==0) {
// INP
cpustate->icount -= 8;
- cpustate->A = memory_read_byte_8le(cpustate->io, (opcode >> 1) & 0x1f);
+ cpustate->A = cpustate->io->read_byte((opcode >> 1) & 0x1f);
} else {
// OUT
cpustate->icount -= 6;
- memory_write_byte_8le(cpustate->io, (opcode >> 1) & 0x1f, cpustate->A);
+ cpustate->io->write_byte((opcode >> 1) & 0x1f, cpustate->A);
}
break;
}
diff --git a/src/emu/cpu/i8085/i8085.c b/src/emu/cpu/i8085/i8085.c
index b3476e8fe6f..b3072576021 100644
--- a/src/emu/cpu/i8085/i8085.c
+++ b/src/emu/cpu/i8085/i8085.c
@@ -374,13 +374,13 @@ INLINE UINT16 ARG16(i8085_state *cpustate)
INLINE UINT8 RM(i8085_state *cpustate, UINT32 a)
{
set_status(cpustate, 0x82); // memory read
- return memory_read_byte_8le(cpustate->program, a);
+ return cpustate->program->read_byte(a);
}
INLINE void WM(i8085_state *cpustate, UINT32 a, UINT8 v)
{
set_status(cpustate, 0x00); // memory write
- memory_write_byte_8le(cpustate->program, a, v);
+ cpustate->program->write_byte(a, v);
}
diff --git a/src/emu/cpu/i8085/i8085cpu.h b/src/emu/cpu/i8085/i8085cpu.h
index 2492532a33e..a581924b578 100644
--- a/src/emu/cpu/i8085/i8085cpu.h
+++ b/src/emu/cpu/i8085/i8085cpu.h
@@ -125,24 +125,24 @@
#define M_IN \
cpustate->STATUS = 0x42; \
cpustate->WZ.d=ARG(cpustate); \
- cpustate->AF.b.h=memory_read_byte_8le(cpustate->io, cpustate->WZ.d);
+ cpustate->AF.b.h=cpustate->io->read_byte(cpustate->WZ.d);
#define M_OUT \
cpustate->STATUS = 0x10; \
cpustate->WZ.d=ARG(cpustate); \
- memory_write_byte_8le(cpustate->io, cpustate->WZ.d,cpustate->AF.b.h)
+ cpustate->io->write_byte(cpustate->WZ.d,cpustate->AF.b.h)
/* stack */
#define M_PUSH(R) { \
cpustate->STATUS = 0x04; \
- memory_write_byte_8le(cpustate->program, --cpustate->SP.w.l, cpustate->R.b.h); \
- memory_write_byte_8le(cpustate->program, --cpustate->SP.w.l, cpustate->R.b.l); \
+ cpustate->program->write_byte(--cpustate->SP.w.l, cpustate->R.b.h); \
+ cpustate->program->write_byte(--cpustate->SP.w.l, cpustate->R.b.l); \
}
#define M_POP(R) { \
cpustate->STATUS = 0x86; \
- cpustate->R.b.l = memory_read_byte_8le(cpustate->program, cpustate->SP.w.l++); \
- cpustate->R.b.h = memory_read_byte_8le(cpustate->program, cpustate->SP.w.l++); \
+ cpustate->R.b.l = cpustate->program->read_byte(cpustate->SP.w.l++); \
+ cpustate->R.b.h = cpustate->program->read_byte(cpustate->SP.w.l++); \
}
/* jumps */
diff --git a/src/emu/cpu/i86/i86mem.c b/src/emu/cpu/i86/i86mem.c
index 653fe495164..096cf1cf1cc 100644
--- a/src/emu/cpu/i86/i86mem.c
+++ b/src/emu/cpu/i86/i86mem.c
@@ -2,15 +2,22 @@
8-bit memory accessors
*****************************************************************************/
+static UINT8 memory_read_byte(address_space *space, offs_t address) { return space->read_byte(address); }
+static void memory_write_byte(address_space *space, offs_t address, UINT8 data) { space->write_byte(address, data); }
+
#ifdef I8086
+
+static UINT16 memory_read_word(address_space *space, offs_t address) { return space->read_word(address); }
+static void memory_write_word(address_space *space, offs_t address, UINT16 data) { space->write_word(address, data); }
+
static void configure_memory_8bit(i8086_state *cpustate)
{
cpustate->mem.fetch_xor = 0;
- cpustate->mem.rbyte = memory_read_byte_8le;
- cpustate->mem.rword = memory_read_word_8le;
- cpustate->mem.wbyte = memory_write_byte_8le;
- cpustate->mem.wword = memory_write_word_8le;
+ cpustate->mem.rbyte = memory_read_byte;
+ cpustate->mem.rword = memory_read_word;
+ cpustate->mem.wbyte = memory_write_byte;
+ cpustate->mem.wword = memory_write_word;
}
#endif
@@ -22,22 +29,22 @@ static void configure_memory_8bit(i8086_state *cpustate)
static UINT16 read_word_16le(address_space *space, offs_t addr)
{
if (!(addr & 1))
- return memory_read_word_16le(space, addr);
+ return space->read_word(addr);
else
{
- UINT16 result = memory_read_byte_16le(space, addr);
- return result | (memory_read_byte_16le(space, addr + 1) << 8);
+ UINT16 result = space->read_byte(addr);
+ return result | (space->read_byte(addr + 1) << 8);
}
}
static void write_word_16le(address_space *space, offs_t addr, UINT16 data)
{
if (!(addr & 1))
- memory_write_word_16le(space, addr, data);
+ space->write_word(addr, data);
else
{
- memory_write_byte_16le(space, addr, data);
- memory_write_byte_16le(space, addr + 1, data >> 8);
+ space->write_byte(addr, data);
+ space->write_byte(addr + 1, data >> 8);
}
}
@@ -45,8 +52,8 @@ static void configure_memory_16bit(i8086_state *cpustate)
{
cpustate->mem.fetch_xor = BYTE_XOR_LE(0);
- cpustate->mem.rbyte = memory_read_byte_16le;
+ cpustate->mem.rbyte = memory_read_byte;
cpustate->mem.rword = read_word_16le;
- cpustate->mem.wbyte = memory_write_byte_16le;
+ cpustate->mem.wbyte = memory_write_byte;
cpustate->mem.wword = write_word_16le;
}
diff --git a/src/emu/cpu/i86/i86priv.h b/src/emu/cpu/i86/i86priv.h
index 11b3892c265..3480cece0c2 100644
--- a/src/emu/cpu/i86/i86priv.h
+++ b/src/emu/cpu/i86/i86priv.h
@@ -84,10 +84,10 @@ typedef enum {
/************************************************************************/
-#define read_byte(a) (*cpustate->mem.rbyte)(cpustate->program, a)
-#define read_word(a) (*cpustate->mem.rword)(cpustate->program, a)
-#define write_byte(a,d) (*cpustate->mem.wbyte)(cpustate->program, (a),(d))
-#define write_word(a,d) (*cpustate->mem.wword)(cpustate->program, (a),(d))
+#define read_mem_byte(a) (*cpustate->mem.rbyte)(cpustate->program, a)
+#define read_mem_word(a) (*cpustate->mem.rword)(cpustate->program, a)
+#define write_mem_byte(a,d) (*cpustate->mem.wbyte)(cpustate->program, (a),(d))
+#define write_mem_word(a,d) (*cpustate->mem.wword)(cpustate->program, (a),(d))
#define read_port_byte(a) (*cpustate->mem.rbyte)(cpustate->io, a)
#define read_port_word(a) (*cpustate->mem.rword)(cpustate->io, a)
@@ -100,16 +100,16 @@ typedef enum {
#define DefaultBase(Seg) ((cpustate->seg_prefix && (Seg == DS || Seg == SS)) ? cpustate->prefix_base : cpustate->base[Seg])
-#define GetMemB(Seg,Off) (read_byte((DefaultBase(Seg) + (Off)) & AMASK))
-#define GetMemW(Seg,Off) (read_word((DefaultBase(Seg) + (Off)) & AMASK))
-#define PutMemB(Seg,Off,x) write_byte((DefaultBase(Seg) + (Off)) & AMASK, (x))
-#define PutMemW(Seg,Off,x) write_word((DefaultBase(Seg) + (Off)) & AMASK, (x))
+#define GetMemB(Seg,Off) (read_mem_byte((DefaultBase(Seg) + (Off)) & AMASK))
+#define GetMemW(Seg,Off) (read_mem_word((DefaultBase(Seg) + (Off)) & AMASK))
+#define PutMemB(Seg,Off,x) write_mem_byte((DefaultBase(Seg) + (Off)) & AMASK, (x))
+#define PutMemW(Seg,Off,x) write_mem_word((DefaultBase(Seg) + (Off)) & AMASK, (x))
-#define PEEKBYTE(ea) (read_byte((ea) & AMASK))
-#define ReadByte(ea) (read_byte((ea) & AMASK))
-#define ReadWord(ea) (read_word((ea) & AMASK))
-#define WriteByte(ea,val) write_byte((ea) & AMASK, val);
-#define WriteWord(ea,val) write_word((ea) & AMASK, val);
+#define PEEKBYTE(ea) (read_mem_byte((ea) & AMASK))
+#define ReadByte(ea) (read_mem_byte((ea) & AMASK))
+#define ReadWord(ea) (read_mem_word((ea) & AMASK))
+#define WriteByte(ea,val) write_mem_byte((ea) & AMASK, val);
+#define WriteWord(ea,val) write_mem_word((ea) & AMASK, val);
#define FETCH_XOR(a) ((a) ^ cpustate->mem.fetch_xor)
#define FETCH (memory_raw_read_byte(cpustate->program, FETCH_XOR(cpustate->pc++)))
diff --git a/src/emu/cpu/i860/i860dec.c b/src/emu/cpu/i860/i860dec.c
index 8efb7115b49..27dc6ab52e7 100644
--- a/src/emu/cpu/i860/i860dec.c
+++ b/src/emu/cpu/i860/i860dec.c
@@ -369,7 +369,7 @@ static UINT32 ifetch (i860s *cpustate, UINT32 pc)
/* Since i860 instructions are always stored LSB first (regardless of
the BE bit), we need to adjust the instruction below on MSB hosts. */
- w1 = memory_read_dword_64le(cpustate->program, phys_pc);
+ w1 = cpustate->program->read_dword(phys_pc);
#ifdef HOST_MSB
BYTE_REV32 (w1);
#endif /* HOST_MSB. */
@@ -407,7 +407,7 @@ static UINT32 get_address_translation (i860s *cpustate, UINT32 vaddr, int is_dat
/* Get page directory entry at DTB:DIR:00. */
pg_dir_entry_a = dtb | (vdir << 2);
- pg_dir_entry = memory_read_dword_64le(cpustate->program, pg_dir_entry_a);
+ pg_dir_entry = cpustate->program->read_dword(pg_dir_entry_a);
#ifdef HOST_MSB
BYTE_REV32 (pg_dir_entry);
#endif
@@ -455,7 +455,7 @@ static UINT32 get_address_translation (i860s *cpustate, UINT32 vaddr, int is_dat
/* Get page table entry at PFA1:PAGE:00. */
pfa1 = pg_dir_entry & 0xfffff000;
pg_tbl_entry_a = pfa1 | (vpage << 2);
- pg_tbl_entry = memory_read_dword_64le(cpustate->program, pg_tbl_entry_a);
+ pg_tbl_entry = cpustate->program->read_dword(pg_tbl_entry_a);
#ifdef HOST_MSB
BYTE_REV32 (pg_tbl_entry);
#endif
@@ -505,8 +505,8 @@ static UINT32 get_address_translation (i860s *cpustate, UINT32 vaddr, int is_dat
BYTE_REV32 (ttpde);
BYTE_REV32 (ttpte);
#endif
- memory_write_dword_64le(cpustate->program, pg_dir_entry_a, ttpde);
- memory_write_dword_64le(cpustate->program, pg_tbl_entry_a, ttpte);
+ cpustate->program->write_dword(pg_dir_entry_a, ttpde);
+ cpustate->program->write_dword(pg_tbl_entry_a, ttpte);
if (is_write && is_dataref && (pg_tbl_entry & 0x40) == 0)
{
@@ -567,12 +567,12 @@ static UINT32 readmemi_emu (i860s *cpustate, UINT32 addr, int size)
/* Now do the actual read. */
if (size == 1)
{
- UINT32 ret = memory_read_byte_64le(cpustate->program, addr);
+ UINT32 ret = cpustate->program->read_byte(addr);
return ret & 0xff;
}
else if (size == 2)
{
- UINT32 ret = memory_read_word_64le(cpustate->program, addr);
+ UINT32 ret = cpustate->program->read_word(addr);
#ifdef HOST_MSB
BYTE_REV16 (ret);
#endif
@@ -580,7 +580,7 @@ static UINT32 readmemi_emu (i860s *cpustate, UINT32 addr, int size)
}
else if (size == 4)
{
- UINT32 ret = memory_read_dword_64le(cpustate->program, addr);
+ UINT32 ret = cpustate->program->read_dword(addr);
#ifdef HOST_MSB
BYTE_REV32 (ret);
#endif
@@ -630,20 +630,20 @@ static void writememi_emu (i860s *cpustate, UINT32 addr, int size, UINT32 data)
/* Now do the actual write. */
if (size == 1)
- memory_write_byte_64le(cpustate->program, addr, data);
+ cpustate->program->write_byte(addr, data);
else if (size == 2)
{
#ifdef HOST_MSB
BYTE_REV16 (data);
#endif
- memory_write_word_64le(cpustate->program, addr, data);
+ cpustate->program->write_word(addr, data);
}
else if (size == 4)
{
#ifdef HOST_MSB
BYTE_REV32 (data);
#endif
- memory_write_dword_64le(cpustate->program, addr, data);
+ cpustate->program->write_dword(addr, data);
}
else
assert (0);
@@ -689,28 +689,28 @@ static void fp_readmem_emu (i860s *cpustate, UINT32 addr, int size, UINT8 *dest)
if (size == 4)
{
- dest[0] = memory_read_byte_64le(cpustate->program, addr+3);
- dest[1] = memory_read_byte_64le(cpustate->program, addr+2);
- dest[2] = memory_read_byte_64le(cpustate->program, addr+1);
- dest[3] = memory_read_byte_64le(cpustate->program, addr+0);
+ dest[0] = cpustate->program->read_byte(addr+3);
+ dest[1] = cpustate->program->read_byte(addr+2);
+ dest[2] = cpustate->program->read_byte(addr+1);
+ dest[3] = cpustate->program->read_byte(addr+0);
}
else if (size == 8)
{
- dest[0] = memory_read_byte_64le(cpustate->program, addr+7);
- dest[1] = memory_read_byte_64le(cpustate->program, addr+6);
- dest[2] = memory_read_byte_64le(cpustate->program, addr+5);
- dest[3] = memory_read_byte_64le(cpustate->program, addr+4);
- dest[4] = memory_read_byte_64le(cpustate->program, addr+3);
- dest[5] = memory_read_byte_64le(cpustate->program, addr+2);
- dest[6] = memory_read_byte_64le(cpustate->program, addr+1);
- dest[7] = memory_read_byte_64le(cpustate->program, addr+0);
+ dest[0] = cpustate->program->read_byte(addr+7);
+ dest[1] = cpustate->program->read_byte(addr+6);
+ dest[2] = cpustate->program->read_byte(addr+5);
+ dest[3] = cpustate->program->read_byte(addr+4);
+ dest[4] = cpustate->program->read_byte(addr+3);
+ dest[5] = cpustate->program->read_byte(addr+2);
+ dest[6] = cpustate->program->read_byte(addr+1);
+ dest[7] = cpustate->program->read_byte(addr+0);
}
else if (size == 16)
{
int i;
for (i = 0; i < 16; i++)
{
- dest[i] = memory_read_byte_64le(cpustate->program, addr+15-i);
+ dest[i] = cpustate->program->read_byte(addr+15-i);
}
}
}
@@ -757,13 +757,13 @@ static void fp_writemem_emu (i860s *cpustate, UINT32 addr, int size, UINT8 *data
if (size == 4)
{
#if 1
- memory_write_byte_64le(cpustate->program, addr+3, data[0]);
- memory_write_byte_64le(cpustate->program, addr+2, data[1]);
- memory_write_byte_64le(cpustate->program, addr+1, data[2]);
- memory_write_byte_64le(cpustate->program, addr+0, data[3]);
+ cpustate->program->write_byte(addr+3, data[0]);
+ cpustate->program->write_byte(addr+2, data[1]);
+ cpustate->program->write_byte(addr+1, data[2]);
+ cpustate->program->write_byte(addr+0, data[3]);
#else
UINT32 ddd = (data[3]) | (data[2] << 8) | (data[1] << 16) |(data[0] << 24);
- memory_write_dword_64le(cpustate->program, addr+0, ddd);
+ cpustate->program->write_dword(addr+0, ddd);
#endif
}
else if (size == 8)
@@ -771,25 +771,25 @@ static void fp_writemem_emu (i860s *cpustate, UINT32 addr, int size, UINT8 *data
/* Special: watch for wmask != 0xff, which means we're doing pst.d. */
if (wmask == 0xff)
{
- memory_write_byte_64le(cpustate->program, addr+7, data[0]);
- memory_write_byte_64le(cpustate->program, addr+6, data[1]);
- memory_write_byte_64le(cpustate->program, addr+5, data[2]);
- memory_write_byte_64le(cpustate->program, addr+4, data[3]);
- memory_write_byte_64le(cpustate->program, addr+3, data[4]);
- memory_write_byte_64le(cpustate->program, addr+2, data[5]);
- memory_write_byte_64le(cpustate->program, addr+1, data[6]);
- memory_write_byte_64le(cpustate->program, addr+0, data[7]);
+ cpustate->program->write_byte(addr+7, data[0]);
+ cpustate->program->write_byte(addr+6, data[1]);
+ cpustate->program->write_byte(addr+5, data[2]);
+ cpustate->program->write_byte(addr+4, data[3]);
+ cpustate->program->write_byte(addr+3, data[4]);
+ cpustate->program->write_byte(addr+2, data[5]);
+ cpustate->program->write_byte(addr+1, data[6]);
+ cpustate->program->write_byte(addr+0, data[7]);
}
else
{
- if (wmask & 0x80) memory_write_byte_64le(cpustate->program, addr+7, data[0]);
- if (wmask & 0x40) memory_write_byte_64le(cpustate->program, addr+6, data[1]);
- if (wmask & 0x20) memory_write_byte_64le(cpustate->program, addr+5, data[2]);
- if (wmask & 0x10) memory_write_byte_64le(cpustate->program, addr+4, data[3]);
- if (wmask & 0x08) memory_write_byte_64le(cpustate->program, addr+3, data[4]);
- if (wmask & 0x04) memory_write_byte_64le(cpustate->program, addr+2, data[5]);
- if (wmask & 0x02) memory_write_byte_64le(cpustate->program, addr+1, data[6]);
- if (wmask & 0x01) memory_write_byte_64le(cpustate->program, addr+0, data[7]);
+ if (wmask & 0x80) cpustate->program->write_byte(addr+7, data[0]);
+ if (wmask & 0x40) cpustate->program->write_byte(addr+6, data[1]);
+ if (wmask & 0x20) cpustate->program->write_byte(addr+5, data[2]);
+ if (wmask & 0x10) cpustate->program->write_byte(addr+4, data[3]);
+ if (wmask & 0x08) cpustate->program->write_byte(addr+3, data[4]);
+ if (wmask & 0x04) cpustate->program->write_byte(addr+2, data[5]);
+ if (wmask & 0x02) cpustate->program->write_byte(addr+1, data[6]);
+ if (wmask & 0x01) cpustate->program->write_byte(addr+0, data[7]);
}
}
else if (size == 16)
@@ -797,7 +797,7 @@ static void fp_writemem_emu (i860s *cpustate, UINT32 addr, int size, UINT8 *data
int i;
for (i = 0; i < 16; i++)
{
- memory_write_byte_64le(cpustate->program, addr+15-i, data[i]);
+ cpustate->program->write_byte(addr+15-i, data[i]);
}
}
@@ -4552,7 +4552,7 @@ static void disasm (i860s *cpustate, UINT32 addr, int len)
/* Note that we print the incoming (possibly virtual) address as the
PC rather than the translated address. */
fprintf (stderr, " (%s) 0x%08x: ", cpustate->device->tag(), addr);
- insn = memory_read_dword_64le(cpustate->program, phys_addr);
+ insn = cpustate->program->read_dword(phys_addr);
#ifdef HOST_MSB
BYTE_REV32 (insn);
#endif /* HOST_MSB. */
@@ -4584,7 +4584,7 @@ static void dbg_db (i860s *cpustate, UINT32 addr, int len)
if (GET_DIRBASE_ATE ())
phys_addr = get_address_translation (cpustate, addr, 1 /* is_dataref */, 0 /* is_write */);
- b[i] = memory_read_byte_64le(cpustate->program, phys_addr);
+ b[i] = cpustate->program->read_byte(phys_addr);
fprintf (stderr, "%02x ", b[i]);
addr++;
}
diff --git a/src/emu/cpu/i960/i960.c b/src/emu/cpu/i960/i960.c
index 9ae1359bb10..5b03af5269f 100644
--- a/src/emu/cpu/i960/i960.c
+++ b/src/emu/cpu/i960/i960.c
@@ -52,31 +52,31 @@ static void do_call(i960_state_t *i960, UINT32 adr, int type, UINT32 stack);
INLINE UINT32 i960_read_dword_unaligned(i960_state_t *i960, UINT32 address)
{
if (address & 3)
- return memory_read_byte_32le(i960->program, address) | memory_read_byte_32le(i960->program, address+1)<<8 | memory_read_byte_32le(i960->program, address+2)<<16 | memory_read_byte_32le(i960->program, address+3)<<24;
+ return i960->program->read_byte(address) | i960->program->read_byte(address+1)<<8 | i960->program->read_byte(address+2)<<16 | i960->program->read_byte(address+3)<<24;
else
- return memory_read_dword_32le(i960->program, address);
+ return i960->program->read_dword(address);
}
INLINE UINT16 i960_read_word_unaligned(i960_state_t *i960, UINT32 address)
{
if (address & 1)
- return memory_read_byte_32le(i960->program, address) | memory_read_byte_32le(i960->program, address+1)<<8;
+ return i960->program->read_byte(address) | i960->program->read_byte(address+1)<<8;
else
- return memory_read_word_32le(i960->program, address);
+ return i960->program->read_word(address);
}
INLINE void i960_write_dword_unaligned(i960_state_t *i960, UINT32 address, UINT32 data)
{
if (address & 3)
{
- memory_write_byte_32le(i960->program, address, data & 0xff);
- memory_write_byte_32le(i960->program, address+1, (data>>8)&0xff);
- memory_write_byte_32le(i960->program, address+2, (data>>16)&0xff);
- memory_write_byte_32le(i960->program, address+3, (data>>24)&0xff);
+ i960->program->write_byte(address, data & 0xff);
+ i960->program->write_byte(address+1, (data>>8)&0xff);
+ i960->program->write_byte(address+2, (data>>16)&0xff);
+ i960->program->write_byte(address+3, (data>>24)&0xff);
}
else
{
- memory_write_dword_32le(i960->program, address, data);
+ i960->program->write_dword(address, data);
}
}
@@ -84,22 +84,22 @@ INLINE void i960_write_word_unaligned(i960_state_t *i960, UINT32 address, UINT16
{
if (address & 1)
{
- memory_write_byte_32le(i960->program, address, data & 0xff);
- memory_write_byte_32le(i960->program, address+1, (data>>8)&0xff);
+ i960->program->write_byte(address, data & 0xff);
+ i960->program->write_byte(address+1, (data>>8)&0xff);
}
else
{
- memory_write_word_32le(i960->program, address, data);
+ i960->program->write_word(address, data);
}
}
INLINE void send_iac(i960_state_t *i960, UINT32 adr)
{
UINT32 iac[4];
- iac[0] = memory_read_dword_32le(i960->program, adr);
- iac[1] = memory_read_dword_32le(i960->program, adr+4);
- iac[2] = memory_read_dword_32le(i960->program, adr+8);
- iac[3] = memory_read_dword_32le(i960->program, adr+12);
+ iac[0] = i960->program->read_dword(adr);
+ iac[1] = i960->program->read_dword(adr+4);
+ iac[2] = i960->program->read_dword(adr+8);
+ iac[3] = i960->program->read_dword(adr+12);
switch(iac[0]>>24) {
case 0x93: // reinit
@@ -415,12 +415,12 @@ INLINE const char *i960_get_strflags(i960_state_t *i960)
// interrupt dispatch
static void take_interrupt(i960_state_t *i960, int vector, int lvl)
{
- int int_tab = memory_read_dword_32le(i960->program, i960->PRCB+20); // interrupt table
- int int_SP = memory_read_dword_32le(i960->program, i960->PRCB+24); // interrupt stack
+ int int_tab = i960->program->read_dword(i960->PRCB+20); // interrupt table
+ int int_SP = i960->program->read_dword(i960->PRCB+24); // interrupt stack
int SP;
UINT32 IRQV;
- IRQV = memory_read_dword_32le(i960->program, int_tab + 36 + (vector-8)*4);
+ IRQV = i960->program->read_dword(int_tab + 36 + (vector-8)*4);
// start the process
if(!(i960->PC & 0x2000)) // if this is a nested interrupt, don't re-get int_SP
@@ -438,10 +438,10 @@ static void take_interrupt(i960_state_t *i960, int vector, int lvl)
do_call(i960, IRQV, 7, SP);
// save the processor state
- memory_write_dword_32le(i960->program, i960->r[I960_FP]-16, i960->PC);
- memory_write_dword_32le(i960->program, i960->r[I960_FP]-12, i960->AC);
+ i960->program->write_dword(i960->r[I960_FP]-16, i960->PC);
+ i960->program->write_dword(i960->r[I960_FP]-12, i960->AC);
// store the vector
- memory_write_dword_32le(i960->program, i960->r[I960_FP]-8, vector-8);
+ i960->program->write_dword(i960->r[I960_FP]-8, vector-8);
i960->PC &= ~0x1f00; // clear priority, state, trace-fault pending, and trace enable
i960->PC |= (lvl<<16); // set CPU level to current IRQ level
@@ -450,14 +450,14 @@ static void take_interrupt(i960_state_t *i960, int vector, int lvl)
static void check_irqs(i960_state_t *i960)
{
- int int_tab = memory_read_dword_32le(i960->program, i960->PRCB+20); // interrupt table
+ int int_tab = i960->program->read_dword(i960->PRCB+20); // interrupt table
int cpu_pri = (i960->PC>>16)&0x1f;
int pending_pri;
int lvl, irq, take = -1;
int vword;
static const UINT32 lvlmask[4] = { 0x000000ff, 0x0000ff00, 0x00ff0000, 0xff000000 };
- pending_pri = memory_read_dword_32le(i960->program, int_tab); // read pending priorities
+ pending_pri = i960->program->read_dword(int_tab); // read pending priorities
if ((i960->immediate_irq) && ((cpu_pri < i960->immediate_pri) || (i960->immediate_pri == 31)))
{
@@ -475,14 +475,14 @@ static void check_irqs(i960_state_t *i960)
wordl = (lvl % 4) * 8;
wordh = (wordl + 8) - 1;
- vword = memory_read_dword_32le(i960->program, int_tab + word);
+ vword = i960->program->read_dword(int_tab + word);
// take the first vector we find for this level
for (irq = wordh; irq >= wordl; irq--) {
if(vword & (1 << irq)) {
// clear pending bit
vword &= ~(1 << irq);
- memory_write_dword_32le(i960->program, int_tab + word, vword);
+ i960->program->write_dword(int_tab + word, vword);
take = irq;
break;
}
@@ -494,14 +494,14 @@ static void check_irqs(i960_state_t *i960)
// try to recover...
pending_pri &= ~(1 << lvl);
- memory_write_dword_32le(i960->program, int_tab, pending_pri);
+ i960->program->write_dword(int_tab, pending_pri);
return;
}
// if no vectors are waiting for this level, clear the level bit
if(!(vword & lvlmask[lvl % 4])) {
pending_pri &= ~(1 << lvl);
- memory_write_dword_32le(i960->program, int_tab, pending_pri);
+ i960->program->write_dword(int_tab, pending_pri);
}
take += ((lvl/4) * 32);
@@ -530,7 +530,7 @@ static void do_call(i960_state_t *i960, UINT32 adr, int type, UINT32 stack)
// flush the current register set to the current frame
FP = i960->r[I960_FP] & ~0x3f;
for (i = 0; i < 16; i++) {
- memory_write_dword_32le(i960->program, FP + (i*4), i960->r[i]);
+ i960->program->write_dword(FP + (i*4), i960->r[i]);
}
}
else // a cache entry is available, use it
@@ -569,7 +569,7 @@ static void do_ret_0(i960_state_t *i960)
{
int i;
for(i=0; i<0x10; i++)
- i960->r[i] = memory_read_dword_32le(i960->program, i960->r[I960_FP]+4*i);
+ i960->r[i] = i960->program->read_dword(i960->r[I960_FP]+4*i);
if (i960->rcache_pos < 0)
{
@@ -595,8 +595,8 @@ static void do_ret(i960_state_t *i960)
break;
case 7:
- x = memory_read_dword(i960->program, i960->r[I960_FP]-16);
- y = memory_read_dword(i960->program, i960->r[I960_FP]-12);
+ x = i960->program->read_dword(i960->r[I960_FP]-16);
+ y = i960->program->read_dword(i960->r[I960_FP]-12);
do_ret_0(i960);
i960->AC = y;
// #### test supervisor
@@ -1235,9 +1235,9 @@ INLINE void execute_op(i960_state_t *i960, UINT32 opcode)
t2 = get_2_ri(i960, opcode);
// interrupt control register
if(t1 == 0xff000004)
- i960->ICR = memory_read_dword_32le(i960->program, t2);
+ i960->ICR = i960->program->read_dword(t2);
else
- memory_write_dword_32le(i960->program, t1, memory_read_dword_32le(i960->program, t2));
+ i960->program->write_dword(t1, i960->program->read_dword(t2));
i960->AC = (i960->AC & ~7) | 2;
break;
@@ -1248,10 +1248,10 @@ INLINE void execute_op(i960_state_t *i960, UINT32 opcode)
if(t1 == 0xff000010)
send_iac(i960, t2);
else {
- memory_write_dword_32le(i960->program, t1, memory_read_dword_32le(i960->program, t2));
- memory_write_dword_32le(i960->program, t1+4, memory_read_dword_32le(i960->program, t2+4));
- memory_write_dword_32le(i960->program, t1+8, memory_read_dword_32le(i960->program, t2+8));
- memory_write_dword_32le(i960->program, t1+12, memory_read_dword_32le(i960->program, t2+12));
+ i960->program->write_dword(t1, i960->program->read_dword(t2));
+ i960->program->write_dword(t1+4, i960->program->read_dword(t2+4));
+ i960->program->write_dword(t1+8, i960->program->read_dword(t2+8));
+ i960->program->write_dword(t1+12, i960->program->read_dword(t2+12));
}
i960->AC = (i960->AC & ~7) | 2;
break;
@@ -1352,7 +1352,7 @@ INLINE void execute_op(i960_state_t *i960, UINT32 opcode)
for (i = 0; i < 0x10; i++)
{
- memory_write_dword_32le(i960->program, i960->rcache_frame_addr[t1] + (i * sizeof(UINT32)), i960->rcache[t1][i]);
+ i960->program->write_dword(i960->rcache_frame_addr[t1] + (i * sizeof(UINT32)), i960->rcache[t1][i]);
}
}
i960->rcache_pos = 0;
@@ -1792,12 +1792,12 @@ INLINE void execute_op(i960_state_t *i960, UINT32 opcode)
case 0x80: // ldob
i960->icount -= 4;
- i960->r[(opcode>>19)&0x1f] = memory_read_byte_32le(i960->program, get_ea(i960, opcode));
+ i960->r[(opcode>>19)&0x1f] = i960->program->read_byte(get_ea(i960, opcode));
break;
case 0x82: // stob
i960->icount -= 2;
- memory_write_byte_32le(i960->program, get_ea(i960, opcode), i960->r[(opcode>>19)&0x1f]);
+ i960->program->write_byte(get_ea(i960, opcode), i960->r[(opcode>>19)&0x1f]);
break;
case 0x84: // bx
@@ -1928,12 +1928,12 @@ INLINE void execute_op(i960_state_t *i960, UINT32 opcode)
case 0xc0: // ldib
i960->icount -= 4;
- i960->r[(opcode>>19)&0x1f] = (INT8)memory_read_byte_32le(i960->program, get_ea(i960, opcode));
+ i960->r[(opcode>>19)&0x1f] = (INT8)i960->program->read_byte(get_ea(i960, opcode));
break;
case 0xc2: // stib
i960->icount -= 2;
- memory_write_byte_32le(i960->program, get_ea(i960, opcode), i960->r[(opcode>>19)&0x1f]);
+ i960->program->write_byte(get_ea(i960, opcode), i960->r[(opcode>>19)&0x1f]);
break;
case 0xc8: // ldis
@@ -1973,7 +1973,7 @@ static CPU_EXECUTE( i960 )
static void set_irq_line(i960_state_t *i960, int irqline, int state)
{
- int int_tab = memory_read_dword_32le(i960->program, i960->PRCB+20); // interrupt table
+ int int_tab = i960->program->read_dword(i960->PRCB+20); // interrupt table
int cpu_pri = (i960->PC>>16)&0x1f;
int vector =0;
int priority;
@@ -2022,16 +2022,16 @@ static void set_irq_line(i960_state_t *i960, int irqline, int state)
else
{
// store the interrupt in the "pending" table
- pend = memory_read_dword_32le(i960->program, int_tab);
+ pend = i960->program->read_dword(int_tab);
pend |= (1 << priority);
- memory_write_dword_32le(i960->program, int_tab, pend);
+ i960->program->write_dword(int_tab, pend);
// now bitfield-ize the vector
word = ((vector / 32) * 4) + 4;
wordofs = vector % 32;
- pend = memory_read_dword_32le(i960->program, int_tab + word);
+ pend = i960->program->read_dword(int_tab + word);
pend |= (1 << wordofs);
- memory_write_dword_32le(i960->program, int_tab + word, pend);
+ i960->program->write_dword(int_tab + word, pend);
}
// and ack it to the core now that it's queued
@@ -2085,9 +2085,9 @@ static CPU_RESET( i960 )
{
i960_state_t *i960 = get_safe_token(device);
- i960->SAT = memory_read_dword_32le(i960->program, 0);
- i960->PRCB = memory_read_dword_32le(i960->program, 4);
- i960->IP = memory_read_dword_32le(i960->program, 12);
+ i960->SAT = i960->program->read_dword(0);
+ i960->PRCB = i960->program->read_dword(4);
+ i960->IP = i960->program->read_dword(12);
i960->PC = 0x001f2002;
i960->AC = 0;
i960->ICR = 0xff000000;
@@ -2097,7 +2097,7 @@ static CPU_RESET( i960 )
memset(i960->r, 0, sizeof(i960->r));
memset(i960->rcache, 0, sizeof(i960->rcache));
- i960->r[I960_FP] = memory_read_dword_32le(i960->program, i960->PRCB+24);
+ i960->r[I960_FP] = i960->program->read_dword(i960->PRCB+24);
i960->r[I960_SP] = i960->r[I960_FP] + 64;
i960->rcache_pos = 0;
}
diff --git a/src/emu/cpu/jaguar/jaguar.c b/src/emu/cpu/jaguar/jaguar.c
index f0f1b981beb..b25dcc4957f 100644
--- a/src/emu/cpu/jaguar/jaguar.c
+++ b/src/emu/cpu/jaguar/jaguar.c
@@ -64,13 +64,13 @@ CPU_DISASSEMBLE( jaguardsp );
#define CONDITION(x) condition_table[(x) + ((jaguar->FLAGS & 7) << 5)]
-#define READBYTE(J,a) memory_read_byte_32be((J)->program, a)
-#define READWORD(J,a) memory_read_word_32be((J)->program, a)
-#define READLONG(J,a) memory_read_dword_32be((J)->program, a)
+#define READBYTE(J,a) (J)->program->read_byte(a)
+#define READWORD(J,a) (J)->program->read_word(a)
+#define READLONG(J,a) (J)->program->read_dword(a)
-#define WRITEBYTE(J,a,v) memory_write_byte_32be((J)->program, a, v)
-#define WRITEWORD(J,a,v) memory_write_word_32be((J)->program, a, v)
-#define WRITELONG(J,a,v) memory_write_dword_32be((J)->program, a, v)
+#define WRITEBYTE(J,a,v) (J)->program->write_byte(a, v)
+#define WRITEWORD(J,a,v) (J)->program->write_word(a, v)
+#define WRITELONG(J,a,v) (J)->program->write_dword(a, v)
diff --git a/src/emu/cpu/konami/konami.c b/src/emu/cpu/konami/konami.c
index 143c8f3b984..1dde92f375d 100644
--- a/src/emu/cpu/konami/konami.c
+++ b/src/emu/cpu/konami/konami.c
@@ -118,8 +118,8 @@ INLINE konami_state *get_safe_token(running_device *device)
#define KONAMI_SYNC 16 /* set when SYNC is waiting for an interrupt */
#define KONAMI_LDS 32 /* set when LDS occured at least once */
-#define RM(cs,Addr) memory_read_byte_8be((cs)->program, Addr)
-#define WM(cs,Addr,Value) memory_write_byte_8be((cs)->program, Addr,Value)
+#define RM(cs,Addr) (cs)->program->read_byte(Addr)
+#define WM(cs,Addr,Value) (cs)->program->write_byte(Addr,Value)
#define ROP(cs,Addr) memory_decrypted_read_byte((cs)->program, Addr)
#define ROP_ARG(cs,Addr) memory_raw_read_byte((cs)->program, Addr)
diff --git a/src/emu/cpu/lh5801/5801tbl.c b/src/emu/cpu/lh5801/5801tbl.c
index ca2d42f6e40..cc3512050ed 100644
--- a/src/emu/cpu/lh5801/5801tbl.c
+++ b/src/emu/cpu/lh5801/5801tbl.c
@@ -37,8 +37,8 @@ INLINE void lh5801_adc(lh5801_state *cpustate, UINT8 data)
INLINE void lh5801_add_mem(lh5801_state *cpustate, int addr, UINT8 data)
{
- int v=lh5801_add_generic(cpustate,memory_read_byte(cpustate->program,addr),data,0);
- memory_write_byte(cpustate->program,addr,v);
+ int v=lh5801_add_generic(cpustate,cpustate->program->read_byte(addr),data,0);
+ cpustate->program->write_byte(addr,v);
}
INLINE void lh5801_adr(lh5801_state *cpustate, PAIR *reg)
@@ -97,10 +97,10 @@ INLINE void lh5801_and(lh5801_state *cpustate, UINT8 data)
INLINE void lh5801_and_mem(lh5801_state *cpustate, int addr, UINT8 data)
{
- data&=memory_read_byte(cpustate->program,addr);
+ data&=cpustate->program->read_byte(addr);
cpustate->t&=~Z;
if (!data) cpustate->t|=Z;
- memory_write_byte(cpustate->program,addr,data);
+ cpustate->program->write_byte(addr,data);
}
INLINE void lh5801_bit(lh5801_state *cpustate, UINT8 a, UINT8 b)
@@ -125,10 +125,10 @@ INLINE void lh5801_ora(lh5801_state *cpustate, UINT8 data)
INLINE void lh5801_ora_mem(lh5801_state *cpustate, int addr, UINT8 data)
{
- data|=memory_read_byte(cpustate->program,addr);
+ data|=cpustate->program->read_byte(addr);
cpustate->t&=~Z;
if (!data) cpustate->t|=Z;
- memory_write_byte(cpustate->program,addr,data);
+ cpustate->program->write_byte(addr,data);
}
INLINE void lh5801_lda(lh5801_state *cpustate, UINT8 data)
@@ -141,27 +141,27 @@ INLINE void lh5801_lda(lh5801_state *cpustate, UINT8 data)
INLINE void lh5801_lde(lh5801_state *cpustate, PAIR *reg)
{
// or z flag depends on reg
- cpustate->a=memory_read_byte(cpustate->program,reg->w.l--);
+ cpustate->a=cpustate->program->read_byte(reg->w.l--);
cpustate->t&=~Z;
if (!cpustate->a) cpustate->t|=Z;
}
INLINE void lh5801_sde(lh5801_state *cpustate, PAIR *reg)
{
- memory_write_byte(cpustate->program,reg->w.l--, cpustate->a);
+ cpustate->program->write_byte(reg->w.l--, cpustate->a);
}
INLINE void lh5801_lin(lh5801_state *cpustate, PAIR *reg)
{
// or z flag depends on reg
- cpustate->a=memory_read_byte(cpustate->program,reg->w.l++);
+ cpustate->a=cpustate->program->read_byte(reg->w.l++);
cpustate->t&=~Z;
if (!cpustate->a) cpustate->t|=Z;
}
INLINE void lh5801_sin(lh5801_state *cpustate, PAIR *reg)
{
- memory_write_byte(cpustate->program,reg->w.l++, cpustate->a);
+ cpustate->program->write_byte(reg->w.l++, cpustate->a);
}
INLINE void lh5801_dec(lh5801_state *cpustate, UINT8 *adr)
@@ -176,40 +176,40 @@ INLINE void lh5801_inc(lh5801_state *cpustate, UINT8 *adr)
INLINE void lh5801_pop(lh5801_state *cpustate)
{
- cpustate->a=memory_read_byte(cpustate->program,++S);
+ cpustate->a=cpustate->program->read_byte(++S);
cpustate->t&=~Z;
if (!cpustate->a) cpustate->t|=Z;
}
INLINE void lh5801_pop_word(lh5801_state *cpustate, PAIR *reg)
{
- reg->b.h=memory_read_byte(cpustate->program,++S);
- reg->b.l=memory_read_byte(cpustate->program,++S);
+ reg->b.h=cpustate->program->read_byte(++S);
+ reg->b.l=cpustate->program->read_byte(++S);
// z flag?
}
INLINE void lh5801_rtn(lh5801_state *cpustate)
{
- P=memory_read_byte(cpustate->program,++S)<<8;
- P|=memory_read_byte(cpustate->program,++S);
+ P=cpustate->program->read_byte(++S)<<8;
+ P|=cpustate->program->read_byte(++S);
}
INLINE void lh5801_rti(lh5801_state *cpustate)
{
- P=memory_read_byte(cpustate->program,++S)<<8;
- P|=memory_read_byte(cpustate->program,++S);
- cpustate->t=memory_read_byte(cpustate->program,++S);
+ P=cpustate->program->read_byte(++S)<<8;
+ P|=cpustate->program->read_byte(++S);
+ cpustate->t=cpustate->program->read_byte(++S);
}
INLINE void lh5801_push(lh5801_state *cpustate, UINT8 data)
{
- memory_write_byte(cpustate->program,S--, data);
+ cpustate->program->write_byte(S--, data);
}
INLINE void lh5801_push_word(lh5801_state *cpustate, UINT16 data)
{
- memory_write_byte(cpustate->program,S--, data&0xff);
- memory_write_byte(cpustate->program,S--, data>>8);
+ cpustate->program->write_byte(S--, data&0xff);
+ cpustate->program->write_byte(S--, data>>8);
}
INLINE void lh5801_jmp(lh5801_state *cpustate, UINT16 adr)
@@ -256,8 +256,8 @@ INLINE void lh5801_vector(lh5801_state *cpustate, int doit, int nr)
{
if (doit) {
lh5801_push_word(cpustate,P);
- P=memory_read_byte(cpustate->program,0xff00+nr)<<8;
- P|=memory_read_byte(cpustate->program,0xff00+nr+1);
+ P=cpustate->program->read_byte(0xff00+nr)<<8;
+ P|=cpustate->program->read_byte(0xff00+nr+1);
cpustate->icount-=21-8;
}
cpustate->t&=~Z; // after the jump!?
@@ -272,18 +272,18 @@ INLINE void lh5801_aex(lh5801_state *cpustate)
INLINE void lh5801_drl(lh5801_state *cpustate, int adr)
{
- UINT16 t=cpustate->a|(memory_read_byte(cpustate->program,adr)<<8);
+ UINT16 t=cpustate->a|(cpustate->program->read_byte(adr)<<8);
cpustate->a=t>>8;
- memory_write_byte(cpustate->program,adr,t>>4);
+ cpustate->program->write_byte(adr,t>>4);
}
INLINE void lh5801_drr(lh5801_state *cpustate, int adr)
{
- UINT16 t=memory_read_byte(cpustate->program,adr)|(cpustate->a<<8);
+ UINT16 t=cpustate->program->read_byte(adr)|(cpustate->a<<8);
cpustate->a=t;
- memory_write_byte(cpustate->program,adr,t>>4);
+ cpustate->program->write_byte(adr,t>>4);
}
INLINE void lh5801_rol(lh5801_state *cpustate)
@@ -351,42 +351,42 @@ static void lh5801_instruction_fd(lh5801_state *cpustate)
oper=memory_decrypted_read_byte(cpustate->program,P++);
switch (oper) {
- case 0x01: lh5801_sbc(cpustate,memory_read_byte(cpustate->program,0x10000|X)); cpustate->icount-=11;break;
- case 0x03: lh5801_adc(cpustate,memory_read_byte(cpustate->program,0x10000|X)); cpustate->icount-=11;break;
- case 0x05: lh5801_lda(cpustate,memory_read_byte(cpustate->program,0x10000|X)); cpustate->icount-=10;break;
- case 0x07: lh5801_cpa(cpustate,cpustate->a, memory_read_byte(cpustate->program,0x10000|X)); cpustate->icount-=11;break;
+ case 0x01: lh5801_sbc(cpustate,cpustate->program->read_byte(0x10000|X)); cpustate->icount-=11;break;
+ case 0x03: lh5801_adc(cpustate,cpustate->program->read_byte(0x10000|X)); cpustate->icount-=11;break;
+ case 0x05: lh5801_lda(cpustate,cpustate->program->read_byte(0x10000|X)); cpustate->icount-=10;break;
+ case 0x07: lh5801_cpa(cpustate,cpustate->a, cpustate->program->read_byte(0x10000|X)); cpustate->icount-=11;break;
case 0x08: X=X;cpustate->icount-=11;break; //!!!
- case 0x09: lh5801_and(cpustate,memory_read_byte(cpustate->program,0x10000|X)); cpustate->icount-=11;break;
+ case 0x09: lh5801_and(cpustate,cpustate->program->read_byte(0x10000|X)); cpustate->icount-=11;break;
case 0x0a: lh5801_pop_word(cpustate,&cpustate->x); cpustate->icount-=15;break;
- case 0x0b: lh5801_ora(cpustate,memory_read_byte(cpustate->program,0x10000|X)); cpustate->icount-=11;break;
- case 0x0c: lh5801_dcs(cpustate,memory_read_byte(cpustate->program,0x10000|X)); cpustate->icount-=17; break;
- case 0x0d: lh5801_eor(cpustate,memory_read_byte(cpustate->program,0x10000|X)); cpustate->icount-=11;break;
- case 0x0e: memory_write_byte(cpustate->program,0x10000|X,cpustate->a); cpustate->icount-=10;break;
- case 0x0f: lh5801_bit(cpustate,memory_read_byte(cpustate->program,0x10000|X),cpustate->a); cpustate->icount-=11;break;
- case 0x11: lh5801_sbc(cpustate,memory_read_byte(cpustate->program,0x10000|Y)); cpustate->icount-=11;break;
- case 0x13: lh5801_adc(cpustate,memory_read_byte(cpustate->program,0x10000|Y)); cpustate->icount-=11;break;
- case 0x15: lh5801_lda(cpustate,memory_read_byte(cpustate->program,0x10000|Y)); cpustate->icount-=10;break;
- case 0x17: lh5801_cpa(cpustate,cpustate->a, memory_read_byte(cpustate->program,0x10000|Y)); cpustate->icount-=11;break;
+ case 0x0b: lh5801_ora(cpustate,cpustate->program->read_byte(0x10000|X)); cpustate->icount-=11;break;
+ case 0x0c: lh5801_dcs(cpustate,cpustate->program->read_byte(0x10000|X)); cpustate->icount-=17; break;
+ case 0x0d: lh5801_eor(cpustate,cpustate->program->read_byte(0x10000|X)); cpustate->icount-=11;break;
+ case 0x0e: cpustate->program->write_byte(0x10000|X,cpustate->a); cpustate->icount-=10;break;
+ case 0x0f: lh5801_bit(cpustate,cpustate->program->read_byte(0x10000|X),cpustate->a); cpustate->icount-=11;break;
+ case 0x11: lh5801_sbc(cpustate,cpustate->program->read_byte(0x10000|Y)); cpustate->icount-=11;break;
+ case 0x13: lh5801_adc(cpustate,cpustate->program->read_byte(0x10000|Y)); cpustate->icount-=11;break;
+ case 0x15: lh5801_lda(cpustate,cpustate->program->read_byte(0x10000|Y)); cpustate->icount-=10;break;
+ case 0x17: lh5801_cpa(cpustate,cpustate->a, cpustate->program->read_byte(0x10000|Y)); cpustate->icount-=11;break;
case 0x18: X=Y;cpustate->icount-=11;break;
- case 0x19: lh5801_and(cpustate,memory_read_byte(cpustate->program,0x10000|Y)); cpustate->icount-=11;break;
+ case 0x19: lh5801_and(cpustate,cpustate->program->read_byte(0x10000|Y)); cpustate->icount-=11;break;
case 0x1a: lh5801_pop_word(cpustate,&cpustate->y); cpustate->icount-=15;break;
- case 0x1b: lh5801_ora(cpustate,memory_read_byte(cpustate->program,0x10000|Y)); cpustate->icount-=11;break;
- case 0x1c: lh5801_dcs(cpustate,memory_read_byte(cpustate->program,0x10000|Y)); cpustate->icount-=17; break;
- case 0x1d: lh5801_eor(cpustate,memory_read_byte(cpustate->program,0x10000|Y)); cpustate->icount-=11;break;
- case 0x1e: memory_write_byte(cpustate->program,0x10000|Y,cpustate->a); cpustate->icount-=10;break;
- case 0x1f: lh5801_bit(cpustate,memory_read_byte(cpustate->program,0x10000|Y),cpustate->a); cpustate->icount-=11;break;
- case 0x21: lh5801_sbc(cpustate,memory_read_byte(cpustate->program,0x10000|U)); cpustate->icount-=11;break;
- case 0x23: lh5801_adc(cpustate,memory_read_byte(cpustate->program,0x10000|U)); cpustate->icount-=11;break;
- case 0x25: lh5801_lda(cpustate,memory_read_byte(cpustate->program,0x10000|U)); cpustate->icount-=10;break;
- case 0x27: lh5801_cpa(cpustate,cpustate->a, memory_read_byte(cpustate->program,0x10000|U)); cpustate->icount-=11;break;
+ case 0x1b: lh5801_ora(cpustate,cpustate->program->read_byte(0x10000|Y)); cpustate->icount-=11;break;
+ case 0x1c: lh5801_dcs(cpustate,cpustate->program->read_byte(0x10000|Y)); cpustate->icount-=17; break;
+ case 0x1d: lh5801_eor(cpustate,cpustate->program->read_byte(0x10000|Y)); cpustate->icount-=11;break;
+ case 0x1e: cpustate->program->write_byte(0x10000|Y,cpustate->a); cpustate->icount-=10;break;
+ case 0x1f: lh5801_bit(cpustate,cpustate->program->read_byte(0x10000|Y),cpustate->a); cpustate->icount-=11;break;
+ case 0x21: lh5801_sbc(cpustate,cpustate->program->read_byte(0x10000|U)); cpustate->icount-=11;break;
+ case 0x23: lh5801_adc(cpustate,cpustate->program->read_byte(0x10000|U)); cpustate->icount-=11;break;
+ case 0x25: lh5801_lda(cpustate,cpustate->program->read_byte(0x10000|U)); cpustate->icount-=10;break;
+ case 0x27: lh5801_cpa(cpustate,cpustate->a, cpustate->program->read_byte(0x10000|U)); cpustate->icount-=11;break;
case 0x28: X=U;cpustate->icount-=11;break;
- case 0x29: lh5801_and(cpustate,memory_read_byte(cpustate->program,0x10000|U)); cpustate->icount-=11;break;
+ case 0x29: lh5801_and(cpustate,cpustate->program->read_byte(0x10000|U)); cpustate->icount-=11;break;
case 0x2a: lh5801_pop_word(cpustate,&cpustate->u); cpustate->icount-=15;break;
- case 0x2b: lh5801_ora(cpustate,memory_read_byte(cpustate->program,0x10000|U)); cpustate->icount-=11;break;
- case 0x2c: lh5801_dcs(cpustate,memory_read_byte(cpustate->program,0x10000|U)); cpustate->icount-=17; break;
- case 0x2d: lh5801_eor(cpustate,memory_read_byte(cpustate->program,0x10000|U)); cpustate->icount-=11;break;
- case 0x2e: memory_write_byte(cpustate->program,0x10000|U,cpustate->a); cpustate->icount-=10;break;
- case 0x2f: lh5801_bit(cpustate,memory_read_byte(cpustate->program,0x10000|U),cpustate->a); cpustate->icount-=11;break;
+ case 0x2b: lh5801_ora(cpustate,cpustate->program->read_byte(0x10000|U)); cpustate->icount-=11;break;
+ case 0x2c: lh5801_dcs(cpustate,cpustate->program->read_byte(0x10000|U)); cpustate->icount-=17; break;
+ case 0x2d: lh5801_eor(cpustate,cpustate->program->read_byte(0x10000|U)); cpustate->icount-=11;break;
+ case 0x2e: cpustate->program->write_byte(0x10000|U,cpustate->a); cpustate->icount-=10;break;
+ case 0x2f: lh5801_bit(cpustate,cpustate->program->read_byte(0x10000|U),cpustate->a); cpustate->icount-=11;break;
case 0x40: lh5801_inc(cpustate,&XH);cpustate->icount-=9;break;
case 0x42: lh5801_dec(cpustate,&XH);cpustate->icount-=9;break;
case 0x48: X=S;cpustate->icount-=11;break;
@@ -394,7 +394,7 @@ static void lh5801_instruction_fd(lh5801_state *cpustate)
case 0x4a: X=X;cpustate->icount-=11;break; //!!!
case 0x4b: lh5801_ora_mem(cpustate,0x10000|X, memory_decrypted_read_byte(cpustate->program,P++)); cpustate->icount-=17;break;
case 0x4c: cpustate->bf=0;/*off !*/ cpustate->icount-=8;break;
- case 0x4d: lh5801_bit(cpustate,memory_read_byte(cpustate->program,X|0x10000), memory_decrypted_read_byte(cpustate->program,P++));cpustate->icount-=14;break;
+ case 0x4d: lh5801_bit(cpustate,cpustate->program->read_byte(X|0x10000), memory_decrypted_read_byte(cpustate->program,P++));cpustate->icount-=14;break;
case 0x4e: S=X;cpustate->icount-=11;break;
case 0x4f: lh5801_add_mem(cpustate,0x10000|X, memory_decrypted_read_byte(cpustate->program,P++)); cpustate->icount-=17;break;
case 0x50: lh5801_inc(cpustate,&YH);cpustate->icount-=9;break;
@@ -403,7 +403,7 @@ static void lh5801_instruction_fd(lh5801_state *cpustate)
case 0x59: lh5801_and_mem(cpustate,0x10000|Y, memory_decrypted_read_byte(cpustate->program,P++)); cpustate->icount-=17;break;
case 0x5a: Y=X;cpustate->icount-=11;break;
case 0x5b: lh5801_ora_mem(cpustate,0x10000|Y, memory_decrypted_read_byte(cpustate->program,P++)); cpustate->icount-=17;break;
- case 0x5d: lh5801_bit(cpustate,memory_read_byte(cpustate->program,Y|0x10000), memory_decrypted_read_byte(cpustate->program,P++));cpustate->icount-=14;break;
+ case 0x5d: lh5801_bit(cpustate,cpustate->program->read_byte(Y|0x10000), memory_decrypted_read_byte(cpustate->program,P++));cpustate->icount-=14;break;
case 0x5e: lh5801_jmp(cpustate,X);cpustate->icount-=11;break; // P=X
case 0x5f: lh5801_add_mem(cpustate,0x10000|Y, memory_decrypted_read_byte(cpustate->program,P++)); cpustate->icount-=17;break;
case 0x60: lh5801_inc(cpustate,&UH);cpustate->icount-=9;break;
@@ -411,27 +411,27 @@ static void lh5801_instruction_fd(lh5801_state *cpustate)
case 0x69: lh5801_and_mem(cpustate,0x10000|U, memory_decrypted_read_byte(cpustate->program,P++)); cpustate->icount-=17;break;
case 0x6a: U=X;cpustate->icount-=11;break;
case 0x6b: lh5801_ora_mem(cpustate,0x10000|U, memory_decrypted_read_byte(cpustate->program,P++)); cpustate->icount-=17;break;
- case 0x6d: lh5801_bit(cpustate,memory_read_byte(cpustate->program,X|0x10000), memory_decrypted_read_byte(cpustate->program,P++));cpustate->icount-=14;break;
+ case 0x6d: lh5801_bit(cpustate,cpustate->program->read_byte(X|0x10000), memory_decrypted_read_byte(cpustate->program,P++));cpustate->icount-=14;break;
case 0x6f: lh5801_add_mem(cpustate,0x10000|U, memory_decrypted_read_byte(cpustate->program,P++)); cpustate->icount-=17;break;
case 0x81: cpustate->t|=IE; /*sie !*/cpustate->icount-=8;break;
case 0x88: lh5801_push_word(cpustate,X); cpustate->icount-=14;break;
case 0x8a: lh5801_pop(cpustate); cpustate->icount-=12; break;
- case 0x8c: lh5801_dca(cpustate,memory_read_byte(cpustate->program,0x10000|X)); cpustate->icount-=19; break;
+ case 0x8c: lh5801_dca(cpustate,cpustate->program->read_byte(0x10000|X)); cpustate->icount-=19; break;
case 0x8e: /*cdv clears internal devider*/cpustate->icount-=8;break;
case 0x98: lh5801_push_word(cpustate,Y); cpustate->icount-=14;break;
- case 0x9c: lh5801_dca(cpustate,memory_read_byte(cpustate->program,0x10000|Y)); cpustate->icount-=19; break;
- case 0xa1: lh5801_sbc(cpustate,memory_read_byte(cpustate->program,0x10000|lh5801_readop_word(cpustate))); cpustate->icount-=17;break;
- case 0xa3: lh5801_adc(cpustate,memory_read_byte(cpustate->program,0x10000|lh5801_readop_word(cpustate))); cpustate->icount-=17;break;
- case 0xa5: lh5801_lda(cpustate,memory_read_byte(cpustate->program,0x10000|lh5801_readop_word(cpustate))); cpustate->icount-=16;break;
- case 0xa7: lh5801_cpa(cpustate,cpustate->a, memory_read_byte(cpustate->program,0x10000|lh5801_readop_word(cpustate))); cpustate->icount-=17;break;
+ case 0x9c: lh5801_dca(cpustate,cpustate->program->read_byte(0x10000|Y)); cpustate->icount-=19; break;
+ case 0xa1: lh5801_sbc(cpustate,cpustate->program->read_byte(0x10000|lh5801_readop_word(cpustate))); cpustate->icount-=17;break;
+ case 0xa3: lh5801_adc(cpustate,cpustate->program->read_byte(0x10000|lh5801_readop_word(cpustate))); cpustate->icount-=17;break;
+ case 0xa5: lh5801_lda(cpustate,cpustate->program->read_byte(0x10000|lh5801_readop_word(cpustate))); cpustate->icount-=16;break;
+ case 0xa7: lh5801_cpa(cpustate,cpustate->a, cpustate->program->read_byte(0x10000|lh5801_readop_word(cpustate))); cpustate->icount-=17;break;
case 0xa8: lh5801_push_word(cpustate,U); cpustate->icount-=14;break;
- case 0xa9: lh5801_and(cpustate,memory_read_byte(cpustate->program,0x10000|lh5801_readop_word(cpustate))); cpustate->icount-=17;break;
+ case 0xa9: lh5801_and(cpustate,cpustate->program->read_byte(0x10000|lh5801_readop_word(cpustate))); cpustate->icount-=17;break;
case 0xaa: lh5801_lda(cpustate,cpustate->t); cpustate->icount-=9;break;
- case 0xab: lh5801_ora(cpustate,memory_read_byte(cpustate->program,0x10000|lh5801_readop_word(cpustate))); cpustate->icount-=17;break;
- case 0xac: lh5801_dca(cpustate,memory_read_byte(cpustate->program,0x10000|U)); cpustate->icount-=19; break;
- case 0xad: lh5801_eor(cpustate,memory_read_byte(cpustate->program,0x10000|lh5801_readop_word(cpustate))); cpustate->icount-=17;break;
- case 0xae: memory_write_byte(cpustate->program,0x10000|lh5801_readop_word(cpustate),cpustate->a); cpustate->icount-=16;break;
- case 0xaf: lh5801_bit(cpustate,memory_read_byte(cpustate->program,0x10000|lh5801_readop_word(cpustate)),cpustate->a); cpustate->icount-=17;break;
+ case 0xab: lh5801_ora(cpustate,cpustate->program->read_byte(0x10000|lh5801_readop_word(cpustate))); cpustate->icount-=17;break;
+ case 0xac: lh5801_dca(cpustate,cpustate->program->read_byte(0x10000|U)); cpustate->icount-=19; break;
+ case 0xad: lh5801_eor(cpustate,cpustate->program->read_byte(0x10000|lh5801_readop_word(cpustate))); cpustate->icount-=17;break;
+ case 0xae: cpustate->program->write_byte(0x10000|lh5801_readop_word(cpustate),cpustate->a); cpustate->icount-=16;break;
+ case 0xaf: lh5801_bit(cpustate,cpustate->program->read_byte(0x10000|lh5801_readop_word(cpustate)),cpustate->a); cpustate->icount-=17;break;
case 0xb1: /*hlt*/cpustate->icount-=8;break;
case 0xba: lh5801_ita(cpustate);cpustate->icount-=9;break;
case 0xbe: cpustate->t&=~IE; /*rie !*/cpustate->icount-=8;break;
@@ -456,7 +456,7 @@ static void lh5801_instruction_fd(lh5801_state *cpustate)
break;
case 0xec: cpustate->t=cpustate->a; cpustate->icount-=9;break;
case 0xed:
- adr=lh5801_readop_word(cpustate)|0x10000;lh5801_bit(cpustate,memory_read_byte(cpustate->program,adr), memory_decrypted_read_byte(cpustate->program,P++));
+ adr=lh5801_readop_word(cpustate)|0x10000;lh5801_bit(cpustate,cpustate->program->read_byte(adr), memory_decrypted_read_byte(cpustate->program,P++));
cpustate->icount-=20;break;
case 0xef:
adr=lh5801_readop_word(cpustate)|0x10000;
@@ -476,53 +476,53 @@ static void lh5801_instruction(lh5801_state *cpustate)
oper=memory_decrypted_read_byte(cpustate->program,P++);
switch (oper) {
case 0x00: lh5801_sbc(cpustate,XL); cpustate->icount-=6;break;
- case 0x01: lh5801_sbc(cpustate,memory_read_byte(cpustate->program,X)); cpustate->icount-=7;break;
+ case 0x01: lh5801_sbc(cpustate,cpustate->program->read_byte(X)); cpustate->icount-=7;break;
case 0x02: lh5801_adc(cpustate,XL); cpustate->icount-=6;break;
- case 0x03: lh5801_adc(cpustate,memory_read_byte(cpustate->program,X)); cpustate->icount-=7;break;
+ case 0x03: lh5801_adc(cpustate,cpustate->program->read_byte(X)); cpustate->icount-=7;break;
case 0x04: lh5801_lda(cpustate,XL); cpustate->icount-=5;break;
- case 0x05: lh5801_lda(cpustate,memory_read_byte(cpustate->program,X)); cpustate->icount-=6;break;
+ case 0x05: lh5801_lda(cpustate,cpustate->program->read_byte(X)); cpustate->icount-=6;break;
case 0x06: lh5801_cpa(cpustate,cpustate->a, XL); cpustate->icount-=6;break;
- case 0x07: lh5801_cpa(cpustate,cpustate->a, memory_read_byte(cpustate->program,X)); cpustate->icount-=7;break;
+ case 0x07: lh5801_cpa(cpustate,cpustate->a, cpustate->program->read_byte(X)); cpustate->icount-=7;break;
case 0x08: XH=cpustate->a; cpustate->icount-=5; break;
- case 0x09: lh5801_and(cpustate,memory_read_byte(cpustate->program,X)); cpustate->icount-=7;break;
+ case 0x09: lh5801_and(cpustate,cpustate->program->read_byte(X)); cpustate->icount-=7;break;
case 0x0a: XL=cpustate->a; cpustate->icount-=5; break;
- case 0x0b: lh5801_ora(cpustate,memory_read_byte(cpustate->program,X)); cpustate->icount-=7;break;
- case 0x0c: lh5801_dcs(cpustate,memory_read_byte(cpustate->program,X)); cpustate->icount-=13; break;
- case 0x0d: lh5801_eor(cpustate,memory_read_byte(cpustate->program,X)); cpustate->icount-=7;break;
- case 0x0e: memory_write_byte(cpustate->program,X,cpustate->a); cpustate->icount-=6;break;
- case 0x0f: lh5801_bit(cpustate,memory_read_byte(cpustate->program,X),cpustate->a); cpustate->icount-=7;break;
+ case 0x0b: lh5801_ora(cpustate,cpustate->program->read_byte(X)); cpustate->icount-=7;break;
+ case 0x0c: lh5801_dcs(cpustate,cpustate->program->read_byte(X)); cpustate->icount-=13; break;
+ case 0x0d: lh5801_eor(cpustate,cpustate->program->read_byte(X)); cpustate->icount-=7;break;
+ case 0x0e: cpustate->program->write_byte(X,cpustate->a); cpustate->icount-=6;break;
+ case 0x0f: lh5801_bit(cpustate,cpustate->program->read_byte(X),cpustate->a); cpustate->icount-=7;break;
case 0x10: lh5801_sbc(cpustate,YL); cpustate->icount-=6;break;
- case 0x11: lh5801_sbc(cpustate,memory_read_byte(cpustate->program,Y)); cpustate->icount-=7;break;
+ case 0x11: lh5801_sbc(cpustate,cpustate->program->read_byte(Y)); cpustate->icount-=7;break;
case 0x12: lh5801_adc(cpustate,YL); cpustate->icount-=6;break;
- case 0x13: lh5801_adc(cpustate,memory_read_byte(cpustate->program,Y)); cpustate->icount-=7;break;
+ case 0x13: lh5801_adc(cpustate,cpustate->program->read_byte(Y)); cpustate->icount-=7;break;
case 0x14: lh5801_lda(cpustate,YL); cpustate->icount-=5;break;
- case 0x15: lh5801_lda(cpustate,memory_read_byte(cpustate->program,Y)); cpustate->icount-=6;break;
+ case 0x15: lh5801_lda(cpustate,cpustate->program->read_byte(Y)); cpustate->icount-=6;break;
case 0x16: lh5801_cpa(cpustate,cpustate->a, YL); cpustate->icount-=6;break;
- case 0x17: lh5801_cpa(cpustate,cpustate->a, memory_read_byte(cpustate->program,Y)); cpustate->icount-=7;break;
+ case 0x17: lh5801_cpa(cpustate,cpustate->a, cpustate->program->read_byte(Y)); cpustate->icount-=7;break;
case 0x18: YH=cpustate->a; cpustate->icount-=5; break;
- case 0x19: lh5801_and(cpustate,memory_read_byte(cpustate->program,Y)); cpustate->icount-=7;break;
+ case 0x19: lh5801_and(cpustate,cpustate->program->read_byte(Y)); cpustate->icount-=7;break;
case 0x1a: YL=cpustate->a; cpustate->icount-=5; break;
- case 0x1b: lh5801_ora(cpustate,memory_read_byte(cpustate->program,Y)); cpustate->icount-=7;break;
- case 0x1c: lh5801_dcs(cpustate,memory_read_byte(cpustate->program,Y)); cpustate->icount-=13; break;
- case 0x1d: lh5801_eor(cpustate,memory_read_byte(cpustate->program,Y)); cpustate->icount-=7;break;
- case 0x1e: memory_write_byte(cpustate->program,Y,cpustate->a); cpustate->icount-=6;break;
- case 0x1f: lh5801_bit(cpustate,memory_read_byte(cpustate->program,Y),cpustate->a); cpustate->icount-=7;break;
+ case 0x1b: lh5801_ora(cpustate,cpustate->program->read_byte(Y)); cpustate->icount-=7;break;
+ case 0x1c: lh5801_dcs(cpustate,cpustate->program->read_byte(Y)); cpustate->icount-=13; break;
+ case 0x1d: lh5801_eor(cpustate,cpustate->program->read_byte(Y)); cpustate->icount-=7;break;
+ case 0x1e: cpustate->program->write_byte(Y,cpustate->a); cpustate->icount-=6;break;
+ case 0x1f: lh5801_bit(cpustate,cpustate->program->read_byte(Y),cpustate->a); cpustate->icount-=7;break;
case 0x20: lh5801_sbc(cpustate,UL); cpustate->icount-=6;break;
- case 0x21: lh5801_sbc(cpustate,memory_read_byte(cpustate->program,U)); cpustate->icount-=7;break;
+ case 0x21: lh5801_sbc(cpustate,cpustate->program->read_byte(U)); cpustate->icount-=7;break;
case 0x22: lh5801_adc(cpustate,UL); cpustate->icount-=6;break;
- case 0x23: lh5801_adc(cpustate,memory_read_byte(cpustate->program,U)); cpustate->icount-=7;break;
+ case 0x23: lh5801_adc(cpustate,cpustate->program->read_byte(U)); cpustate->icount-=7;break;
case 0x24: lh5801_lda(cpustate,UL); cpustate->icount-=5;break;
- case 0x25: lh5801_lda(cpustate,memory_read_byte(cpustate->program,U)); cpustate->icount-=6;break;
+ case 0x25: lh5801_lda(cpustate,cpustate->program->read_byte(U)); cpustate->icount-=6;break;
case 0x26: lh5801_cpa(cpustate,cpustate->a, UL); cpustate->icount-=6;break;
- case 0x27: lh5801_cpa(cpustate,cpustate->a, memory_read_byte(cpustate->program,U)); cpustate->icount-=7;break;
+ case 0x27: lh5801_cpa(cpustate,cpustate->a, cpustate->program->read_byte(U)); cpustate->icount-=7;break;
case 0x28: UH=cpustate->a; cpustate->icount-=5; break;
- case 0x29: lh5801_and(cpustate,memory_read_byte(cpustate->program,U)); cpustate->icount-=7;break;
+ case 0x29: lh5801_and(cpustate,cpustate->program->read_byte(U)); cpustate->icount-=7;break;
case 0x2a: UL=cpustate->a; cpustate->icount-=5; break;
- case 0x2b: lh5801_ora(cpustate,memory_read_byte(cpustate->program,U)); cpustate->icount-=7;break;
- case 0x2c: lh5801_dcs(cpustate,memory_read_byte(cpustate->program,U)); cpustate->icount-=13; break;
- case 0x2d: lh5801_eor(cpustate,memory_read_byte(cpustate->program,U)); cpustate->icount-=7;break;
- case 0x2e: memory_write_byte(cpustate->program,U,cpustate->a); cpustate->icount-=6;break;
- case 0x2f: lh5801_bit(cpustate,memory_read_byte(cpustate->program,U),cpustate->a); cpustate->icount-=7;break;
+ case 0x2b: lh5801_ora(cpustate,cpustate->program->read_byte(U)); cpustate->icount-=7;break;
+ case 0x2c: lh5801_dcs(cpustate,cpustate->program->read_byte(U)); cpustate->icount-=13; break;
+ case 0x2d: lh5801_eor(cpustate,cpustate->program->read_byte(U)); cpustate->icount-=7;break;
+ case 0x2e: cpustate->program->write_byte(U,cpustate->a); cpustate->icount-=6;break;
+ case 0x2f: lh5801_bit(cpustate,cpustate->program->read_byte(U),cpustate->a); cpustate->icount-=7;break;
case 0x38: /*nop*/cpustate->icount-=5;break;
case 0x40: lh5801_inc(cpustate,&XL);cpustate->icount-=5;break;
case 0x41: lh5801_sin(cpustate,&cpustate->x); cpustate->icount-=6;break;
@@ -537,7 +537,7 @@ static void lh5801_instruction(lh5801_state *cpustate)
case 0x4a: XL=memory_decrypted_read_byte(cpustate->program,P++);cpustate->icount-=6;break;
case 0x4b: lh5801_ora_mem(cpustate,X, memory_decrypted_read_byte(cpustate->program,P++)); cpustate->icount-=13;break;
case 0x4c: lh5801_cpa(cpustate,XH, memory_decrypted_read_byte(cpustate->program,P++)); cpustate->icount-=7;break;
- case 0x4d: lh5801_bit(cpustate,memory_read_byte(cpustate->program,X), memory_decrypted_read_byte(cpustate->program,P++));cpustate->icount-=10;break;
+ case 0x4d: lh5801_bit(cpustate,cpustate->program->read_byte(X), memory_decrypted_read_byte(cpustate->program,P++));cpustate->icount-=10;break;
case 0x4e: lh5801_cpa(cpustate,XL, memory_decrypted_read_byte(cpustate->program,P++)); cpustate->icount-=7;break;
case 0x4f: lh5801_add_mem(cpustate,X, memory_decrypted_read_byte(cpustate->program,P++)); cpustate->icount-=13;break;
case 0x50: lh5801_inc(cpustate,&YL);cpustate->icount-=5;break;
@@ -553,7 +553,7 @@ static void lh5801_instruction(lh5801_state *cpustate)
case 0x5a: YL=memory_decrypted_read_byte(cpustate->program,P++);cpustate->icount-=6;break;
case 0x5b: lh5801_ora_mem(cpustate,Y, memory_decrypted_read_byte(cpustate->program,P++)); cpustate->icount-=13;break;
case 0x5c: lh5801_cpa(cpustate,YH, memory_decrypted_read_byte(cpustate->program,P++)); cpustate->icount-=7;break;
- case 0x5d: lh5801_bit(cpustate,memory_read_byte(cpustate->program,Y), memory_decrypted_read_byte(cpustate->program,P++));cpustate->icount-=10;break;
+ case 0x5d: lh5801_bit(cpustate,cpustate->program->read_byte(Y), memory_decrypted_read_byte(cpustate->program,P++));cpustate->icount-=10;break;
case 0x5e: lh5801_cpa(cpustate,YL, memory_decrypted_read_byte(cpustate->program,P++)); cpustate->icount-=7;break;
case 0x5f: lh5801_add_mem(cpustate,Y, memory_decrypted_read_byte(cpustate->program,P++)); cpustate->icount-=13;break;
case 0x60: lh5801_inc(cpustate,&UL);cpustate->icount-=5;break;
@@ -569,7 +569,7 @@ static void lh5801_instruction(lh5801_state *cpustate)
case 0x6a: UL=memory_decrypted_read_byte(cpustate->program,P++);cpustate->icount-=6;break;
case 0x6b: lh5801_ora_mem(cpustate,U, memory_decrypted_read_byte(cpustate->program,P++)); cpustate->icount-=13;break;
case 0x6c: lh5801_cpa(cpustate,UH, memory_decrypted_read_byte(cpustate->program,P++)); cpustate->icount-=7;break;
- case 0x6d: lh5801_bit(cpustate,memory_read_byte(cpustate->program,U), memory_decrypted_read_byte(cpustate->program,P++));cpustate->icount-=10;break;
+ case 0x6d: lh5801_bit(cpustate,cpustate->program->read_byte(U), memory_decrypted_read_byte(cpustate->program,P++));cpustate->icount-=10;break;
case 0x6e: lh5801_cpa(cpustate,UL, memory_decrypted_read_byte(cpustate->program,P++)); cpustate->icount-=7;break;
case 0x6f: lh5801_add_mem(cpustate,U, memory_decrypted_read_byte(cpustate->program,P++)); cpustate->icount-=13;break;
case 0x80: lh5801_sbc(cpustate,XH); cpustate->icount-=6;break;
@@ -584,7 +584,7 @@ static void lh5801_instruction(lh5801_state *cpustate)
case 0x89: lh5801_branch_plus(cpustate,!(cpustate->t&Z)); cpustate->icount-=8; break;
case 0x8a: lh5801_rti(cpustate); cpustate->icount-=14; break;
case 0x8b: lh5801_branch_plus(cpustate,cpustate->t&Z); cpustate->icount-=8; break;
- case 0x8c: lh5801_dca(cpustate,memory_read_byte(cpustate->program,X)); cpustate->icount-=15; break;
+ case 0x8c: lh5801_dca(cpustate,cpustate->program->read_byte(X)); cpustate->icount-=15; break;
case 0x8d: lh5801_branch_plus(cpustate,!(cpustate->t&V)); cpustate->icount-=8; break;
case 0x8e: lh5801_branch_plus(cpustate,1); cpustate->icount-=5; break;
case 0x8f: lh5801_branch_plus(cpustate,cpustate->t&V); cpustate->icount-=8; break;
@@ -599,26 +599,26 @@ static void lh5801_instruction(lh5801_state *cpustate)
case 0x99: lh5801_branch_minus(cpustate,!(cpustate->t&Z)); cpustate->icount-=8; break;
case 0x9a: lh5801_rtn(cpustate); cpustate->icount-=11; break;
case 0x9b: lh5801_branch_minus(cpustate,cpustate->t&Z); cpustate->icount-=8; break;
- case 0x9c: lh5801_dca(cpustate,memory_read_byte(cpustate->program,Y)); cpustate->icount-=15; break;
+ case 0x9c: lh5801_dca(cpustate,cpustate->program->read_byte(Y)); cpustate->icount-=15; break;
case 0x9d: lh5801_branch_minus(cpustate,!(cpustate->t&V)); cpustate->icount-=8; break;
case 0x9e: lh5801_branch_minus(cpustate,1); cpustate->icount-=6; break;
case 0x9f: lh5801_branch_minus(cpustate,cpustate->t&V); cpustate->icount-=8; break;
case 0xa0: lh5801_sbc(cpustate,UH); cpustate->icount-=6;break;
case 0xa2: lh5801_adc(cpustate,UH); cpustate->icount-=6;break;
- case 0xa1: lh5801_sbc(cpustate,memory_read_byte(cpustate->program,lh5801_readop_word(cpustate))); cpustate->icount-=13;break;
- case 0xa3: lh5801_adc(cpustate,memory_read_byte(cpustate->program,lh5801_readop_word(cpustate))); cpustate->icount-=13;break;
+ case 0xa1: lh5801_sbc(cpustate,cpustate->program->read_byte(lh5801_readop_word(cpustate))); cpustate->icount-=13;break;
+ case 0xa3: lh5801_adc(cpustate,cpustate->program->read_byte(lh5801_readop_word(cpustate))); cpustate->icount-=13;break;
case 0xa4: lh5801_lda(cpustate,UH); cpustate->icount-=5;break;
- case 0xa5: lh5801_lda(cpustate,memory_read_byte(cpustate->program,lh5801_readop_word(cpustate))); cpustate->icount-=12;break;
+ case 0xa5: lh5801_lda(cpustate,cpustate->program->read_byte(lh5801_readop_word(cpustate))); cpustate->icount-=12;break;
case 0xa6: lh5801_cpa(cpustate,cpustate->a, UH); cpustate->icount-=6;break;
- case 0xa7: lh5801_cpa(cpustate,cpustate->a, memory_read_byte(cpustate->program,lh5801_readop_word(cpustate))); cpustate->icount-=13;break;
+ case 0xa7: lh5801_cpa(cpustate,cpustate->a, cpustate->program->read_byte(lh5801_readop_word(cpustate))); cpustate->icount-=13;break;
case 0xa8: cpustate->pv=1;/*spv!*/ cpustate->icount-=4; break;
- case 0xa9: lh5801_and(cpustate,memory_read_byte(cpustate->program,lh5801_readop_word(cpustate))); cpustate->icount-=13;break;
+ case 0xa9: lh5801_and(cpustate,cpustate->program->read_byte(lh5801_readop_word(cpustate))); cpustate->icount-=13;break;
case 0xaa: S=lh5801_readop_word(cpustate);cpustate->icount-=6;break;
- case 0xab: lh5801_ora(cpustate,memory_read_byte(cpustate->program,lh5801_readop_word(cpustate))); cpustate->icount-=13;break;
- case 0xac: lh5801_dca(cpustate,memory_read_byte(cpustate->program,U)); cpustate->icount-=15; break;
- case 0xad: lh5801_eor(cpustate,memory_read_byte(cpustate->program,lh5801_readop_word(cpustate))); cpustate->icount-=13;break;
- case 0xae: memory_write_byte(cpustate->program,lh5801_readop_word(cpustate),cpustate->a); cpustate->icount-=12;break;
- case 0xaf: lh5801_bit(cpustate,memory_read_byte(cpustate->program,lh5801_readop_word(cpustate)),cpustate->a); cpustate->icount-=13;break;
+ case 0xab: lh5801_ora(cpustate,cpustate->program->read_byte(lh5801_readop_word(cpustate))); cpustate->icount-=13;break;
+ case 0xac: lh5801_dca(cpustate,cpustate->program->read_byte(U)); cpustate->icount-=15; break;
+ case 0xad: lh5801_eor(cpustate,cpustate->program->read_byte(lh5801_readop_word(cpustate))); cpustate->icount-=13;break;
+ case 0xae: cpustate->program->write_byte(lh5801_readop_word(cpustate),cpustate->a); cpustate->icount-=12;break;
+ case 0xaf: lh5801_bit(cpustate,cpustate->program->read_byte(lh5801_readop_word(cpustate)),cpustate->a); cpustate->icount-=13;break;
case 0xb1: lh5801_sbc(cpustate,memory_decrypted_read_byte(cpustate->program,P++)); cpustate->icount-=7;break;
case 0xb3: lh5801_adc(cpustate,memory_decrypted_read_byte(cpustate->program,P++)); cpustate->icount-=7;break;
case 0xb5: lh5801_lda(cpustate,memory_decrypted_read_byte(cpustate->program,P++)); cpustate->icount-=6;break;
@@ -655,15 +655,15 @@ static void lh5801_instruction(lh5801_state *cpustate)
adr=lh5801_readop_word(cpustate);lh5801_ora_mem(cpustate,adr, memory_decrypted_read_byte(cpustate->program,P++));
cpustate->icount-=19;break;
case 0xed:
- adr=lh5801_readop_word(cpustate);lh5801_bit(cpustate,memory_read_byte(cpustate->program,adr), memory_decrypted_read_byte(cpustate->program,P++));
+ adr=lh5801_readop_word(cpustate);lh5801_bit(cpustate,cpustate->program->read_byte(adr), memory_decrypted_read_byte(cpustate->program,P++));
cpustate->icount-=16;break;
case 0xef:
adr=lh5801_readop_word(cpustate);
lh5801_add_mem(cpustate,adr, memory_decrypted_read_byte(cpustate->program,P++)); cpustate->icount-=19;
break;
case 0xf1: lh5801_aex(cpustate); cpustate->icount-=6; break;
- case 0xf5: memory_write_byte(cpustate->program,Y++, memory_read_byte(cpustate->program,X++)); cpustate->icount-=7; break; //tin
- case 0xf7: lh5801_cpa(cpustate,cpustate->a, memory_read_byte(cpustate->program,X++));cpustate->icount-=7; break; //cin
+ case 0xf5: cpustate->program->write_byte(Y++, cpustate->program->read_byte(X++)); cpustate->icount-=7; break; //tin
+ case 0xf7: lh5801_cpa(cpustate,cpustate->a, cpustate->program->read_byte(X++));cpustate->icount-=7; break; //cin
case 0xf9: cpustate->t&=~C;cpustate->icount-=4;break;
case 0xfb: cpustate->t|=C;cpustate->icount-=4;break;
case 0xfd: lh5801_instruction_fd(cpustate);break;
diff --git a/src/emu/cpu/lh5801/lh5801.c b/src/emu/cpu/lh5801/lh5801.c
index 3cd4cf4af8c..562b7dfee9e 100644
--- a/src/emu/cpu/lh5801/lh5801.c
+++ b/src/emu/cpu/lh5801/lh5801.c
@@ -112,7 +112,7 @@ static CPU_RESET( lh5801 )
{
lh5801_state *cpustate = get_safe_token(device);
- P = (memory_read_byte(cpustate->program, 0xfffe)<<8) | memory_read_byte(cpustate->program, 0xffff);
+ P = (cpustate->program->read_byte(0xfffe)<<8) | cpustate->program->read_byte(0xffff);
cpustate->idle=0;
}
diff --git a/src/emu/cpu/lr35902/lr35902.c b/src/emu/cpu/lr35902/lr35902.c
index 05958475063..fa5006eba31 100644
--- a/src/emu/cpu/lr35902/lr35902.c
+++ b/src/emu/cpu/lr35902/lr35902.c
@@ -129,8 +129,8 @@ typedef int (*OpcodeEmulator) (lr35902_state *cpustate);
/* Memory functions */
/****************************************************************************/
-#define mem_ReadByte(cs,A) ((UINT8)memory_read_byte_8le((cs)->w.program,A))
-#define mem_WriteByte(cs,A,V) (memory_write_byte_8le((cs)->w.program,A,V))
+#define mem_ReadByte(cs,A) ((UINT8)(cs)->w.program->read_byte(A))
+#define mem_WriteByte(cs,A,V) ((cs)->w.program->write_byte(A,V))
INLINE UINT16 mem_ReadWord (lr35902_state *cpustate, UINT32 address)
{
diff --git a/src/emu/cpu/m37710/m37710.c b/src/emu/cpu/m37710/m37710.c
index c2ddd370c12..b8a250b610d 100644
--- a/src/emu/cpu/m37710/m37710.c
+++ b/src/emu/cpu/m37710/m37710.c
@@ -405,56 +405,56 @@ static UINT8 m37710_internal_r(m37710i_cpu_struct *cpustate, int offset)
switch (offset)
{
case 2: // p0
- return memory_read_byte_8le(cpustate->io, M37710_PORT0);
+ return cpustate->io->read_byte(M37710_PORT0);
case 3: // p1
- return memory_read_byte_8le(cpustate->io, M37710_PORT1);
+ return cpustate->io->read_byte(M37710_PORT1);
case 6: // p2
- return memory_read_byte_8le(cpustate->io, M37710_PORT2);
+ return cpustate->io->read_byte(M37710_PORT2);
case 7: // p3
- return memory_read_byte_8le(cpustate->io, M37710_PORT3);
+ return cpustate->io->read_byte(M37710_PORT3);
case 0xa: // p4
- return memory_read_byte_8le(cpustate->io, M37710_PORT4);
+ return cpustate->io->read_byte(M37710_PORT4);
case 0xb: // p5
- return memory_read_byte_8le(cpustate->io, M37710_PORT5);
+ return cpustate->io->read_byte(M37710_PORT5);
case 0xe: // p6
- return memory_read_byte_8le(cpustate->io, M37710_PORT6);
+ return cpustate->io->read_byte(M37710_PORT6);
case 0xf: // p7
- return memory_read_byte_8le(cpustate->io, M37710_PORT7);
+ return cpustate->io->read_byte(M37710_PORT7);
case 0x12: // p8
- return memory_read_byte_8le(cpustate->io, M37710_PORT8);
+ return cpustate->io->read_byte(M37710_PORT8);
case 0x20:
- return memory_read_byte_8le(cpustate->io, M37710_ADC0_L);
+ return cpustate->io->read_byte(M37710_ADC0_L);
case 0x21:
- return memory_read_byte_8le(cpustate->io, M37710_ADC0_H);
+ return cpustate->io->read_byte(M37710_ADC0_H);
case 0x22:
- return memory_read_byte_8le(cpustate->io, M37710_ADC1_L);
+ return cpustate->io->read_byte(M37710_ADC1_L);
case 0x23:
- return memory_read_byte_8le(cpustate->io, M37710_ADC1_H);
+ return cpustate->io->read_byte(M37710_ADC1_H);
case 0x24:
- return memory_read_byte_8le(cpustate->io, M37710_ADC2_L);
+ return cpustate->io->read_byte(M37710_ADC2_L);
case 0x25:
- return memory_read_byte_8le(cpustate->io, M37710_ADC2_H);
+ return cpustate->io->read_byte(M37710_ADC2_H);
case 0x26:
- return memory_read_byte_8le(cpustate->io, M37710_ADC3_L);
+ return cpustate->io->read_byte(M37710_ADC3_L);
case 0x27:
- return memory_read_byte_8le(cpustate->io, M37710_ADC3_H);
+ return cpustate->io->read_byte(M37710_ADC3_H);
case 0x28:
- return memory_read_byte_8le(cpustate->io, M37710_ADC4_L);
+ return cpustate->io->read_byte(M37710_ADC4_L);
case 0x29:
- return memory_read_byte_8le(cpustate->io, M37710_ADC4_H);
+ return cpustate->io->read_byte(M37710_ADC4_H);
case 0x2a:
- return memory_read_byte_8le(cpustate->io, M37710_ADC5_L);
+ return cpustate->io->read_byte(M37710_ADC5_L);
case 0x2b:
- return memory_read_byte_8le(cpustate->io, M37710_ADC5_H);
+ return cpustate->io->read_byte(M37710_ADC5_H);
case 0x2c:
- return memory_read_byte_8le(cpustate->io, M37710_ADC6_L);
+ return cpustate->io->read_byte(M37710_ADC6_L);
case 0x2d:
- return memory_read_byte_8le(cpustate->io, M37710_ADC6_H);
+ return cpustate->io->read_byte(M37710_ADC6_H);
case 0x2e:
- return memory_read_byte_8le(cpustate->io, M37710_ADC7_L);
+ return cpustate->io->read_byte(M37710_ADC7_L);
case 0x2f:
- return memory_read_byte_8le(cpustate->io, M37710_ADC7_H);
+ return cpustate->io->read_byte(M37710_ADC7_H);
case 0x35:
return 0xff; // UART control
@@ -472,31 +472,31 @@ static void m37710_internal_w(m37710i_cpu_struct *cpustate, int offset, UINT8 da
switch(offset)
{
case 2: // p0
- memory_write_byte_8le(cpustate->io, M37710_PORT0, data);
+ cpustate->io->write_byte(M37710_PORT0, data);
return;
case 3: // p1
- memory_write_byte_8le(cpustate->io, M37710_PORT1, data);
+ cpustate->io->write_byte(M37710_PORT1, data);
return;
case 6: // p2
- memory_write_byte_8le(cpustate->io, M37710_PORT2, data);
+ cpustate->io->write_byte(M37710_PORT2, data);
return;
case 7: // p3
- memory_write_byte_8le(cpustate->io, M37710_PORT3, data);
+ cpustate->io->write_byte(M37710_PORT3, data);
return;
case 0xa: // p4
- memory_write_byte_8le(cpustate->io, M37710_PORT4, data);
+ cpustate->io->write_byte(M37710_PORT4, data);
return;
case 0xb: // p5
- memory_write_byte_8le(cpustate->io, M37710_PORT5, data);
+ cpustate->io->write_byte(M37710_PORT5, data);
return;
case 0xe: // p6
- memory_write_byte_8le(cpustate->io, M37710_PORT6, data);
+ cpustate->io->write_byte(M37710_PORT6, data);
return;
case 0xf: // p7
- memory_write_byte_8le(cpustate->io, M37710_PORT7, data);
+ cpustate->io->write_byte(M37710_PORT7, data);
return;
case 0x12: // p8
- memory_write_byte_8le(cpustate->io, M37710_PORT8, data);
+ cpustate->io->write_byte(M37710_PORT8, data);
return;
case 0x40: // count start
diff --git a/src/emu/cpu/m37710/m37710cm.h b/src/emu/cpu/m37710/m37710cm.h
index 0c10bffc795..f9bacccfa86 100644
--- a/src/emu/cpu/m37710/m37710cm.h
+++ b/src/emu/cpu/m37710/m37710cm.h
@@ -22,11 +22,11 @@
#undef M37710_CALL_DEBUGGER
#define M37710_CALL_DEBUGGER(x) debugger_instruction_hook(cpustate->device, x)
-#define m37710_read_8(addr) memory_read_byte_16le(cpustate->program, addr)
-#define m37710_write_8(addr,data) memory_write_byte_16le(cpustate->program, addr,data)
-#define m37710_read_8_immediate(A) memory_read_byte_16le(cpustate->program, A)
-#define m37710_read_16(addr) memory_read_word_16le(cpustate->program, addr)
-#define m37710_write_16(addr,data) memory_write_word_16le(cpustate->program, addr,data)
+#define m37710_read_8(addr) cpustate->program->read_byte(addr)
+#define m37710_write_8(addr,data) cpustate->program->write_byte(addr,data)
+#define m37710_read_8_immediate(A) cpustate->program->read_byte(A)
+#define m37710_read_16(addr) cpustate->program->read_word(addr)
+#define m37710_write_16(addr,data) cpustate->program->write_word(addr,data)
#define m37710_jumping(A)
#define m37710_branching(A)
diff --git a/src/emu/cpu/m6502/m4510.c b/src/emu/cpu/m6502/m4510.c
index 2a8503600a8..8560fb085cb 100644
--- a/src/emu/cpu/m6502/m4510.c
+++ b/src/emu/cpu/m6502/m4510.c
@@ -185,12 +185,12 @@ INLINE int m4510_cpu_readop_arg(m4510_Regs *cpustate)
static UINT8 default_rdmem_id(address_space *space, offs_t address)
{
m4510_Regs *cpustate = get_safe_token(space->cpu);
- return memory_read_byte_8le(space, M4510_MEM(address));
+ return space->read_byte(M4510_MEM(address));
}
static void default_wrmem_id(address_space *space, offs_t address, UINT8 data)
{
m4510_Regs *cpustate = get_safe_token(space->cpu);
- memory_write_byte_8le(space, M4510_MEM(address), data);
+ space->write_byte(M4510_MEM(address), data);
}
static CPU_INIT( m4510 )
diff --git a/src/emu/cpu/m6502/m6502.c b/src/emu/cpu/m6502/m6502.c
index 8ec0784915f..d4493988776 100644
--- a/src/emu/cpu/m6502/m6502.c
+++ b/src/emu/cpu/m6502/m6502.c
@@ -99,8 +99,8 @@ INLINE m6502_Regs *get_safe_token(running_device *device)
return (m6502_Regs *)downcast<legacy_cpu_device *>(device)->token();
}
-static UINT8 default_rdmem_id(address_space *space, offs_t offset) { return memory_read_byte_8le(space, offset); }
-static void default_wdmem_id(address_space *space, offs_t offset, UINT8 data) { memory_write_byte_8le(space, offset, data); }
+static UINT8 default_rdmem_id(address_space *space, offs_t offset) { return space->read_byte(offset); }
+static void default_wdmem_id(address_space *space, offs_t offset, UINT8 data) { space->write_byte(offset, data); }
/***************************************************************
* include the opcode macros, functions and tables
diff --git a/src/emu/cpu/m6502/m6509.c b/src/emu/cpu/m6502/m6509.c
index 9d989465e45..f59da80342f 100644
--- a/src/emu/cpu/m6502/m6509.c
+++ b/src/emu/cpu/m6502/m6509.c
@@ -134,8 +134,8 @@ static ADDRESS_MAP_START(m6509_mem, ADDRESS_SPACE_PROGRAM, 8)
AM_RANGE(0x00001, 0x00001) AM_MIRROR(0xF0000) AM_READWRITE(m6509_read_00001, m6509_write_00001)
ADDRESS_MAP_END
-static UINT8 default_rdmem_id(address_space *space, offs_t address) { return memory_read_byte_8le(space, address); }
-static void default_wdmem_id(address_space *space, offs_t address, UINT8 data) { memory_write_byte_8le(space, address, data); }
+static UINT8 default_rdmem_id(address_space *space, offs_t address) { return space->read_byte(address); }
+static void default_wdmem_id(address_space *space, offs_t address, UINT8 data) { space->write_byte(address, data); }
static CPU_INIT( m6509 )
{
diff --git a/src/emu/cpu/m6502/m65ce02.c b/src/emu/cpu/m6502/m65ce02.c
index 6f5bfd352fb..a81056b7fb2 100644
--- a/src/emu/cpu/m6502/m65ce02.c
+++ b/src/emu/cpu/m6502/m65ce02.c
@@ -94,8 +94,8 @@ INLINE m65ce02_Regs *get_safe_token(running_device *device)
#include "t65ce02.c"
-static UINT8 default_rdmem_id(address_space *space, offs_t address) { return memory_read_byte_8le(space, address); }
-static void default_wdmem_id(address_space *space, offs_t address, UINT8 data) { memory_write_byte_8le(space, address, data); }
+static UINT8 default_rdmem_id(address_space *space, offs_t address) { return space->read_byte(address); }
+static void default_wdmem_id(address_space *space, offs_t address, UINT8 data) { space->write_byte(address, data); }
static CPU_INIT( m65ce02 )
{
diff --git a/src/emu/cpu/m6502/minc4510.h b/src/emu/cpu/m6502/minc4510.h
index 88018f8ef62..1998780c75b 100644
--- a/src/emu/cpu/m6502/minc4510.h
+++ b/src/emu/cpu/m6502/minc4510.h
@@ -54,8 +54,8 @@
#define PEEK_OP() memory_decrypted_read_byte(cpustate->space, M4510_MEM(PCW))
-#define RDMEM(addr) memory_read_byte_8le(cpustate->space, M4510_MEM(addr)); cpustate->icount -= 1
-#define WRMEM(addr,data) memory_write_byte_8le(cpustate->space, M4510_MEM(addr),data); cpustate->icount -= 1
+#define RDMEM(addr) cpustate->space->read_byte(M4510_MEM(addr)); cpustate->icount -= 1
+#define WRMEM(addr,data) cpustate->space->write_byte(M4510_MEM(addr),data); cpustate->icount -= 1
/***************************************************************
* RDOP read an opcode
diff --git a/src/emu/cpu/m6502/mincce02.h b/src/emu/cpu/m6502/mincce02.h
index 3888f9af412..769f6ac477f 100644
--- a/src/emu/cpu/m6502/mincce02.h
+++ b/src/emu/cpu/m6502/mincce02.h
@@ -65,5 +65,5 @@
#define PEEK_OP() memory_decrypted_read_byte(cpustate->space, PCW)
-#define RDMEM(addr) memory_read_byte_8le(cpustate->space, addr); cpustate->icount -= 1
-#define WRMEM(addr,data) memory_write_byte_8le(cpustate->space, addr,data); cpustate->icount -= 1
+#define RDMEM(addr) cpustate->space->read_byte(addr); cpustate->icount -= 1
+#define WRMEM(addr,data) cpustate->space->write_byte(addr,data); cpustate->icount -= 1
diff --git a/src/emu/cpu/m6502/ops02.h b/src/emu/cpu/m6502/ops02.h
index 98278f55f3c..9e17527a15c 100644
--- a/src/emu/cpu/m6502/ops02.h
+++ b/src/emu/cpu/m6502/ops02.h
@@ -81,12 +81,12 @@
/***************************************************************
* RDMEM read memory
***************************************************************/
-#define RDMEM(addr) memory_read_byte_8le(cpustate->space, addr); cpustate->icount -= 1
+#define RDMEM(addr) cpustate->space->read_byte(addr); cpustate->icount -= 1
/***************************************************************
* WRMEM write memory
***************************************************************/
-#define WRMEM(addr,data) memory_write_byte_8le(cpustate->space, addr,data); cpustate->icount -= 1
+#define WRMEM(addr,data) cpustate->space->write_byte(addr,data); cpustate->icount -= 1
/***************************************************************
* BRA branch relative
diff --git a/src/emu/cpu/m6502/ops09.h b/src/emu/cpu/m6502/ops09.h
index 29f9c3bda3a..eb76f53daa0 100644
--- a/src/emu/cpu/m6502/ops09.h
+++ b/src/emu/cpu/m6502/ops09.h
@@ -46,13 +46,13 @@
* RDMEM read memory
***************************************************************/
#undef RDMEM
-#define RDMEM(addr) memory_read_byte_8le(cpustate->space, addr); cpustate->icount -= 1
+#define RDMEM(addr) cpustate->space->read_byte(addr); cpustate->icount -= 1
/***************************************************************
* WRMEM write memory
***************************************************************/
#undef WRMEM
-#define WRMEM(addr,data) memory_write_byte_8le(cpustate->space, addr,data); cpustate->icount -= 1
+#define WRMEM(addr,data) cpustate->space->write_byte(addr,data); cpustate->icount -= 1
/***************************************************************
* push a register onto the stack
diff --git a/src/emu/cpu/m6502/tdeco16.c b/src/emu/cpu/m6502/tdeco16.c
index 24060f90643..9dcc5be88f7 100644
--- a/src/emu/cpu/m6502/tdeco16.c
+++ b/src/emu/cpu/m6502/tdeco16.c
@@ -188,7 +188,7 @@ OP(27) { RD_DUM; ILL; } /* 2 ILL / 5 RMB2 ZPG ?? */
OP(47) { RD_DUM; ILL; } /* 2 ILL / 5 RMB4 ZPG ?? */
OP(67) {
int tmp; RD_IMM;
- cpustate->a=memory_read_byte_8le(cpustate->io,0);
+ cpustate->a=cpustate->io->read_byte(0);
// logerror("%04x: VBL (0x67)\n",PCW);
@@ -274,7 +274,7 @@ OP(2b) { RD_DUM; ILL; } /* 2 ILL */
OP(4b) { int tmp; cpustate->icount -= 1; RD_IMM;
//logerror("%04x: OP4B %02x\n",PCW,tmp);
/* TODO: Maybe it's just read I/O 0 and do a logic AND with bit 1? */
- cpustate->a=memory_read_byte_8le(cpustate->io,1);
+ cpustate->a=cpustate->io->read_byte(1);
//tilt??
@@ -367,7 +367,7 @@ OP(8f) { int tmp; cpustate->icount -= 1; RD_IMM;
if (DECO16_VERBOSE)
logerror("%04x: BANK (8F) %02x\n",PCW,tmp);
- memory_write_byte_8le(cpustate->io,0,tmp);
+ cpustate->io->write_byte(0,tmp);
//swap bank in/out
} /* */
diff --git a/src/emu/cpu/m6800/m6800.c b/src/emu/cpu/m6800/m6800.c
index 1ab28fd172f..9e79c37bcf1 100644
--- a/src/emu/cpu/m6800/m6800.c
+++ b/src/emu/cpu/m6800/m6800.c
@@ -206,12 +206,12 @@ static UINT32 timer_next;
/****************************************************************************/
/* Read a byte from given memory location */
/****************************************************************************/
-#define RM(Addr) ((unsigned)memory_read_byte_8be(cpustate->program, Addr))
+#define RM(Addr) ((unsigned)cpustate->program->read_byte(Addr))
/****************************************************************************/
/* Write a byte to given memory location */
/****************************************************************************/
-#define WM(Addr,Value) (memory_write_byte_8be(cpustate->program, Addr,Value))
+#define WM(Addr,Value) (cpustate->program->write_byte(Addr,Value))
/****************************************************************************/
/* M6800_RDOP() is identical to M6800_RDMEM() except it is used for reading */
@@ -675,15 +675,15 @@ static void m6800_tx(m6800_state *cpustate, int value)
cpustate->port2_data = (cpustate->port2_data & 0xef) | (value << 4);
if(cpustate->port2_ddr == 0xff)
- memory_write_byte_8be(cpustate->io, M6803_PORT2,cpustate->port2_data);
+ cpustate->io->write_byte(M6803_PORT2,cpustate->port2_data);
else
- memory_write_byte_8be(cpustate->io, M6803_PORT2,(cpustate->port2_data & cpustate->port2_ddr)
- | (memory_read_byte_8be(cpustate->io, M6803_PORT2) & (cpustate->port2_ddr ^ 0xff)));
+ cpustate->io->write_byte(M6803_PORT2,(cpustate->port2_data & cpustate->port2_ddr)
+ | (cpustate->io->read_byte(M6803_PORT2) & (cpustate->port2_ddr ^ 0xff)));
}
static int m6800_rx(m6800_state *cpustate)
{
- return (memory_read_byte_8be(cpustate->io, M6803_PORT2) & M6800_PORT2_IO3) >> 3;
+ return (cpustate->io->read_byte(M6803_PORT2) & M6800_PORT2_IO3) >> 3;
}
static TIMER_CALLBACK(m6800_tx_tick)
@@ -2360,20 +2360,20 @@ static READ8_HANDLER( m6803_internal_registers_r )
case 0x01:
return cpustate->port2_ddr;
case 0x02:
- return (memory_read_byte_8be(cpustate->io, M6803_PORT1) & (cpustate->port1_ddr ^ 0xff))
+ return (cpustate->io->read_byte(M6803_PORT1) & (cpustate->port1_ddr ^ 0xff))
| (cpustate->port1_data & cpustate->port1_ddr);
case 0x03:
- return (memory_read_byte_8be(cpustate->io, M6803_PORT2) & (cpustate->port2_ddr ^ 0xff))
+ return (cpustate->io->read_byte(M6803_PORT2) & (cpustate->port2_ddr ^ 0xff))
| (cpustate->port2_data & cpustate->port2_ddr);
case 0x04:
return cpustate->port3_ddr;
case 0x05:
return cpustate->port4_ddr;
case 0x06:
- return (memory_read_byte_8be(cpustate->io, M6803_PORT3) & (cpustate->port3_ddr ^ 0xff))
+ return (cpustate->io->read_byte(M6803_PORT3) & (cpustate->port3_ddr ^ 0xff))
| (cpustate->port3_data & cpustate->port3_ddr);
case 0x07:
- return (memory_read_byte_8be(cpustate->io, M6803_PORT4) & (cpustate->port4_ddr ^ 0xff))
+ return (cpustate->io->read_byte(M6803_PORT4) & (cpustate->port4_ddr ^ 0xff))
| (cpustate->port4_data & cpustate->port4_ddr);
case 0x08:
cpustate->pending_tcsr = 0;
@@ -2458,10 +2458,10 @@ static WRITE8_HANDLER( m6803_internal_registers_w )
{
cpustate->port1_ddr = data;
if(cpustate->port1_ddr == 0xff)
- memory_write_byte_8be(cpustate->io, M6803_PORT1,cpustate->port1_data);
+ cpustate->io->write_byte(M6803_PORT1,cpustate->port1_data);
else
- memory_write_byte_8be(cpustate->io, M6803_PORT1,(cpustate->port1_data & cpustate->port1_ddr)
- | (memory_read_byte_8be(cpustate->io, M6803_PORT1) & (cpustate->port1_ddr ^ 0xff)));
+ cpustate->io->write_byte(M6803_PORT1,(cpustate->port1_data & cpustate->port1_ddr)
+ | (cpustate->io->read_byte(M6803_PORT1) & (cpustate->port1_ddr ^ 0xff)));
}
break;
case 0x01:
@@ -2469,10 +2469,10 @@ static WRITE8_HANDLER( m6803_internal_registers_w )
{
cpustate->port2_ddr = data;
if(cpustate->port2_ddr == 0xff)
- memory_write_byte_8be(cpustate->io, M6803_PORT2,cpustate->port2_data);
+ cpustate->io->write_byte(M6803_PORT2,cpustate->port2_data);
else
- memory_write_byte_8be(cpustate->io, M6803_PORT2,(cpustate->port2_data & cpustate->port2_ddr)
- | (memory_read_byte_8be(cpustate->io, M6803_PORT2) & (cpustate->port2_ddr ^ 0xff)));
+ cpustate->io->write_byte(M6803_PORT2,(cpustate->port2_data & cpustate->port2_ddr)
+ | (cpustate->io->read_byte(M6803_PORT2) & (cpustate->port2_ddr ^ 0xff)));
if (cpustate->port2_ddr & 2)
logerror("CPU '%s' PC %04x: warning - port 2 bit 1 set as output (OLVL) - not supported\n",space->cpu->tag(),cpu_get_pc(space->cpu));
@@ -2481,10 +2481,10 @@ static WRITE8_HANDLER( m6803_internal_registers_w )
case 0x02:
cpustate->port1_data = data;
if(cpustate->port1_ddr == 0xff)
- memory_write_byte_8be(cpustate->io, M6803_PORT1,cpustate->port1_data);
+ cpustate->io->write_byte(M6803_PORT1,cpustate->port1_data);
else
- memory_write_byte_8be(cpustate->io, M6803_PORT1,(cpustate->port1_data & cpustate->port1_ddr)
- | (memory_read_byte_8be(cpustate->io, M6803_PORT1) & (cpustate->port1_ddr ^ 0xff)));
+ cpustate->io->write_byte(M6803_PORT1,(cpustate->port1_data & cpustate->port1_ddr)
+ | (cpustate->io->read_byte(M6803_PORT1) & (cpustate->port1_ddr ^ 0xff)));
break;
case 0x03:
if (cpustate->trcsr & M6800_TRCSR_TE)
@@ -2496,20 +2496,20 @@ static WRITE8_HANDLER( m6803_internal_registers_w )
cpustate->port2_data = data;
}
if(cpustate->port2_ddr == 0xff)
- memory_write_byte_8be(cpustate->io, M6803_PORT2,cpustate->port2_data);
+ cpustate->io->write_byte(M6803_PORT2,cpustate->port2_data);
else
- memory_write_byte_8be(cpustate->io, M6803_PORT2,(cpustate->port2_data & cpustate->port2_ddr)
- | (memory_read_byte_8be(cpustate->io, M6803_PORT2) & (cpustate->port2_ddr ^ 0xff)));
+ cpustate->io->write_byte(M6803_PORT2,(cpustate->port2_data & cpustate->port2_ddr)
+ | (cpustate->io->read_byte(M6803_PORT2) & (cpustate->port2_ddr ^ 0xff)));
break;
case 0x04:
if (cpustate->port3_ddr != data)
{
cpustate->port3_ddr = data;
if(cpustate->port3_ddr == 0xff)
- memory_write_byte_8be(cpustate->io, M6803_PORT3,cpustate->port3_data);
+ cpustate->io->write_byte(M6803_PORT3,cpustate->port3_data);
else
- memory_write_byte_8be(cpustate->io, M6803_PORT3,(cpustate->port3_data & cpustate->port3_ddr)
- | (memory_read_byte_8be(cpustate->io, M6803_PORT3) & (cpustate->port3_ddr ^ 0xff)));
+ cpustate->io->write_byte(M6803_PORT3,(cpustate->port3_data & cpustate->port3_ddr)
+ | (cpustate->io->read_byte(M6803_PORT3) & (cpustate->port3_ddr ^ 0xff)));
}
break;
case 0x05:
@@ -2517,27 +2517,27 @@ static WRITE8_HANDLER( m6803_internal_registers_w )
{
cpustate->port4_ddr = data;
if(cpustate->port4_ddr == 0xff)
- memory_write_byte_8be(cpustate->io, M6803_PORT4,cpustate->port4_data);
+ cpustate->io->write_byte(M6803_PORT4,cpustate->port4_data);
else
- memory_write_byte_8be(cpustate->io, M6803_PORT4,(cpustate->port4_data & cpustate->port4_ddr)
- | (memory_read_byte_8be(cpustate->io, M6803_PORT4) & (cpustate->port4_ddr ^ 0xff)));
+ cpustate->io->write_byte(M6803_PORT4,(cpustate->port4_data & cpustate->port4_ddr)
+ | (cpustate->io->read_byte(M6803_PORT4) & (cpustate->port4_ddr ^ 0xff)));
}
break;
case 0x06:
cpustate->port3_data = data;
if(cpustate->port3_ddr == 0xff)
- memory_write_byte_8be(cpustate->io, M6803_PORT3,cpustate->port3_data);
+ cpustate->io->write_byte(M6803_PORT3,cpustate->port3_data);
else
- memory_write_byte_8be(cpustate->io, M6803_PORT3,(cpustate->port3_data & cpustate->port3_ddr)
- | (memory_read_byte_8be(cpustate->io, M6803_PORT3) & (cpustate->port3_ddr ^ 0xff)));
+ cpustate->io->write_byte(M6803_PORT3,(cpustate->port3_data & cpustate->port3_ddr)
+ | (cpustate->io->read_byte(M6803_PORT3) & (cpustate->port3_ddr ^ 0xff)));
break;
case 0x07:
cpustate->port4_data = data;
if(cpustate->port4_ddr == 0xff)
- memory_write_byte_8be(cpustate->io, M6803_PORT4,cpustate->port4_data);
+ cpustate->io->write_byte(M6803_PORT4,cpustate->port4_data);
else
- memory_write_byte_8be(cpustate->io, M6803_PORT4,(cpustate->port4_data & cpustate->port4_ddr)
- | (memory_read_byte_8be(cpustate->io, M6803_PORT4) & (cpustate->port4_ddr ^ 0xff)));
+ cpustate->io->write_byte(M6803_PORT4,(cpustate->port4_data & cpustate->port4_ddr)
+ | (cpustate->io->read_byte(M6803_PORT4) & (cpustate->port4_ddr ^ 0xff)));
break;
case 0x08:
cpustate->tcsr = data;
diff --git a/src/emu/cpu/m68000/m68kcpu.c b/src/emu/cpu/m68000/m68kcpu.c
index 1489a6105be..1ece0325223 100644
--- a/src/emu/cpu/m68000/m68kcpu.c
+++ b/src/emu/cpu/m68000/m68kcpu.c
@@ -940,6 +940,13 @@ void m68k_set_encrypted_opcode_range(running_device *device, offs_t start, offs_
m68k->encrypted_end = end;
}
+static UINT8 memory_read_byte(address_space *space, offs_t address) { return space->read_byte(address); }
+static void memory_write_byte(address_space *space, offs_t address, UINT8 data) { space->write_byte(address, data); }
+static UINT16 memory_read_word(address_space *space, offs_t address) { return space->read_word(address); }
+static void memory_write_word(address_space *space, offs_t address, UINT16 data) { space->write_word(address, data); }
+static UINT32 memory_read_dword(address_space *space, offs_t address) { return space->read_dword(address); }
+static void memory_write_dword(address_space *space, offs_t address, UINT32 data) { space->write_dword(address, data); }
+
/****************************************************************************
* 8-bit data memory interface
****************************************************************************/
@@ -955,12 +962,12 @@ static const m68k_memory_interface interface_d8 =
{
0,
m68008_read_immediate_16,
- memory_read_byte_8be,
- memory_read_word_8be,
- memory_read_dword_8be,
- memory_write_byte_8be,
- memory_write_word_8be,
- memory_write_dword_8be
+ memory_read_byte,
+ memory_read_word,
+ memory_read_dword,
+ memory_write_byte,
+ memory_write_word,
+ memory_write_dword
};
/****************************************************************************
@@ -983,12 +990,12 @@ static const m68k_memory_interface interface_d16 =
{
0,
simple_read_immediate_16,
- memory_read_byte_16be,
- memory_read_word_16be,
- memory_read_dword_16be,
- memory_write_byte_16be,
- memory_write_word_16be,
- memory_write_dword_16be
+ memory_read_byte,
+ memory_read_word,
+ memory_read_dword,
+ memory_write_byte,
+ memory_write_word,
+ memory_write_dword
};
/****************************************************************************
@@ -1001,9 +1008,9 @@ static UINT16 readword_d32(address_space *space, offs_t address)
UINT16 result;
if (!(address & 1))
- return memory_read_word_32be(space, address);
- result = memory_read_byte_32be(space, address) << 8;
- return result | memory_read_byte_32be(space, address + 1);
+ return space->read_word(address);
+ result = space->read_byte(address) << 8;
+ return result | space->read_byte(address + 1);
}
/* potentially misaligned 16-bit writes with a 32-bit data bus (and 24-bit address bus) */
@@ -1011,11 +1018,11 @@ static void writeword_d32(address_space *space, offs_t address, UINT16 data)
{
if (!(address & 1))
{
- memory_write_word_32be(space, address, data);
+ space->write_word(address, data);
return;
}
- memory_write_byte_32be(space, address, data >> 8);
- memory_write_byte_32be(space, address + 1, data);
+ space->write_byte(address, data >> 8);
+ space->write_byte(address + 1, data);
}
/* potentially misaligned 32-bit reads with a 32-bit data bus (and 24-bit address bus) */
@@ -1024,15 +1031,15 @@ static UINT32 readlong_d32(address_space *space, offs_t address)
UINT32 result;
if (!(address & 3))
- return memory_read_dword_32be(space, address);
+ return space->read_dword(address);
else if (!(address & 1))
{
- result = memory_read_word_32be(space, address) << 16;
- return result | memory_read_word_32be(space, address + 2);
+ result = space->read_word(address) << 16;
+ return result | space->read_word(address + 2);
}
- result = memory_read_byte_32be(space, address) << 24;
- result |= memory_read_word_32be(space, address + 1) << 8;
- return result | memory_read_byte_32be(space, address + 3);
+ result = space->read_byte(address) << 24;
+ result |= space->read_word(address + 1) << 8;
+ return result | space->read_byte(address + 3);
}
/* potentially misaligned 32-bit writes with a 32-bit data bus (and 24-bit address bus) */
@@ -1040,18 +1047,18 @@ static void writelong_d32(address_space *space, offs_t address, UINT32 data)
{
if (!(address & 3))
{
- memory_write_dword_32be(space, address, data);
+ space->write_dword(address, data);
return;
}
else if (!(address & 1))
{
- memory_write_word_32be(space, address, data >> 16);
- memory_write_word_32be(space, address + 2, data);
+ space->write_word(address, data >> 16);
+ space->write_word(address + 2, data);
return;
}
- memory_write_byte_32be(space, address, data >> 24);
- memory_write_word_32be(space, address + 1, data >> 8);
- memory_write_byte_32be(space, address + 3, data);
+ space->write_byte(address, data >> 24);
+ space->write_word(address + 1, data >> 8);
+ space->write_byte(address + 3, data);
}
/* interface for 32-bit data bus (68EC020, 68020) */
@@ -1059,10 +1066,10 @@ static const m68k_memory_interface interface_d32 =
{
WORD_XOR_BE(0),
read_immediate_16,
- memory_read_byte_32be,
+ memory_read_byte,
readword_d32,
readlong_d32,
- memory_write_byte_32be,
+ memory_write_byte,
writeword_d32,
writelong_d32
};
@@ -1077,7 +1084,7 @@ static UINT8 read_byte_32_mmu(address_space *space, offs_t address)
address = pmmu_translate_addr(m68k, address);
}
- return memory_read_byte_32be(space, address);
+ return space->read_byte(address);
}
static void write_byte_32_mmu(address_space *space, offs_t address, UINT8 data)
@@ -1089,7 +1096,7 @@ static void write_byte_32_mmu(address_space *space, offs_t address, UINT8 data)
address = pmmu_translate_addr(m68k, address);
}
- memory_write_byte_32be(space, address, data);
+ space->write_byte(address, data);
}
static UINT16 read_immediate_16_mmu(address_space *space, offs_t address)
@@ -1116,9 +1123,9 @@ static UINT16 readword_d32_mmu(address_space *space, offs_t address)
}
if (!(address & 1))
- return memory_read_word_32be(space, address);
- result = memory_read_byte_32be(space, address) << 8;
- return result | memory_read_byte_32be(space, address + 1);
+ return space->read_word(address);
+ result = space->read_byte(address) << 8;
+ return result | space->read_byte(address + 1);
}
/* potentially misaligned 16-bit writes with a 32-bit data bus (and 24-bit address bus) */
@@ -1133,11 +1140,11 @@ static void writeword_d32_mmu(address_space *space, offs_t address, UINT16 data)
if (!(address & 1))
{
- memory_write_word_32be(space, address, data);
+ space->write_word(address, data);
return;
}
- memory_write_byte_32be(space, address, data >> 8);
- memory_write_byte_32be(space, address + 1, data);
+ space->write_byte(address, data >> 8);
+ space->write_byte(address + 1, data);
}
/* potentially misaligned 32-bit reads with a 32-bit data bus (and 24-bit address bus) */
@@ -1152,15 +1159,15 @@ static UINT32 readlong_d32_mmu(address_space *space, offs_t address)
}
if (!(address & 3))
- return memory_read_dword_32be(space, address);
+ return space->read_dword(address);
else if (!(address & 1))
{
- result = memory_read_word_32be(space, address) << 16;
- return result | memory_read_word_32be(space, address + 2);
+ result = space->read_word(address) << 16;
+ return result | space->read_word(address + 2);
}
- result = memory_read_byte_32be(space, address) << 24;
- result |= memory_read_word_32be(space, address + 1) << 8;
- return result | memory_read_byte_32be(space, address + 3);
+ result = space->read_byte(address) << 24;
+ result |= space->read_word(address + 1) << 8;
+ return result | space->read_byte(address + 3);
}
/* potentially misaligned 32-bit writes with a 32-bit data bus (and 24-bit address bus) */
@@ -1175,18 +1182,18 @@ static void writelong_d32_mmu(address_space *space, offs_t address, UINT32 data)
if (!(address & 3))
{
- memory_write_dword_32be(space, address, data);
+ space->write_dword(address, data);
return;
}
else if (!(address & 1))
{
- memory_write_word_32be(space, address, data >> 16);
- memory_write_word_32be(space, address + 2, data);
+ space->write_word(address, data >> 16);
+ space->write_word(address + 2, data);
return;
}
- memory_write_byte_32be(space, address, data >> 24);
- memory_write_word_32be(space, address + 1, data >> 8);
- memory_write_byte_32be(space, address + 3, data);
+ space->write_byte(address, data >> 24);
+ space->write_word(address + 1, data >> 8);
+ space->write_byte(address + 3, data);
}
static const m68k_memory_interface interface_d32_mmu =
diff --git a/src/emu/cpu/m68000/m68kmmu.h b/src/emu/cpu/m68000/m68kmmu.h
index 56acc761654..f2b601f0c96 100644
--- a/src/emu/cpu/m68000/m68kmmu.h
+++ b/src/emu/cpu/m68000/m68kmmu.h
@@ -53,7 +53,7 @@ INLINE UINT32 pmmu_translate_addr(m68ki_cpu_core *m68k, UINT32 addr_in)
case 2: // valid 4 byte descriptors
tofs *= 4;
// logerror("PMMU: reading table A entry at %08x\n", tofs + (root_aptr & 0xfffffffc));
- tbl_entry = memory_read_dword_32be(m68k->program, tofs + (root_aptr & 0xfffffffc));
+ tbl_entry = m68k->program->read_dword(tofs + (root_aptr & 0xfffffffc));
tamode = tbl_entry & 3;
// logerror("PMMU: addr %08x entry %08x mode %x tofs %x\n", addr_in, tbl_entry, tamode, tofs);
break;
@@ -61,8 +61,8 @@ INLINE UINT32 pmmu_translate_addr(m68ki_cpu_core *m68k, UINT32 addr_in)
case 3: // valid 8 byte descriptors
tofs *= 8;
// logerror("PMMU: reading table A entries at %08x\n", tofs + (root_aptr & 0xfffffffc));
- tbl_entry2 = memory_read_dword_32be(m68k->program, tofs + (root_aptr & 0xfffffffc));
- tbl_entry = memory_read_dword_32be(m68k->program, tofs + (root_aptr & 0xfffffffc)+4);
+ tbl_entry2 = m68k->program->read_dword(tofs + (root_aptr & 0xfffffffc));
+ tbl_entry = m68k->program->read_dword(tofs + (root_aptr & 0xfffffffc)+4);
tamode = tbl_entry2 & 3;
// logerror("PMMU: addr %08x entry %08x entry2 %08x mode %x tofs %x\n", addr_in, tbl_entry, tbl_entry2, tamode, tofs);
break;
@@ -82,7 +82,7 @@ INLINE UINT32 pmmu_translate_addr(m68ki_cpu_core *m68k, UINT32 addr_in)
case 2: // 4-byte table B descriptor
tofs *= 4;
// logerror("PMMU: reading table B entry at %08x\n", tofs + tptr);
- tbl_entry = memory_read_dword_32be(m68k->program, tofs + tptr);
+ tbl_entry = m68k->program->read_dword(tofs + tptr);
tbmode = tbl_entry & 3;
// logerror("PMMU: addr %08x entry %08x mode %x tofs %x\n", addr_in, tbl_entry, tbmode, tofs);
break;
@@ -90,8 +90,8 @@ INLINE UINT32 pmmu_translate_addr(m68ki_cpu_core *m68k, UINT32 addr_in)
case 3: // 8-byte table B descriptor
tofs *= 8;
// logerror("PMMU: reading table B entries at %08x\n", tofs + tptr);
- tbl_entry2 = memory_read_dword_32be(m68k->program, tofs + tptr);
- tbl_entry = memory_read_dword_32be(m68k->program, tofs + tptr + 4);
+ tbl_entry2 = m68k->program->read_dword(tofs + tptr);
+ tbl_entry = m68k->program->read_dword(tofs + tptr + 4);
tbmode = tbl_entry2 & 3;
// logerror("PMMU: addr %08x entry %08x entry2 %08x mode %x tofs %x\n", addr_in, tbl_entry, tbl_entry2, tbmode, tofs);
break;
@@ -121,7 +121,7 @@ INLINE UINT32 pmmu_translate_addr(m68ki_cpu_core *m68k, UINT32 addr_in)
case 2: // 4-byte table C descriptor
tofs *= 4;
// logerror("PMMU: reading table C entry at %08x\n", tofs + tptr);
- tbl_entry = memory_read_dword_32be(m68k->program, tofs + tptr);
+ tbl_entry = m68k->program->read_dword(tofs + tptr);
tcmode = tbl_entry & 3;
// logerror("PMMU: addr %08x entry %08x mode %x tofs %x\n", addr_in, tbl_entry, tbmode, tofs);
break;
@@ -129,8 +129,8 @@ INLINE UINT32 pmmu_translate_addr(m68ki_cpu_core *m68k, UINT32 addr_in)
case 3: // 8-byte table C descriptor
tofs *= 8;
// logerror("PMMU: reading table C entries at %08x\n", tofs + tptr);
- tbl_entry2 = memory_read_dword_32be(m68k->program, tofs + tptr);
- tbl_entry = memory_read_dword_32be(m68k->program, tofs + tptr + 4);
+ tbl_entry2 = m68k->program->read_dword(tofs + tptr);
+ tbl_entry = m68k->program->read_dword(tofs + tptr + 4);
tcmode = tbl_entry2 & 3;
// logerror("PMMU: addr %08x entry %08x entry2 %08x mode %x tofs %x\n", addr_in, tbl_entry, tbl_entry2, tbmode, tofs);
break;
diff --git a/src/emu/cpu/m6805/m6805.c b/src/emu/cpu/m6805/m6805.c
index 830c9e6517a..90150d9c5e5 100644
--- a/src/emu/cpu/m6805/m6805.c
+++ b/src/emu/cpu/m6805/m6805.c
@@ -79,12 +79,12 @@ INLINE m6805_Regs *get_safe_token(running_device *device)
/****************************************************************************/
/* Read a byte from given memory location */
/****************************************************************************/
-#define M6805_RDMEM(Addr) ((unsigned)memory_read_byte_8be(cpustate->program, Addr))
+#define M6805_RDMEM(Addr) ((unsigned)cpustate->program->read_byte(Addr))
/****************************************************************************/
/* Write a byte to given memory location */
/****************************************************************************/
-#define M6805_WRMEM(Addr,Value) (memory_write_byte_8be(cpustate->program, Addr,Value))
+#define M6805_WRMEM(Addr,Value) (cpustate->program->write_byte(Addr,Value))
/****************************************************************************/
/* M6805_RDOP() is identical to M6805_RDMEM() except it is used for reading */
diff --git a/src/emu/cpu/m6809/m6809.c b/src/emu/cpu/m6809/m6809.c
index 665efada724..c30d6a09ea2 100644
--- a/src/emu/cpu/m6809/m6809.c
+++ b/src/emu/cpu/m6809/m6809.c
@@ -172,12 +172,12 @@ INLINE void fetch_effective_address( m68_state_t *m68_state );
/****************************************************************************/
/* Read a byte from given memory location */
/****************************************************************************/
-#define RM(Addr) ((unsigned)memory_read_byte_8be(m68_state->program, Addr))
+#define RM(Addr) ((unsigned)m68_state->program->read_byte(Addr))
/****************************************************************************/
/* Write a byte to given memory location */
/****************************************************************************/
-#define WM(Addr,Value) (memory_write_byte_8be(m68_state->program, Addr,Value))
+#define WM(Addr,Value) (m68_state->program->write_byte(Addr,Value))
/****************************************************************************/
/* Z80_RDOP() is identical to Z80_RDMEM() except it is used for reading */
diff --git a/src/emu/cpu/mb86233/mb86233.c b/src/emu/cpu/mb86233/mb86233.c
index cd61a1d1ed5..80edb1b7157 100644
--- a/src/emu/cpu/mb86233/mb86233.c
+++ b/src/emu/cpu/mb86233/mb86233.c
@@ -96,8 +96,8 @@ INLINE mb86233_state *get_safe_token(running_device *device)
#define GETREPCNT() cpustate->repcnt
#define ROPCODE(a) memory_decrypted_read_dword(cpustate->program, a<<2)
-#define RDMEM(a) memory_read_dword_32le(cpustate->program, (a<<2))
-#define WRMEM(a,v) memory_write_dword_32le(cpustate->program, (a<<2), v)
+#define RDMEM(a) cpustate->program->read_dword((a<<2))
+#define WRMEM(a,v) cpustate->program->write_dword((a<<2), v)
/***************************************************************************
Initialization and Shutdown
diff --git a/src/emu/cpu/mb88xx/mb88xx.c b/src/emu/cpu/mb88xx/mb88xx.c
index be904aed01a..f783eb8bc1e 100644
--- a/src/emu/cpu/mb88xx/mb88xx.c
+++ b/src/emu/cpu/mb88xx/mb88xx.c
@@ -100,11 +100,11 @@ static TIMER_CALLBACK( serial_timer );
#define READOP(a) (memory_decrypted_read_byte(cpustate->program, a))
-#define RDMEM(a) (memory_read_byte_8be(cpustate->data, a))
-#define WRMEM(a,v) (memory_write_byte_8be(cpustate->data, (a), (v)))
+#define RDMEM(a) (cpustate->data->read_byte(a))
+#define WRMEM(a,v) (cpustate->data->write_byte((a), (v)))
-#define READPORT(a) (memory_read_byte_8be(cpustate->io, a))
-#define WRITEPORT(a,v) (memory_write_byte_8be(cpustate->io, (a), (v)))
+#define READPORT(a) (cpustate->io->read_byte(a))
+#define WRITEPORT(a,v) (cpustate->io->write_byte((a), (v)))
#define TEST_ST() (cpustate->st & 1)
#define TEST_ZF() (cpustate->zf & 1)
diff --git a/src/emu/cpu/mc68hc11/mc68hc11.c b/src/emu/cpu/mc68hc11/mc68hc11.c
index b336247771a..b80cf939ee1 100644
--- a/src/emu/cpu/mc68hc11/mc68hc11.c
+++ b/src/emu/cpu/mc68hc11/mc68hc11.c
@@ -97,21 +97,21 @@ static UINT8 hc11_regs_r(hc11_state *cpustate, UINT32 address)
switch(reg)
{
case 0x00: /* PORTA */
- return memory_read_byte(cpustate->io, MC68HC11_IO_PORTA);
+ return cpustate->io->read_byte(MC68HC11_IO_PORTA);
case 0x01: /* DDRA */
return 0;
case 0x02: /* PIOC */
return 0;
case 0x03: /* PORTC */
- return memory_read_byte(cpustate->io, MC68HC11_IO_PORTC);
+ return cpustate->io->read_byte(MC68HC11_IO_PORTC);
case 0x04: /* PORTB */
- return memory_read_byte(cpustate->io, MC68HC11_IO_PORTB);
+ return cpustate->io->read_byte(MC68HC11_IO_PORTB);
case 0x08: /* PORTD */
- return memory_read_byte(cpustate->io, MC68HC11_IO_PORTD);
+ return cpustate->io->read_byte(MC68HC11_IO_PORTD);
case 0x09: /* DDRD */
return 0;
case 0x0a: /* PORTE */
- return memory_read_byte(cpustate->io, MC68HC11_IO_PORTE);
+ return cpustate->io->read_byte(MC68HC11_IO_PORTE);
case 0x23:
return cpustate->tflg1;
case 0x28: /* SPCR1 */
@@ -122,44 +122,44 @@ static UINT8 hc11_regs_r(hc11_state *cpustate, UINT32 address)
{
if (cpustate->adctl & 0x10)
{
- return memory_read_byte(cpustate->io, (cpustate->adctl & 0x4) + MC68HC11_IO_AD0);
+ return cpustate->io->read_byte((cpustate->adctl & 0x4) + MC68HC11_IO_AD0);
}
else
{
- return memory_read_byte(cpustate->io, (cpustate->adctl & 0x7) + MC68HC11_IO_AD0);
+ return cpustate->io->read_byte((cpustate->adctl & 0x7) + MC68HC11_IO_AD0);
}
}
case 0x32: /* ADR2 */
{
if (cpustate->adctl & 0x10)
{
- return memory_read_byte(cpustate->io, (cpustate->adctl & 0x4) + MC68HC11_IO_AD1);
+ return cpustate->io->read_byte((cpustate->adctl & 0x4) + MC68HC11_IO_AD1);
}
else
{
- return memory_read_byte(cpustate->io, (cpustate->adctl & 0x7) + MC68HC11_IO_AD0);
+ return cpustate->io->read_byte((cpustate->adctl & 0x7) + MC68HC11_IO_AD0);
}
}
case 0x33: /* ADR3 */
{
if (cpustate->adctl & 0x10)
{
- return memory_read_byte(cpustate->io, (cpustate->adctl & 0x4) + MC68HC11_IO_AD2);
+ return cpustate->io->read_byte((cpustate->adctl & 0x4) + MC68HC11_IO_AD2);
}
else
{
- return memory_read_byte(cpustate->io, (cpustate->adctl & 0x7) + MC68HC11_IO_AD0);
+ return cpustate->io->read_byte((cpustate->adctl & 0x7) + MC68HC11_IO_AD0);
}
}
case 0x34: /* ADR4 */
{
if (cpustate->adctl & 0x10)
{
- return memory_read_byte(cpustate->io, (cpustate->adctl & 0x4) + MC68HC11_IO_AD3);
+ return cpustate->io->read_byte((cpustate->adctl & 0x4) + MC68HC11_IO_AD3);
}
else
{
- return memory_read_byte(cpustate->io, (cpustate->adctl & 0x7) + MC68HC11_IO_AD0);
+ return cpustate->io->read_byte((cpustate->adctl & 0x7) + MC68HC11_IO_AD0);
}
}
case 0x38: /* OPT2 */
@@ -175,9 +175,9 @@ static UINT8 hc11_regs_r(hc11_state *cpustate, UINT32 address)
case 0x74: /* SCSR1 */
return 0x40;
case 0x7c: /* PORTH */
- return memory_read_byte(cpustate->io, MC68HC11_IO_PORTH);
+ return cpustate->io->read_byte(MC68HC11_IO_PORTH);
case 0x7e: /* PORTG */
- return memory_read_byte(cpustate->io, MC68HC11_IO_PORTG);
+ return cpustate->io->read_byte(MC68HC11_IO_PORTG);
case 0x7f: /* DDRG */
return 0;
@@ -186,7 +186,7 @@ static UINT8 hc11_regs_r(hc11_state *cpustate, UINT32 address)
case 0x89: /* SPSR2 */
return 0x80;
case 0x8a: /* SPDR2 */
- return memory_read_byte(cpustate->io, MC68HC11_IO_SPI2_DATA);
+ return cpustate->io->read_byte(MC68HC11_IO_SPI2_DATA);
case 0x8b: /* OPT4 */
return 0;
@@ -203,25 +203,25 @@ static void hc11_regs_w(hc11_state *cpustate, UINT32 address, UINT8 value)
switch(reg)
{
case 0x00: /* PORTA */
- memory_write_byte(cpustate->io, MC68HC11_IO_PORTA, value);
+ cpustate->io->write_byte(MC68HC11_IO_PORTA, value);
return;
case 0x01: /* DDRA */
//mame_printf_debug("HC11: ddra = %02X\n", value);
return;
case 0x03: /* PORTC */
- memory_write_byte(cpustate->io, MC68HC11_IO_PORTC, value);
+ cpustate->io->write_byte(MC68HC11_IO_PORTC, value);
return;
case 0x04: /* PORTC */
- memory_write_byte(cpustate->io, MC68HC11_IO_PORTB, value);
+ cpustate->io->write_byte(MC68HC11_IO_PORTB, value);
return;
case 0x08: /* PORTD */
- memory_write_byte(cpustate->io, MC68HC11_IO_PORTD, value); //mask & 0x3f?
+ cpustate->io->write_byte(MC68HC11_IO_PORTD, value); //mask & 0x3f?
return;
case 0x09: /* DDRD */
//mame_printf_debug("HC11: ddrd = %02X\n", value);
return;
case 0x0a: /* PORTE */
- memory_write_byte(cpustate->io, MC68HC11_IO_PORTE, value);
+ cpustate->io->write_byte(MC68HC11_IO_PORTE, value);
return;
case 0x22: /* TMSK1 */
return;
@@ -271,13 +271,13 @@ static void hc11_regs_w(hc11_state *cpustate, UINT32 address, UINT8 value)
case 0x77: /* SCDRL */
return;
case 0x7c: /* PORTH */
- memory_write_byte(cpustate->io, MC68HC11_IO_PORTH, value);
+ cpustate->io->write_byte(MC68HC11_IO_PORTH, value);
return;
case 0x7d: /* DDRH */
//mame_printf_debug("HC11: ddrh = %02X at %04X\n", value, cpustate->pc);
return;
case 0x7e: /* PORTG */
- memory_write_byte(cpustate->io, MC68HC11_IO_PORTG, value);
+ cpustate->io->write_byte(MC68HC11_IO_PORTG, value);
return;
case 0x7f: /* DDRG */
//mame_printf_debug("HC11: ddrg = %02X at %04X\n", value, cpustate->pc);
@@ -288,7 +288,7 @@ static void hc11_regs_w(hc11_state *cpustate, UINT32 address, UINT8 value)
case 0x89: /* SPSR2 */
return;
case 0x8a: /* SPDR2 */
- memory_write_byte(cpustate->io, MC68HC11_IO_SPI2_DATA, value);
+ cpustate->io->write_byte(MC68HC11_IO_SPI2_DATA, value);
return;
case 0x8b: /* OPT4 */
@@ -324,7 +324,7 @@ INLINE UINT8 READ8(hc11_state *cpustate, UINT32 address)
{
return cpustate->internal_ram[address-cpustate->ram_position];
}
- return memory_read_byte(cpustate->program, address);
+ return cpustate->program->read_byte(address);
}
INLINE void WRITE8(hc11_state *cpustate, UINT32 address, UINT8 value)
@@ -339,7 +339,7 @@ INLINE void WRITE8(hc11_state *cpustate, UINT32 address, UINT8 value)
cpustate->internal_ram[address-cpustate->ram_position] = value;
return;
}
- memory_write_byte(cpustate->program, address, value);
+ cpustate->program->write_byte(address, value);
}
INLINE UINT16 READ16(hc11_state *cpustate, UINT32 address)
diff --git a/src/emu/cpu/mcs48/mcs48.c b/src/emu/cpu/mcs48/mcs48.c
index a735800fb5e..0a8b4125663 100644
--- a/src/emu/cpu/mcs48/mcs48.c
+++ b/src/emu/cpu/mcs48/mcs48.c
@@ -175,23 +175,23 @@ typedef int (*mcs48_ophandler)(mcs48_state *state);
***************************************************************************/
/* ROM is mapped to ADDRESS_SPACE_PROGRAM */
-#define program_r(a) memory_read_byte_8le(cpustate->program, a)
+#define program_r(a) cpustate->program->read_byte(a)
/* RAM is mapped to ADDRESS_SPACE_DATA */
-#define ram_r(a) memory_read_byte_8le(cpustate->data, a)
-#define ram_w(a,V) memory_write_byte_8le(cpustate->data, a, V)
+#define ram_r(a) cpustate->data->read_byte(a)
+#define ram_w(a,V) cpustate->data->write_byte(a, V)
/* ports are mapped to ADDRESS_SPACE_IO */
-#define ext_r(a) memory_read_byte_8le(cpustate->io, a)
-#define ext_w(a,V) memory_write_byte_8le(cpustate->io, a, V)
-#define port_r(a) memory_read_byte_8le(cpustate->io, MCS48_PORT_P0 + a)
-#define port_w(a,V) memory_write_byte_8le(cpustate->io, MCS48_PORT_P0 + a, V)
-#define test_r(a) memory_read_byte_8le(cpustate->io, MCS48_PORT_T0 + a)
-#define test_w(a,V) memory_write_byte_8le(cpustate->io, MCS48_PORT_T0 + a, V)
-#define bus_r() memory_read_byte_8le(cpustate->io, MCS48_PORT_BUS)
-#define bus_w(V) memory_write_byte_8le(cpustate->io, MCS48_PORT_BUS, V)
-#define ea_r() memory_read_byte_8le(cpustate->io, MCS48_PORT_EA)
-#define prog_w(V) memory_write_byte_8le(cpustate->io, MCS48_PORT_PROG, V)
+#define ext_r(a) cpustate->io->read_byte(a)
+#define ext_w(a,V) cpustate->io->write_byte(a, V)
+#define port_r(a) cpustate->io->read_byte(MCS48_PORT_P0 + a)
+#define port_w(a,V) cpustate->io->write_byte(MCS48_PORT_P0 + a, V)
+#define test_r(a) cpustate->io->read_byte(MCS48_PORT_T0 + a)
+#define test_w(a,V) cpustate->io->write_byte(MCS48_PORT_T0 + a, V)
+#define bus_r() cpustate->io->read_byte(MCS48_PORT_BUS)
+#define bus_w(V) cpustate->io->write_byte(MCS48_PORT_BUS, V)
+#define ea_r() cpustate->io->read_byte(MCS48_PORT_EA)
+#define prog_w(V) cpustate->io->write_byte(MCS48_PORT_PROG, V)
/* r0-r7 map to memory via the regptr */
#define R0 regptr[0]
diff --git a/src/emu/cpu/mcs51/mcs51.c b/src/emu/cpu/mcs51/mcs51.c
index 6b54f066aae..2973866ac44 100644
--- a/src/emu/cpu/mcs51/mcs51.c
+++ b/src/emu/cpu/mcs51/mcs51.c
@@ -314,11 +314,11 @@ struct _mcs51_state_t
#define ROP_ARG(pc) memory_raw_read_byte(mcs51_state->program, pc)
/* Read a byte from External Code Memory (Usually Program Rom(s) Space) */
-#define CODEMEM_R(a) (UINT8)memory_read_byte_8le(mcs51_state->program, a)
+#define CODEMEM_R(a) (UINT8)mcs51_state->program->read_byte(a)
/* Read/Write a byte from/to External Data Memory (Usually RAM or other I/O) */
-#define DATAMEM_R(a) (UINT8)memory_read_byte_8le(mcs51_state->io, a)
-#define DATAMEM_W(a,v) memory_write_byte_8le(mcs51_state->io, a, v)
+#define DATAMEM_R(a) (UINT8)mcs51_state->io->read_byte(a)
+#define DATAMEM_W(a,v) mcs51_state->io->write_byte(a, v)
/* Read/Write a byte from/to the Internal RAM */
@@ -327,8 +327,8 @@ struct _mcs51_state_t
/* Read/Write a byte from/to the Internal RAM indirectly */
/* (called from indirect addressing) */
-INLINE UINT8 iram_iread(mcs51_state_t *mcs51_state, offs_t a) { return (a <= mcs51_state->ram_mask) ? memory_read_byte_8le(mcs51_state->data, a) : 0xff; }
-INLINE void iram_iwrite(mcs51_state_t *mcs51_state, offs_t a, UINT8 d) { if (a <= mcs51_state->ram_mask) memory_write_byte_8le(mcs51_state->data, a, d); }
+INLINE UINT8 iram_iread(mcs51_state_t *mcs51_state, offs_t a) { return (a <= mcs51_state->ram_mask) ? mcs51_state->data->read_byte(a) : 0xff; }
+INLINE void iram_iwrite(mcs51_state_t *mcs51_state, offs_t a, UINT8 d) { if (a <= mcs51_state->ram_mask) mcs51_state->data->write_byte(a, d); }
#define IRAM_IR(a) iram_iread(mcs51_state, a)
#define IRAM_IW(a, d) iram_iwrite(mcs51_state, a, d)
@@ -342,8 +342,8 @@ INLINE void iram_iwrite(mcs51_state_t *mcs51_state, offs_t a, UINT8 d) { if (a <
#define BIT_W(a,v) bit_address_w(mcs51_state, a, v)
/* Input/Output a byte from given I/O port */
-#define IN(port) ((UINT8)memory_read_byte(mcs51_state->io, port))
-#define OUT(port,value) memory_write_byte(mcs51_state->io, port,value)
+#define IN(port) ((UINT8)mcs51_state->io->read_byte(port))
+#define OUT(port,value) mcs51_state->io->write_byte(port,value)
/***************************************************************************
@@ -757,13 +757,13 @@ INLINE offs_t external_ram_iaddr(mcs51_state_t *mcs51_state, offs_t offset, offs
INLINE UINT8 iram_read(mcs51_state_t *mcs51_state, size_t offset)
{
- return (((offset) < 0x80) ? memory_read_byte_8le(mcs51_state->data, offset) : mcs51_state->sfr_read(mcs51_state, offset));
+ return (((offset) < 0x80) ? mcs51_state->data->read_byte(offset) : mcs51_state->sfr_read(mcs51_state, offset));
}
INLINE void iram_write(mcs51_state_t *mcs51_state, size_t offset, UINT8 data)
{
if ((offset) < 0x80)
- memory_write_byte_8le(mcs51_state->data, offset, data);
+ mcs51_state->data->write_byte(offset, data);
else
mcs51_state->sfr_write(mcs51_state, offset, data);
}
@@ -2024,7 +2024,7 @@ static void mcs51_sfr_write(mcs51_state_t *mcs51_state, size_t offset, UINT8 dat
/* no write in this case according to manual */
return;
}
- memory_write_byte_8le(mcs51_state->data, (size_t)offset | 0x100, data);
+ mcs51_state->data->write_byte((size_t)offset | 0x100, data);
}
static UINT8 mcs51_sfr_read(mcs51_state_t *mcs51_state, size_t offset)
@@ -2057,7 +2057,7 @@ static UINT8 mcs51_sfr_read(mcs51_state_t *mcs51_state, size_t offset)
case ADDR_SBUF:
case ADDR_IE:
case ADDR_IP:
- return memory_read_byte_8le(mcs51_state->data, (size_t) offset | 0x100);
+ return mcs51_state->data->read_byte((size_t) offset | 0x100);
/* Illegal or non-implemented sfr */
default:
LOG(("mcs51 '%s': attemping to read an invalid/non-implemented SFR address: %x at 0x%04x\n", mcs51_state->device->tag(), (UINT32)offset,PC));
@@ -2212,7 +2212,7 @@ static void i8052_sfr_write(mcs51_state_t *mcs51_state, size_t offset, UINT8 dat
case ADDR_RCAP2H:
case ADDR_TL2:
case ADDR_TH2:
- memory_write_byte_8le(mcs51_state->data, (size_t) offset | 0x100, data);
+ mcs51_state->data->write_byte((size_t) offset | 0x100, data);
break;
default:
@@ -2230,7 +2230,7 @@ static UINT8 i8052_sfr_read(mcs51_state_t *mcs51_state, size_t offset)
case ADDR_RCAP2H:
case ADDR_TL2:
case ADDR_TH2:
- return memory_read_byte_8le(mcs51_state->data, (size_t) offset | 0x100);
+ return mcs51_state->data->read_byte((size_t) offset | 0x100);
default:
return mcs51_sfr_read(mcs51_state, offset);
}
@@ -2272,7 +2272,7 @@ static void i80c52_sfr_write(mcs51_state_t *mcs51_state, size_t offset, UINT8 da
i8052_sfr_write(mcs51_state, offset, data);
return;
}
- memory_write_byte_8le(mcs51_state->data, (size_t) offset | 0x100, data);
+ mcs51_state->data->write_byte((size_t) offset | 0x100, data);
}
static UINT8 i80c52_sfr_read(mcs51_state_t *mcs51_state, size_t offset)
@@ -2283,7 +2283,7 @@ static UINT8 i80c52_sfr_read(mcs51_state_t *mcs51_state, size_t offset)
case ADDR_IPH:
case ADDR_SADDR:
case ADDR_SADEN:
- return memory_read_byte_8le(mcs51_state->data, (size_t) offset | 0x100);
+ return mcs51_state->data->read_byte((size_t) offset | 0x100);
default:
return i8052_sfr_read(mcs51_state, offset);
}
@@ -2355,7 +2355,7 @@ static void ds5002fp_sfr_write(mcs51_state_t *mcs51_state, size_t offset, UINT8
mcs51_sfr_write(mcs51_state, offset, data);
return;
}
- memory_write_byte_8le(mcs51_state->data, (size_t) offset | 0x100, data);
+ mcs51_state->data->write_byte((size_t) offset | 0x100, data);
}
static UINT8 ds5002fp_sfr_read(mcs51_state_t *mcs51_state, size_t offset)
@@ -2376,7 +2376,7 @@ static UINT8 ds5002fp_sfr_read(mcs51_state_t *mcs51_state, size_t offset)
default:
return mcs51_sfr_read(mcs51_state, offset);
}
- return memory_read_byte_8le(mcs51_state->data, (size_t) offset | 0x100);
+ return mcs51_state->data->read_byte((size_t) offset | 0x100);
}
static CPU_INIT( ds5002fp )
diff --git a/src/emu/cpu/minx/minx.c b/src/emu/cpu/minx/minx.c
index 52e6e4bb7be..8ebff33a073 100644
--- a/src/emu/cpu/minx/minx.c
+++ b/src/emu/cpu/minx/minx.c
@@ -89,8 +89,8 @@ typedef struct {
int icount;
} minx_state;
-#define RD(offset) memory_read_byte_8be( minx->program, offset )
-#define WR(offset,data) memory_write_byte_8be( minx->program, offset, data )
+#define RD(offset) minx->program->read_byte( offset )
+#define WR(offset,data) minx->program->write_byte( offset, data )
#define GET_MINX_PC ( ( minx->PC & 0x8000 ) ? ( minx->V << 15 ) | (minx->PC & 0x7FFF ) : minx->PC )
INLINE minx_state *get_safe_token(running_device *device)
diff --git a/src/emu/cpu/mips/psx.c b/src/emu/cpu/mips/psx.c
index aa23ecc8f9e..106f530ccbf 100644
--- a/src/emu/cpu/mips/psx.c
+++ b/src/emu/cpu/mips/psx.c
@@ -335,7 +335,7 @@ INLINE UINT8 psx_readbyte( psxcpu_state *psxcpu, UINT32 address )
{
if( psxcpu->bus_attached )
{
- return memory_read_byte_32le( psxcpu->program, address );
+ return psxcpu->program->read_byte( address );
}
else
{
@@ -347,7 +347,7 @@ INLINE UINT16 psx_readhalf( psxcpu_state *psxcpu, UINT32 address )
{
if( psxcpu->bus_attached )
{
- return memory_read_word_32le( psxcpu->program, address );
+ return psxcpu->program->read_word( address );
}
else
{
@@ -359,7 +359,7 @@ INLINE UINT32 psx_readword( psxcpu_state *psxcpu, UINT32 address )
{
if( psxcpu->bus_attached )
{
- return memory_read_dword_32le( psxcpu->program, address );
+ return psxcpu->program->read_dword( address );
}
else
{
@@ -371,7 +371,7 @@ INLINE UINT32 psx_readword_masked( psxcpu_state *psxcpu, UINT32 address, UINT32
{
if( psxcpu->bus_attached )
{
- return memory_read_dword_masked_32le( psxcpu->program, address, mask );
+ return psxcpu->program->read_dword( address, mask );
}
else
{
@@ -383,7 +383,7 @@ INLINE void psx_writeword( psxcpu_state *psxcpu, UINT32 address, UINT32 data )
{
if( psxcpu->bus_attached )
{
- memory_write_dword_32le( psxcpu->program, address, data );
+ psxcpu->program->write_dword( address, data );
}
else
{
@@ -395,7 +395,7 @@ INLINE void psx_writeword_masked( psxcpu_state *psxcpu, UINT32 address, UINT32 d
{
if( psxcpu->bus_attached )
{
- memory_write_dword_masked_32le( psxcpu->program, address, data, mask );
+ psxcpu->program->write_dword( address, data, mask );
}
else
{
@@ -1797,7 +1797,7 @@ static void mips_swc( psxcpu_state *psxcpu, int cop, int sr_cu )
}
}
- data = memory_read_dword_32le( psxcpu->program, address );
+ data = psxcpu->program->read_dword( address );
}
break;
@@ -2959,7 +2959,7 @@ static UINT32 getcp1dr( psxcpu_state *psxcpu, int reg )
{
/* if a mtc/ctc precedes then this will get the value moved (which cop1 register is irrelevant). */
/* if a mfc/cfc follows then it will get the same value as this one. */
- return memory_read_dword_32le( psxcpu->program, psxcpu->pc + 4 );
+ return psxcpu->program->read_dword( psxcpu->pc + 4 );
}
static void setcp1dr( psxcpu_state *psxcpu, int reg, UINT32 value )
@@ -2970,7 +2970,7 @@ static UINT32 getcp1cr( psxcpu_state *psxcpu, int reg )
{
/* if a mtc/ctc precedes then this will get the value moved (which cop1 register is irrelevant). */
/* if a mfc/cfc follows then it will get the same value as this one. */
- return memory_read_dword_32le( psxcpu->program, psxcpu->pc + 4 );
+ return psxcpu->program->read_dword( psxcpu->pc + 4 );
}
static void setcp1cr( psxcpu_state *psxcpu, int reg, UINT32 value )
@@ -2983,7 +2983,7 @@ static UINT32 getcp3dr( psxcpu_state *psxcpu, int reg )
/* if you have mtc/ctc with an mfc/cfc directly afterwards then you get the value that was moved. */
/* if you have an lwc with an mfc/cfc somewhere after it then you get the value that is loaded */
/* otherwise you get the next opcode. which register you transfer to or from is irrelevant. */
- return memory_read_dword_32le( psxcpu->program, psxcpu->pc + 4 );
+ return psxcpu->program->read_dword( psxcpu->pc + 4 );
}
static void setcp3dr( psxcpu_state *psxcpu, int reg, UINT32 value )
@@ -2995,7 +2995,7 @@ static UINT32 getcp3cr( psxcpu_state *psxcpu, int reg )
/* if you have mtc/ctc with an mfc/cfc directly afterwards then you get the value that was moved. */
/* if you have an lwc with an mfc/cfc somewhere after it then you get the value that is loaded */
/* otherwise you get the next opcode. which register you transfer to or from is irrelevant. */
- return memory_read_dword_32le( psxcpu->program, psxcpu->pc + 4 );
+ return psxcpu->program->read_dword( psxcpu->pc + 4 );
}
static void setcp3cr( psxcpu_state *psxcpu, int reg, UINT32 value )
diff --git a/src/emu/cpu/mn10200/mn10200.c b/src/emu/cpu/mn10200/mn10200.c
index 0c3a1518c6c..2a5f3b05c08 100644
--- a/src/emu/cpu/mn10200/mn10200.c
+++ b/src/emu/cpu/mn10200/mn10200.c
@@ -79,7 +79,7 @@ INLINE UINT8 mn102_read_byte(mn102_info *mn102, UINT32 address)
return mn10200_r(mn102, address-0xfc00, MEM_BYTE);
}
- return memory_read_byte_16le(mn102->program, address);
+ return mn102->program->read_byte(address);
}
INLINE UINT16 mn102_read_word(mn102_info *mn102, UINT32 address)
@@ -91,10 +91,10 @@ INLINE UINT16 mn102_read_word(mn102_info *mn102, UINT32 address)
if (address & 1)
{
- return memory_read_byte_16le(mn102->program, address) | (memory_read_byte_16le(mn102->program, address+1)<<8);
+ return mn102->program->read_byte(address) | (mn102->program->read_byte(address+1)<<8);
}
- return memory_read_word_16le(mn102->program, address);
+ return mn102->program->read_word(address);
}
INLINE void mn102_write_byte(mn102_info *mn102, UINT32 address, UINT8 data)
@@ -105,7 +105,7 @@ INLINE void mn102_write_byte(mn102_info *mn102, UINT32 address, UINT8 data)
return;
}
- memory_write_byte_16le(mn102->program, address, data);
+ mn102->program->write_byte(address, data);
}
INLINE void mn102_write_word(mn102_info *mn102, UINT32 address, UINT16 data)
@@ -118,12 +118,12 @@ INLINE void mn102_write_word(mn102_info *mn102, UINT32 address, UINT16 data)
if (address & 1)
{
- memory_write_byte_16le(mn102->program, address, data&0xff);
- memory_write_byte_16le(mn102->program, address+1, (data>>8)&0xff);
+ mn102->program->write_byte(address, data&0xff);
+ mn102->program->write_byte(address+1, (data>>8)&0xff);
return;
}
- memory_write_word_16le(mn102->program, address, data);
+ mn102->program->write_word(address, data);
}
INLINE INT32 r24u(mn102_info *mn102, offs_t adr)
@@ -2057,7 +2057,7 @@ static void mn10200_w(mn102_info *mn102, UINT32 adr, UINT32 data, int type)
break;
case 0x264:
- memory_write_byte_8le(mn102->io, MN10200_PORT1, data);
+ mn102->io->write_byte(MN10200_PORT1, data);
break;
case 0x280: case 0x290: case 0x2a0: case 0x2b0: case 0x2c0: case 0x2d0: case 0x2e0: case 0x2f0: {
@@ -2211,15 +2211,15 @@ static void mn10200_w(mn102_info *mn102, UINT32 adr, UINT32 data, int type)
break;
case 0x3c0: // port 0 data
- memory_write_byte_8le(mn102->io, MN10200_PORT0, data);
+ mn102->io->write_byte(MN10200_PORT0, data);
break;
case 0x3c2: // port 2 data
- memory_write_byte_8le(mn102->io, MN10200_PORT2, data);
+ mn102->io->write_byte(MN10200_PORT2, data);
break;
case 0x3c3: // port 3 data
- memory_write_byte_8le(mn102->io, MN10200_PORT3, data);
+ mn102->io->write_byte(MN10200_PORT3, data);
break;
case 0x3e0: // port0 ddr
@@ -2304,7 +2304,7 @@ static UINT32 mn10200_r(mn102_info *mn102, UINT32 adr, int type)
break;
case 0x264: // port 1 data
- return memory_read_byte_8le(mn102->io, MN10200_PORT1);
+ return mn102->io->read_byte(MN10200_PORT1);
case 0x28c: case 0x29c: case 0x2ac: case 0x2bc: case 0x2cc: case 0x2dc: case 0x2ec: case 0x2fc:
{
@@ -2313,13 +2313,13 @@ static UINT32 mn10200_r(mn102_info *mn102, UINT32 adr, int type)
}
case 0x3c0: // port 0 data
- return memory_read_byte_8le(mn102->io, MN10200_PORT0);
+ return mn102->io->read_byte(MN10200_PORT0);
case 0x3c2: // port 2 data
- return memory_read_byte_8le(mn102->io, MN10200_PORT2);
+ return mn102->io->read_byte(MN10200_PORT2);
case 0x3c3: // port 3 data
- return memory_read_byte_8le(mn102->io, MN10200_PORT3);
+ return mn102->io->read_byte(MN10200_PORT3);
default:
log_event("MN102", "internal_r %04x (%03x)", adr+0xfc00, adr);
diff --git a/src/emu/cpu/nec/nec.c b/src/emu/cpu/nec/nec.c
index 31a5aba0256..417424fd9c5 100644
--- a/src/emu/cpu/nec/nec.c
+++ b/src/emu/cpu/nec/nec.c
@@ -357,8 +357,8 @@ static void nec_interrupt(nec_state_t *nec_state, unsigned int_num,BOOLEAN md_fl
nec_state->pending_irq &= ~INT_IRQ;
}
- dest_off = read_word(int_num*4);
- dest_seg = read_word(int_num*4+2);
+ dest_off = read_mem_word(int_num*4);
+ dest_seg = read_mem_word(int_num*4+2);
PUSH(nec_state->sregs[PS]);
PUSH(nec_state->ip);
@@ -1138,14 +1138,20 @@ static void nec_init(legacy_cpu_device *device, device_irq_callback irqcallback,
8-bit memory accessors
*****************************************************************************/
+static UINT8 memory_read_byte(address_space *space, offs_t address) { return space->read_byte(address); }
+static void memory_write_byte(address_space *space, offs_t address, UINT8 data) { space->write_byte(address, data); }
+static UINT16 memory_read_word(address_space *space, offs_t address) { return space->read_word(address); }
+static void memory_write_word(address_space *space, offs_t address, UINT16 data) { space->write_word(address, data); }
+
+
static void configure_memory_8bit(nec_state_t *nec_state)
{
nec_state->mem.fetch_xor = 0;
- nec_state->mem.rbyte = memory_read_byte_8le;
- nec_state->mem.rword = memory_read_word_8le;
- nec_state->mem.wbyte = memory_write_byte_8le;
- nec_state->mem.wword = memory_write_word_8le;
+ nec_state->mem.rbyte = memory_read_byte;
+ nec_state->mem.rword = memory_read_word;
+ nec_state->mem.wbyte = memory_write_byte;
+ nec_state->mem.wword = memory_write_word;
}
@@ -1156,22 +1162,22 @@ static void configure_memory_8bit(nec_state_t *nec_state)
static UINT16 read_word_16le(address_space *space, offs_t addr)
{
if (!(addr & 1))
- return memory_read_word_16le(space, addr);
+ return space->read_word(addr);
else
{
- UINT16 result = memory_read_byte_16le(space, addr);
- return result | (memory_read_byte_16le(space, addr + 1) << 8);
+ UINT16 result = space->read_byte(addr);
+ return result | (space->read_byte(addr + 1) << 8);
}
}
static void write_word_16le(address_space *space, offs_t addr, UINT16 data)
{
if (!(addr & 1))
- memory_write_word_16le(space, addr, data);
+ space->write_word(addr, data);
else
{
- memory_write_byte_16le(space, addr, data);
- memory_write_byte_16le(space, addr + 1, data >> 8);
+ space->write_byte(addr, data);
+ space->write_byte(addr + 1, data >> 8);
}
}
@@ -1179,9 +1185,9 @@ static void configure_memory_16bit(nec_state_t *nec_state)
{
nec_state->mem.fetch_xor = BYTE_XOR_LE(0);
- nec_state->mem.rbyte = memory_read_byte_16le;
+ nec_state->mem.rbyte = memory_read_byte;
nec_state->mem.rword = read_word_16le;
- nec_state->mem.wbyte = memory_write_byte_16le;
+ nec_state->mem.wbyte = memory_write_byte;
nec_state->mem.wword = write_word_16le;
}
diff --git a/src/emu/cpu/nec/necmodrm.h b/src/emu/cpu/nec/necmodrm.h
index 8673fd53a70..e21519fcddc 100644
--- a/src/emu/cpu/nec/necmodrm.h
+++ b/src/emu/cpu/nec/necmodrm.h
@@ -13,15 +13,15 @@ static struct {
#define RegByte(ModRM) nec_state->regs.b[Mod_RM.reg.b[ModRM]]
#define GetRMWord(ModRM) \
- ((ModRM) >= 0xc0 ? nec_state->regs.w[Mod_RM.RM.w[ModRM]] : ( (*GetEA[ModRM])(nec_state), read_word( EA ) ))
+ ((ModRM) >= 0xc0 ? nec_state->regs.w[Mod_RM.RM.w[ModRM]] : ( (*GetEA[ModRM])(nec_state), read_mem_word( EA ) ))
#define PutbackRMWord(ModRM,val) \
{ \
if (ModRM >= 0xc0) nec_state->regs.w[Mod_RM.RM.w[ModRM]]=val; \
- else write_word(EA,val); \
+ else write_mem_word(EA,val); \
}
-#define GetnextRMWord read_word((EA&0xf0000)|((EA+2)&0xffff))
+#define GetnextRMWord read_mem_word((EA&0xf0000)|((EA+2)&0xffff))
#define PutRMWord(ModRM,val) \
{ \
@@ -29,7 +29,7 @@ static struct {
nec_state->regs.w[Mod_RM.RM.w[ModRM]]=val; \
else { \
(*GetEA[ModRM])(nec_state); \
- write_word( EA ,val); \
+ write_mem_word( EA ,val); \
} \
}
@@ -41,19 +41,19 @@ static struct {
else { \
(*GetEA[ModRM])(nec_state); \
val = FETCHWORD(); \
- write_word( EA , val); \
+ write_mem_word( EA , val); \
} \
}
#define GetRMByte(ModRM) \
- ((ModRM) >= 0xc0 ? nec_state->regs.b[Mod_RM.RM.b[ModRM]] : read_byte( (*GetEA[ModRM])(nec_state) ))
+ ((ModRM) >= 0xc0 ? nec_state->regs.b[Mod_RM.RM.b[ModRM]] : read_mem_byte( (*GetEA[ModRM])(nec_state) ))
#define PutRMByte(ModRM,val) \
{ \
if (ModRM >= 0xc0) \
nec_state->regs.b[Mod_RM.RM.b[ModRM]]=val; \
else \
- write_byte( (*GetEA[ModRM])(nec_state) ,val); \
+ write_mem_byte( (*GetEA[ModRM])(nec_state) ,val); \
}
#define PutImmRMByte(ModRM) \
@@ -62,7 +62,7 @@ static struct {
nec_state->regs.b[Mod_RM.RM.b[ModRM]]=FETCH(); \
else { \
(*GetEA[ModRM])(nec_state); \
- write_byte( EA , FETCH() ); \
+ write_mem_byte( EA , FETCH() ); \
} \
}
@@ -71,7 +71,7 @@ static struct {
if (ModRM >= 0xc0) \
nec_state->regs.b[Mod_RM.RM.b[ModRM]]=val; \
else \
- write_byte(EA,val); \
+ write_mem_byte(EA,val); \
}
#define DEF_br8 \
diff --git a/src/emu/cpu/nec/necpriv.h b/src/emu/cpu/nec/necpriv.h
index fe2da05fb90..e0c5dcc35c3 100644
--- a/src/emu/cpu/nec/necpriv.h
+++ b/src/emu/cpu/nec/necpriv.h
@@ -80,10 +80,10 @@ typedef enum {
/************************************************************************/
-#define read_byte(a) (*nec_state->mem.rbyte)(nec_state->program, a)
-#define read_word(a) (*nec_state->mem.rword)(nec_state->program, a)
-#define write_byte(a,d) (*nec_state->mem.wbyte)(nec_state->program, (a),(d))
-#define write_word(a,d) (*nec_state->mem.wword)(nec_state->program, (a),(d))
+#define read_mem_byte(a) (*nec_state->mem.rbyte)(nec_state->program, a)
+#define read_mem_word(a) (*nec_state->mem.rword)(nec_state->program, a)
+#define write_mem_byte(a,d) (*nec_state->mem.wbyte)(nec_state->program, (a),(d))
+#define write_mem_word(a,d) (*nec_state->mem.wword)(nec_state->program, (a),(d))
#define read_port_byte(a) (*nec_state->mem.rbyte)(nec_state->io, a)
#define read_port_word(a) (*nec_state->mem.rword)(nec_state->io, a)
@@ -98,11 +98,11 @@ typedef enum {
#define DefaultBase(Seg) ((nec_state->seg_prefix && (Seg==DS0 || Seg==SS)) ? nec_state->prefix_base : nec_state->sregs[Seg] << 4)
-#define GetMemB(Seg,Off) (read_byte(DefaultBase(Seg) + (Off)))
-#define GetMemW(Seg,Off) (read_word(DefaultBase(Seg) + (Off)))
+#define GetMemB(Seg,Off) (read_mem_byte(DefaultBase(Seg) + (Off)))
+#define GetMemW(Seg,Off) (read_mem_word(DefaultBase(Seg) + (Off)))
-#define PutMemB(Seg,Off,x) { write_byte(DefaultBase(Seg) + (Off), (x)); }
-#define PutMemW(Seg,Off,x) { write_word(DefaultBase(Seg) + (Off), (x)); }
+#define PutMemB(Seg,Off,x) { write_mem_byte(DefaultBase(Seg) + (Off), (x)); }
+#define PutMemW(Seg,Off,x) { write_mem_word(DefaultBase(Seg) + (Off), (x)); }
/* prefetch timing */
@@ -112,8 +112,8 @@ typedef enum {
#define EMPTY_PREFETCH() nec_state->prefetch_reset = 1
-#define PUSH(val) { nec_state->regs.w[SP]-=2; write_word((((nec_state->sregs[SS]<<4)+nec_state->regs.w[SP])),val); }
-#define POP(var) { var = read_word((((nec_state->sregs[SS]<<4)+nec_state->regs.w[SP]))); nec_state->regs.w[SP]+=2; }
+#define PUSH(val) { nec_state->regs.w[SP]-=2; write_mem_word((((nec_state->sregs[SS]<<4)+nec_state->regs.w[SP])),val); }
+#define POP(var) { var = read_mem_word((((nec_state->sregs[SS]<<4)+nec_state->regs.w[SP]))); nec_state->regs.w[SP]+=2; }
#define GetModRM UINT32 ModRM=FETCH()
@@ -221,7 +221,7 @@ typedef enum {
} \
else { \
(*GetEA[ModRM])(nec_state); \
- tmp=read_byte(EA); \
+ tmp=read_mem_byte(EA); \
}
#define BITOP_WORD \
@@ -231,7 +231,7 @@ typedef enum {
} \
else { \
(*GetEA[ModRM])(nec_state); \
- tmp=read_word(EA); \
+ tmp=read_mem_word(EA); \
}
#define BIT_NOT \
diff --git a/src/emu/cpu/pdp1/pdp1.c b/src/emu/cpu/pdp1/pdp1.c
index e3c7a4548db..fb7594a1623 100644
--- a/src/emu/cpu/pdp1/pdp1.c
+++ b/src/emu/cpu/pdp1/pdp1.c
@@ -343,8 +343,8 @@
#define LOG_EXTRA 0
#define LOG_IOT_EXTRA 0
-#define READ_PDP_18BIT(A) ((signed)memory_read_dword_32be(cpustate->program, (A)<<2))
-#define WRITE_PDP_18BIT(A,V) (memory_write_dword_32be(cpustate->program, (A)<<2,(V)))
+#define READ_PDP_18BIT(A) ((signed)cpustate->program->read_dword((A)<<2))
+#define WRITE_PDP_18BIT(A,V) (cpustate->program->write_dword((A)<<2,(V)))
/* PDP1 Registers */
diff --git a/src/emu/cpu/pdp1/tx0.c b/src/emu/cpu/pdp1/tx0.c
index 13e4784a6d8..bc587a19196 100644
--- a/src/emu/cpu/pdp1/tx0.c
+++ b/src/emu/cpu/pdp1/tx0.c
@@ -76,8 +76,8 @@ INLINE tx0_state *get_safe_token(running_device *device)
return (tx0_state *)downcast<legacy_cpu_device *>(device)->token();
}
-#define READ_TX0_18BIT(A) ((signed)memory_read_dword_32be(cpustate->program, (A)<<2))
-#define WRITE_TX0_18BIT(A,V) (memory_write_dword_32be(cpustate->program, (A)<<2,(V)))
+#define READ_TX0_18BIT(A) ((signed)cpustate->program->read_dword((A)<<2))
+#define WRITE_TX0_18BIT(A,V) (cpustate->program->write_dword((A)<<2,(V)))
#define io_handler_rim 3
diff --git a/src/emu/cpu/pic16c5x/pic16c5x.c b/src/emu/cpu/pic16c5x/pic16c5x.c
index 3ebe8fa81be..a3b84d94c92 100644
--- a/src/emu/cpu/pic16c5x/pic16c5x.c
+++ b/src/emu/cpu/pic16c5x/pic16c5x.c
@@ -133,12 +133,12 @@ INLINE void update_internalram_ptr(pic16c5x_state *cpustate)
#define PIC16C5x_RDOP(A) (memory_decrypted_read_word(cpustate->program, (A)<<1))
-#define PIC16C5x_RAM_RDMEM(A) ((UINT8)memory_read_byte_8le(cpustate->data, A))
-#define PIC16C5x_RAM_WRMEM(A,V) (memory_write_byte_8le(cpustate->data, A,V))
-#define PIC16C5x_In(Port) ((UINT8)memory_read_byte_8le(cpustate->io, (Port)))
-#define PIC16C5x_Out(Port,Value) (memory_write_byte_8le(cpustate->io, (Port),Value))
+#define PIC16C5x_RAM_RDMEM(A) ((UINT8)cpustate->data->read_byte(A))
+#define PIC16C5x_RAM_WRMEM(A,V) (cpustate->data->write_byte(A,V))
+#define PIC16C5x_In(Port) ((UINT8)cpustate->io->read_byte((Port)))
+#define PIC16C5x_Out(Port,Value) (cpustate->io->write_byte((Port),Value))
/************ Read the state of the T0 Clock input signal ************/
-#define PIC16C5x_T0_In (memory_read_byte_8le(cpustate->io, PIC16C5x_T0))
+#define PIC16C5x_T0_In (cpustate->io->read_byte(PIC16C5x_T0))
#define M_RDRAM(A) (((A) < 8) ? cpustate->internalram[A] : PIC16C5x_RAM_RDMEM(A))
#define M_WRTRAM(A,V) do { if ((A) < 8) cpustate->internalram[A] = (V); else PIC16C5x_RAM_WRMEM(A,V); } while (0)
diff --git a/src/emu/cpu/pic16c62x/pic16c62x.c b/src/emu/cpu/pic16c62x/pic16c62x.c
index e0d67b3493c..2333a2e4c90 100644
--- a/src/emu/cpu/pic16c62x/pic16c62x.c
+++ b/src/emu/cpu/pic16c62x/pic16c62x.c
@@ -130,12 +130,12 @@ INLINE void update_internalram_ptr(pic16c62x_state *cpustate)
}
#define PIC16C62x_RDOP(A) (memory_decrypted_read_word(cpustate->program, (A)<<1))
-#define PIC16C62x_RAM_RDMEM(A) ((UINT8)memory_read_byte_8le(cpustate->data, A))
-#define PIC16C62x_RAM_WRMEM(A,V) (memory_write_byte_8le(cpustate->data, A,V))
-#define PIC16C62x_In(Port) ((UINT8)memory_read_byte_8le(cpustate->io, (Port)))
-#define PIC16C62x_Out(Port,Value) (memory_write_byte_8le(cpustate->io, (Port),Value))
+#define PIC16C62x_RAM_RDMEM(A) ((UINT8)cpustate->data->read_byte(A))
+#define PIC16C62x_RAM_WRMEM(A,V) (cpustate->data->write_byte(A,V))
+#define PIC16C62x_In(Port) ((UINT8)cpustate->io->read_byte((Port)))
+#define PIC16C62x_Out(Port,Value) (cpustate->io->write_byte((Port),Value))
/************ Read the state of the T0 Clock input signal ************/
-#define PIC16C62x_T0_In (memory_read_byte_8le(cpustate->io, PIC16C62x_T0) >> 4)
+#define PIC16C62x_T0_In (cpustate->io->read_byte(PIC16C62x_T0) >> 4)
#define M_RDRAM(A) (((A) == 0) ? cpustate->internalram[0] : PIC16C62x_RAM_RDMEM(A))
#define M_WRTRAM(A,V) do { if ((A) == 0) cpustate->internalram[0] = (V); else PIC16C62x_RAM_WRMEM(A,V); } while (0)
diff --git a/src/emu/cpu/powerpc/ppc403.c b/src/emu/cpu/powerpc/ppc403.c
index 7fb08c4cf46..3ee47476885 100644
--- a/src/emu/cpu/powerpc/ppc403.c
+++ b/src/emu/cpu/powerpc/ppc403.c
@@ -634,7 +634,7 @@ static void ppc403_spu_w(UINT32 a, UINT8 d)
for (i=0; i < length; i++)
{
- memory_write_byte_32be(ppc.program, ppc.dma[ch].da++, spu_rx_dma_ptr[i]);
+ ppc.program->write_byte(ppc.dma[ch].da++, spu_rx_dma_ptr[i]);
}
}
@@ -809,7 +809,7 @@ static void ppc403_dma_exec(int ch)
int length = ppc.dma[ch].ct;
for( i=0; i < length; i++ ) {
- spu_tx_dma_ptr[i] = memory_read_byte_32be(ppc.program, ppc.dma[ch].da++);
+ spu_tx_dma_ptr[i] = ppc.program->read_byte(ppc.dma[ch].da++);
}
spu_tx_dma_handler(length);
}
@@ -910,7 +910,7 @@ static UINT8 ppc403_read8(address_space *space, UINT32 a)
{
if(a >= 0x40000000 && a <= 0x4000000f) /* Serial Port */
return ppc403_spu_r(a);
- return memory_read_byte_32be(space, a);
+ return space->read_byte(a);
}
#define ppc403_read16 memory_read_word_32be
@@ -923,7 +923,7 @@ static void ppc403_write8(address_space *space, UINT32 a, UINT8 d)
ppc403_spu_w(a, d);
return;
}
- memory_write_byte_32be(space, a, d);
+ space->write_byte(a, d);
}
#define ppc403_write16 memory_write_word_32be
diff --git a/src/emu/cpu/powerpc/ppc_mem.c b/src/emu/cpu/powerpc/ppc_mem.c
index 94f5bd3d7f3..1176d874d81 100644
--- a/src/emu/cpu/powerpc/ppc_mem.c
+++ b/src/emu/cpu/powerpc/ppc_mem.c
@@ -309,56 +309,56 @@ static int ppc_translate_address_cb(int space, offs_t *addr)
static UINT8 ppc_read8_translated(address_space *space, offs_t address)
{
ppc_translate_address(&address, PPC_TRANSLATE_DATA | PPC_TRANSLATE_READ);
- return memory_read_byte_64be(space, address);
+ return space->read_byte(address);
}
static UINT16 ppc_read16_translated(address_space *space, offs_t address)
{
ppc_translate_address(&address, PPC_TRANSLATE_DATA | PPC_TRANSLATE_READ);
- return memory_read_word_64be(space, address);
+ return space->read_word(address);
}
static UINT32 ppc_read32_translated(address_space *space, offs_t address)
{
ppc_translate_address(&address, PPC_TRANSLATE_DATA | PPC_TRANSLATE_READ);
- return memory_read_dword_64be(space, address);
+ return space->read_dword(address);
}
static UINT64 ppc_read64_translated(address_space *space, offs_t address)
{
ppc_translate_address(&address, PPC_TRANSLATE_DATA | PPC_TRANSLATE_READ);
- return memory_read_qword_64be(space, address);
+ return space->read_qword(address);
}
static void ppc_write8_translated(address_space *space, offs_t address, UINT8 data)
{
ppc_translate_address(&address, PPC_TRANSLATE_DATA | PPC_TRANSLATE_WRITE);
- memory_write_byte_64be(space, address, data);
+ space->write_byte(address, data);
}
static void ppc_write16_translated(address_space *space, offs_t address, UINT16 data)
{
ppc_translate_address(&address, PPC_TRANSLATE_DATA | PPC_TRANSLATE_WRITE);
- memory_write_word_64be(space, address, data);
+ space->write_word(address, data);
}
static void ppc_write32_translated(address_space *space, offs_t address, UINT32 data)
{
ppc_translate_address(&address, PPC_TRANSLATE_DATA | PPC_TRANSLATE_WRITE);
- memory_write_dword_64be(space, address, data);
+ space->write_dword(address, data);
}
static void ppc_write64_translated(address_space *space, offs_t address, UINT64 data)
{
ppc_translate_address(&address, PPC_TRANSLATE_DATA | PPC_TRANSLATE_WRITE);
- memory_write_qword_64be(space, address, data);
+ space->write_qword(address, data);
}
#ifndef PPC_DRC
static UINT32 ppc_readop_translated(address_space *space, offs_t address)
{
ppc_translate_address(&address, PPC_TRANSLATE_CODE | PPC_TRANSLATE_READ);
- return memory_read_dword_64be(space, address);
+ return space->read_dword(address);
}
#endif
@@ -385,10 +385,10 @@ static CPU_READOP( ppc )
{
switch(size)
{
- case 1: *value = memory_read_byte(ppc.program, offset); break;
- case 2: *value = memory_read_word(ppc.program, offset); break;
- case 4: *value = memory_read_dword(ppc.program, offset); break;
- case 8: *value = memory_read_qword(ppc.program, offset); break;
+ case 1: *value = ppc.program->read_byte(offset); break;
+ case 2: *value = ppc.program->read_word(offset); break;
+ case 4: *value = ppc.program->read_dword(offset); break;
+ case 8: *value = ppc.program->read_qword(offset); break;
}
}
@@ -406,10 +406,10 @@ static CPU_READ( ppc )
{
switch(size)
{
- case 1: *value = memory_read_byte(ppc.program, offset); break;
- case 2: *value = memory_read_word(ppc.program, offset); break;
- case 4: *value = memory_read_dword(ppc.program, offset); break;
- case 8: *value = memory_read_qword(ppc.program, offset); break;
+ case 1: *value = ppc.program->read_byte(offset); break;
+ case 2: *value = ppc.program->read_word(offset); break;
+ case 4: *value = ppc.program->read_dword(offset); break;
+ case 8: *value = ppc.program->read_qword(offset); break;
}
}
@@ -425,10 +425,10 @@ static CPU_WRITE( ppc )
{
switch(size)
{
- case 1: memory_write_byte(ppc.program, offset, value); break;
- case 2: memory_write_word(ppc.program, offset, value); break;
- case 4: memory_write_dword(ppc.program, offset, value); break;
- case 8: memory_write_qword(ppc.program, offset, value); break;
+ case 1: ppc.program->write_byte(offset, value); break;
+ case 2: ppc.program->write_word(offset, value); break;
+ case 4: ppc.program->write_dword(offset, value); break;
+ case 8: ppc.program->write_qword(offset, value); break;
}
}
diff --git a/src/emu/cpu/powerpc/ppccom.c b/src/emu/cpu/powerpc/ppccom.c
index 2082033eab2..8fc79199cce 100644
--- a/src/emu/cpu/powerpc/ppccom.c
+++ b/src/emu/cpu/powerpc/ppccom.c
@@ -1639,7 +1639,7 @@ static int ppc4xx_dma_fetch_transmit_byte(powerpc_state *ppc, int dmachan, UINT8
return FALSE;
/* fetch the data */
- *byte = memory_read_byte(ppc->program, dmaregs[DCR4XX_DMADA0]++);
+ *byte = ppc->program->read_byte(dmaregs[DCR4XX_DMADA0]++);
ppc4xx_dma_decrement_count(ppc, dmachan);
return TRUE;
}
@@ -1663,7 +1663,7 @@ static int ppc4xx_dma_handle_receive_byte(powerpc_state *ppc, int dmachan, UINT8
return FALSE;
/* store the data */
- memory_write_byte(ppc->program, dmaregs[DCR4XX_DMADA0]++, byte);
+ ppc->program->write_byte(dmaregs[DCR4XX_DMADA0]++, byte);
ppc4xx_dma_decrement_count(ppc, dmachan);
return TRUE;
}
@@ -1716,7 +1716,7 @@ static void ppc4xx_dma_exec(powerpc_state *ppc, int dmachan)
case 1:
do
{
- memory_write_byte(ppc->program, dmaregs[DCR4XX_DMADA0], memory_read_byte(ppc->program, dmaregs[DCR4XX_DMASA0]));
+ ppc->program->write_byte(dmaregs[DCR4XX_DMADA0], ppc->program->read_byte(dmaregs[DCR4XX_DMASA0]));
dmaregs[DCR4XX_DMASA0] += srcinc;
dmaregs[DCR4XX_DMADA0] += destinc;
} while (!ppc4xx_dma_decrement_count(ppc, dmachan));
@@ -1726,7 +1726,7 @@ static void ppc4xx_dma_exec(powerpc_state *ppc, int dmachan)
case 2:
do
{
- memory_write_word(ppc->program, dmaregs[DCR4XX_DMADA0], memory_read_word(ppc->program, dmaregs[DCR4XX_DMASA0]));
+ ppc->program->write_word(dmaregs[DCR4XX_DMADA0], ppc->program->read_word(dmaregs[DCR4XX_DMASA0]));
dmaregs[DCR4XX_DMASA0] += srcinc;
dmaregs[DCR4XX_DMADA0] += destinc;
} while (!ppc4xx_dma_decrement_count(ppc, dmachan));
@@ -1736,7 +1736,7 @@ static void ppc4xx_dma_exec(powerpc_state *ppc, int dmachan)
case 4:
do
{
- memory_write_dword(ppc->program, dmaregs[DCR4XX_DMADA0], memory_read_dword(ppc->program, dmaregs[DCR4XX_DMASA0]));
+ ppc->program->write_dword(dmaregs[DCR4XX_DMADA0], ppc->program->read_dword(dmaregs[DCR4XX_DMASA0]));
dmaregs[DCR4XX_DMASA0] += srcinc;
dmaregs[DCR4XX_DMADA0] += destinc;
} while (!ppc4xx_dma_decrement_count(ppc, dmachan));
@@ -1746,8 +1746,8 @@ static void ppc4xx_dma_exec(powerpc_state *ppc, int dmachan)
case 16:
do
{
- memory_write_qword(ppc->program, dmaregs[DCR4XX_DMADA0], memory_read_qword(ppc->program, dmaregs[DCR4XX_DMASA0]));
- memory_write_qword(ppc->program, dmaregs[DCR4XX_DMADA0] + 8, memory_read_qword(ppc->program, dmaregs[DCR4XX_DMASA0] + 8));
+ ppc->program->write_qword(dmaregs[DCR4XX_DMADA0], ppc->program->read_qword(dmaregs[DCR4XX_DMASA0]));
+ ppc->program->write_qword(dmaregs[DCR4XX_DMADA0] + 8, ppc->program->read_qword(dmaregs[DCR4XX_DMASA0] + 8));
dmaregs[DCR4XX_DMASA0] += srcinc;
dmaregs[DCR4XX_DMADA0] += destinc;
} while (!ppc4xx_dma_decrement_count(ppc, dmachan));
diff --git a/src/emu/cpu/rsp/rsp.c b/src/emu/cpu/rsp/rsp.c
index 3cdea5d8414..62d6362f407 100644
--- a/src/emu/cpu/rsp/rsp.c
+++ b/src/emu/cpu/rsp/rsp.c
@@ -109,7 +109,7 @@ INLINE rsp_state *get_safe_token(running_device *device)
INLINE UINT8 READ8(rsp_state *rsp, UINT32 address)
{
address = 0x04000000 | (address & 0xfff);
- return memory_read_byte_32be(rsp->program, address);
+ return rsp->program->read_byte(address);
}
INLINE UINT16 READ16(rsp_state *rsp, UINT32 address)
@@ -119,10 +119,10 @@ INLINE UINT16 READ16(rsp_state *rsp, UINT32 address)
if (address & 1)
{
//osd_die("RSP: READ16: unaligned %08X at %08X\n", address, rsp->ppc);
- return ((memory_read_byte_32be(rsp->program, address+0) & 0xff) << 8) | (memory_read_byte_32be(rsp->program, address+1) & 0xff);
+ return ((rsp->program->read_byte(address+0) & 0xff) << 8) | (rsp->program->read_byte(address+1) & 0xff);
}
- return memory_read_word_32be(rsp->program, address);
+ return rsp->program->read_word(address);
}
INLINE UINT32 READ32(rsp_state *rsp, UINT32 address)
@@ -132,19 +132,19 @@ INLINE UINT32 READ32(rsp_state *rsp, UINT32 address)
if (address & 3)
{
//osd_die("RSP: READ32: unaligned %08X at %08X\n", address, rsp->ppc);
- return ((memory_read_byte_32be(rsp->program, address + 0) & 0xff) << 24) |
- ((memory_read_byte_32be(rsp->program, address + 1) & 0xff) << 16) |
- ((memory_read_byte_32be(rsp->program, address + 2) & 0xff) << 8) |
- ((memory_read_byte_32be(rsp->program, address + 3) & 0xff) << 0);
+ return ((rsp->program->read_byte(address + 0) & 0xff) << 24) |
+ ((rsp->program->read_byte(address + 1) & 0xff) << 16) |
+ ((rsp->program->read_byte(address + 2) & 0xff) << 8) |
+ ((rsp->program->read_byte(address + 3) & 0xff) << 0);
}
- return memory_read_dword_32be(rsp->program, address);
+ return rsp->program->read_dword(address);
}
INLINE void WRITE8(rsp_state *rsp, UINT32 address, UINT8 data)
{
address = 0x04000000 | (address & 0xfff);
- memory_write_byte_32be(rsp->program, address, data);
+ rsp->program->write_byte(address, data);
}
INLINE void WRITE16(rsp_state *rsp, UINT32 address, UINT16 data)
@@ -154,12 +154,12 @@ INLINE void WRITE16(rsp_state *rsp, UINT32 address, UINT16 data)
if (address & 1)
{
//fatalerror("RSP: WRITE16: unaligned %08X, %04X at %08X\n", address, data, rsp->ppc);
- memory_write_byte_32be(rsp->program, address + 0, (data >> 8) & 0xff);
- memory_write_byte_32be(rsp->program, address + 1, (data >> 0) & 0xff);
+ rsp->program->write_byte(address + 0, (data >> 8) & 0xff);
+ rsp->program->write_byte(address + 1, (data >> 0) & 0xff);
return;
}
- memory_write_word_32be(rsp->program, address, data);
+ rsp->program->write_word(address, data);
}
INLINE void WRITE32(rsp_state *rsp, UINT32 address, UINT32 data)
@@ -169,14 +169,14 @@ INLINE void WRITE32(rsp_state *rsp, UINT32 address, UINT32 data)
if (address & 3)
{
//osd_die("RSP: WRITE32: unaligned %08X, %08X at %08X\n", address, data, rsp->ppc);
- memory_write_byte_32be(rsp->program, address + 0, (data >> 24) & 0xff);
- memory_write_byte_32be(rsp->program, address + 1, (data >> 16) & 0xff);
- memory_write_byte_32be(rsp->program, address + 2, (data >> 8) & 0xff);
- memory_write_byte_32be(rsp->program, address + 3, (data >> 0) & 0xff);
+ rsp->program->write_byte(address + 0, (data >> 24) & 0xff);
+ rsp->program->write_byte(address + 1, (data >> 16) & 0xff);
+ rsp->program->write_byte(address + 2, (data >> 8) & 0xff);
+ rsp->program->write_byte(address + 3, (data >> 0) & 0xff);
return;
}
- memory_write_dword_32be(rsp->program, address, data);
+ rsp->program->write_dword(address, data);
}
/*****************************************************************************/
diff --git a/src/emu/cpu/s2650/s2650.c b/src/emu/cpu/s2650/s2650.c
index cbb811b8d88..b3ebfd47acc 100644
--- a/src/emu/cpu/s2650/s2650.c
+++ b/src/emu/cpu/s2650/s2650.c
@@ -151,7 +151,7 @@ static const int S2650_relative[0x100] =
* RDMEM
* read memory byte from addr
***************************************************************/
-#define RDMEM(addr) memory_read_byte_8le(s2650c->program, addr)
+#define RDMEM(addr) s2650c->program->read_byte(addr)
static void s2650_set_sense(s2650_regs *s2650c, int state);
@@ -161,7 +161,7 @@ INLINE void set_psu(s2650_regs *s2650c, UINT8 new_val)
s2650c->psu = new_val;
if ((new_val ^ old) & FO)
- memory_write_byte_8le(s2650c->io, S2650_FO_PORT, (new_val & FO) ? 1 : 0);
+ s2650c->io->write_byte(S2650_FO_PORT, (new_val & FO) ? 1 : 0);
}
INLINE UINT8 get_sp(s2650_regs *s2650c)
@@ -532,7 +532,7 @@ INLINE UINT8 ARG(s2650_regs *s2650c)
* Store source register to memory addr (CC unchanged)
***************************************************************/
#define M_STR(address,source) \
- memory_write_byte_8le(s2650c->program, address, source)
+ s2650c->program->write_byte(address, source)
/***************************************************************
* M_AND
@@ -677,7 +677,7 @@ INLINE UINT8 ARG(s2650_regs *s2650c)
***************************************************************/
#define M_SPSU() \
{ \
- R0 = ((s2650c->psu & ~PSU34) | (memory_read_byte_8le(s2650c->io, S2650_SENSE_PORT) ? SI : 0)); \
+ R0 = ((s2650c->psu & ~PSU34) | (s2650c->io->read_byte(S2650_SENSE_PORT) ? SI : 0)); \
SET_CC(R0); \
}
@@ -746,7 +746,7 @@ INLINE UINT8 ARG(s2650_regs *s2650c)
#define M_TPSU() \
{ \
UINT8 tpsu = ARG(s2650c); \
- UINT8 rpsu = (s2650c->psu | (memory_read_byte_8le(s2650c->io, S2650_SENSE_PORT) ? SI : 0)); \
+ UINT8 rpsu = (s2650c->psu | (s2650c->io->read_byte(S2650_SENSE_PORT) ? SI : 0)); \
s2650c->psl &= ~CC; \
if( (rpsu & tpsu) != tpsu ) \
s2650c->psl |= 0x80; \
@@ -879,7 +879,7 @@ static int s2650_get_sense(s2650_regs *s2650c)
{
/* OR'd with Input to allow for external connections */
- return (((s2650c->psu & SI) ? 1 : 0) | ((memory_read_byte_8le(s2650c->io, S2650_SENSE_PORT) & SI) ? 1 : 0));
+ return (((s2650c->psu & SI) ? 1 : 0) | ((s2650c->io->read_byte(S2650_SENSE_PORT) & SI) ? 1 : 0));
}
static CPU_EXECUTE( s2650 )
@@ -1018,7 +1018,7 @@ static CPU_EXECUTE( s2650 )
case 0x32: /* REDC,2 */
case 0x33: /* REDC,3 */
s2650c->icount -= 6;
- s2650c->reg[s2650c->r] = memory_read_byte_8le(s2650c->io, S2650_CTRL_PORT);
+ s2650c->reg[s2650c->r] = s2650c->io->read_byte(S2650_CTRL_PORT);
SET_CC( s2650c->reg[s2650c->r] );
break;
@@ -1108,7 +1108,7 @@ static CPU_EXECUTE( s2650 )
case 0x56: /* REDE,2 v */
case 0x57: /* REDE,3 v */
s2650c->icount -= 9;
- s2650c->reg[s2650c->r] = memory_read_byte_8le( s2650c->io, ARG(s2650c) );
+ s2650c->reg[s2650c->r] = s2650c->io->read_byte( ARG(s2650c) );
SET_CC(s2650c->reg[s2650c->r]);
break;
@@ -1167,7 +1167,7 @@ static CPU_EXECUTE( s2650 )
case 0x72: /* REDD,2 */
case 0x73: /* REDD,3 */
s2650c->icount -= 6;
- s2650c->reg[s2650c->r] = memory_read_byte_8le(s2650c->io, S2650_DATA_PORT);
+ s2650c->reg[s2650c->r] = s2650c->io->read_byte(S2650_DATA_PORT);
SET_CC(s2650c->reg[s2650c->r]);
break;
@@ -1323,7 +1323,7 @@ static CPU_EXECUTE( s2650 )
case 0xb2: /* WRTC,2 */
case 0xb3: /* WRTC,3 */
s2650c->icount -= 6;
- memory_write_byte_8le(s2650c->io, S2650_CTRL_PORT,s2650c->reg[s2650c->r]);
+ s2650c->io->write_byte(S2650_CTRL_PORT,s2650c->reg[s2650c->r]);
break;
case 0xb4: /* TPSU */
@@ -1409,7 +1409,7 @@ static CPU_EXECUTE( s2650 )
case 0xd6: /* WRTE,2 v */
case 0xd7: /* WRTE,3 v */
s2650c->icount -= 9;
- memory_write_byte_8le( s2650c->io, ARG(s2650c), s2650c->reg[s2650c->r] );
+ s2650c->io->write_byte( ARG(s2650c), s2650c->reg[s2650c->r] );
break;
case 0xd8: /* BIRR,0 (*)a */
@@ -1467,7 +1467,7 @@ static CPU_EXECUTE( s2650 )
case 0xf2: /* WRTD,2 */
case 0xf3: /* WRTD,3 */
s2650c->icount -= 6;
- memory_write_byte_8le(s2650c->io, S2650_DATA_PORT, s2650c->reg[s2650c->r]);
+ s2650c->io->write_byte(S2650_DATA_PORT, s2650c->reg[s2650c->r]);
break;
case 0xf4: /* TMI,0 v */
diff --git a/src/emu/cpu/saturn/satops.c b/src/emu/cpu/saturn/satops.c
index b42a23171b3..3d4d98c6b3c 100644
--- a/src/emu/cpu/saturn/satops.c
+++ b/src/emu/cpu/saturn/satops.c
@@ -78,7 +78,7 @@ INLINE int READ_NIBBLE(saturn_state *cpustate, SaturnAdr adr)
{
UINT8 data;
cpustate->icount-=3;
- data=memory_read_byte(cpustate->program, adr&0xfffff);
+ data=cpustate->program->read_byte(adr&0xfffff);
saturn_assert(data<0x10);
if (cpustate->config&&cpustate->config->crc) cpustate->config->crc(cpustate->device, adr&0xfffff, data);
return data;
@@ -108,7 +108,7 @@ INLINE void WRITE_NIBBLE(saturn_state *cpustate, SaturnAdr adr, SaturnNib nib)
{
cpustate->icount-=3;
saturn_assert(nib<0x10);
- memory_write_byte(cpustate->program, adr&0xfffff,nib);
+ cpustate->program->write_byte(adr&0xfffff,nib);
}
#define BEGIN_B 0
diff --git a/src/emu/cpu/sc61860/scops.c b/src/emu/cpu/sc61860/scops.c
index a9395b42a72..49fdc6260ce 100644
--- a/src/emu/cpu/sc61860/scops.c
+++ b/src/emu/cpu/sc61860/scops.c
@@ -45,12 +45,12 @@ INLINE UINT16 READ_OP_ARG_WORD(sc61860_state *cpustate)
INLINE UINT8 READ_BYTE(sc61860_state *cpustate, UINT16 adr)
{
- return memory_read_byte(cpustate->program, adr);
+ return cpustate->program->read_byte(adr);
}
INLINE void WRITE_BYTE(sc61860_state *cpustate, UINT16 a,UINT8 v)
{
- memory_write_byte(cpustate->program, a,v);
+ cpustate->program->write_byte(a,v);
}
#define PUSH(v) cpustate->ram[--cpustate->r]=v
diff --git a/src/emu/cpu/scmp/scmp.c b/src/emu/cpu/scmp/scmp.c
index 73dd02b46a7..2dfe6762e84 100644
--- a/src/emu/cpu/scmp/scmp.c
+++ b/src/emu/cpu/scmp/scmp.c
@@ -81,12 +81,12 @@ INLINE UINT8 ARG(scmp_state *cpustate)
INLINE UINT8 RM(scmp_state *cpustate,UINT32 a)
{
- return memory_read_byte_8le(cpustate->program, a);
+ return cpustate->program->read_byte(a);
}
INLINE void WM(scmp_state *cpustate,UINT32 a, UINT8 v)
{
- memory_write_byte_8le(cpustate->program, a, v);
+ cpustate->program->write_byte(a, v);
}
INLINE void illegal(scmp_state *cpustate,UINT8 opcode)
diff --git a/src/emu/cpu/se3208/se3208.c b/src/emu/cpu/se3208/se3208.c
index f1d0418e258..be7cda647e1 100644
--- a/src/emu/cpu/se3208/se3208.c
+++ b/src/emu/cpu/se3208/se3208.c
@@ -68,31 +68,31 @@ INLINE se3208_state_t *get_safe_token(running_device *device)
INLINE UINT32 read_dword_unaligned(address_space *space, UINT32 address)
{
if (address & 3)
- return memory_read_byte_32le(space,address) | memory_read_byte_32le(space,address+1)<<8 | memory_read_byte_32le(space,address+2)<<16 | memory_read_byte_32le(space,address+3)<<24;
+ return space->read_byte(address) | space->read_byte(address+1)<<8 | space->read_byte(address+2)<<16 | space->read_byte(address+3)<<24;
else
- return memory_read_dword_32le(space,address);
+ return space->read_dword(address);
}
INLINE UINT16 read_word_unaligned(address_space *space, UINT32 address)
{
if (address & 1)
- return memory_read_byte_32le(space,address) | memory_read_byte_32le(space,address+1)<<8;
+ return space->read_byte(address) | space->read_byte(address+1)<<8;
else
- return memory_read_word_32le(space,address);
+ return space->read_word(address);
}
INLINE void write_dword_unaligned(address_space *space, UINT32 address, UINT32 data)
{
if (address & 3)
{
- memory_write_byte_32le(space, address, data & 0xff);
- memory_write_byte_32le(space, address+1, (data>>8)&0xff);
- memory_write_byte_32le(space, address+2, (data>>16)&0xff);
- memory_write_byte_32le(space, address+3, (data>>24)&0xff);
+ space->write_byte(address, data & 0xff);
+ space->write_byte(address+1, (data>>8)&0xff);
+ space->write_byte(address+2, (data>>16)&0xff);
+ space->write_byte(address+3, (data>>24)&0xff);
}
else
{
- memory_write_dword_32le(space, address, data);
+ space->write_dword(address, data);
}
}
@@ -100,19 +100,19 @@ INLINE void write_word_unaligned(address_space *space, UINT32 address, UINT16 da
{
if (address & 1)
{
- memory_write_byte_32le(space, address, data & 0xff);
- memory_write_byte_32le(space, address+1, (data>>8)&0xff);
+ space->write_byte(address, data & 0xff);
+ space->write_byte(address+1, (data>>8)&0xff);
}
else
{
- memory_write_word_32le(space, address, data);
+ space->write_word(address, data);
}
}
INLINE UINT8 SE3208_Read8(se3208_state_t *se3208_state, UINT32 addr)
{
- return memory_read_byte_32le(se3208_state->program,addr);
+ return se3208_state->program->read_byte(addr);
}
INLINE UINT16 SE3208_Read16(se3208_state_t *se3208_state, UINT32 addr)
@@ -127,7 +127,7 @@ INLINE UINT32 SE3208_Read32(se3208_state_t *se3208_state, UINT32 addr)
INLINE void SE3208_Write8(se3208_state_t *se3208_state, UINT32 addr,UINT8 val)
{
- memory_write_byte_32le(se3208_state->program,addr,val);
+ se3208_state->program->write_byte(addr,val);
}
INLINE void SE3208_Write16(se3208_state_t *se3208_state, UINT32 addr,UINT16 val)
diff --git a/src/emu/cpu/sh2/sh2.c b/src/emu/cpu/sh2/sh2.c
index 747a49d8b3b..1a60aa88332 100644
--- a/src/emu/cpu/sh2/sh2.c
+++ b/src/emu/cpu/sh2/sh2.c
@@ -131,12 +131,12 @@ INLINE UINT8 RB(sh2_state *sh2, offs_t A)
return sh2_internal_r(sh2->internal, (A & 0x1fc)>>2, 0xff << (((~A) & 3)*8)) >> (((~A) & 3)*8);
if (A >= 0xc0000000)
- return memory_read_byte_32be(sh2->program, A);
+ return sh2->program->read_byte(A);
if (A >= 0x40000000)
return 0xa5;
- return memory_read_byte_32be(sh2->program, A & AM);
+ return sh2->program->read_byte(A & AM);
}
INLINE UINT16 RW(sh2_state *sh2, offs_t A)
@@ -145,12 +145,12 @@ INLINE UINT16 RW(sh2_state *sh2, offs_t A)
return sh2_internal_r(sh2->internal, (A & 0x1fc)>>2, 0xffff << (((~A) & 2)*8)) >> (((~A) & 2)*8);
if (A >= 0xc0000000)
- return memory_read_word_32be(sh2->program, A);
+ return sh2->program->read_word(A);
if (A >= 0x40000000)
return 0xa5a5;
- return memory_read_word_32be(sh2->program, A & AM);
+ return sh2->program->read_word(A & AM);
}
INLINE UINT32 RL(sh2_state *sh2, offs_t A)
@@ -159,12 +159,12 @@ INLINE UINT32 RL(sh2_state *sh2, offs_t A)
return sh2_internal_r(sh2->internal, (A & 0x1fc)>>2, 0xffffffff);
if (A >= 0xc0000000)
- return memory_read_dword_32be(sh2->program, A);
+ return sh2->program->read_dword(A);
if (A >= 0x40000000)
return 0xa5a5a5a5;
- return memory_read_dword_32be(sh2->program, A & AM);
+ return sh2->program->read_dword(A & AM);
}
INLINE void WB(sh2_state *sh2, offs_t A, UINT8 V)
@@ -178,14 +178,14 @@ INLINE void WB(sh2_state *sh2, offs_t A, UINT8 V)
if (A >= 0xc0000000)
{
- memory_write_byte_32be(sh2->program, A,V);
+ sh2->program->write_byte(A,V);
return;
}
if (A >= 0x40000000)
return;
- memory_write_byte_32be(sh2->program, A & AM,V);
+ sh2->program->write_byte(A & AM,V);
}
INLINE void WW(sh2_state *sh2, offs_t A, UINT16 V)
@@ -198,14 +198,14 @@ INLINE void WW(sh2_state *sh2, offs_t A, UINT16 V)
if (A >= 0xc0000000)
{
- memory_write_word_32be(sh2->program, A,V);
+ sh2->program->write_word(A,V);
return;
}
if (A >= 0x40000000)
return;
- memory_write_word_32be(sh2->program, A & AM,V);
+ sh2->program->write_word(A & AM,V);
}
INLINE void WL(sh2_state *sh2, offs_t A, UINT32 V)
@@ -218,14 +218,14 @@ INLINE void WL(sh2_state *sh2, offs_t A, UINT32 V)
if (A >= 0xc0000000)
{
- memory_write_dword_32be(sh2->program, A,V);
+ sh2->program->write_dword(A,V);
return;
}
if (A >= 0x40000000)
return;
- memory_write_dword_32be(sh2->program, A & AM,V);
+ sh2->program->write_dword(A & AM,V);
}
/* code cycles t-bit
diff --git a/src/emu/cpu/sh2/sh2comn.c b/src/emu/cpu/sh2/sh2comn.c
index 1ed0c4b511d..f4e1cc8f5b3 100644
--- a/src/emu/cpu/sh2/sh2comn.c
+++ b/src/emu/cpu/sh2/sh2comn.c
@@ -30,12 +30,12 @@ INLINE UINT32 RL(sh2_state *sh2, offs_t A)
return sh2_internal_r(sh2->internal, (A & 0x1fc)>>2, 0xffffffff);
if (A >= 0xc0000000)
- return memory_read_dword_32be(sh2->program, A);
+ return sh2->program->read_dword(A);
if (A >= 0x40000000)
return 0xa5a5a5a5;
- return memory_read_dword_32be(sh2->program, A & AM);
+ return sh2->program->read_dword(A & AM);
}
INLINE void WL(sh2_state *sh2, offs_t A, UINT32 V)
@@ -48,14 +48,14 @@ INLINE void WL(sh2_state *sh2, offs_t A, UINT32 V)
if (A >= 0xc0000000)
{
- memory_write_dword_32be(sh2->program, A,V);
+ sh2->program->write_dword(A,V);
return;
}
if (A >= 0x40000000)
return;
- memory_write_dword_32be(sh2->program, A & AM,V);
+ sh2->program->write_dword(A & AM,V);
}
static void sh2_timer_resync(sh2_state *sh2)
@@ -185,9 +185,9 @@ static void sh2_dmac_check(sh2_state *sh2, int dma)
if(incd == 2)
dst --;
- dmadata = memory_read_byte_32be(sh2->program, src);
+ dmadata = sh2->program->read_byte(src);
if (sh2->dma_callback_kludge) dmadata = sh2->dma_callback_kludge(src, dst, dmadata, size);
- memory_write_byte_32be(sh2->program, dst, dmadata);
+ sh2->program->write_byte(dst, dmadata);
if(incs == 1)
src ++;
@@ -207,9 +207,9 @@ static void sh2_dmac_check(sh2_state *sh2, int dma)
dst -= 2;
// check: should this really be using read_word_32 / write_word_32?
- dmadata = memory_read_word_32be(sh2->program, src);
+ dmadata = sh2->program->read_word(src);
if (sh2->dma_callback_kludge) dmadata = sh2->dma_callback_kludge(src, dst, dmadata, size);
- memory_write_word_32be(sh2->program, dst, dmadata);
+ sh2->program->write_word(dst, dmadata);
if(incs == 1)
src += 2;
@@ -227,9 +227,9 @@ static void sh2_dmac_check(sh2_state *sh2, int dma)
if(incd == 2)
dst -= 4;
- dmadata = memory_read_dword_32be(sh2->program, src);
+ dmadata = sh2->program->read_dword(src);
if (sh2->dma_callback_kludge) dmadata = sh2->dma_callback_kludge(src, dst, dmadata, size);
- memory_write_dword_32be(sh2->program, dst, dmadata);
+ sh2->program->write_dword(dst, dmadata);
if(incs == 1)
src += 4;
@@ -247,21 +247,21 @@ static void sh2_dmac_check(sh2_state *sh2, int dma)
if(incd == 2)
dst -= 16;
- dmadata = memory_read_dword_32be(sh2->program, src);
+ dmadata = sh2->program->read_dword(src);
if (sh2->dma_callback_kludge) dmadata = sh2->dma_callback_kludge(src, dst, dmadata, size);
- memory_write_dword_32be(sh2->program, dst, dmadata);
+ sh2->program->write_dword(dst, dmadata);
- dmadata = memory_read_dword_32be(sh2->program, src+4);
+ dmadata = sh2->program->read_dword(src+4);
if (sh2->dma_callback_kludge) dmadata = sh2->dma_callback_kludge(src, dst, dmadata, size);
- memory_write_dword_32be(sh2->program, dst+4, dmadata);
+ sh2->program->write_dword(dst+4, dmadata);
- dmadata = memory_read_dword_32be(sh2->program, src+8);
+ dmadata = sh2->program->read_dword(src+8);
if (sh2->dma_callback_kludge) dmadata = sh2->dma_callback_kludge(src, dst, dmadata, size);
- memory_write_dword_32be(sh2->program, dst+8, dmadata);
+ sh2->program->write_dword(dst+8, dmadata);
- dmadata = memory_read_dword_32be(sh2->program, src+12);
+ dmadata = sh2->program->read_dword(src+12);
if (sh2->dma_callback_kludge) dmadata = sh2->dma_callback_kludge(src, dst, dmadata, size);
- memory_write_dword_32be(sh2->program, dst+12, dmadata);
+ sh2->program->write_dword(dst+12, dmadata);
src += 16;
if(incd == 1)
diff --git a/src/emu/cpu/sh2/sh2drc.c b/src/emu/cpu/sh2/sh2drc.c
index d7626db72cb..53440dce6ef 100644
--- a/src/emu/cpu/sh2/sh2drc.c
+++ b/src/emu/cpu/sh2/sh2drc.c
@@ -151,9 +151,9 @@ INLINE UINT16 RW(sh2_state *sh2, offs_t A)
return sh2_internal_r(sh2->internal, (A & 0x1fc)>>2, 0xffff << (((~A) & 2)*8)) >> (((~A) & 2)*8);
if (A >= 0xc0000000)
- return memory_read_word_32be(sh2->program, A);
+ return sh2->program->read_word(A);
- return memory_read_word_32be(sh2->program, A & AM);
+ return sh2->program->read_word(A & AM);
}
INLINE UINT32 RL(sh2_state *sh2, offs_t A)
@@ -162,9 +162,9 @@ INLINE UINT32 RL(sh2_state *sh2, offs_t A)
return sh2_internal_r(sh2->internal, (A & 0x1fc)>>2, 0xffffffff);
if (A >= 0xc0000000)
- return memory_read_dword_32be(sh2->program, A);
+ return sh2->program->read_dword(A);
- return memory_read_dword_32be(sh2->program, A & AM);
+ return sh2->program->read_dword(A & AM);
}
/*-------------------------------------------------
@@ -827,8 +827,8 @@ static CPU_RESET( sh2 )
sh2->m = m;
memset(sh2->m, 0, 0x200);
- sh2->pc = memory_read_dword_32be(sh2->program, 0);
- sh2->r[15] = memory_read_dword_32be(sh2->program, 4);
+ sh2->pc = sh2->program->read_dword(0);
+ sh2->r[15] = sh2->program->read_dword(4);
sh2->sr = I;
sh2->internal_irq_level = -1;
diff --git a/src/emu/cpu/sh4/sh4.c b/src/emu/cpu/sh4/sh4.c
index d7e1784cd4f..c675be750ff 100644
--- a/src/emu/cpu/sh4/sh4.c
+++ b/src/emu/cpu/sh4/sh4.c
@@ -126,9 +126,9 @@ INLINE UINT8 RB(sh4_state *sh4, offs_t A)
return sh4_internal_r(sh4->internal, ((A & 0x0fc) >> 2) | ((A & 0x1fe0000) >> 11), 0xff << ((A & 3)*8)) >> ((A & 3)*8);
if (A >= 0xe0000000)
- return memory_read_byte_64le(sh4->program, A);
+ return sh4->program->read_byte(A);
- return memory_read_byte_64le(sh4->program, A & AM);
+ return sh4->program->read_byte(A & AM);
}
INLINE UINT16 RW(sh4_state *sh4, offs_t A)
@@ -137,9 +137,9 @@ INLINE UINT16 RW(sh4_state *sh4, offs_t A)
return sh4_internal_r(sh4->internal, ((A & 0x0fc) >> 2) | ((A & 0x1fe0000) >> 11), 0xffff << ((A & 2)*8)) >> ((A & 2)*8);
if (A >= 0xe0000000)
- return memory_read_word_64le(sh4->program, A);
+ return sh4->program->read_word(A);
- return memory_read_word_64le(sh4->program, A & AM);
+ return sh4->program->read_word(A & AM);
}
INLINE UINT32 RL(sh4_state *sh4, offs_t A)
@@ -148,9 +148,9 @@ INLINE UINT32 RL(sh4_state *sh4, offs_t A)
return sh4_internal_r(sh4->internal, ((A & 0x0fc) >> 2) | ((A & 0x1fe0000) >> 11), 0xffffffff);
if (A >= 0xe0000000)
- return memory_read_dword_64le(sh4->program, A);
+ return sh4->program->read_dword(A);
- return memory_read_dword_64le(sh4->program, A & AM);
+ return sh4->program->read_dword(A & AM);
}
INLINE void WB(sh4_state *sh4, offs_t A, UINT8 V)
@@ -164,11 +164,11 @@ INLINE void WB(sh4_state *sh4, offs_t A, UINT8 V)
if (A >= 0xe0000000)
{
- memory_write_byte_64le(sh4->program, A,V);
+ sh4->program->write_byte(A,V);
return;
}
- memory_write_byte_64le(sh4->program, A & AM,V);
+ sh4->program->write_byte(A & AM,V);
}
INLINE void WW(sh4_state *sh4, offs_t A, UINT16 V)
@@ -181,11 +181,11 @@ INLINE void WW(sh4_state *sh4, offs_t A, UINT16 V)
if (A >= 0xe0000000)
{
- memory_write_word_64le(sh4->program, A,V);
+ sh4->program->write_word(A,V);
return;
}
- memory_write_word_64le(sh4->program, A & AM,V);
+ sh4->program->write_word(A & AM,V);
}
INLINE void WL(sh4_state *sh4, offs_t A, UINT32 V)
@@ -198,14 +198,14 @@ INLINE void WL(sh4_state *sh4, offs_t A, UINT32 V)
if (A >= 0xe0000000)
{
- memory_write_dword_64le(sh4->program, A,V);
+ sh4->program->write_dword(A,V);
return;
}
/* if (A >= 0x40000000)
return;*/
- memory_write_dword_64le(sh4->program, A & AM,V);
+ sh4->program->write_dword(A & AM,V);
}
/* code cycles t-bit
@@ -2129,7 +2129,7 @@ INLINE void PREFM(sh4_state *sh4, UINT32 n)
for (a = 0;a < 4;a++)
{
// shouldn't be causing a memory read, should store sq writes in registers.
- memory_write_qword_64le(sh4->program, dest, memory_read_qword_64le(sh4->program, addr));
+ sh4->program->write_qword(dest, sh4->program->read_qword(addr));
addr += 8;
dest += 8;
}
diff --git a/src/emu/cpu/sh4/sh4comn.c b/src/emu/cpu/sh4/sh4comn.c
index 18ec0ae9b2a..8d58e0b899d 100644
--- a/src/emu/cpu/sh4/sh4comn.c
+++ b/src/emu/cpu/sh4/sh4comn.c
@@ -480,7 +480,7 @@ static int sh4_dma_transfer(sh4_state *sh4, int channel, int timermode, UINT32 c
src --;
if(incd == 2)
dst --;
- memory_write_byte_64le(sh4->program, dst, memory_read_byte_64le(sh4->program, src));
+ sh4->program->write_byte(dst, sh4->program->read_byte(src));
if(incs == 1)
src ++;
if(incd == 1)
@@ -496,7 +496,7 @@ static int sh4_dma_transfer(sh4_state *sh4, int channel, int timermode, UINT32 c
src -= 2;
if(incd == 2)
dst -= 2;
- memory_write_word_64le(sh4->program, dst, memory_read_word_64le(sh4->program, src));
+ sh4->program->write_word(dst, sh4->program->read_word(src));
if(incs == 1)
src += 2;
if(incd == 1)
@@ -512,7 +512,7 @@ static int sh4_dma_transfer(sh4_state *sh4, int channel, int timermode, UINT32 c
src -= 8;
if(incd == 2)
dst -= 8;
- memory_write_qword_64le(sh4->program, dst, memory_read_qword_64le(sh4->program, src));
+ sh4->program->write_qword(dst, sh4->program->read_qword(src));
if(incs == 1)
src += 8;
if(incd == 1)
@@ -529,7 +529,7 @@ static int sh4_dma_transfer(sh4_state *sh4, int channel, int timermode, UINT32 c
src -= 4;
if(incd == 2)
dst -= 4;
- memory_write_dword_64le(sh4->program, dst, memory_read_dword_64le(sh4->program, src));
+ sh4->program->write_dword(dst, sh4->program->read_dword(src));
if(incs == 1)
src += 4;
if(incd == 1)
@@ -546,10 +546,10 @@ static int sh4_dma_transfer(sh4_state *sh4, int channel, int timermode, UINT32 c
src -= 32;
if(incd == 2)
dst -= 32;
- memory_write_qword_64le(sh4->program, dst, memory_read_qword_64le(sh4->program, src));
- memory_write_qword_64le(sh4->program, dst+8, memory_read_qword_64le(sh4->program, src+8));
- memory_write_qword_64le(sh4->program, dst+16, memory_read_qword_64le(sh4->program, src+16));
- memory_write_qword_64le(sh4->program, dst+24, memory_read_qword_64le(sh4->program, src+24));
+ sh4->program->write_qword(dst, sh4->program->read_qword(src));
+ sh4->program->write_qword(dst+8, sh4->program->read_qword(src+8));
+ sh4->program->write_qword(dst+16, sh4->program->read_qword(src+16));
+ sh4->program->write_qword(dst+24, sh4->program->read_qword(src+24));
if(incs == 1)
src += 32;
if(incd == 1)
@@ -910,11 +910,11 @@ WRITE32_HANDLER( sh4_internal_w )
sh4->ioport16_direction &= 0xffff;
sh4->ioport16_pullup = (sh4->ioport16_pullup | sh4->ioport16_direction) ^ 0xffff;
if (sh4->m[BCR2] & 1)
- memory_write_dword_64le(sh4->io, SH4_IOPORT_16, (UINT64)(sh4->m[PDTRA] & sh4->ioport16_direction) | ((UINT64)sh4->m[PCTRA] << 16));
+ sh4->io->write_dword(SH4_IOPORT_16, (UINT64)(sh4->m[PDTRA] & sh4->ioport16_direction) | ((UINT64)sh4->m[PCTRA] << 16));
break;
case PDTRA:
if (sh4->m[BCR2] & 1)
- memory_write_dword_64le(sh4->io, SH4_IOPORT_16, (UINT64)(sh4->m[PDTRA] & sh4->ioport16_direction) | ((UINT64)sh4->m[PCTRA] << 16));
+ sh4->io->write_dword(SH4_IOPORT_16, (UINT64)(sh4->m[PDTRA] & sh4->ioport16_direction) | ((UINT64)sh4->m[PCTRA] << 16));
break;
case PCTRB:
sh4->ioport4_pullup = 0;
@@ -926,11 +926,11 @@ WRITE32_HANDLER( sh4_internal_w )
sh4->ioport4_direction &= 0xf;
sh4->ioport4_pullup = (sh4->ioport4_pullup | sh4->ioport4_direction) ^ 0xf;
if (sh4->m[BCR2] & 1)
- memory_write_dword_64le(sh4->io, SH4_IOPORT_4, (sh4->m[PDTRB] & sh4->ioport4_direction) | (sh4->m[PCTRB] << 16));
+ sh4->io->write_dword(SH4_IOPORT_4, (sh4->m[PDTRB] & sh4->ioport4_direction) | (sh4->m[PCTRB] << 16));
break;
case PDTRB:
if (sh4->m[BCR2] & 1)
- memory_write_dword_64le(sh4->io, SH4_IOPORT_4, (sh4->m[PDTRB] & sh4->ioport4_direction) | (sh4->m[PCTRB] << 16));
+ sh4->io->write_dword(SH4_IOPORT_4, (sh4->m[PDTRB] & sh4->ioport4_direction) | (sh4->m[PCTRB] << 16));
break;
case SCBRR2:
@@ -981,11 +981,11 @@ READ32_HANDLER( sh4_internal_r )
// I/O ports
case PDTRA:
if (sh4->m[BCR2] & 1)
- return (memory_read_dword_64le(sh4->io, SH4_IOPORT_16) & ~sh4->ioport16_direction) | (sh4->m[PDTRA] & sh4->ioport16_direction);
+ return (sh4->io->read_dword(SH4_IOPORT_16) & ~sh4->ioport16_direction) | (sh4->m[PDTRA] & sh4->ioport16_direction);
break;
case PDTRB:
if (sh4->m[BCR2] & 1)
- return (memory_read_dword_64le(sh4->io, SH4_IOPORT_4) & ~sh4->ioport4_direction) | (sh4->m[PDTRB] & sh4->ioport4_direction);
+ return (sh4->io->read_dword(SH4_IOPORT_4) & ~sh4->ioport4_direction) | (sh4->m[PDTRB] & sh4->ioport4_direction);
break;
// SCIF (UART with FIFO)
@@ -1278,7 +1278,7 @@ void sh4_dma_ddt(running_device *device, struct sh4_ddt_dma *s)
len = s->length;
p32bits = (UINT32 *)(s->buffer);
for (pos = 0;pos < len;pos++) {
- *p32bits = memory_read_dword_64le(sh4->program, s->source);
+ *p32bits = sh4->program->read_dword(s->source);
p32bits++;
s->source = s->source + 4;
}
@@ -1286,7 +1286,7 @@ void sh4_dma_ddt(running_device *device, struct sh4_ddt_dma *s)
len = s->length;
p32bits = (UINT32 *)(s->buffer);
for (pos = 0;pos < len;pos++) {
- memory_write_dword_64le(sh4->program, s->destination, *p32bits);
+ sh4->program->write_dword(s->destination, *p32bits);
p32bits++;
s->destination = s->destination + 4;
}
@@ -1297,7 +1297,7 @@ void sh4_dma_ddt(running_device *device, struct sh4_ddt_dma *s)
len = s->length * 4;
p32bytes = (UINT64 *)(s->buffer);
for (pos = 0;pos < len;pos++) {
- *p32bytes = memory_read_qword_64le(sh4->program, s->source);
+ *p32bytes = sh4->program->read_qword(s->source);
p32bytes++;
s->destination = s->destination + 8;
}
@@ -1305,7 +1305,7 @@ void sh4_dma_ddt(running_device *device, struct sh4_ddt_dma *s)
len = s->length * 4;
p32bytes = (UINT64 *)(s->buffer);
for (pos = 0;pos < len;pos++) {
- memory_write_qword_64le(sh4->program, s->destination, *p32bytes);
+ sh4->program->write_qword(s->destination, *p32bytes);
p32bytes++;
s->destination = s->destination + 8;
}
diff --git a/src/emu/cpu/sharc/sharcmem.c b/src/emu/cpu/sharc/sharcmem.c
index 3b275f06be5..79d8f3679a1 100644
--- a/src/emu/cpu/sharc/sharcmem.c
+++ b/src/emu/cpu/sharc/sharcmem.c
@@ -153,7 +153,7 @@ static UINT32 dm_read32(SHARC_REGS *cpustate, UINT32 address)
}
}
- return memory_read_dword_32le(cpustate->data, address << 2);
+ return cpustate->data->read_dword(address << 2);
}
static void dm_write32(SHARC_REGS *cpustate, UINT32 address, UINT32 data)
@@ -198,5 +198,5 @@ static void dm_write32(SHARC_REGS *cpustate, UINT32 address, UINT32 data)
return;
}
- memory_write_dword_32le(cpustate->data, address << 2, data);
+ cpustate->data->write_dword(address << 2, data);
}
diff --git a/src/emu/cpu/sm8500/sm8500.c b/src/emu/cpu/sm8500/sm8500.c
index e548591b584..77a088d24b3 100644
--- a/src/emu/cpu/sm8500/sm8500.c
+++ b/src/emu/cpu/sm8500/sm8500.c
@@ -68,14 +68,14 @@ static const UINT8 sm8500_b2w[8] = {
};
static UINT8 sm85cpu_mem_readbyte( sm8500_state *cpustate, UINT32 offset ) {
- return ( offset < 0x10 ) ? cpustate->register_base[offset] : memory_read_byte_8be( cpustate->program, offset );
+ return ( offset < 0x10 ) ? cpustate->register_base[offset] : cpustate->program->read_byte( offset );
}
static void sm85cpu_mem_writebyte( sm8500_state *cpustate, UINT32 offset, UINT8 data ) {
if ( offset < 0x10 ) {
cpustate->register_base[offset] = data;
} else {
- memory_write_byte_8be( cpustate->program, offset, data );
+ cpustate->program->write_byte( offset, data );
}
}
diff --git a/src/emu/cpu/spc700/spc700.c b/src/emu/cpu/spc700/spc700.c
index 57056ca2679..d7ba987db56 100644
--- a/src/emu/cpu/spc700/spc700.c
+++ b/src/emu/cpu/spc700/spc700.c
@@ -247,15 +247,15 @@ INLINE int MAKE_INT_8(int A) {return (A & 0x80) ? A | ~0xff : A & 0xff;}
/* ================================= MAME ================================= */
/* ======================================================================== */
-#define spc700_read_8(addr) memory_read_byte_8le(cpustate->program,addr)
-#define spc700_write_8(addr,data) memory_write_byte_8le(cpustate->program,addr,data)
+#define spc700_read_8(addr) cpustate->program->read_byte(addr)
+#define spc700_write_8(addr,data) cpustate->program->write_byte(addr,data)
#define spc700_read_8_direct(A) spc700_read_8(A)
#define spc700_write_8_direct(A, V) spc700_write_8(A, V)
//#define spc700_read_instruction(A) memory_decrypted_read_byte(cpustate->program,A)
//#define spc700_read_8_immediate(A) memory_raw_read_byte(cpustate->program,A)
-#define spc700_read_instruction(A) memory_read_byte_8le(cpustate->program,A)
-#define spc700_read_8_immediate(A) memory_read_byte_8le(cpustate->program,A)
+#define spc700_read_instruction(A) cpustate->program->read_byte(A)
+#define spc700_read_8_immediate(A) cpustate->program->read_byte(A)
#define spc700_jumping(A)
#define spc700_branching(A)
diff --git a/src/emu/cpu/ssem/ssem.c b/src/emu/cpu/ssem/ssem.c
index 13cdd4f9420..78352f52cdc 100644
--- a/src/emu/cpu/ssem/ssem.c
+++ b/src/emu/cpu/ssem/ssem.c
@@ -67,10 +67,10 @@ INLINE UINT32 READ32(ssem_state *cpustate, UINT32 address)
// the address value to get the appropriate byte index.
address <<= 2;
- v |= memory_read_byte(cpustate->program, address + 0) << 24;
- v |= memory_read_byte(cpustate->program, address + 1) << 16;
- v |= memory_read_byte(cpustate->program, address + 2) << 8;
- v |= memory_read_byte(cpustate->program, address + 3) << 0;
+ v |= cpustate->program->read_byte(address + 0) << 24;
+ v |= cpustate->program->read_byte(address + 1) << 16;
+ v |= cpustate->program->read_byte(address + 2) << 8;
+ v |= cpustate->program->read_byte(address + 3) << 0;
return reverse(v);
}
@@ -84,10 +84,10 @@ INLINE void WRITE32(ssem_state *cpustate, UINT32 address, UINT32 data)
// the address value to get the appropriate byte index.
address <<= 2;
- memory_write_byte(cpustate->program, address + 0, (v >> 24) & 0x000000ff);
- memory_write_byte(cpustate->program, address + 1, (v >> 16) & 0x000000ff);
- memory_write_byte(cpustate->program, address + 2, (v >> 8) & 0x000000ff);
- memory_write_byte(cpustate->program, address + 3, (v >> 0) & 0x000000ff);
+ cpustate->program->write_byte(address + 0, (v >> 24) & 0x000000ff);
+ cpustate->program->write_byte(address + 1, (v >> 16) & 0x000000ff);
+ cpustate->program->write_byte(address + 2, (v >> 8) & 0x000000ff);
+ cpustate->program->write_byte(address + 3, (v >> 0) & 0x000000ff);
return;
}
@@ -130,7 +130,7 @@ static void unimplemented_opcode(ssem_state *cpustate, UINT32 op)
{
for( i = 0; i < 0x80; i++ )
{
- fputc(memory_read_byte_32be(cpustate->program, i), store);
+ fputc(cpustate->program->read_byte(i), store);
}
fclose(store);
}
diff --git a/src/emu/cpu/ssp1601/ssp1601.c b/src/emu/cpu/ssp1601/ssp1601.c
index c9b48337b89..b80e44d7c7b 100644
--- a/src/emu/cpu/ssp1601/ssp1601.c
+++ b/src/emu/cpu/ssp1601/ssp1601.c
@@ -84,7 +84,7 @@ INLINE ssp1601_state_t *get_safe_token(running_device *device)
#define PPC ssp1601_state->ppc.w.h
#define FETCH() memory_decrypted_read_word(ssp1601_state->program, rPC++ << 1)
-#define PROGRAM_WORD(a) memory_read_word(ssp1601_state->program, (a) << 1)
+#define PROGRAM_WORD(a) ssp1601_state->program->read_word((a) << 1)
#define GET_PPC_OFFS() PPC
#define REG_READ(ssp1601_state,r) (((r) <= 4) ? ssp1601_state->gr[r].w.h : reg_read_handlers[r](ssp1601_state, r))
@@ -255,13 +255,13 @@ static void write_unknown(ssp1601_state_t *ssp1601_state, int reg, UINT32 d)
static UINT32 read_ext(ssp1601_state_t *ssp1601_state, int reg)
{
reg &= 7;
- return memory_read_word_16be(ssp1601_state->io, (reg << 1));
+ return ssp1601_state->io->read_word((reg << 1));
}
static void write_ext(ssp1601_state_t *ssp1601_state, int reg, UINT32 d)
{
reg &= 7;
- memory_write_word_16be(ssp1601_state->io, (reg << 1), d);
+ ssp1601_state->io->write_word((reg << 1), d);
}
// 4
diff --git a/src/emu/cpu/superfx/superfx.c b/src/emu/cpu/superfx/superfx.c
index be955de4c04..21843831c4f 100644
--- a/src/emu/cpu/superfx/superfx.c
+++ b/src/emu/cpu/superfx/superfx.c
@@ -179,12 +179,12 @@ static void superfx_memory_reset(superfx_state *cpustate)
INLINE UINT8 superfx_bus_read(superfx_state *cpustate, UINT32 addr)
{
- return memory_read_byte(cpustate->program, addr);
+ return cpustate->program->read_byte(addr);
}
INLINE void superfx_bus_write(superfx_state *cpustate, UINT32 addr, UINT8 data)
{
- memory_write_byte(cpustate->program, addr, data);
+ cpustate->program->write_byte(addr, data);
}
INLINE void superfx_pixelcache_flush(superfx_state *cpustate, INT32 line)
diff --git a/src/emu/cpu/t11/t11.c b/src/emu/cpu/t11/t11.c
index 6609df4c70c..03ca8bfb0b0 100644
--- a/src/emu/cpu/t11/t11.c
+++ b/src/emu/cpu/t11/t11.c
@@ -82,25 +82,25 @@ INLINE int ROPCODE(t11_state *cpustate)
INLINE int RBYTE(t11_state *cpustate, int addr)
{
- return memory_read_byte_16le(cpustate->program, addr);
+ return cpustate->program->read_byte(addr);
}
INLINE void WBYTE(t11_state *cpustate, int addr, int data)
{
- memory_write_byte_16le(cpustate->program, addr, data);
+ cpustate->program->write_byte(addr, data);
}
INLINE int RWORD(t11_state *cpustate, int addr)
{
- return memory_read_word_16le(cpustate->program, addr & 0xfffe);
+ return cpustate->program->read_word(addr & 0xfffe);
}
INLINE void WWORD(t11_state *cpustate, int addr, int data)
{
- memory_write_word_16le(cpustate->program, addr & 0xfffe, data);
+ cpustate->program->write_word(addr & 0xfffe, data);
}
diff --git a/src/emu/cpu/tlcs90/tlcs90.c b/src/emu/cpu/tlcs90/tlcs90.c
index 4fd481a8b63..288cdb15a4a 100644
--- a/src/emu/cpu/tlcs90/tlcs90.c
+++ b/src/emu/cpu/tlcs90/tlcs90.c
@@ -177,16 +177,16 @@ static const char *const cc_names[] = { "f", "lt", "le", "ule", "ov", "mi", "z",
#define R16D8( N,R,I ) cpustate->mode##N = MODE_R16D8; cpustate->r##N = R; cpustate->r##N##b = I;
#define R16R8( N,R,g ) cpustate->mode##N = MODE_R16R8; cpustate->r##N = R; cpustate->r##N##b = g;
-INLINE UINT8 RM8 (t90_Regs *cpustate, UINT32 a) { return memory_read_byte_8le( cpustate->program, a ); }
+INLINE UINT8 RM8 (t90_Regs *cpustate, UINT32 a) { return cpustate->program->read_byte( a ); }
INLINE UINT16 RM16(t90_Regs *cpustate, UINT32 a) { return RM8(cpustate,a) | (RM8( cpustate, (a+1) & 0xffff ) << 8); }
-INLINE void WM8 (t90_Regs *cpustate, UINT32 a, UINT8 v) { memory_write_byte_8le( cpustate->program, a, v ); }
+INLINE void WM8 (t90_Regs *cpustate, UINT32 a, UINT8 v) { cpustate->program->write_byte( a, v ); }
INLINE void WM16(t90_Regs *cpustate, UINT32 a, UINT16 v) { WM8(cpustate,a,v); WM8( cpustate, (a+1) & 0xffff, v >> 8); }
-INLINE UINT8 RX8 (t90_Regs *cpustate, UINT32 a, UINT32 base) { return memory_read_byte_8le( cpustate->program, base | a ); }
+INLINE UINT8 RX8 (t90_Regs *cpustate, UINT32 a, UINT32 base) { return cpustate->program->read_byte( base | a ); }
INLINE UINT16 RX16(t90_Regs *cpustate, UINT32 a, UINT32 base) { return RX8(cpustate,a,base) | (RX8( cpustate, (a+1) & 0xffff, base ) << 8); }
-INLINE void WX8 (t90_Regs *cpustate, UINT32 a, UINT8 v, UINT32 base) { memory_write_byte_8le( cpustate->program, base | a, v ); }
+INLINE void WX8 (t90_Regs *cpustate, UINT32 a, UINT8 v, UINT32 base) { cpustate->program->write_byte( base | a, v ); }
INLINE void WX16(t90_Regs *cpustate, UINT32 a, UINT16 v, UINT32 base) { WX8(cpustate,a,v,base); WX8( cpustate, (a+1) & 0xffff, v >> 8, base); }
INLINE UINT8 READ8(t90_Regs *cpustate) { UINT8 b0 = RM8( cpustate, cpustate->addr++ ); cpustate->addr &= 0xffff; return b0; }
@@ -2284,7 +2284,7 @@ static READ8_HANDLER( t90_internal_registers_r )
{
t90_Regs *cpustate = get_safe_token(space->cpu);
- #define RIO memory_read_byte_8le( cpustate->io, T90_IOBASE+offset )
+ #define RIO cpustate->io->read_byte( T90_IOBASE+offset )
UINT8 data = cpustate->internal_registers[offset];
switch ( T90_IOBASE + offset )
@@ -2495,7 +2495,7 @@ static TIMER_CALLBACK( t90_timer4_callback )
static WRITE8_HANDLER( t90_internal_registers_w )
{
- #define WIO memory_write_byte_8le( cpustate->io, T90_IOBASE+offset, data )
+ #define WIO cpustate->io->write_byte( T90_IOBASE+offset, data )
t90_Regs *cpustate = get_safe_token(space->cpu);
UINT8 out_mask;
diff --git a/src/emu/cpu/tlcs900/tlcs900.c b/src/emu/cpu/tlcs900/tlcs900.c
index 3aae6e2142e..a297651af55 100644
--- a/src/emu/cpu/tlcs900/tlcs900.c
+++ b/src/emu/cpu/tlcs900/tlcs900.c
@@ -195,8 +195,8 @@ struct _tlcs900_state
#define FLAG_SF 0x80
-#define RDMEM(addr) memory_read_byte_8le( cpustate->program, addr )
-#define WRMEM(addr,data) memory_write_byte_8le( cpustate->program, addr, data )
+#define RDMEM(addr) cpustate->program->read_byte( addr )
+#define WRMEM(addr,data) cpustate->program->write_byte( addr, data )
#define RDOP() RDMEM( cpustate->pc.d ); cpustate->pc.d++
#define RDMEMW(addr) ( RDMEM(addr) | ( RDMEM(addr+1) << 8 ) )
#define RDMEML(addr) ( RDMEMW(addr) | ( RDMEMW(addr+2) << 16 ) )
diff --git a/src/emu/cpu/tms0980/tms0980.c b/src/emu/cpu/tms0980/tms0980.c
index e198ed3d607..62b5ef1dc2f 100644
--- a/src/emu/cpu/tms0980/tms0980.c
+++ b/src/emu/cpu/tms0980/tms0980.c
@@ -814,7 +814,7 @@ static CPU_EXECUTE( tms0980 )
/* fetch: rom address 0 */
/* execute: read ram, alu input, execute br/call, k input valid */
tms0980_set_cki_bus( device );
- cpustate->ram_data = memory_read_byte_8le( cpustate->data, cpustate->ram_address );
+ cpustate->ram_data = cpustate->data->read_byte( cpustate->ram_address );
cpustate->status = 1;
cpustate->p = 0;
cpustate->n = 0;
@@ -909,22 +909,22 @@ static CPU_EXECUTE( tms0980 )
}
if ( cpustate->decode & M_STO )
{
- memory_write_byte_8le( cpustate->data, cpustate->ram_address, cpustate->a );
+ cpustate->data->write_byte( cpustate->ram_address, cpustate->a );
}
if ( cpustate->decode & M_CKM )
{
- memory_write_byte_8le( cpustate->data, cpustate->ram_address, cpustate->cki_bus );
+ cpustate->data->write_byte( cpustate->ram_address, cpustate->cki_bus );
}
}
else
{
if ( cpustate->decode & F_SBIT )
{
- memory_write_byte_8le( cpustate->data, cpustate->ram_address, cpustate->ram_data | tms0980_bit_value[ cpustate->opcode & 0x03 ] );
+ cpustate->data->write_byte( cpustate->ram_address, cpustate->ram_data | tms0980_bit_value[ cpustate->opcode & 0x03 ] );
}
if ( cpustate->decode & F_RBIT )
{
- memory_write_byte_8le( cpustate->data, cpustate->ram_address, cpustate->ram_data & tms0980_nbit_value[ cpustate->opcode & 0x03 ] );
+ cpustate->data->write_byte( cpustate->ram_address, cpustate->ram_data & tms0980_nbit_value[ cpustate->opcode & 0x03 ] );
}
if ( cpustate->decode & F_SETR )
{
@@ -1028,12 +1028,12 @@ static CPU_EXECUTE( tms0980 )
if ( cpustate->byte_size > 8 )
{
debugger_instruction_hook( device, cpustate->rom_address << 1 );
- cpustate->opcode = memory_read_word_16be( cpustate->program, cpustate->rom_address << 1 ) & 0x1FF;
+ cpustate->opcode = cpustate->program->read_word( cpustate->rom_address << 1 ) & 0x1FF;
}
else
{
debugger_instruction_hook( device, cpustate->rom_address );
- cpustate->opcode = memory_read_word_8le( cpustate->program, cpustate->rom_address ) & 0xFF;
+ cpustate->opcode = cpustate->program->read_word( cpustate->rom_address ) & 0xFF;
}
tms0980_next_pc( cpustate );
if (LOG)
diff --git a/src/emu/cpu/tms32010/tms32010.c b/src/emu/cpu/tms32010/tms32010.c
index 8de6af06011..e005dd461d5 100644
--- a/src/emu/cpu/tms32010/tms32010.c
+++ b/src/emu/cpu/tms32010/tms32010.c
@@ -148,21 +148,21 @@ INLINE int add_branch_cycle(tms32010_state *cpustate);
* Read the state of the BIO pin
*/
-#define TMS32010_BIO_In (memory_read_word_16be(cpustate->io, TMS32010_BIO<<1))
+#define TMS32010_BIO_In (cpustate->io->read_word(TMS32010_BIO<<1))
/****************************************************************************
* Input a word from given I/O port
*/
-#define TMS32010_In(Port) (memory_read_word_16be(cpustate->io, (Port)<<1))
+#define TMS32010_In(Port) (cpustate->io->read_word((Port)<<1))
/****************************************************************************
* Output a word to given I/O port
*/
-#define TMS32010_Out(Port,Value) (memory_write_word_16be(cpustate->io, (Port)<<1,Value))
+#define TMS32010_Out(Port,Value) (cpustate->io->write_word((Port)<<1,Value))
@@ -170,14 +170,14 @@ INLINE int add_branch_cycle(tms32010_state *cpustate);
* Read a word from given ROM memory location
*/
-#define TMS32010_ROM_RDMEM(A) (memory_read_word_16be(cpustate->program, (A)<<1))
+#define TMS32010_ROM_RDMEM(A) (cpustate->program->read_word((A)<<1))
/****************************************************************************
* Write a word to given ROM memory location
*/
-#define TMS32010_ROM_WRMEM(A,V) (memory_write_word_16be(cpustate->program, (A)<<1,V))
+#define TMS32010_ROM_WRMEM(A,V) (cpustate->program->write_word((A)<<1,V))
@@ -185,14 +185,14 @@ INLINE int add_branch_cycle(tms32010_state *cpustate);
* Read a word from given RAM memory location
*/
-#define TMS32010_RAM_RDMEM(A) (memory_read_word_16be(cpustate->data, (A)<<1))
+#define TMS32010_RAM_RDMEM(A) (cpustate->data->read_word((A)<<1))
/****************************************************************************
* Write a word to given RAM memory location
*/
-#define TMS32010_RAM_WRMEM(A,V) (memory_write_word_16be(cpustate->data, (A)<<1,V))
+#define TMS32010_RAM_WRMEM(A,V) (cpustate->data->write_word((A)<<1,V))
diff --git a/src/emu/cpu/tms32025/tms32025.c b/src/emu/cpu/tms32025/tms32025.c
index 1fdca95e213..fb6ee7d58e2 100644
--- a/src/emu/cpu/tms32025/tms32025.c
+++ b/src/emu/cpu/tms32025/tms32025.c
@@ -127,10 +127,10 @@ Table 3-2. TMS32025/26 Memory Blocks
#define SET_PC(x) do { cpustate->PC = (x); } while (0)
-#define P_IN(A) (memory_read_word_16be(cpustate->io, (A)<<1))
-#define P_OUT(A,V) (memory_write_word_16be(cpustate->io, ((A)<<1),(V)))
-#define S_IN(A) (memory_read_word_16be(cpustate->io, (A)<<1))
-#define S_OUT(A,V) (memory_write_word_16be(cpustate->io, ((A)<<1),(V)))
+#define P_IN(A) (cpustate->io->read_word((A)<<1))
+#define P_OUT(A,V) (cpustate->io->write_word(((A)<<1),(V)))
+#define S_IN(A) (cpustate->io->read_word((A)<<1))
+#define S_OUT(A,V) (cpustate->io->write_word(((A)<<1),(V)))
#define M_RDOP(A) ((cpustate->pgmmap[(A) >> 7]) ? (cpustate->pgmmap[(A) >> 7][(A) & 0x7f]) : memory_decrypted_read_word(cpustate->program, (A)<<1))
#define M_RDOP_ARG(A) ((cpustate->pgmmap[(A) >> 7]) ? (cpustate->pgmmap[(A) >> 7][(A) & 0x7f]) : memory_decrypted_read_word(cpustate->program, (A)<<1))
@@ -324,7 +324,7 @@ INLINE UINT16 M_RDROM(tms32025_state *cpustate, offs_t addr)
addr &= 0xffff;
ram = cpustate->pgmmap[addr >> 7];
if (ram) return ram[addr & 0x7f];
- return memory_read_word_16be(cpustate->program, addr << 1);
+ return cpustate->program->read_word(addr << 1);
}
INLINE void M_WRTROM(tms32025_state *cpustate, offs_t addr, UINT16 data)
@@ -333,7 +333,7 @@ INLINE void M_WRTROM(tms32025_state *cpustate, offs_t addr, UINT16 data)
addr &= 0xffff;
ram = cpustate->pgmmap[addr >> 7];
if (ram) { ram[addr & 0x7f] = data; }
- else memory_write_word_16be(cpustate->program, addr << 1, data);
+ else cpustate->program->write_word(addr << 1, data);
}
INLINE UINT16 M_RDRAM(tms32025_state *cpustate, offs_t addr)
@@ -342,7 +342,7 @@ INLINE UINT16 M_RDRAM(tms32025_state *cpustate, offs_t addr)
addr &= 0xffff;
ram = cpustate->datamap[addr >> 7];
if (ram) return ram[addr & 0x7f];
- return memory_read_word_16be(cpustate->data, addr << 1);
+ return cpustate->data->read_word(addr << 1);
}
INLINE void M_WRTRAM(tms32025_state *cpustate, offs_t addr, UINT16 data)
@@ -359,7 +359,7 @@ INLINE void M_WRTRAM(tms32025_state *cpustate, offs_t addr, UINT16 data)
cpustate->IFR |= 0x20;
}
}
- else memory_write_word_16be(cpustate->data, addr << 1, data);
+ else cpustate->data->write_word(addr << 1, data);
}
diff --git a/src/emu/cpu/tms32031/tms32031.c b/src/emu/cpu/tms32031/tms32031.c
index 0a142775ca2..8a300a0641b 100644
--- a/src/emu/cpu/tms32031/tms32031.c
+++ b/src/emu/cpu/tms32031/tms32031.c
@@ -148,8 +148,8 @@ static UINT32 boot_loader(tms32031_state *tms, UINT32 boot_rom_addr);
#define ROPCODE(T,pc) memory_decrypted_read_dword((T)->program, (pc) << 2)
-#define RMEM(T,addr) memory_read_dword_32le((T)->program, (addr) << 2)
-#define WMEM(T,addr,data) memory_write_dword_32le((T)->program, (addr) << 2, data)
+#define RMEM(T,addr) (T)->program->read_dword((addr) << 2)
+#define WMEM(T,addr,data) (T)->program->write_dword((addr) << 2, data)
diff --git a/src/emu/cpu/tms32051/tms32051.c b/src/emu/cpu/tms32051/tms32051.c
index 2a47b6f8171..7b72c223eb9 100644
--- a/src/emu/cpu/tms32051/tms32051.c
+++ b/src/emu/cpu/tms32051/tms32051.c
@@ -173,22 +173,22 @@ INLINE void CHANGE_PC(tms32051_state *cpustate, UINT16 new_pc)
INLINE UINT16 PM_READ16(tms32051_state *cpustate, UINT16 address)
{
- return memory_read_word_16le(cpustate->program, address << 1);
+ return cpustate->program->read_word(address << 1);
}
INLINE void PM_WRITE16(tms32051_state *cpustate, UINT16 address, UINT16 data)
{
- memory_write_word_16le(cpustate->program, address << 1, data);
+ cpustate->program->write_word(address << 1, data);
}
INLINE UINT16 DM_READ16(tms32051_state *cpustate, UINT16 address)
{
- return memory_read_word_16le(cpustate->data, address << 1);
+ return cpustate->data->read_word(address << 1);
}
INLINE void DM_WRITE16(tms32051_state *cpustate, UINT16 address, UINT16 data)
{
- memory_write_word_16le(cpustate->data, address << 1, data);
+ cpustate->data->write_word(address << 1, data);
}
#include "32051ops.c"
diff --git a/src/emu/cpu/tms34010/34010gfx.c b/src/emu/cpu/tms34010/34010gfx.c
index f3196a9e463..2936d3961bd 100644
--- a/src/emu/cpu/tms34010/34010gfx.c
+++ b/src/emu/cpu/tms34010/34010gfx.c
@@ -201,6 +201,16 @@ static int compute_pixblt_b_cycles(int left_partials, int right_partials, int fu
/* Shift register handling */
+static void memory_w(address_space *space, offs_t offset,UINT16 data)
+{
+ space->write_word(offset, data);
+}
+
+static UINT16 memory_r(address_space *space, offs_t offset)
+{
+ return space->read_word(offset);
+}
+
static void shiftreg_w(address_space *space, offs_t offset,UINT16 data)
{
tms34010_state *tms = get_safe_token(space->cpu);
@@ -1042,8 +1052,8 @@ static void FUNCTION_NAME(pixblt)(tms34010_state *tms, int src_is_linear, int ds
}
else
{
- word_write = memory_write_word_16le;
- word_read = memory_read_word_16le;
+ word_write = memory_w;
+ word_read = memory_r;
}
/* compute the starting addresses */
@@ -1388,8 +1398,8 @@ static void FUNCTION_NAME(pixblt_r)(tms34010_state *tms, int src_is_linear, int
}
else
{
- word_write = memory_write_word_16le;
- word_read = memory_read_word_16le;
+ word_write = memory_w;
+ word_read = memory_r;
}
/* compute the starting addresses */
@@ -1653,8 +1663,8 @@ static void FUNCTION_NAME(pixblt_b)(tms34010_state *tms, int dst_is_linear)
}
else
{
- word_write = memory_write_word_16le;
- word_read = memory_read_word_16le;
+ word_write = memory_w;
+ word_read = memory_r;
}
/* compute the starting addresses */
@@ -1867,8 +1877,8 @@ static void FUNCTION_NAME(fill)(tms34010_state *tms, int dst_is_linear)
}
else
{
- word_write = memory_write_word_16le;
- word_read = memory_read_word_16le;
+ word_write = memory_w;
+ word_read = memory_r;
}
/* compute the bounds of the operation */
diff --git a/src/emu/cpu/tms34010/34010ops.h b/src/emu/cpu/tms34010/34010ops.h
index bdf948651f1..14a81bf22e3 100644
--- a/src/emu/cpu/tms34010/34010ops.h
+++ b/src/emu/cpu/tms34010/34010ops.h
@@ -22,20 +22,20 @@
MEMORY I/O MACROS
***************************************************************************/
-#define TMS34010_RDMEM(T,A) ((unsigned)memory_read_byte_16le ((T)->program, A))
-#define TMS34010_RDMEM_WORD(T,A) ((unsigned)memory_read_word_16le ((T)->program, A))
+#define TMS34010_RDMEM(T,A) ((unsigned)(T)->program->read_byte (A))
+#define TMS34010_RDMEM_WORD(T,A) ((unsigned)(T)->program->read_word (A))
INLINE UINT32 TMS34010_RDMEM_DWORD(tms34010_state *tms, offs_t A)
{
- UINT32 result = memory_read_word_16le(tms->program, A);
- return result | (memory_read_word_16le(tms->program, A+2)<<16);
+ UINT32 result = tms->program->read_word(A);
+ return result | (tms->program->read_word(A+2)<<16);
}
-#define TMS34010_WRMEM(T,A,V) (memory_write_byte_16le((T)->program, A,V))
-#define TMS34010_WRMEM_WORD(T,A,V) (memory_write_word_16le((T)->program, A,V))
+#define TMS34010_WRMEM(T,A,V) ((T)->program->write_byte(A,V))
+#define TMS34010_WRMEM_WORD(T,A,V) ((T)->program->write_word(A,V))
INLINE void TMS34010_WRMEM_DWORD(tms34010_state *tms, offs_t A,UINT32 V)
{
- memory_write_word_16le(tms->program, A,V);
- memory_write_word_16le(tms->program, A+2,V>>16);
+ tms->program->write_word(A,V);
+ tms->program->write_word(A+2,V>>16);
}
diff --git a/src/emu/cpu/tms57002/tms57002.c b/src/emu/cpu/tms57002/tms57002.c
index ae1c1a5457e..90eed39f47b 100644
--- a/src/emu/cpu/tms57002/tms57002.c
+++ b/src/emu/cpu/tms57002/tms57002.c
@@ -192,7 +192,7 @@ WRITE8_DEVICE_HANDLER(tms57002_data_w)
s->sti = (s->sti & ~SU_MASK) | SU_PRG;
break;
case SU_PRG:
- memory_write_dword_32le(s->program, (s->pc++) << 2, val);
+ s->program->write_dword((s->pc++) << 2, val);
break;
}
}
@@ -391,7 +391,7 @@ static void tms57002_xm_init(tms57002_t *s)
static void tms57002_xm_step_read(tms57002_t *s)
{
UINT32 adr = s->xm_adr;
- UINT8 v = memory_read_byte_8le(s->data, adr);
+ UINT8 v = s->data->read_byte(adr);
int done;
if(s->st0 & ST0_WORD) {
if(s->st0 & ST0_SEL) {
@@ -451,7 +451,7 @@ static void tms57002_xm_step_write(tms57002_t *s)
done = off == 12;
}
}
- memory_write_byte_8le(s->data, adr, v);
+ s->data->write_byte(adr, v);
if(done) {
s->sti &= ~S_WRITE;
s->xm_adr = 0;
@@ -986,7 +986,7 @@ static void tms57002_execute_cat3(tms57002_t *s, UINT32 opcode)
void tms57002_execute(tms57002_t *s)
{
while(!(s->sti & (S_IDLE | IN_PLOAD | IN_CLOAD))) {
- UINT32 opcode = memory_read_dword_32le(s->program, s->pc << 2);
+ UINT32 opcode = s->program->read_dword(s->pc << 2);
if(s->sti & (S_READ|S_WRITE)) {
if(s->sti & S_READ)
@@ -1245,7 +1245,7 @@ static int tms57002_decode_get_pc(tms57002_t *s)
for(;;) {
short ipc;
- UINT32 opcode = memory_read_dword_32le(s->program, adr << 2);
+ UINT32 opcode = s->program->read_dword(adr << 2);
if((opcode & 0xfc0000) == 0xfc0000)
tms57002_decode_one(s, opcode, &cs, tms57002_decode_cat3);
diff --git a/src/emu/cpu/tms7000/tms7000.c b/src/emu/cpu/tms7000/tms7000.c
index c7c3c40d125..4b842b9923a 100644
--- a/src/emu/cpu/tms7000/tms7000.c
+++ b/src/emu/cpu/tms7000/tms7000.c
@@ -52,8 +52,8 @@ static UINT16 bcd_sub( UINT16 a, UINT16 b);
/* Static variables */
-#define RM(Addr) ((unsigned)memory_read_byte_8be(cpustate->program, Addr))
-#define WM(Addr,Value) (memory_write_byte_8be(cpustate->program, Addr, Value))
+#define RM(Addr) ((unsigned)cpustate->program->read_byte(Addr))
+#define WM(Addr,Value) (cpustate->program->write_byte(Addr, Value))
#define IMMBYTE(b) b = ((unsigned)memory_raw_read_byte(cpustate->program, pPC)); pPC++
#define SIMMBYTE(b) b = ((signed)memory_raw_read_byte(cpustate->program, pPC)); pPC++
@@ -599,19 +599,19 @@ static WRITE8_HANDLER( tms70x0_pf_w ) /* Perpherial file write */
break;
case 0x06: /* Port B write */
- memory_write_byte_8be( cpustate->io, TMS7000_PORTB, data );
+ cpustate->io->write_byte( TMS7000_PORTB, data );
cpustate->pf[ 0x06 ] = data;
break;
case 0x08: /* Port C write */
temp1 = data & cpustate->pf[ 0x09 ]; /* Mask off input bits */
- memory_write_byte_8be( cpustate->io, TMS7000_PORTC, temp1 );
+ cpustate->io->write_byte( TMS7000_PORTC, temp1 );
cpustate->pf[ 0x08 ] = temp1;
break;
case 0x0a: /* Port D write */
temp1 = data & cpustate->pf[ 0x0b ]; /* Mask off input bits */
- memory_write_byte_8be( cpustate->io, TMS7000_PORTD, temp1 );
+ cpustate->io->write_byte( TMS7000_PORTD, temp1 );
cpustate->pf[ 0x0a ] = temp1;
break;
@@ -647,7 +647,7 @@ static READ8_HANDLER( tms70x0_pf_r ) /* Perpherial file read */
break;
case 0x04: /* Port A read */
- result = memory_read_byte_8be( cpustate->io, TMS7000_PORTA );
+ result = cpustate->io->read_byte( TMS7000_PORTA );
break;
@@ -658,14 +658,14 @@ static READ8_HANDLER( tms70x0_pf_r ) /* Perpherial file read */
case 0x08: /* Port C read */
temp1 = cpustate->pf[ 0x08 ] & cpustate->pf[ 0x09 ]; /* Get previous output bits */
- temp2 = memory_read_byte_8be( cpustate->io, TMS7000_PORTC ); /* Read port */
+ temp2 = cpustate->io->read_byte( TMS7000_PORTC ); /* Read port */
temp3 = temp2 & (~cpustate->pf[ 0x09 ]); /* Mask off output bits */
result = temp1 | temp3; /* OR together */
break;
case 0x0a: /* Port D read */
temp1 = cpustate->pf[ 0x0a ] & cpustate->pf[ 0x0b ]; /* Get previous output bits */
- temp2 = memory_read_byte_8be( cpustate->io, TMS7000_PORTD ); /* Read port */
+ temp2 = cpustate->io->read_byte( TMS7000_PORTD ); /* Read port */
temp3 = temp2 & (~cpustate->pf[ 0x0b ]); /* Mask off output bits */
result = temp1 | temp3; /* OR together */
break;
diff --git a/src/emu/cpu/tms9900/99xxcore.h b/src/emu/cpu/tms9900/99xxcore.h
index 9f4684da138..273fff6eab6 100644
--- a/src/emu/cpu/tms9900/99xxcore.h
+++ b/src/emu/cpu/tms9900/99xxcore.h
@@ -529,7 +529,7 @@ static void reset_decrementer(tms99xx_state *cpustate);
READ16_HANDLER(ti990_10_internal_r)
{
//return cpustate->ROM[offset];
- return memory_read_word_16be(space, 0x1ffc00+offset);
+ return space->read_word(0x1ffc00+offset);
}
#endif
@@ -579,14 +579,14 @@ WRITE8_HANDLER(tms9995_internal2_w)
{ /* intercept TPCS and CPU ROM */
if (addr < 0xfc00)
/* TPCS */
- return memory_read_word_16be(cpustate->program, 0x1f0000+addr);
+ return cpustate->program->read_word(0x1f0000+addr);
else
/* CPU ROM */
- return memory_read_word_16be(cpustate->program, 0x1f0000+addr); /* hack... */
+ return cpustate->program->read_word(0x1f0000+addr); /* hack... */
}
else if (! cpustate->mapping_on)
{
- return memory_read_word_16be(cpustate->program, addr);
+ return cpustate->program->read_word(addr);
}
else
{
@@ -607,13 +607,13 @@ WRITE8_HANDLER(tms9995_internal2_w)
cpustate->error_interrupt_register |= EIR_MAPERR;
cpustate->write_inhibit = 1;
}
- return memory_read_word_16be(cpustate->program, addr);
+ return cpustate->program->read_word(addr);
}
if ((! (cpustate->error_interrupt_register & EIR_MAPERR)) && ! (cpustate->diaglat))
cpustate->mapper_address_latch = cpustate->map_files[map_file].bias[map_index]+addr;
if ((cpustate->latch_control[map_index]) && (! cpustate->reset_maperr))
cpustate->diaglat = 1;
- return memory_read_word_16be(cpustate->program, cpustate->map_files[map_file].bias[map_index]+addr);
+ return cpustate->program->read_word(cpustate->map_files[map_file].bias[map_index]+addr);
}
}
@@ -624,14 +624,14 @@ WRITE8_HANDLER(tms9995_internal2_w)
{ /* intercept TPCS and CPU ROM */
if (addr < 0xfc00)
/* TPCS */
- memory_write_word_16be(cpustate->program, 0x1f0000+addr, data);
+ cpustate->program->write_word(0x1f0000+addr, data);
else
/* CPU ROM */
- memory_write_word_16be(cpustate->program, 0x1f0000+addr, data); /* hack... */
+ cpustate->program->write_word(0x1f0000+addr, data); /* hack... */
}
else if (! cpustate->mapping_on)
{
- memory_write_word_16be(cpustate->program, addr, data);
+ cpustate->program->write_word(addr, data);
}
else
{
@@ -653,16 +653,16 @@ WRITE8_HANDLER(tms9995_internal2_w)
cpustate->write_inhibit = 1;
}
if (cpustate->write_inhibit)
- (void)memory_read_word_16be(cpustate->program, addr);
+ (void)cpustate->program->read_word(addr);
else
- memory_write_word_16be(cpustate->program, addr, data);
+ cpustate->program->write_word(addr, data);
return;
}
if ((! (cpustate->error_interrupt_register & EIR_MAPERR)) && ! (cpustate->diaglat))
cpustate->mapper_address_latch = cpustate->map_files[map_file].bias[map_index]+addr;
if ((cpustate->latch_control[map_index]) && (! cpustate->reset_maperr))
cpustate->diaglat = 1;
- memory_write_word_16be(cpustate->program, cpustate->map_files[map_file].bias[map_index]+addr, data);
+ cpustate->program->write_word(cpustate->map_files[map_file].bias[map_index]+addr, data);
}
}
@@ -673,14 +673,14 @@ WRITE8_HANDLER(tms9995_internal2_w)
{ /* intercept TPCS and CPU ROM */
if (addr < 0xfc00)
/* TPCS */
- return memory_read_byte_16be(cpustate->program, 0x1f0000+addr);
+ return cpustate->program->read_byte(0x1f0000+addr);
else
/* CPU ROM */
- return memory_read_byte_16be(cpustate->program, 0x1f0000+addr); /* hack... */
+ return cpustate->program->read_byte(0x1f0000+addr); /* hack... */
}
else if (! cpustate->mapping_on)
{
- return memory_read_byte_16be(cpustate->program, addr);
+ return cpustate->program->read_byte(addr);
}
else
{
@@ -701,13 +701,13 @@ WRITE8_HANDLER(tms9995_internal2_w)
cpustate->error_interrupt_register |= EIR_MAPERR;
cpustate->write_inhibit = 1;
}
- return memory_read_byte_16be(cpustate->program, addr);
+ return cpustate->program->read_byte(addr);
}
if ((! (cpustate->error_interrupt_register & EIR_MAPERR)) && ! (cpustate->diaglat))
cpustate->mapper_address_latch = cpustate->map_files[map_file].bias[map_index]+addr;
if ((cpustate->latch_control[map_index]) && (! cpustate->reset_maperr))
cpustate->diaglat = 1;
- return memory_read_byte_16be(cpustate->program, cpustate->map_files[map_file].bias[map_index]+addr);
+ return cpustate->program->read_byte(cpustate->map_files[map_file].bias[map_index]+addr);
}
}
@@ -718,14 +718,14 @@ WRITE8_HANDLER(tms9995_internal2_w)
{ /* intercept TPCS and CPU ROM */
if (addr < 0xfc00)
/* TPCS */
- memory_write_byte_16be(cpustate->program, 0x1f0000+addr, data);
+ cpustate->program->write_byte(0x1f0000+addr, data);
else
/* CPU ROM */
- memory_write_byte_16be(cpustate->program, 0x1f0000+addr, data); /* hack... */
+ cpustate->program->write_byte(0x1f0000+addr, data); /* hack... */
}
else if (! cpustate->mapping_on)
{
- memory_write_byte_16be(cpustate->program, addr, data);
+ cpustate->program->write_byte(addr, data);
}
else
{
@@ -747,16 +747,16 @@ WRITE8_HANDLER(tms9995_internal2_w)
cpustate->write_inhibit = 1;
}
if (cpustate->write_inhibit)
- (void)memory_read_byte_16be(cpustate->program, addr);
+ (void)cpustate->program->read_byte(addr);
else
- memory_write_byte_16be(cpustate->program, addr, data);
+ cpustate->program->write_byte(addr, data);
return;
}
if ((! (cpustate->error_interrupt_register & EIR_MAPERR)) && ! (cpustate->diaglat))
cpustate->mapper_address_latch = cpustate->map_files[map_file].bias[map_index]+addr;
if ((cpustate->latch_control[map_index]) && (! cpustate->reset_maperr))
cpustate->diaglat = 1;
- memory_write_byte_16be(cpustate->program, cpustate->map_files[map_file].bias[map_index]+addr, data);
+ cpustate->program->write_byte(cpustate->map_files[map_file].bias[map_index]+addr, data);
}
}
@@ -767,11 +767,11 @@ WRITE8_HANDLER(tms9995_internal2_w)
remember this when writing memory handlers.*/
/*This does not apply to tms9995 and tms99xxx, but does apply to tms9980 (see below).*/
- #define readword(cs, addr) memory_read_word_16be((cs)->program, addr)
- #define writeword(cs, addr,data) memory_write_word_16be((cs)->program, (addr), (data))
+ #define readword(cs, addr) (cs)->program->read_word(addr)
+ #define writeword(cs, addr,data) (cs)->program->write_word((addr), (data))
- #define readbyte(cs, addr) memory_read_byte_16be((cs)->program, addr)
- #define writebyte(cs, addr,data) memory_write_byte_16be((cs)->program, (addr),(data))
+ #define readbyte(cs, addr) (cs)->program->read_byte(addr)
+ #define writebyte(cs, addr,data) (cs)->program->write_byte((addr),(data))
#elif (TMS99XX_MODEL == TMS9980_ID)
/*8-bit data bus, 14-bit address*/
@@ -784,14 +784,14 @@ WRITE8_HANDLER(tms9995_internal2_w)
int val;
cpustate->icount -= 2;
- val = memory_read_byte_8be(cpustate->program, addr);
- return (val << 8) | memory_read_byte_8be(cpustate->program, addr+1);
+ val = cpustate->program->read_byte(addr);
+ return (val << 8) | cpustate->program->read_byte(addr+1);
}
- #define writeword(cs, addr,data) { (cs)->icount -= 2; memory_write_byte_8be((cs)->program, (addr), (data) >> 8); memory_write_byte_8be(cpustate->program, (addr) + 1, (data) & 0xff); }
+ #define writeword(cs, addr,data) { (cs)->icount -= 2; (cs)->program->write_byte((addr), (data) >> 8); cpustate->program->write_byte((addr) + 1, (data) & 0xff); }
#if 0
- #define readbyte(cs, addr) ((cs)->icount -= 2, memory_read_byte_8be((cs)->program, addr))
- #define writebyte(cs, addr,data) { (cs)->icount -= 2; memory_write_byte_8be((cs)->program, (addr),(data)); }
+ #define readbyte(cs, addr) ((cs)->icount -= 2, (cs)->program->read_byte(addr))
+ #define writebyte(cs, addr,data) { (cs)->icount -= 2; (cs)->program->write_byte((addr),(data)); }
#else
/*This is how it really works*/
/*Note that every writebyte must match a readbyte (which is indeed the case)*/
@@ -801,13 +801,13 @@ WRITE8_HANDLER(tms9995_internal2_w)
cpustate->icount -= 2;
if (addr & 1)
{
- cpustate->extra_byte = memory_read_byte_8be(cpustate->program, addr-1);
- return memory_read_byte_8be(cpustate->program, addr);
+ cpustate->extra_byte = cpustate->program->read_byte(addr-1);
+ return cpustate->program->read_byte(addr);
}
else
{
- int val = memory_read_byte_8be(cpustate->program, addr);
- cpustate->extra_byte = memory_read_byte_8be(cpustate->program, addr+1);
+ int val = cpustate->program->read_byte(addr);
+ cpustate->extra_byte = cpustate->program->read_byte(addr+1);
return val;
}
}
@@ -816,13 +816,13 @@ WRITE8_HANDLER(tms9995_internal2_w)
cpustate->icount -= 2;
if (addr & 1)
{
- memory_write_byte_8be(cpustate->program, addr-1, cpustate->extra_byte);
- memory_write_byte_8be(cpustate->program, addr, data);
+ cpustate->program->write_byte(addr-1, cpustate->extra_byte);
+ cpustate->program->write_byte(addr, data);
}
else
{
- memory_write_byte_8be(cpustate->program, addr, data);
- memory_write_byte_8be(cpustate->program, addr+1, cpustate->extra_byte);
+ cpustate->program->write_byte(addr, data);
+ cpustate->program->write_byte(addr+1, cpustate->extra_byte);
}
}
#endif
@@ -841,7 +841,7 @@ WRITE8_HANDLER(tms9995_internal2_w)
else
{
cpustate->icount -= 2;
- return (memory_read_byte_8be(cpustate->program, addr) << 8) + memory_read_byte_8be(cpustate->program, addr + 1);
+ return (cpustate->program->read_byte(addr) << 8) + cpustate->program->read_byte(addr + 1);
}
}
static void writeword(tms99xx_state *cpustate, int addr, int data)
@@ -852,8 +852,8 @@ WRITE8_HANDLER(tms9995_internal2_w)
else if (!(addr < 0x2000))
{
cpustate->icount -= 2;
- memory_write_byte_8be(cpustate->program, addr, data >> 8);
- memory_write_byte_8be(cpustate->program, addr + 1, data & 0xff);
+ cpustate->program->write_byte(addr, data >> 8);
+ cpustate->program->write_byte(addr + 1, data & 0xff);
}
}
@@ -870,13 +870,13 @@ WRITE8_HANDLER(tms9995_internal2_w)
cpustate->icount -= 2;
if (addr & 1)
{
- cpustate->extra_byte = memory_read_byte_8be(cpustate->program, addr-1);
- return memory_read_byte_8be(cpustate->program, addr);
+ cpustate->extra_byte = cpustate->program->read_byte(addr-1);
+ return cpustate->program->read_byte(addr);
}
else
{
- int val = memory_read_byte_8be(cpustate->program, addr);
- cpustate->extra_byte = memory_read_byte_8be(cpustate->program, addr+1);
+ int val = cpustate->program->read_byte(addr);
+ cpustate->extra_byte = cpustate->program->read_byte(addr+1);
return val;
}
}
@@ -891,13 +891,13 @@ WRITE8_HANDLER(tms9995_internal2_w)
cpustate->icount -= 2;
if (addr & 1)
{
- memory_write_byte_8be(cpustate->program, addr-1, cpustate->extra_byte);
- memory_write_byte_8be(cpustate->program, addr, data);
+ cpustate->program->write_byte(addr-1, cpustate->extra_byte);
+ cpustate->program->write_byte(addr, data);
}
else
{
- memory_write_byte_8be(cpustate->program, addr, data);
- memory_write_byte_8be(cpustate->program, addr+1, cpustate->extra_byte);
+ cpustate->program->write_byte(addr, data);
+ cpustate->program->write_byte(addr+1, cpustate->extra_byte);
}
}
}
@@ -914,8 +914,8 @@ WRITE8_HANDLER(tms9995_internal2_w)
{
int reply;
cpustate->icount -= cpustate->memory_wait_states_word;
- reply = memory_read_byte_8be(cpustate->program, addr);
- return (reply << 8) | memory_read_byte_8be(cpustate->program, addr + 1);
+ reply = cpustate->program->read_byte(addr);
+ return (reply << 8) | cpustate->program->read_byte(addr + 1);
}
else if (addr < 0xf0fc)
{
@@ -925,8 +925,8 @@ WRITE8_HANDLER(tms9995_internal2_w)
{
int reply;
cpustate->icount -= cpustate->memory_wait_states_word;
- reply = memory_read_byte_8be(cpustate->program, addr);
- return (reply << 8) | memory_read_byte_8be(cpustate->program, addr + 1);
+ reply = cpustate->program->read_byte(addr);
+ return (reply << 8) | cpustate->program->read_byte(addr + 1);
}
else if (addr < 0xfffc)
{
@@ -949,8 +949,8 @@ WRITE8_HANDLER(tms9995_internal2_w)
if ((addr < 0xf000) || (cpustate->is_mp9537))
{
cpustate->icount -= cpustate->memory_wait_states_word;
- memory_write_byte_8be(cpustate->program, addr, data >> 8);
- memory_write_byte_8be(cpustate->program, addr + 1, data & 0xff);
+ cpustate->program->write_byte(addr, data >> 8);
+ cpustate->program->write_byte(addr + 1, data & 0xff);
}
else if (addr < 0xf0fc)
{
@@ -959,8 +959,8 @@ WRITE8_HANDLER(tms9995_internal2_w)
else if (addr < 0xfffa)
{
cpustate->icount -= cpustate->memory_wait_states_word;
- memory_write_byte_8be(cpustate->program, addr, data >> 8);
- memory_write_byte_8be(cpustate->program, addr + 1, data & 0xff);
+ cpustate->program->write_byte(addr, data >> 8);
+ cpustate->program->write_byte(addr + 1, data & 0xff);
}
else if (addr < 0xfffc)
{
@@ -979,7 +979,7 @@ WRITE8_HANDLER(tms9995_internal2_w)
if ((addr < 0xf000) || (cpustate->is_mp9537))
{
cpustate->icount -= cpustate->memory_wait_states_byte;
- return memory_read_byte_8be(cpustate->program, addr);
+ return cpustate->program->read_byte(addr);
}
else if (addr < 0xf0fc)
{
@@ -988,7 +988,7 @@ WRITE8_HANDLER(tms9995_internal2_w)
else if (addr < 0xfffa)
{
cpustate->icount -= cpustate->memory_wait_states_byte;
- return memory_read_byte_8be(cpustate->program, addr);
+ return cpustate->program->read_byte(addr);
}
else if (addr < 0xfffc)
{
@@ -1018,7 +1018,7 @@ WRITE8_HANDLER(tms9995_internal2_w)
if ((addr < 0xf000) || (cpustate->is_mp9537))
{
cpustate->icount -= cpustate->memory_wait_states_byte;
- memory_write_byte_8be(cpustate->program, addr, data);
+ cpustate->program->write_byte(addr, data);
}
else if (addr < 0xf0fc)
{
@@ -1027,7 +1027,7 @@ WRITE8_HANDLER(tms9995_internal2_w)
else if (addr < 0xfffa)
{
cpustate->icount -= cpustate->memory_wait_states_byte;
- memory_write_byte_8be(cpustate->program, addr, data);
+ cpustate->program->write_byte(addr, data);
}
else if (addr < 0xfffc)
{
@@ -1999,7 +1999,7 @@ typedef enum
CRU_PRIVILEGE_VIOLATION = -1
} cru_error_code;
-#define WRITEPORT(cs, port, data) memory_write_byte_8be((cs)->io, port, data)
+#define WRITEPORT(cs, port, data) (cs)->io->write_byte(port, data)
#if (TMS99XX_MODEL == TMS9940_ID) || (TMS99XX_MODEL == TMS9985_ID)
/* on tms9940, we have to handle internal CRU ports */
@@ -2218,7 +2218,7 @@ static void external_instruction_notify(tms99xx_state *cpustate, int ext_op_ID)
read at the same address. This seems to be impossible to emulate efficiently, so, if you need
to emulate this, you're in trouble.
*/
-#define READPORT(cs, port) memory_read_byte_8be((cs)->io, port)
+#define READPORT(cs, port) (cs)->io->read_byte(port)
#if (TMS99XX_MODEL == TMS9940_ID) || (TMS99XX_MODEL == TMS9985_ID)
@@ -2429,10 +2429,10 @@ static void load_map_file(tms99xx_state *cpustate, UINT16 src_addr, int src_map_
for (i=0; i<3; i++)
{
- cpustate->map_files[dst_file].L[i] = memory_read_word_16be(cpustate->program, cpustate->mapper_address_latch) & 0xffe0;
+ cpustate->map_files[dst_file].L[i] = cpustate->program->read_word(cpustate->mapper_address_latch) & 0xffe0;
cpustate->map_files[dst_file].limit[i] = (cpustate->map_files[dst_file].L[i] ^ 0xffe0) | 0x001f;
cpustate->mapper_address_latch = (cpustate->mapper_address_latch+2) & 0x1fffff;
- cpustate->map_files[dst_file].B[i] = memory_read_word_16be(cpustate->program, cpustate->mapper_address_latch);
+ cpustate->map_files[dst_file].B[i] = cpustate->program->read_word(cpustate->mapper_address_latch);
cpustate->map_files[dst_file].bias[i] = ((unsigned int) cpustate->map_files[dst_file].B[i]) << 5;
cpustate->mapper_address_latch = (cpustate->mapper_address_latch+2) & 0x1fffff;
}
diff --git a/src/emu/cpu/unsp/unsp.c b/src/emu/cpu/unsp/unsp.c
index 945554b4088..f85b443a2a1 100644
--- a/src/emu/cpu/unsp/unsp.c
+++ b/src/emu/cpu/unsp/unsp.c
@@ -98,12 +98,12 @@ static void unimplemented_opcode(unsp_state *unsp, UINT16 op)
INLINE UINT16 READ16(unsp_state *unsp, UINT32 address)
{
- return memory_read_word_16be(unsp->program, address << 1);
+ return unsp->program->read_word(address << 1);
}
INLINE void WRITE16(unsp_state *unsp, UINT32 address, UINT16 data)
{
- memory_write_word_16be(unsp->program, address << 1, data);
+ unsp->program->write_word(address << 1, data);
}
/*****************************************************************************/
diff --git a/src/emu/cpu/upd7810/upd7810.c b/src/emu/cpu/upd7810/upd7810.c
index 5a21c3e3dc5..acf9003c25b 100644
--- a/src/emu/cpu/upd7810/upd7810.c
+++ b/src/emu/cpu/upd7810/upd7810.c
@@ -644,8 +644,8 @@ struct opcode_s {
#define RDOP(O) O = memory_decrypted_read_byte(cpustate->program, PCD); PC++
#define RDOPARG(A) A = memory_raw_read_byte(cpustate->program, PCD); PC++
-#define RM(A) memory_read_byte_8le(cpustate->program, A)
-#define WM(A,V) memory_write_byte_8le(cpustate->program, A,V)
+#define RM(A) cpustate->program->read_byte(A)
+#define WM(A,V) cpustate->program->write_byte(A,V)
#define ZHC_ADD(after,before,carry) \
if (after == 0) PSW |= Z; else PSW &= ~Z; \
@@ -686,17 +686,17 @@ static UINT8 RP(upd7810_state *cpustate, offs_t port)
{
case UPD7810_PORTA:
if (cpustate->ma) // NS20031301 no need to read if the port is set as output
- cpustate->pa_in = memory_read_byte_8le(cpustate->io, port);
+ cpustate->pa_in = cpustate->io->read_byte(port);
data = (cpustate->pa_in & cpustate->ma) | (cpustate->pa_out & ~cpustate->ma);
break;
case UPD7810_PORTB:
if (cpustate->mb) // NS20031301 no need to read if the port is set as output
- cpustate->pb_in = memory_read_byte_8le(cpustate->io, port);
+ cpustate->pb_in = cpustate->io->read_byte(port);
data = (cpustate->pb_in & cpustate->mb) | (cpustate->pb_out & ~cpustate->mb);
break;
case UPD7810_PORTC:
if (cpustate->mc) // NS20031301 no need to read if the port is set as output
- cpustate->pc_in = memory_read_byte_8le(cpustate->io, port);
+ cpustate->pc_in = cpustate->io->read_byte(port);
data = (cpustate->pc_in & cpustate->mc) | (cpustate->pc_out & ~cpustate->mc);
if (cpustate->mcc & 0x01) /* PC0 = TxD output */
data = (data & ~0x01) | (cpustate->txd & 1 ? 0x01 : 0x00);
@@ -716,7 +716,7 @@ static UINT8 RP(upd7810_state *cpustate, offs_t port)
data = (data & ~0x80) | (cpustate->co1 & 1 ? 0x80 : 0x00);
break;
case UPD7810_PORTD:
- cpustate->pd_in = memory_read_byte_8le(cpustate->io, port);
+ cpustate->pd_in = cpustate->io->read_byte(port);
switch (cpustate->mm & 0x07)
{
case 0x00: /* PD input mode, PF port mode */
@@ -731,7 +731,7 @@ static UINT8 RP(upd7810_state *cpustate, offs_t port)
}
break;
case UPD7810_PORTF:
- cpustate->pf_in = memory_read_byte_8le(cpustate->io, port);
+ cpustate->pf_in = cpustate->io->read_byte(port);
switch (cpustate->mm & 0x06)
{
case 0x00: /* PD input/output mode, PF port mode */
@@ -751,7 +751,7 @@ static UINT8 RP(upd7810_state *cpustate, offs_t port)
}
break;
case UPD7807_PORTT: // NS20031301 partial implementation
- data = memory_read_byte_8le(cpustate->io, port);
+ data = cpustate->io->read_byte(port);
break;
default:
logerror("uPD7810 internal error: RP(cpustate) called with invalid port number\n");
@@ -767,13 +767,13 @@ static void WP(upd7810_state *cpustate, offs_t port, UINT8 data)
cpustate->pa_out = data;
// data = (data & ~cpustate->ma) | (cpustate->pa_in & cpustate->ma);
data = (data & ~cpustate->ma) | (cpustate->ma); // NS20031401
- memory_write_byte_8le(cpustate->io, port, data);
+ cpustate->io->write_byte(port, data);
break;
case UPD7810_PORTB:
cpustate->pb_out = data;
// data = (data & ~cpustate->mb) | (cpustate->pb_in & cpustate->mb);
data = (data & ~cpustate->mb) | (cpustate->mb); // NS20031401
- memory_write_byte_8le(cpustate->io, port, data);
+ cpustate->io->write_byte(port, data);
break;
case UPD7810_PORTC:
cpustate->pc_out = data;
@@ -795,7 +795,7 @@ static void WP(upd7810_state *cpustate, offs_t port, UINT8 data)
data = (data & ~0x40) | (cpustate->co0 & 1 ? 0x40 : 0x00);
if (cpustate->mcc & 0x80) /* PC7 = CO1 output */
data = (data & ~0x80) | (cpustate->co1 & 1 ? 0x80 : 0x00);
- memory_write_byte_8le(cpustate->io, port, data);
+ cpustate->io->write_byte(port, data);
break;
case UPD7810_PORTD:
cpustate->pd_out = data;
@@ -810,7 +810,7 @@ static void WP(upd7810_state *cpustate, offs_t port, UINT8 data)
default: /* PD extension mode, PF port/extension mode */
return;
}
- memory_write_byte_8le(cpustate->io, port, data);
+ cpustate->io->write_byte(port, data);
break;
case UPD7810_PORTF:
cpustate->pf_out = data;
@@ -829,7 +829,7 @@ static void WP(upd7810_state *cpustate, offs_t port, UINT8 data)
data |= 0xff; /* what would come out for the lower bits here? */
break;
}
- memory_write_byte_8le(cpustate->io, port, data);
+ cpustate->io->write_byte(port, data);
break;
default:
logerror("uPD7810 internal error: RP(cpustate) called with invalid port number\n");
diff --git a/src/emu/cpu/v30mz/v30mz.h b/src/emu/cpu/v30mz/v30mz.h
index b5579606b3d..4d4248fc131 100644
--- a/src/emu/cpu/v30mz/v30mz.h
+++ b/src/emu/cpu/v30mz/v30mz.h
@@ -74,20 +74,20 @@ typedef enum {
#define DefaultBase(Seg) ((cpustate->seg_prefix && (Seg==DS || Seg==SS)) ? cpustate->prefix_base : cpustate->sregs[Seg] << 4)
-#define GetMemB(Seg,Off) ((UINT8)memory_read_byte_8le(cpustate->program, (DefaultBase(Seg)+(Off))))
-#define GetMemW(Seg,Off) ((UINT16) memory_read_byte_8le(cpustate->program, (DefaultBase(Seg)+(Off))) + (memory_read_byte_8le(cpustate->program, (DefaultBase(Seg)+((Off)+1)))<<8) )
+#define GetMemB(Seg,Off) ((UINT8)cpustate->program->read_byte((DefaultBase(Seg)+(Off))))
+#define GetMemW(Seg,Off) ((UINT16) cpustate->program->read_byte((DefaultBase(Seg)+(Off))) + (cpustate->program->read_byte((DefaultBase(Seg)+((Off)+1)))<<8) )
-#define PutMemB(Seg,Off,x) { memory_write_byte_8le(cpustate->program, (DefaultBase(Seg)+(Off)),(x)); }
+#define PutMemB(Seg,Off,x) { cpustate->program->write_byte((DefaultBase(Seg)+(Off)),(x)); }
#define PutMemW(Seg,Off,x) { PutMemB(Seg,Off,(x)&0xff); PutMemB(Seg,(Off)+1,(BYTE)((x)>>8)); }
/* Todo: Remove these later - plus readword could overflow */
-#define ReadByte(ea) ((BYTE)memory_read_byte_8le(cpustate->program, (ea)))
-#define ReadWord(ea) (memory_read_byte_8le(cpustate->program, (ea))+(memory_read_byte_8le(cpustate->program, ((ea)+1))<<8))
-#define WriteByte(ea,val) { memory_write_byte_8le(cpustate->program, (ea),val); }
-#define WriteWord(ea,val) { memory_write_byte_8le(cpustate->program, (ea),(BYTE)(val)); memory_write_byte_8le(cpustate->program, ((ea)+1),(val)>>8); }
+#define ReadByte(ea) ((BYTE)cpustate->program->read_byte((ea)))
+#define ReadWord(ea) (cpustate->program->read_byte((ea))+(cpustate->program->read_byte(((ea)+1))<<8))
+#define WriteByte(ea,val) { cpustate->program->write_byte((ea),val); }
+#define WriteWord(ea,val) { cpustate->program->write_byte((ea),(BYTE)(val)); cpustate->program->write_byte(((ea)+1),(val)>>8); }
-#define read_port(port) memory_read_byte_8le(cpustate->io, port)
-#define write_port(port,val) memory_write_byte_8le(cpustate->io, port,val)
+#define read_port(port) cpustate->io->read_byte(port)
+#define write_port(port,val) cpustate->io->write_byte(port,val)
#define FETCH (memory_raw_read_byte(cpustate->program, (cpustate->sregs[CS]<<4)+cpustate->ip++))
#define FETCHOP (memory_decrypted_read_byte(cpustate->program, (cpustate->sregs[CS]<<4)+cpustate->ip++))
diff --git a/src/emu/cpu/v60/v60mem.c b/src/emu/cpu/v60/v60mem.c
index ddff7c2be95..bbf35cc43e9 100644
--- a/src/emu/cpu/v60/v60mem.c
+++ b/src/emu/cpu/v60/v60mem.c
@@ -21,28 +21,31 @@ struct cpu_info {
/* Memory accesses for 16-bit data bus, 24-bit address bus (V60) */
/*****************************************************************/
-#define MemRead8_16 memory_read_byte_16le
-#define MemWrite8_16 memory_write_byte_16le
+static UINT8 memory_read_byte(address_space *space, offs_t address) { return space->read_byte(address); }
+static void memory_write_byte(address_space *space, offs_t address, UINT8 data) { space->write_byte(address, data); }
+
+#define MemRead8_16 memory_read_byte
+#define MemWrite8_16 memory_write_byte
static UINT16 MemRead16_16(address_space *space, offs_t address)
{
if (!(address & 1))
- return memory_read_word_16le(space, address);
+ return space->read_word(address);
else
{
- UINT16 result = memory_read_byte_16le(space, address);
- return result | memory_read_byte_16le(space, address + 1) << 8;
+ UINT16 result = space->read_byte(address);
+ return result | space->read_byte(address + 1) << 8;
}
}
static void MemWrite16_16(address_space *space, offs_t address, UINT16 data)
{
if (!(address & 1))
- memory_write_word_16le(space, address, data);
+ space->write_word(address, data);
else
{
- memory_write_byte_16le(space, address, data);
- memory_write_byte_16le(space, address + 1, data >> 8);
+ space->write_byte(address, data);
+ space->write_byte(address + 1, data >> 8);
}
}
@@ -50,14 +53,14 @@ static UINT32 MemRead32_16(address_space *space, offs_t address)
{
if (!(address & 1))
{
- UINT32 result = memory_read_word_16le(space, address);
- return result | (memory_read_word_16le(space, address + 2) << 16);
+ UINT32 result = space->read_word(address);
+ return result | (space->read_word(address + 2) << 16);
}
else
{
- UINT32 result = memory_read_byte_16le(space, address);
- result |= memory_read_word_16le(space, address + 1) << 8;
- return result | memory_read_byte_16le(space, address + 3) << 24;
+ UINT32 result = space->read_byte(address);
+ result |= space->read_word(address + 1) << 8;
+ return result | space->read_byte(address + 3) << 24;
}
}
@@ -65,14 +68,14 @@ static void MemWrite32_16(address_space *space, offs_t address, UINT32 data)
{
if (!(address & 1))
{
- memory_write_word_16le(space, address, data);
- memory_write_word_16le(space, address + 2, data >> 16);
+ space->write_word(address, data);
+ space->write_word(address + 2, data >> 16);
}
else
{
- memory_write_byte_16le(space, address, data);
- memory_write_word_16le(space, address + 1, data >> 8);
- memory_write_byte_16le(space, address + 3, data >> 24);
+ space->write_byte(address, data);
+ space->write_word(address + 1, data >> 8);
+ space->write_byte(address + 3, data >> 24);
}
}
@@ -103,62 +106,62 @@ static UINT32 OpRead32_16(address_space *space, offs_t address)
/* Memory accesses for 32-bit data bus, 32-bit address bus (V70) */
/*****************************************************************/
-#define MemRead8_32 memory_read_byte_32le
-#define MemWrite8_32 memory_write_byte_32le
+#define MemRead8_32 memory_read_byte
+#define MemWrite8_32 memory_write_byte
static UINT16 MemRead16_32(address_space *space, offs_t address)
{
if (!(address & 1))
- return memory_read_word_32le(space, address);
+ return space->read_word(address);
else
{
- UINT16 result = memory_read_byte_32le(space, address);
- return result | memory_read_byte_32le(space, address + 1) << 8;
+ UINT16 result = space->read_byte(address);
+ return result | space->read_byte(address + 1) << 8;
}
}
static void MemWrite16_32(address_space *space, offs_t address, UINT16 data)
{
if (!(address & 1))
- memory_write_word_32le(space, address, data);
+ space->write_word(address, data);
else
{
- memory_write_byte_32le(space, address, data);
- memory_write_byte_32le(space, address + 1, data >> 8);
+ space->write_byte(address, data);
+ space->write_byte(address + 1, data >> 8);
}
}
static UINT32 MemRead32_32(address_space *space, offs_t address)
{
if (!(address & 3))
- return memory_read_dword_32le(space, address);
+ return space->read_dword(address);
else if (!(address & 1))
{
- UINT32 result = memory_read_word_32le(space, address);
- return result | (memory_read_word_32le(space, address + 2) << 16);
+ UINT32 result = space->read_word(address);
+ return result | (space->read_word(address + 2) << 16);
}
else
{
- UINT32 result = memory_read_byte_32le(space, address);
- result |= memory_read_word_32le(space, address + 1) << 8;
- return result | memory_read_byte_32le(space, address + 3) << 24;
+ UINT32 result = space->read_byte(address);
+ result |= space->read_word(address + 1) << 8;
+ return result | space->read_byte(address + 3) << 24;
}
}
static void MemWrite32_32(address_space *space, offs_t address, UINT32 data)
{
if (!(address & 3))
- memory_write_dword_32le(space, address, data);
+ space->write_dword(address, data);
else if (!(address & 1))
{
- memory_write_word_32le(space, address, data);
- memory_write_word_32le(space, address + 2, data >> 16);
+ space->write_word(address, data);
+ space->write_word(address + 2, data >> 16);
}
else
{
- memory_write_byte_32le(space, address, data);
- memory_write_word_32le(space, address + 1, data >> 8);
- memory_write_byte_32le(space, address + 3, data >> 24);
+ space->write_byte(address, data);
+ space->write_word(address + 1, data >> 8);
+ space->write_byte(address + 3, data >> 24);
}
}
diff --git a/src/emu/cpu/v810/v810.c b/src/emu/cpu/v810/v810.c
index 1658ecb9bed..e5408efeabd 100644
--- a/src/emu/cpu/v810/v810.c
+++ b/src/emu/cpu/v810/v810.c
@@ -109,24 +109,24 @@ INLINE v810_state *get_safe_token(running_device *device)
#define SET_NP(val) (cpustate->PSW = (cpustate->PSW & ~0x00020000) | ((val) << 17))
#define SET_AE(val) (cpustate->PSW = (cpustate->PSW & ~0x00040000) | ((val) << 18))
-#define R_B(cs, addr) (memory_read_byte_32le((cs)->program, addr))
-#define R_H(cs, addr) (memory_read_word_32le((cs)->program, addr))
-#define R_W(cs, addr) (memory_read_dword_32le((cs)->program, addr))
+#define R_B(cs, addr) ((cs)->program->read_byte(addr))
+#define R_H(cs, addr) ((cs)->program->read_word(addr))
+#define R_W(cs, addr) ((cs)->program->read_dword(addr))
-#define W_B(cs, addr, val) (memory_write_byte_32le((cs)->program, addr,val))
-#define W_H(cs, addr, val) (memory_write_word_32le((cs)->program, addr,val))
-#define W_W(cs, addr, val) (memory_write_dword_32le((cs)->program, addr,val))
+#define W_B(cs, addr, val) ((cs)->program->write_byte(addr,val))
+#define W_H(cs, addr, val) ((cs)->program->write_word(addr,val))
+#define W_W(cs, addr, val) ((cs)->program->write_dword(addr,val))
-#define RIO_B(cs, addr) (memory_read_byte_32le((cs)->io, addr))
-#define RIO_H(cs, addr) (memory_read_word_32le((cs)->io, addr))
-#define RIO_W(cs, addr) (memory_read_dword_32le((cs)->io, addr))
+#define RIO_B(cs, addr) ((cs)->io->read_byte(addr))
+#define RIO_H(cs, addr) ((cs)->io->read_word(addr))
+#define RIO_W(cs, addr) ((cs)->io->read_dword(addr))
-#define WIO_B(cs, addr, val) (memory_write_byte_32le((cs)->io, addr,val))
-#define WIO_H(cs, addr, val) (memory_write_word_32le((cs)->io, addr,val))
-#define WIO_W(cs, addr, val) (memory_write_dword_32le((cs)->io, addr,val))
+#define WIO_B(cs, addr, val) ((cs)->io->write_byte(addr,val))
+#define WIO_H(cs, addr, val) ((cs)->io->write_word(addr,val))
+#define WIO_W(cs, addr, val) ((cs)->io->write_dword(addr,val))
#define R_OP(cs, addr) (memory_decrypted_read_word((cs)->program, addr))
diff --git a/src/emu/cpu/z180/z180.c b/src/emu/cpu/z180/z180.c
index 14bf9ec1f86..06cee2276aa 100644
--- a/src/emu/cpu/z180/z180.c
+++ b/src/emu/cpu/z180/z180.c
@@ -839,7 +839,7 @@ static CPU_SET_INFO( z180 );
static UINT8 z180_readcontrol(z180_state *cpustate, offs_t port)
{
/* normal external readport */
- UINT8 data = memory_read_byte_8le(cpustate->iospace, port);
+ UINT8 data = cpustate->iospace->read_byte(port);
/* remap internal I/O registers */
if((port & (cpustate->IO_IOCR & 0xc0)) == (cpustate->IO_IOCR & 0xc0))
@@ -1267,7 +1267,7 @@ data |= 0x02; // kludge for 20pacgal
static void z180_writecontrol(z180_state *cpustate, offs_t port, UINT8 data)
{
/* normal external write port */
- memory_write_byte_8le(cpustate->iospace, port, data);
+ cpustate->iospace->write_byte(port, data);
/* remap internal I/O registers */
if((port & (cpustate->IO_IOCR & 0xc0)) == (cpustate->IO_IOCR & 0xc0))
@@ -1642,18 +1642,18 @@ static int z180_dma0(z180_state *cpustate, int max_cycles)
switch( cpustate->IO_DMODE & (Z180_DMODE_SM | Z180_DMODE_DM) )
{
case 0x00: /* memory SAR0+1 to memory DAR0+1 */
- memory_write_byte_8le(cpustate->program, dar0++, memory_read_byte_8le(cpustate->program, sar0++));
+ cpustate->program->write_byte(dar0++, cpustate->program->read_byte(sar0++));
break;
case 0x04: /* memory SAR0-1 to memory DAR0+1 */
- memory_write_byte_8le(cpustate->program, dar0++, memory_read_byte_8le(cpustate->program, sar0--));
+ cpustate->program->write_byte(dar0++, cpustate->program->read_byte(sar0--));
break;
case 0x08: /* memory SAR0 fixed to memory DAR0+1 */
- memory_write_byte_8le(cpustate->program, dar0++, memory_read_byte_8le(cpustate->program, sar0));
+ cpustate->program->write_byte(dar0++, cpustate->program->read_byte(sar0));
break;
case 0x0c: /* I/O SAR0 fixed to memory DAR0+1 */
if (cpustate->iol & Z180_DREQ0)
{
- memory_write_byte_8le(cpustate->program, dar0++, IN(cpustate, sar0));
+ cpustate->program->write_byte(dar0++, IN(cpustate, sar0));
/* edge sensitive DREQ0 ? */
if (cpustate->IO_DCNTL & Z180_DCNTL_DIM0)
{
@@ -1663,18 +1663,18 @@ static int z180_dma0(z180_state *cpustate, int max_cycles)
}
break;
case 0x10: /* memory SAR0+1 to memory DAR0-1 */
- memory_write_byte_8le(cpustate->program, dar0--, memory_read_byte_8le(cpustate->program, sar0++));
+ cpustate->program->write_byte(dar0--, cpustate->program->read_byte(sar0++));
break;
case 0x14: /* memory SAR0-1 to memory DAR0-1 */
- memory_write_byte_8le(cpustate->program, dar0--, memory_read_byte_8le(cpustate->program, sar0--));
+ cpustate->program->write_byte(dar0--, cpustate->program->read_byte(sar0--));
break;
case 0x18: /* memory SAR0 fixed to memory DAR0-1 */
- memory_write_byte_8le(cpustate->program, dar0--, memory_read_byte_8le(cpustate->program, sar0));
+ cpustate->program->write_byte(dar0--, cpustate->program->read_byte(sar0));
break;
case 0x1c: /* I/O SAR0 fixed to memory DAR0-1 */
if (cpustate->iol & Z180_DREQ0)
{
- memory_write_byte_8le(cpustate->program, dar0--, IN(cpustate, sar0));
+ cpustate->program->write_byte(dar0--, IN(cpustate, sar0));
/* edge sensitive DREQ0 ? */
if (cpustate->IO_DCNTL & Z180_DCNTL_DIM0)
{
@@ -1684,10 +1684,10 @@ static int z180_dma0(z180_state *cpustate, int max_cycles)
}
break;
case 0x20: /* memory SAR0+1 to memory DAR0 fixed */
- memory_write_byte_8le(cpustate->program, dar0, memory_read_byte_8le(cpustate->program, sar0++));
+ cpustate->program->write_byte(dar0, cpustate->program->read_byte(sar0++));
break;
case 0x24: /* memory SAR0-1 to memory DAR0 fixed */
- memory_write_byte_8le(cpustate->program, dar0, memory_read_byte_8le(cpustate->program, sar0--));
+ cpustate->program->write_byte(dar0, cpustate->program->read_byte(sar0--));
break;
case 0x28: /* reserved */
break;
@@ -1696,7 +1696,7 @@ static int z180_dma0(z180_state *cpustate, int max_cycles)
case 0x30: /* memory SAR0+1 to I/O DAR0 fixed */
if (cpustate->iol & Z180_DREQ0)
{
- OUT(cpustate, dar0, memory_read_byte_8le(cpustate->program, sar0++));
+ OUT(cpustate, dar0, cpustate->program->read_byte(sar0++));
/* edge sensitive DREQ0 ? */
if (cpustate->IO_DCNTL & Z180_DCNTL_DIM0)
{
@@ -1708,7 +1708,7 @@ static int z180_dma0(z180_state *cpustate, int max_cycles)
case 0x34: /* memory SAR0-1 to I/O DAR0 fixed */
if (cpustate->iol & Z180_DREQ0)
{
- OUT(cpustate, dar0, memory_read_byte_8le(cpustate->program, sar0--));
+ OUT(cpustate, dar0, cpustate->program->read_byte(sar0--));
/* edge sensitive DREQ0 ? */
if (cpustate->IO_DCNTL & Z180_DCNTL_DIM0)
{
@@ -1776,16 +1776,16 @@ static int z180_dma1(z180_state *cpustate)
switch (cpustate->IO_DCNTL & (Z180_DCNTL_DIM1 | Z180_DCNTL_DIM0))
{
case 0x00: /* memory MAR1+1 to I/O IAR1 fixed */
- memory_write_byte_8le(cpustate->iospace, iar1, memory_read_byte_8le(cpustate->program, mar1++));
+ cpustate->iospace->write_byte(iar1, cpustate->program->read_byte(mar1++));
break;
case 0x01: /* memory MAR1-1 to I/O IAR1 fixed */
- memory_write_byte_8le(cpustate->iospace, iar1, memory_read_byte_8le(cpustate->program, mar1--));
+ cpustate->iospace->write_byte(iar1, cpustate->program->read_byte(mar1--));
break;
case 0x02: /* I/O IAR1 fixed to memory MAR1+1 */
- memory_write_byte_8le(cpustate->program, mar1++, memory_read_byte_8le(cpustate->iospace, iar1));
+ cpustate->program->write_byte(mar1++, cpustate->iospace->read_byte(iar1));
break;
case 0x03: /* I/O IAR1 fixed to memory MAR1-1 */
- memory_write_byte_8le(cpustate->program, mar1--, memory_read_byte_8le(cpustate->iospace, iar1));
+ cpustate->program->write_byte(mar1--, cpustate->iospace->read_byte(iar1));
break;
}
diff --git a/src/emu/cpu/z180/z180ops.h b/src/emu/cpu/z180/z180ops.h
index a28297b43d5..5f192c162dd 100644
--- a/src/emu/cpu/z180/z180ops.h
+++ b/src/emu/cpu/z180/z180ops.h
@@ -22,7 +22,7 @@
***************************************************************/
#define IN(cs,port) \
(((port ^ (cs)->IO_IOCR) & 0xffc0) == 0) ? \
- z180_readcontrol(cs, port) : memory_read_byte_8le((cs)->iospace, port)
+ z180_readcontrol(cs, port) : (cs)->iospace->read_byte(port)
/***************************************************************
* Output a byte to given I/O port
@@ -30,7 +30,7 @@
#define OUT(cs,port,value) \
if (((port ^ (cs)->IO_IOCR) & 0xffc0) == 0) \
z180_writecontrol(cs,port,value); \
- else memory_write_byte_8le((cs)->iospace,port,value)
+ else (cs)->iospace->write_byte(port,value)
/***************************************************************
* MMU calculate the memory managemant lookup table
@@ -66,7 +66,7 @@ INLINE void z180_mmu(z180_state *cpustate)
/***************************************************************
* Read a byte from given memory location
***************************************************************/
-#define RM(cs,addr) memory_read_byte_8le((cs)->program, MMU_REMAP_ADDR(cs,addr))
+#define RM(cs,addr) (cs)->program->read_byte(MMU_REMAP_ADDR(cs,addr))
#ifdef UNUSED_FUNCTION
UINT8 z180_readmem(running_device *device, offs_t offset)
{
@@ -78,7 +78,7 @@ UINT8 z180_readmem(running_device *device, offs_t offset)
/***************************************************************
* Write a byte to given memory location
***************************************************************/
-#define WM(cs,addr,value) memory_write_byte_8le((cs)->program, MMU_REMAP_ADDR(cs,addr),value)
+#define WM(cs,addr,value) (cs)->program->write_byte(MMU_REMAP_ADDR(cs,addr),value)
#ifdef UNUSED_FUNCTION
void z180_writemem(running_device *device, offs_t offset, UINT8 data)
{
diff --git a/src/emu/cpu/z8/z8.c b/src/emu/cpu/z8/z8.c
index 835d5d55269..184d112a427 100644
--- a/src/emu/cpu/z8/z8.c
+++ b/src/emu/cpu/z8/z8.c
@@ -233,7 +233,7 @@ INLINE UINT8 register_read(z8_state *cpustate, UINT8 offset)
if (!(P3M & Z8_P3M_P0_STROBED))
{
- if (mask) cpustate->input[offset] = memory_read_byte_8be(cpustate->io, offset);
+ if (mask) cpustate->input[offset] = cpustate->io->read_byte(offset);
}
data |= cpustate->input[offset] & mask;
@@ -249,7 +249,7 @@ INLINE UINT8 register_read(z8_state *cpustate, UINT8 offset)
if ((P3M & Z8_P3M_P33_P34_MASK) != Z8_P3M_P33_P34_DAV1_RDY1)
{
- if (mask) cpustate->input[offset] = memory_read_byte_8be(cpustate->io, offset);
+ if (mask) cpustate->input[offset] = cpustate->io->read_byte(offset);
}
data |= cpustate->input[offset] & mask;
@@ -260,7 +260,7 @@ INLINE UINT8 register_read(z8_state *cpustate, UINT8 offset)
if (!(P3M & Z8_P3M_P2_STROBED))
{
- if (mask) cpustate->input[offset] = memory_read_byte_8be(cpustate->io, offset);
+ if (mask) cpustate->input[offset] = cpustate->io->read_byte(offset);
}
data = (cpustate->input[offset] & mask) | (cpustate->output[offset] & ~mask);
@@ -273,7 +273,7 @@ INLINE UINT8 register_read(z8_state *cpustate, UINT8 offset)
mask = 0x0f;
}
- if (mask) cpustate->input[offset] = memory_read_byte_8be(cpustate->io, offset);
+ if (mask) cpustate->input[offset] = cpustate->io->read_byte(offset);
data = (cpustate->input[offset] & mask) | (cpustate->output[offset] & ~mask);
break;
@@ -318,19 +318,19 @@ INLINE void register_write(z8_state *cpustate, UINT8 offset, UINT8 data)
cpustate->output[offset] = data;
if ((P01M & Z8_P01M_P0L_MODE_MASK) == Z8_P01M_P0L_MODE_OUTPUT) mask |= 0x0f;
if ((P01M & Z8_P01M_P0H_MODE_MASK) == Z8_P01M_P0H_MODE_OUTPUT) mask |= 0xf0;
- if (mask) memory_write_byte_8be(cpustate->io, offset, data & mask);
+ if (mask) cpustate->io->write_byte(offset, data & mask);
break;
case Z8_REGISTER_P1:
cpustate->output[offset] = data;
if ((P01M & Z8_P01M_P1_MODE_MASK) == Z8_P01M_P1_MODE_OUTPUT) mask = 0xff;
- if (mask) memory_write_byte_8be(cpustate->io, offset, data & mask);
+ if (mask) cpustate->io->write_byte(offset, data & mask);
break;
case Z8_REGISTER_P2:
cpustate->output[offset] = data;
mask = cpustate->r[Z8_REGISTER_P2M] ^ 0xff;
- if (mask) memory_write_byte_8be(cpustate->io, offset, data & mask);
+ if (mask) cpustate->io->write_byte(offset, data & mask);
break;
case Z8_REGISTER_P3:
@@ -342,7 +342,7 @@ INLINE void register_write(z8_state *cpustate, UINT8 offset, UINT8 data)
mask = 0xf0;
}
- if (mask) memory_write_byte_8be(cpustate->io, offset, data & mask);
+ if (mask) cpustate->io->write_byte(offset, data & mask);
break;
case Z8_REGISTER_SIO:
@@ -436,7 +436,7 @@ INLINE void stack_push_byte(z8_state *cpustate, UINT8 src)
register_pair_write(cpustate, Z8_REGISTER_SPH, sp);
/* @SP <- src */
- memory_write_byte(cpustate->data, sp, src);
+ cpustate->data->write_byte(sp, src);
}
}
@@ -458,7 +458,7 @@ INLINE void stack_push_word(z8_state *cpustate, UINT16 src)
register_pair_write(cpustate, Z8_REGISTER_SPH, sp);
/* @SP <- src */
- memory_write_word_8le(cpustate->data, sp, src);
+ cpustate->data->write_word(sp, src);
}
}
@@ -480,7 +480,7 @@ INLINE UINT8 stack_pop_byte(z8_state *cpustate)
register_pair_write(cpustate, Z8_REGISTER_SPH, sp);
/* @SP <- src */
- return memory_read_byte(cpustate->data, sp);
+ return cpustate->data->read_byte(sp);
}
}
@@ -502,7 +502,7 @@ INLINE UINT16 stack_pop_word(z8_state *cpustate)
register_pair_write(cpustate, Z8_REGISTER_SPH, sp);
/* @SP <- src */
- return memory_read_word_8le(cpustate->data, sp);
+ return cpustate->data->read_word(sp);
}
}
@@ -694,7 +694,7 @@ static CPU_EXECUTE( z8 )
debugger_instruction_hook(device, cpustate->pc);
/* TODO: sample interrupts */
- cpustate->input[3] = memory_read_byte_8be(cpustate->io, 3);
+ cpustate->input[3] = cpustate->io->read_byte(3);
/* fetch opcode */
opcode = fetch(cpustate);
diff --git a/src/emu/cpu/z8/z8ops.c b/src/emu/cpu/z8/z8ops.c
index 62e82c81da8..7d002e795f8 100644
--- a/src/emu/cpu/z8/z8ops.c
+++ b/src/emu/cpu/z8/z8ops.c
@@ -161,7 +161,7 @@ static void load_to_memory(z8_state *cpustate, address_space *space)
UINT16 address = register_pair_read(cpustate, dst);
UINT8 data = register_read(cpustate, src);
- memory_write_byte(cpustate->program, address, data);
+ cpustate->program->write_byte(address, data);
}
static void load_from_memory_autoinc(z8_state *cpustate, address_space *space)
@@ -190,7 +190,7 @@ static void load_to_memory_autoinc(z8_state *cpustate, address_space *space)
UINT16 address = register_pair_read(cpustate, dst);
UINT8 data = register_read(cpustate, real_src);
- memory_write_byte(cpustate->program, address, data);
+ cpustate->program->write_byte(address, data);
register_pair_write(cpustate, dst, address + 1);
register_write(cpustate, src, real_src + 1);
diff --git a/src/emu/cpu/z80/z80.c b/src/emu/cpu/z80/z80.c
index c4c79a91626..ab46e6cae52 100644
--- a/src/emu/cpu/z80/z80.c
+++ b/src/emu/cpu/z80/z80.c
@@ -595,17 +595,17 @@ INLINE void BURNODD(z80_state *z80, int cycles, int opcodes, int cyclesum)
/***************************************************************
* Input a byte from given I/O port
***************************************************************/
-#define IN(Z,port) memory_read_byte_8le((Z)->io, port)
+#define IN(Z,port) (Z)->io->read_byte(port)
/***************************************************************
* Output a byte to given I/O port
***************************************************************/
-#define OUT(Z,port,value) memory_write_byte_8le((Z)->io, port, value)
+#define OUT(Z,port,value) (Z)->io->write_byte(port, value)
/***************************************************************
* Read a byte from given memory location
***************************************************************/
-#define RM(Z,addr) memory_read_byte_8le((Z)->program, addr)
+#define RM(Z,addr) (Z)->program->read_byte(addr)
/***************************************************************
* Read a word from given memory location
@@ -619,7 +619,7 @@ INLINE void RM16(z80_state *z80, UINT32 addr, PAIR *r)
/***************************************************************
* Write a byte to given memory location
***************************************************************/
-#define WM(Z,addr,value) memory_write_byte_8le((Z)->program, addr, value)
+#define WM(Z,addr,value) (Z)->program->write_byte(addr, value)
/***************************************************************
* Write a word to given memory location
diff --git a/src/emu/cpu/z8000/z8000.c b/src/emu/cpu/z8000/z8000.c
index 9ccb6e4cd6f..5fe5ce86a76 100644
--- a/src/emu/cpu/z8000/z8000.c
+++ b/src/emu/cpu/z8000/z8000.c
@@ -115,46 +115,46 @@ INLINE UINT16 RDOP(z8000_state *cpustate)
INLINE UINT8 RDMEM_B(z8000_state *cpustate, UINT32 addr)
{
- return memory_read_byte_16be(cpustate->program, addr);
+ return cpustate->program->read_byte(addr);
}
INLINE UINT16 RDMEM_W(z8000_state *cpustate, UINT32 addr)
{
addr &= ~1;
- return memory_read_word_16be(cpustate->program, addr);
+ return cpustate->program->read_word(addr);
}
INLINE UINT32 RDMEM_L(z8000_state *cpustate, UINT32 addr)
{
UINT32 result;
addr &= ~1;
- result = memory_read_word_16be(cpustate->program, addr) << 16;
- return result + memory_read_word_16be(cpustate->program, addr + 2);
+ result = cpustate->program->read_word(addr) << 16;
+ return result + cpustate->program->read_word(addr + 2);
}
INLINE void WRMEM_B(z8000_state *cpustate, UINT32 addr, UINT8 value)
{
- memory_write_byte_16be(cpustate->program, addr, value);
+ cpustate->program->write_byte(addr, value);
}
INLINE void WRMEM_W(z8000_state *cpustate, UINT32 addr, UINT16 value)
{
addr &= ~1;
- memory_write_word_16be(cpustate->program, addr, value);
+ cpustate->program->write_word(addr, value);
}
INLINE void WRMEM_L(z8000_state *cpustate, UINT32 addr, UINT32 value)
{
addr &= ~1;
- memory_write_word_16be(cpustate->program, addr, value >> 16);
- memory_write_word_16be(cpustate->program, (UINT16)(addr + 2), value & 0xffff);
+ cpustate->program->write_word(addr, value >> 16);
+ cpustate->program->write_word((UINT16)(addr + 2), value & 0xffff);
}
INLINE UINT8 RDPORT_B(z8000_state *cpustate, int mode, UINT16 addr)
{
if(mode == 0)
{
- return memory_read_byte_8le(cpustate->io, addr);
+ return cpustate->io->read_byte(addr);
}
else
{
@@ -167,8 +167,8 @@ INLINE UINT16 RDPORT_W(z8000_state *cpustate, int mode, UINT16 addr)
{
if(mode == 0)
{
- return memory_read_byte_8le(cpustate->io, (UINT16)(addr)) +
- (memory_read_byte_8le(cpustate->io, (UINT16)(addr+1)) << 8);
+ return cpustate->io->read_byte((UINT16)(addr)) +
+ (cpustate->io->read_byte((UINT16)(addr+1)) << 8);
}
else
{
@@ -181,7 +181,7 @@ INLINE void WRPORT_B(z8000_state *cpustate, int mode, UINT16 addr, UINT8 value)
{
if(mode == 0)
{
- memory_write_byte_8le(cpustate->io, addr,value);
+ cpustate->io->write_byte(addr,value);
}
else
{
@@ -193,8 +193,8 @@ INLINE void WRPORT_W(z8000_state *cpustate, int mode, UINT16 addr, UINT16 value)
{
if(mode == 0)
{
- memory_write_byte_8le(cpustate->io, (UINT16)(addr),value & 0xff);
- memory_write_byte_8le(cpustate->io, (UINT16)(addr+1),(value >> 8) & 0xff);
+ cpustate->io->write_byte((UINT16)(addr),value & 0xff);
+ cpustate->io->write_byte((UINT16)(addr+1),(value >> 8) & 0xff);
}
else
{
diff --git a/src/emu/machine/at28c16.c b/src/emu/machine/at28c16.c
index b847d5d7813..0b1360c1fac 100644
--- a/src/emu/machine/at28c16.c
+++ b/src/emu/machine/at28c16.c
@@ -155,7 +155,7 @@ void at28c16_device::nvram_default()
UINT16 default_value = 0xff;
for( offs_t offs = 0; offs < AT28C16_TOTAL_BYTES; offs++ )
{
- memory_write_byte( m_addrspace[ 0 ], offs, default_value );
+ m_addrspace[ 0 ]->write_byte( offs, default_value );
}
/* populate from a memory region if present */
@@ -173,7 +173,7 @@ void at28c16_device::nvram_default()
for( offs_t offs = 0; offs < AT28C16_DATA_BYTES; offs++ )
{
- memory_write_byte( m_addrspace[ 0 ], offs, m_region->u8( offs ) );
+ m_addrspace[ 0 ]->write_byte( offs, m_region->u8( offs ) );
}
}
}
@@ -192,7 +192,7 @@ void at28c16_device::nvram_read( mame_file &file )
for( offs_t offs = 0; offs < AT28C16_TOTAL_BYTES; offs++ )
{
- memory_write_byte( m_addrspace[ 0 ], offs, buffer[ offs ] );
+ m_addrspace[ 0 ]->write_byte( offs, buffer[ offs ] );
}
auto_free( &m_machine, buffer );
@@ -209,7 +209,7 @@ void at28c16_device::nvram_write( mame_file &file )
for( offs_t offs = 0; offs < AT28C16_TOTAL_BYTES; offs++ )
{
- buffer[ offs ] = memory_read_byte( m_addrspace[ 0 ], offs );
+ buffer[ offs ] = m_addrspace[ 0 ]->read_byte( offs );
}
mame_fwrite( &file, buffer, AT28C16_TOTAL_BYTES );
@@ -241,7 +241,7 @@ void at28c16_device::write( offs_t offset, UINT8 data )
{
for( offs_t offs = 0; offs < AT28C16_TOTAL_BYTES; offs++ )
{
- memory_write_byte( m_addrspace[ 0 ], offs, 0xff );
+ m_addrspace[ 0 ]->write_byte( offs, 0xff );
}
m_last_write = 0xff;
@@ -256,9 +256,9 @@ void at28c16_device::write( offs_t offset, UINT8 data )
}
// logerror( "%s: AT28C16: write( %04x, %02x )\n", cpuexec_describe_context(machine), offset, data );
- if( m_last_write < 0 && memory_read_byte( m_addrspace[ 0 ], offset ) != data )
+ if( m_last_write < 0 && m_addrspace[ 0 ]->read_byte( offset ) != data )
{
- memory_write_byte( m_addrspace[ 0 ], offset, data );
+ m_addrspace[ 0 ]->write_byte( offset, data );
m_last_write = data;
timer_adjust_oneshot( m_write_timer, ATTOTIME_IN_USEC( 200 ), 0 );
}
@@ -286,7 +286,7 @@ UINT8 at28c16_device::read( offs_t offset )
offset += AT28C16_ID_BYTES;
}
- UINT8 data = memory_read_byte( m_addrspace[ 0 ], offset );
+ UINT8 data = m_addrspace[ 0 ]->read_byte( offset );
// logerror( "%s: AT28C16: read( %04x ) data %02x\n", cpuexec_describe_context(machine), offset, data );
return data;
}
diff --git a/src/emu/machine/eeprom.c b/src/emu/machine/eeprom.c
index 5a0c23f3a68..409b8773a5e 100644
--- a/src/emu/machine/eeprom.c
+++ b/src/emu/machine/eeprom.c
@@ -239,14 +239,14 @@ void eeprom_device::nvram_default()
default_value = m_config.m_default_value;
for (offs_t offs = 0; offs < eeprom_length; offs++)
if (m_config.m_data_bits == 8)
- memory_write_byte(m_addrspace[0], offs, default_value);
+ m_addrspace[0]->write_byte(offs, default_value);
else
- memory_write_word(m_addrspace[0], offs * 2, default_value);
+ m_addrspace[0]->write_word(offs * 2, default_value);
/* handle hard-coded data from the driver */
if (m_config.m_default_data != NULL)
for (offs_t offs = 0; offs < m_config.m_default_data_size; offs++)
- memory_write_byte(m_addrspace[0], offs, m_config.m_default_data[offs]);
+ m_addrspace[0]->write_byte(offs, m_config.m_default_data[offs]);
/* populate from a memory region if present */
if (m_region != NULL)
@@ -260,9 +260,9 @@ void eeprom_device::nvram_default()
for (offs_t offs = 0; offs < eeprom_length; offs++)
if (m_config.m_data_bits == 8)
- memory_write_byte(m_addrspace[0], offs, m_region->u8(offs));
+ m_addrspace[0]->write_byte(offs, m_region->u8(offs));
else
- memory_write_word(m_addrspace[0], offs * 2, m_region->u16(offs));
+ m_addrspace[0]->write_word(offs * 2, m_region->u16(offs));
}
}
@@ -280,7 +280,7 @@ void eeprom_device::nvram_read(mame_file &file)
UINT8 *buffer = auto_alloc_array(&m_machine, UINT8, eeprom_bytes);
mame_fread(&file, buffer, eeprom_bytes);
for (offs_t offs = 0; offs < eeprom_bytes; offs++)
- memory_write_byte(m_addrspace[0], offs, buffer[offs]);
+ m_addrspace[0]->write_byte(offs, buffer[offs]);
auto_free(&m_machine, buffer);
}
@@ -297,7 +297,7 @@ void eeprom_device::nvram_write(mame_file &file)
UINT8 *buffer = auto_alloc_array(&m_machine, UINT8, eeprom_bytes);
for (offs_t offs = 0; offs < eeprom_bytes; offs++)
- buffer[offs] = memory_read_byte(m_addrspace[0], offs);
+ buffer[offs] = m_addrspace[0]->read_byte(offs);
mame_fwrite(&file, buffer, eeprom_bytes);
auto_free(&m_machine, buffer);
}
@@ -391,9 +391,9 @@ void eeprom_device::set_clock_line(int state)
{
m_read_address = (m_read_address + 1) & ((1 << m_config.m_address_bits) - 1);
if (m_config.m_data_bits == 16)
- m_data_bits = memory_read_word(m_addrspace[0], m_read_address * 2);
+ m_data_bits = m_addrspace[0]->read_word(m_read_address * 2);
else
- m_data_bits = memory_read_byte(m_addrspace[0], m_read_address);
+ m_data_bits = m_addrspace[0]->read_byte(m_read_address);
m_clock_count = 0;
logerror("EEPROM read %04x from address %02x\n",m_data_bits,m_read_address);
}
@@ -439,9 +439,9 @@ void eeprom_device::write(int bit)
if (m_serial_buffer[i] == '1') address |= 1;
}
if (m_config.m_data_bits == 16)
- m_data_bits = memory_read_word(m_addrspace[0], address * 2);
+ m_data_bits = m_addrspace[0]->read_word(address * 2);
else
- m_data_bits = memory_read_byte(m_addrspace[0], address);
+ m_data_bits = m_addrspace[0]->read_byte(address);
m_read_address = address;
m_clock_count = 0;
m_sending = 1;
@@ -463,9 +463,9 @@ logerror("EEPROM erase address %02x\n",address);
if (m_locked == 0)
{
if (m_config.m_data_bits == 16)
- memory_write_word(m_addrspace[0], address * 2, 0x0000);
+ m_addrspace[0]->write_word(address * 2, 0x0000);
else
- memory_write_byte(m_addrspace[0], address, 0x00);
+ m_addrspace[0]->write_byte(address, 0x00);
}
else
logerror("Error: EEPROM is m_locked\n");
@@ -492,9 +492,9 @@ logerror("EEPROM write %04x to address %02x\n",data,address);
if (m_locked == 0)
{
if (m_config.m_data_bits == 16)
- memory_write_word(m_addrspace[0], address * 2, data);
+ m_addrspace[0]->write_word(address * 2, data);
else
- memory_write_byte(m_addrspace[0], address, data);
+ m_addrspace[0]->write_byte(address, data);
}
else
logerror("Error: EEPROM is m_locked\n");
diff --git a/src/emu/machine/i2cmem.c b/src/emu/machine/i2cmem.c
index c8c3683f067..63f0cfcd349 100644
--- a/src/emu/machine/i2cmem.c
+++ b/src/emu/machine/i2cmem.c
@@ -233,7 +233,7 @@ void i2cmem_device::nvram_default()
UINT16 default_value = 0xff;
for( offs_t offs = 0; offs < i2cmem_bytes; offs++ )
{
- memory_write_byte( m_addrspace[ 0 ], offs, default_value );
+ m_addrspace[ 0 ]->write_byte( offs, default_value );
}
/* populate from a memory region if present */
@@ -251,7 +251,7 @@ void i2cmem_device::nvram_default()
for( offs_t offs = 0; offs < i2cmem_bytes; offs++ )
{
- memory_write_byte( m_addrspace[ 0 ], offs, m_region->u8( offs ) );
+ m_addrspace[ 0 ]->write_byte( offs, m_region->u8( offs ) );
}
}
}
@@ -271,7 +271,7 @@ void i2cmem_device::nvram_read( mame_file &file )
for( offs_t offs = 0; offs < i2cmem_bytes; offs++ )
{
- memory_write_byte( m_addrspace[ 0 ], offs, buffer[ offs ] );
+ m_addrspace[ 0 ]->write_byte( offs, buffer[ offs ] );
}
auto_free( &m_machine, buffer );
@@ -289,7 +289,7 @@ void i2cmem_device::nvram_write( mame_file &file )
for( offs_t offs = 0; offs < i2cmem_bytes; offs++ )
{
- buffer[ offs ] = memory_read_byte( m_addrspace[ 0 ], offs );
+ buffer[ offs ] = m_addrspace[ 0 ]->read_byte( offs );
}
mame_fwrite( &file, buffer, i2cmem_bytes );
@@ -464,7 +464,7 @@ void i2cmem_device::set_scl_line( int state )
for( int i = 0; i < m_page_size; i++ )
{
- memory_write_byte( m_addrspace[ 0 ], offset + i, m_page[ i ] );
+ m_addrspace[ 0 ]->write_byte( offset + i, m_page[ i ] );
}
m_page_offset = 0;
@@ -475,7 +475,7 @@ void i2cmem_device::set_scl_line( int state )
int offset = data_offset();
verboselog( this, 1, "data[ %04x ] <- %02x\n", offset, m_shift );
- memory_write_byte( m_addrspace[ 0 ], offset, m_shift );
+ m_addrspace[ 0 ]->write_byte( offset, m_shift );
m_byteaddr++;
}
@@ -508,7 +508,7 @@ void i2cmem_device::set_scl_line( int state )
{
int offset = data_offset();
- m_shift = memory_read_byte( m_addrspace[ 0 ], offset );
+ m_shift = m_addrspace[ 0 ]->read_byte( offset );
verboselog( this, 1, "data[ %04x ] -> %02x\n", offset, m_shift );
m_byteaddr++;
}
diff --git a/src/emu/machine/idectrl.c b/src/emu/machine/idectrl.c
index 5d3c934c937..3375f107b53 100644
--- a/src/emu/machine/idectrl.c
+++ b/src/emu/machine/idectrl.c
@@ -693,17 +693,17 @@ static void write_buffer_to_dma(ide_state *ide)
}
/* fetch the address */
- ide->dma_address = memory_read_byte(ide->dma_space, ide->dma_descriptor++ ^ ide->dma_address_xor);
- ide->dma_address |= memory_read_byte(ide->dma_space, ide->dma_descriptor++ ^ ide->dma_address_xor) << 8;
- ide->dma_address |= memory_read_byte(ide->dma_space, ide->dma_descriptor++ ^ ide->dma_address_xor) << 16;
- ide->dma_address |= memory_read_byte(ide->dma_space, ide->dma_descriptor++ ^ ide->dma_address_xor) << 24;
+ ide->dma_address = ide->dma_space->read_byte(ide->dma_descriptor++ ^ ide->dma_address_xor);
+ ide->dma_address |= ide->dma_space->read_byte(ide->dma_descriptor++ ^ ide->dma_address_xor) << 8;
+ ide->dma_address |= ide->dma_space->read_byte(ide->dma_descriptor++ ^ ide->dma_address_xor) << 16;
+ ide->dma_address |= ide->dma_space->read_byte(ide->dma_descriptor++ ^ ide->dma_address_xor) << 24;
ide->dma_address &= 0xfffffffe;
/* fetch the length */
- ide->dma_bytes_left = memory_read_byte(ide->dma_space, ide->dma_descriptor++ ^ ide->dma_address_xor);
- ide->dma_bytes_left |= memory_read_byte(ide->dma_space, ide->dma_descriptor++ ^ ide->dma_address_xor) << 8;
- ide->dma_bytes_left |= memory_read_byte(ide->dma_space, ide->dma_descriptor++ ^ ide->dma_address_xor) << 16;
- ide->dma_bytes_left |= memory_read_byte(ide->dma_space, ide->dma_descriptor++ ^ ide->dma_address_xor) << 24;
+ ide->dma_bytes_left = ide->dma_space->read_byte(ide->dma_descriptor++ ^ ide->dma_address_xor);
+ ide->dma_bytes_left |= ide->dma_space->read_byte(ide->dma_descriptor++ ^ ide->dma_address_xor) << 8;
+ ide->dma_bytes_left |= ide->dma_space->read_byte(ide->dma_descriptor++ ^ ide->dma_address_xor) << 16;
+ ide->dma_bytes_left |= ide->dma_space->read_byte(ide->dma_descriptor++ ^ ide->dma_address_xor) << 24;
ide->dma_last_buffer = (ide->dma_bytes_left >> 31) & 1;
ide->dma_bytes_left &= 0xfffe;
if (ide->dma_bytes_left == 0)
@@ -713,7 +713,7 @@ static void write_buffer_to_dma(ide_state *ide)
}
/* write the next byte */
- memory_write_byte(ide->dma_space, ide->dma_address++, *data++);
+ ide->dma_space->write_byte(ide->dma_address++, *data++);
ide->dma_bytes_left--;
}
}
@@ -897,17 +897,17 @@ static void read_buffer_from_dma(ide_state *ide)
}
/* fetch the address */
- ide->dma_address = memory_read_byte(ide->dma_space, ide->dma_descriptor++ ^ ide->dma_address_xor);
- ide->dma_address |= memory_read_byte(ide->dma_space, ide->dma_descriptor++ ^ ide->dma_address_xor) << 8;
- ide->dma_address |= memory_read_byte(ide->dma_space, ide->dma_descriptor++ ^ ide->dma_address_xor) << 16;
- ide->dma_address |= memory_read_byte(ide->dma_space, ide->dma_descriptor++ ^ ide->dma_address_xor) << 24;
+ ide->dma_address = ide->dma_space->read_byte(ide->dma_descriptor++ ^ ide->dma_address_xor);
+ ide->dma_address |= ide->dma_space->read_byte(ide->dma_descriptor++ ^ ide->dma_address_xor) << 8;
+ ide->dma_address |= ide->dma_space->read_byte(ide->dma_descriptor++ ^ ide->dma_address_xor) << 16;
+ ide->dma_address |= ide->dma_space->read_byte(ide->dma_descriptor++ ^ ide->dma_address_xor) << 24;
ide->dma_address &= 0xfffffffe;
/* fetch the length */
- ide->dma_bytes_left = memory_read_byte(ide->dma_space, ide->dma_descriptor++ ^ ide->dma_address_xor);
- ide->dma_bytes_left |= memory_read_byte(ide->dma_space, ide->dma_descriptor++ ^ ide->dma_address_xor) << 8;
- ide->dma_bytes_left |= memory_read_byte(ide->dma_space, ide->dma_descriptor++ ^ ide->dma_address_xor) << 16;
- ide->dma_bytes_left |= memory_read_byte(ide->dma_space, ide->dma_descriptor++ ^ ide->dma_address_xor) << 24;
+ ide->dma_bytes_left = ide->dma_space->read_byte(ide->dma_descriptor++ ^ ide->dma_address_xor);
+ ide->dma_bytes_left |= ide->dma_space->read_byte(ide->dma_descriptor++ ^ ide->dma_address_xor) << 8;
+ ide->dma_bytes_left |= ide->dma_space->read_byte(ide->dma_descriptor++ ^ ide->dma_address_xor) << 16;
+ ide->dma_bytes_left |= ide->dma_space->read_byte(ide->dma_descriptor++ ^ ide->dma_address_xor) << 24;
ide->dma_last_buffer = (ide->dma_bytes_left >> 31) & 1;
ide->dma_bytes_left &= 0xfffe;
if (ide->dma_bytes_left == 0)
@@ -917,7 +917,7 @@ static void read_buffer_from_dma(ide_state *ide)
}
/* read the next byte */
- *data++ = memory_read_byte(ide->dma_space, ide->dma_address++);
+ *data++ = ide->dma_space->read_byte(ide->dma_address++);
ide->dma_bytes_left--;
}
}
diff --git a/src/emu/memory.h b/src/emu/memory.h
index b63da7395b0..a7ce4da0938 100644
--- a/src/emu/memory.h
+++ b/src/emu/memory.h
@@ -838,83 +838,6 @@ inline UINT64 direct_read_data::read_decrypted_qword(offs_t byteaddress)
// LEGACY FUNCTIONS TO REMOVE
//**************************************************************************
-static inline UINT8 memory_read_byte(address_space *space, offs_t byteaddress)
-{
- return const_cast<address_space *>(space)->read_byte(byteaddress);
-}
-
-static inline UINT16 memory_read_word(address_space *space, offs_t byteaddress)
-{
- return const_cast<address_space *>(space)->read_word(byteaddress);
-}
-
-static inline UINT16 memory_read_word_masked(address_space *space, offs_t byteaddress, UINT16 mask)
-{
- return const_cast<address_space *>(space)->read_word(byteaddress, mask);
-}
-
-static inline UINT32 memory_read_dword(address_space *space, offs_t byteaddress)
-{
- return const_cast<address_space *>(space)->read_dword(byteaddress);
-}
-
-static inline UINT32 memory_read_dword_masked(address_space *space, offs_t byteaddress, UINT32 mask)
-{
- return const_cast<address_space *>(space)->read_dword(byteaddress, mask);
-}
-
-static inline UINT64 memory_read_qword(address_space *space, offs_t byteaddress)
-{
- return const_cast<address_space *>(space)->read_qword(byteaddress);
-}
-
-static inline UINT64 memory_read_qword_masked(address_space *space, offs_t byteaddress, UINT64 mask)
-{
- return const_cast<address_space *>(space)->read_qword(byteaddress, mask);
-}
-
-
-/*-------------------------------------------------
- memory_write_byte/word/dword/qword - write a
- value to the specified address space
--------------------------------------------------*/
-
-static inline void memory_write_byte(address_space *space, offs_t byteaddress, UINT8 data)
-{
- const_cast<address_space *>(space)->write_byte(byteaddress, data);
-}
-
-static inline void memory_write_word(address_space *space, offs_t byteaddress, UINT16 data)
-{
- const_cast<address_space *>(space)->write_word(byteaddress, data);
-}
-
-static inline void memory_write_word_masked(address_space *space, offs_t byteaddress, UINT16 data, UINT16 mask)
-{
- const_cast<address_space *>(space)->write_word(byteaddress, data, mask);
-}
-
-static inline void memory_write_dword(address_space *space, offs_t byteaddress, UINT32 data)
-{
- const_cast<address_space *>(space)->write_dword(byteaddress, data);
-}
-
-static inline void memory_write_dword_masked(address_space *space, offs_t byteaddress, UINT32 data, UINT32 mask)
-{
- const_cast<address_space *>(space)->write_dword(byteaddress, data, mask);
-}
-
-static inline void memory_write_qword(address_space *space, offs_t byteaddress, UINT64 data)
-{
- const_cast<address_space *>(space)->write_qword(byteaddress, data);
-}
-
-static inline void memory_write_qword_masked(address_space *space, offs_t byteaddress, UINT64 data, UINT64 mask)
-{
- const_cast<address_space *>(space)->write_qword(byteaddress, data, mask);
-}
-
-
static inline void *memory_raw_read_ptr(address_space *space, offs_t byteaddress) { return space->direct().read_raw_ptr(byteaddress); }
static inline UINT8 memory_raw_read_byte(address_space *space, offs_t byteaddress) { return space->direct().read_raw_byte(byteaddress); }
static inline UINT16 memory_raw_read_word(address_space *space, offs_t byteaddress) { return space->direct().read_raw_word(byteaddress); }
@@ -976,125 +899,4 @@ static inline bool memory_get_log_unmap(address_space *space)
}
-// declare generic address space handlers
-static inline UINT8 memory_read_byte_8le(address_space *space, offs_t address) { return (const_cast<address_space *>(space))->read_byte(address); }
-static inline UINT16 memory_read_word_8le(address_space *space, offs_t address) { return (const_cast<address_space *>(space))->read_word(address); }
-static inline UINT16 memory_read_word_masked_8le(address_space *space, offs_t address, UINT16 mask) { return (const_cast<address_space *>(space))->read_word(address, mask); }
-static inline UINT32 memory_read_dword_8le(address_space *space, offs_t address) { return (const_cast<address_space *>(space))->read_dword(address); }
-static inline UINT32 memory_read_dword_masked_8le(address_space *space, offs_t address, UINT32 mask) { return (const_cast<address_space *>(space))->read_dword(address, mask); }
-static inline UINT64 memory_read_qword_8le(address_space *space, offs_t address) { return (const_cast<address_space *>(space))->read_qword(address); }
-static inline UINT64 memory_read_qword_masked_8le(address_space *space, offs_t address, UINT64 mask) { return (const_cast<address_space *>(space))->read_qword(address, mask); }
-static inline void memory_write_byte_8le(address_space *space, offs_t address, UINT8 data) { return (const_cast<address_space *>(space))->write_byte(address, data); }
-static inline void memory_write_word_8le(address_space *space, offs_t address, UINT16 data) { return (const_cast<address_space *>(space))->write_word(address, data); }
-static inline void memory_write_word_masked_8le(address_space *space, offs_t address, UINT16 data, UINT16 mask) { return (const_cast<address_space *>(space))->write_word(address, data, mask); }
-static inline void memory_write_dword_8le(address_space *space, offs_t address, UINT32 data) { return (const_cast<address_space *>(space))->write_dword(address, data); }
-static inline void memory_write_dword_masked_8le(address_space *space, offs_t address, UINT32 data, UINT32 mask) { return (const_cast<address_space *>(space))->write_dword(address, data, mask); }
-static inline void memory_write_qword_8le(address_space *space, offs_t address, UINT64 data) { return (const_cast<address_space *>(space))->write_qword(address, data); }
-static inline void memory_write_qword_masked_8le(address_space *space, offs_t address, UINT64 data, UINT64 mask) { return (const_cast<address_space *>(space))->write_qword(address, data, mask); }
-
-static inline UINT8 memory_read_byte_8be(address_space *space, offs_t address) { return (const_cast<address_space *>(space))->read_byte(address); }
-static inline UINT16 memory_read_word_8be(address_space *space, offs_t address) { return (const_cast<address_space *>(space))->read_word(address); }
-static inline UINT16 memory_read_word_masked_8be(address_space *space, offs_t address, UINT16 mask) { return (const_cast<address_space *>(space))->read_word(address, mask); }
-static inline UINT32 memory_read_dword_8be(address_space *space, offs_t address) { return (const_cast<address_space *>(space))->read_dword(address); }
-static inline UINT32 memory_read_dword_masked_8be(address_space *space, offs_t address, UINT32 mask) { return (const_cast<address_space *>(space))->read_dword(address, mask); }
-static inline UINT64 memory_read_qword_8be(address_space *space, offs_t address) { return (const_cast<address_space *>(space))->read_qword(address); }
-static inline UINT64 memory_read_qword_masked_8be(address_space *space, offs_t address, UINT64 mask) { return (const_cast<address_space *>(space))->read_qword(address, mask); }
-static inline void memory_write_byte_8be(address_space *space, offs_t address, UINT8 data) { return (const_cast<address_space *>(space))->write_byte(address, data); }
-static inline void memory_write_word_8be(address_space *space, offs_t address, UINT16 data) { return (const_cast<address_space *>(space))->write_word(address, data); }
-static inline void memory_write_word_masked_8be(address_space *space, offs_t address, UINT16 data, UINT16 mask) { return (const_cast<address_space *>(space))->write_word(address, data, mask); }
-static inline void memory_write_dword_8be(address_space *space, offs_t address, UINT32 data) { return (const_cast<address_space *>(space))->write_dword(address, data); }
-static inline void memory_write_dword_masked_8be(address_space *space, offs_t address, UINT32 data, UINT32 mask) { return (const_cast<address_space *>(space))->write_dword(address, data, mask); }
-static inline void memory_write_qword_8be(address_space *space, offs_t address, UINT64 data) { return (const_cast<address_space *>(space))->write_qword(address, data); }
-static inline void memory_write_qword_masked_8be(address_space *space, offs_t address, UINT64 data, UINT64 mask) { return (const_cast<address_space *>(space))->write_qword(address, data, mask); }
-
-static inline UINT8 memory_read_byte_16le(address_space *space, offs_t address) { return (const_cast<address_space *>(space))->read_byte(address); }
-static inline UINT16 memory_read_word_16le(address_space *space, offs_t address) { return (const_cast<address_space *>(space))->read_word(address); }
-static inline UINT16 memory_read_word_masked_16le(address_space *space, offs_t address, UINT16 mask) { return (const_cast<address_space *>(space))->read_word(address, mask); }
-static inline UINT32 memory_read_dword_16le(address_space *space, offs_t address) { return (const_cast<address_space *>(space))->read_dword(address); }
-static inline UINT32 memory_read_dword_masked_16le(address_space *space, offs_t address, UINT32 mask) { return (const_cast<address_space *>(space))->read_dword(address, mask); }
-static inline UINT64 memory_read_qword_16le(address_space *space, offs_t address) { return (const_cast<address_space *>(space))->read_qword(address); }
-static inline UINT64 memory_read_qword_masked_16le(address_space *space, offs_t address, UINT64 mask) { return (const_cast<address_space *>(space))->read_qword(address, mask); }
-static inline void memory_write_byte_16le(address_space *space, offs_t address, UINT8 data) { return (const_cast<address_space *>(space))->write_byte(address, data); }
-static inline void memory_write_word_16le(address_space *space, offs_t address, UINT16 data) { return (const_cast<address_space *>(space))->write_word(address, data); }
-static inline void memory_write_word_masked_16le(address_space *space, offs_t address, UINT16 data, UINT16 mask) { return (const_cast<address_space *>(space))->write_word(address, data, mask); }
-static inline void memory_write_dword_16le(address_space *space, offs_t address, UINT32 data) { return (const_cast<address_space *>(space))->write_dword(address, data); }
-static inline void memory_write_dword_masked_16le(address_space *space, offs_t address, UINT32 data, UINT32 mask) { return (const_cast<address_space *>(space))->write_dword(address, data, mask); }
-static inline void memory_write_qword_16le(address_space *space, offs_t address, UINT64 data) { return (const_cast<address_space *>(space))->write_qword(address, data); }
-static inline void memory_write_qword_masked_16le(address_space *space, offs_t address, UINT64 data, UINT64 mask) { return (const_cast<address_space *>(space))->write_qword(address, data, mask); }
-
-static inline UINT8 memory_read_byte_16be(address_space *space, offs_t address) { return (const_cast<address_space *>(space))->read_byte(address); }
-static inline UINT16 memory_read_word_16be(address_space *space, offs_t address) { return (const_cast<address_space *>(space))->read_word(address); }
-static inline UINT16 memory_read_word_masked_16be(address_space *space, offs_t address, UINT16 mask) { return (const_cast<address_space *>(space))->read_word(address, mask); }
-static inline UINT32 memory_read_dword_16be(address_space *space, offs_t address) { return (const_cast<address_space *>(space))->read_dword(address); }
-static inline UINT32 memory_read_dword_masked_16be(address_space *space, offs_t address, UINT32 mask) { return (const_cast<address_space *>(space))->read_dword(address, mask); }
-static inline UINT64 memory_read_qword_16be(address_space *space, offs_t address) { return (const_cast<address_space *>(space))->read_qword(address); }
-static inline UINT64 memory_read_qword_masked_16be(address_space *space, offs_t address, UINT64 mask) { return (const_cast<address_space *>(space))->read_qword(address, mask); }
-static inline void memory_write_byte_16be(address_space *space, offs_t address, UINT8 data) { return (const_cast<address_space *>(space))->write_byte(address, data); }
-static inline void memory_write_word_16be(address_space *space, offs_t address, UINT16 data) { return (const_cast<address_space *>(space))->write_word(address, data); }
-static inline void memory_write_word_masked_16be(address_space *space, offs_t address, UINT16 data, UINT16 mask) { return (const_cast<address_space *>(space))->write_word(address, data, mask); }
-static inline void memory_write_dword_16be(address_space *space, offs_t address, UINT32 data) { return (const_cast<address_space *>(space))->write_dword(address, data); }
-static inline void memory_write_dword_masked_16be(address_space *space, offs_t address, UINT32 data, UINT32 mask) { return (const_cast<address_space *>(space))->write_dword(address, data, mask); }
-static inline void memory_write_qword_16be(address_space *space, offs_t address, UINT64 data) { return (const_cast<address_space *>(space))->write_qword(address, data); }
-static inline void memory_write_qword_masked_16be(address_space *space, offs_t address, UINT64 data, UINT64 mask) { return (const_cast<address_space *>(space))->write_qword(address, data, mask); }
-
-static inline UINT8 memory_read_byte_32le(address_space *space, offs_t address) { return (const_cast<address_space *>(space))->read_byte(address); }
-static inline UINT16 memory_read_word_32le(address_space *space, offs_t address) { return (const_cast<address_space *>(space))->read_word(address); }
-static inline UINT16 memory_read_word_masked_32le(address_space *space, offs_t address, UINT16 mask) { return (const_cast<address_space *>(space))->read_word(address, mask); }
-static inline UINT32 memory_read_dword_32le(address_space *space, offs_t address) { return (const_cast<address_space *>(space))->read_dword(address); }
-static inline UINT32 memory_read_dword_masked_32le(address_space *space, offs_t address, UINT32 mask) { return (const_cast<address_space *>(space))->read_dword(address, mask); }
-static inline UINT64 memory_read_qword_32le(address_space *space, offs_t address) { return (const_cast<address_space *>(space))->read_qword(address); }
-static inline UINT64 memory_read_qword_masked_32le(address_space *space, offs_t address, UINT64 mask) { return (const_cast<address_space *>(space))->read_qword(address, mask); }
-static inline void memory_write_byte_32le(address_space *space, offs_t address, UINT8 data) { return (const_cast<address_space *>(space))->write_byte(address, data); }
-static inline void memory_write_word_32le(address_space *space, offs_t address, UINT16 data) { return (const_cast<address_space *>(space))->write_word(address, data); }
-static inline void memory_write_word_masked_32le(address_space *space, offs_t address, UINT16 data, UINT16 mask) { return (const_cast<address_space *>(space))->write_word(address, data, mask); }
-static inline void memory_write_dword_32le(address_space *space, offs_t address, UINT32 data) { return (const_cast<address_space *>(space))->write_dword(address, data); }
-static inline void memory_write_dword_masked_32le(address_space *space, offs_t address, UINT32 data, UINT32 mask) { return (const_cast<address_space *>(space))->write_dword(address, data, mask); }
-static inline void memory_write_qword_32le(address_space *space, offs_t address, UINT64 data) { return (const_cast<address_space *>(space))->write_qword(address, data); }
-static inline void memory_write_qword_masked_32le(address_space *space, offs_t address, UINT64 data, UINT64 mask) { return (const_cast<address_space *>(space))->write_qword(address, data, mask); }
-
-static inline UINT8 memory_read_byte_32be(address_space *space, offs_t address) { return (const_cast<address_space *>(space))->read_byte(address); }
-static inline UINT16 memory_read_word_32be(address_space *space, offs_t address) { return (const_cast<address_space *>(space))->read_word(address); }
-static inline UINT16 memory_read_word_masked_32be(address_space *space, offs_t address, UINT16 mask) { return (const_cast<address_space *>(space))->read_word(address, mask); }
-static inline UINT32 memory_read_dword_32be(address_space *space, offs_t address) { return (const_cast<address_space *>(space))->read_dword(address); }
-static inline UINT32 memory_read_dword_masked_32be(address_space *space, offs_t address, UINT32 mask) { return (const_cast<address_space *>(space))->read_dword(address, mask); }
-static inline UINT64 memory_read_qword_32be(address_space *space, offs_t address) { return (const_cast<address_space *>(space))->read_qword(address); }
-static inline UINT64 memory_read_qword_masked_32be(address_space *space, offs_t address, UINT64 mask) { return (const_cast<address_space *>(space))->read_qword(address, mask); }
-static inline void memory_write_byte_32be(address_space *space, offs_t address, UINT8 data) { return (const_cast<address_space *>(space))->write_byte(address, data); }
-static inline void memory_write_word_32be(address_space *space, offs_t address, UINT16 data) { return (const_cast<address_space *>(space))->write_word(address, data); }
-static inline void memory_write_word_masked_32be(address_space *space, offs_t address, UINT16 data, UINT16 mask) { return (const_cast<address_space *>(space))->write_word(address, data, mask); }
-static inline void memory_write_dword_32be(address_space *space, offs_t address, UINT32 data) { return (const_cast<address_space *>(space))->write_dword(address, data); }
-static inline void memory_write_dword_masked_32be(address_space *space, offs_t address, UINT32 data, UINT32 mask) { return (const_cast<address_space *>(space))->write_dword(address, data, mask); }
-static inline void memory_write_qword_32be(address_space *space, offs_t address, UINT64 data) { return (const_cast<address_space *>(space))->write_qword(address, data); }
-static inline void memory_write_qword_masked_32be(address_space *space, offs_t address, UINT64 data, UINT64 mask) { return (const_cast<address_space *>(space))->write_qword(address, data, mask); }
-
-static inline UINT8 memory_read_byte_64le(address_space *space, offs_t address) { return (const_cast<address_space *>(space))->read_byte(address); }
-static inline UINT16 memory_read_word_64le(address_space *space, offs_t address) { return (const_cast<address_space *>(space))->read_word(address); }
-static inline UINT16 memory_read_word_masked_64le(address_space *space, offs_t address, UINT16 mask) { return (const_cast<address_space *>(space))->read_word(address, mask); }
-static inline UINT32 memory_read_dword_64le(address_space *space, offs_t address) { return (const_cast<address_space *>(space))->read_dword(address); }
-static inline UINT32 memory_read_dword_masked_64le(address_space *space, offs_t address, UINT32 mask) { return (const_cast<address_space *>(space))->read_dword(address, mask); }
-static inline UINT64 memory_read_qword_64le(address_space *space, offs_t address) { return (const_cast<address_space *>(space))->read_qword(address); }
-static inline UINT64 memory_read_qword_masked_64le(address_space *space, offs_t address, UINT64 mask) { return (const_cast<address_space *>(space))->read_qword(address, mask); }
-static inline void memory_write_byte_64le(address_space *space, offs_t address, UINT8 data) { return (const_cast<address_space *>(space))->write_byte(address, data); }
-static inline void memory_write_word_64le(address_space *space, offs_t address, UINT16 data) { return (const_cast<address_space *>(space))->write_word(address, data); }
-static inline void memory_write_word_masked_64le(address_space *space, offs_t address, UINT16 data, UINT16 mask) { return (const_cast<address_space *>(space))->write_word(address, data, mask); }
-static inline void memory_write_dword_64le(address_space *space, offs_t address, UINT32 data) { return (const_cast<address_space *>(space))->write_dword(address, data); }
-static inline void memory_write_dword_masked_64le(address_space *space, offs_t address, UINT32 data, UINT32 mask) { return (const_cast<address_space *>(space))->write_dword(address, data, mask); }
-static inline void memory_write_qword_64le(address_space *space, offs_t address, UINT64 data) { return (const_cast<address_space *>(space))->write_qword(address, data); }
-static inline void memory_write_qword_masked_64le(address_space *space, offs_t address, UINT64 data, UINT64 mask) { return (const_cast<address_space *>(space))->write_qword(address, data, mask); }
-
-static inline UINT8 memory_read_byte_64be(address_space *space, offs_t address) { return (const_cast<address_space *>(space))->read_byte(address); }
-static inline UINT16 memory_read_word_64be(address_space *space, offs_t address) { return (const_cast<address_space *>(space))->read_word(address); }
-static inline UINT16 memory_read_word_masked_64be(address_space *space, offs_t address, UINT16 mask) { return (const_cast<address_space *>(space))->read_word(address, mask); }
-static inline UINT32 memory_read_dword_64be(address_space *space, offs_t address) { return (const_cast<address_space *>(space))->read_dword(address); }
-static inline UINT32 memory_read_dword_masked_64be(address_space *space, offs_t address, UINT32 mask) { return (const_cast<address_space *>(space))->read_dword(address, mask); }
-static inline UINT64 memory_read_qword_64be(address_space *space, offs_t address) { return (const_cast<address_space *>(space))->read_qword(address); }
-static inline UINT64 memory_read_qword_masked_64be(address_space *space, offs_t address, UINT64 mask) { return (const_cast<address_space *>(space))->read_qword(address, mask); }
-static inline void memory_write_byte_64be(address_space *space, offs_t address, UINT8 data) { return (const_cast<address_space *>(space))->write_byte(address, data); }
-static inline void memory_write_word_64be(address_space *space, offs_t address, UINT16 data) { return (const_cast<address_space *>(space))->write_word(address, data); }
-static inline void memory_write_word_masked_64be(address_space *space, offs_t address, UINT16 data, UINT16 mask) { return (const_cast<address_space *>(space))->write_word(address, data, mask); }
-static inline void memory_write_dword_64be(address_space *space, offs_t address, UINT32 data) { return (const_cast<address_space *>(space))->write_dword(address, data); }
-static inline void memory_write_dword_masked_64be(address_space *space, offs_t address, UINT32 data, UINT32 mask) { return (const_cast<address_space *>(space))->write_dword(address, data, mask); }
-static inline void memory_write_qword_64be(address_space *space, offs_t address, UINT64 data) { return (const_cast<address_space *>(space))->write_qword(address, data); }
-static inline void memory_write_qword_masked_64be(address_space *space, offs_t address, UINT64 data, UINT64 mask) { return (const_cast<address_space *>(space))->write_qword(address, data, mask); }
-
#endif /* __MEMORY_H__ */
diff --git a/src/emu/sound/nes_apu.c b/src/emu/sound/nes_apu.c
index 6e36f64f53a..558b6a19666 100644
--- a/src/emu/sound/nes_apu.c
+++ b/src/emu/sound/nes_apu.c
@@ -384,7 +384,7 @@ static int8 apu_dpcm(nesapu_state *info, dpcm_t *chan)
bit_pos = 7 - (chan->bits_left & 7);
if (7 == bit_pos)
{
- chan->cur_byte = memory_read_byte(info->APU.dpcm.memory, chan->address);
+ chan->cur_byte = info->APU.dpcm.memory->read_byte(chan->address);
chan->address++;
chan->length--;
}
diff --git a/src/emu/sound/scsp.c b/src/emu/sound/scsp.c
index bb37aa2287e..fe98f293ceb 100644
--- a/src/emu/sound/scsp.c
+++ b/src/emu/sound/scsp.c
@@ -1191,7 +1191,7 @@ static void dma_scsp(address_space *space, struct _SCSP *SCSP)
{
for(;SCSP->scsp_dtlg > 0;SCSP->scsp_dtlg-=2)
{
- memory_write_word(space,SCSP->scsp_dmea, memory_read_word(space,0x100000|SCSP->scsp_drga));
+ space->write_word(SCSP->scsp_dmea, space->read_word(0x100000|SCSP->scsp_drga));
SCSP->scsp_dmea+=2;
SCSP->scsp_drga+=2;
}
@@ -1200,7 +1200,7 @@ static void dma_scsp(address_space *space, struct _SCSP *SCSP)
{
for(;SCSP->scsp_dtlg > 0;SCSP->scsp_dtlg-=2)
{
- memory_write_word(space,0x100000|SCSP->scsp_drga,memory_read_word(space,SCSP->scsp_dmea));
+ space->write_word(0x100000|SCSP->scsp_drga,space->read_word(SCSP->scsp_dmea));
SCSP->scsp_dmea+=2;
SCSP->scsp_drga+=2;
}
diff --git a/src/emu/sound/vrender0.c b/src/emu/sound/vrender0.c
index 3945e170a98..02cbaf50258 100644
--- a/src/emu/sound/vrender0.c
+++ b/src/emu/sound/vrender0.c
@@ -85,8 +85,8 @@ static const unsigned short ULawTo16[]=
#define ENVVOL(chan) (VR0->SOUNDREGS[(0x20/4)*chan+0x04/4]&0xffffff)
/*
-#define GETSOUNDREG16(Chan,Offs) memory_read_word_32le(space,VR0->Intf.reg_base+0x20*Chan+Offs)
-#define GETSOUNDREG32(Chan,Offs) memory_read_dword_32le(space,VR0->Intf.reg_base+0x20*Chan+Offs)
+#define GETSOUNDREG16(Chan,Offs) space->read_word(VR0->Intf.reg_base+0x20*Chan+Offs)
+#define GETSOUNDREG32(Chan,Offs) space->read_dword(VR0->Intf.reg_base+0x20*Chan+Offs)
#define CURSADDR(chan) GETSOUNDREG32(chan,0x00)
#define DSADDR(chan) GETSOUNDREG16(chan,0x08)