summaryrefslogtreecommitdiffstatshomepage
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
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.
-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
-rw-r--r--src/mame/audio/cage.c2
-rw-r--r--src/mame/audio/dcs.c16
-rw-r--r--src/mame/audio/harddriv.c4
-rw-r--r--src/mame/audio/leland.c2
-rw-r--r--src/mame/drivers/39in1.c50
-rw-r--r--src/mame/drivers/asterix.c16
-rw-r--r--src/mame/drivers/atarigt.c8
-rw-r--r--src/mame/drivers/atarisy4.c4
-rw-r--r--src/mame/drivers/attckufo.c4
-rw-r--r--src/mame/drivers/calchase.c4
-rw-r--r--src/mame/drivers/coolridr.c6
-rw-r--r--src/mame/drivers/crystal.c46
-rw-r--r--src/mame/drivers/ddayjlc.c2
-rw-r--r--src/mame/drivers/deco32.c6
-rw-r--r--src/mame/drivers/dkong.c11
-rw-r--r--src/mame/drivers/ertictac.c2
-rw-r--r--src/mame/drivers/galpani2.c70
-rw-r--r--src/mame/drivers/gamecstl.c4
-rw-r--r--src/mame/drivers/guab.c4
-rw-r--r--src/mame/drivers/harddriv.c4
-rw-r--r--src/mame/drivers/hng64.c36
-rw-r--r--src/mame/drivers/jalmah.c6
-rw-r--r--src/mame/drivers/konamigx.c102
-rw-r--r--src/mame/drivers/konamim2.c2
-rw-r--r--src/mame/drivers/littlerb.c2
-rw-r--r--src/mame/drivers/lockon.c24
-rw-r--r--src/mame/drivers/mario.c3
-rw-r--r--src/mame/drivers/mediagx.c4
-rw-r--r--src/mame/drivers/megadriv.c2
-rw-r--r--src/mame/drivers/metalmx.c8
-rw-r--r--src/mame/drivers/model3.c2
-rw-r--r--src/mame/drivers/moo.c6
-rw-r--r--src/mame/drivers/namcos22.c2
-rw-r--r--src/mame/drivers/namcos23.c4
-rw-r--r--src/mame/drivers/neogeo.c2
-rw-r--r--src/mame/drivers/offtwall.c2
-rw-r--r--src/mame/drivers/pcat_dyn.c4
-rw-r--r--src/mame/drivers/pcxt.c4
-rw-r--r--src/mame/drivers/photoply.c4
-rw-r--r--src/mame/drivers/pinkiri8.c2
-rw-r--r--src/mame/drivers/seattle.c12
-rw-r--r--src/mame/drivers/segag80r.c4
-rw-r--r--src/mame/drivers/segag80v.c4
-rw-r--r--src/mame/drivers/segas16a.c4
-rw-r--r--src/mame/drivers/segas32.c2
-rw-r--r--src/mame/drivers/seta2.c2
-rw-r--r--src/mame/drivers/sf.c32
-rw-r--r--src/mame/drivers/stv.c74
-rw-r--r--src/mame/drivers/suna8.c2
-rw-r--r--src/mame/drivers/suprnova.c2
-rw-r--r--src/mame/drivers/system1.c8
-rw-r--r--src/mame/drivers/taitowlf.c4
-rw-r--r--src/mame/drivers/thunderj.c2
-rw-r--r--src/mame/drivers/tmnt.c24
-rw-r--r--src/mame/drivers/tx1.c4
-rw-r--r--src/mame/drivers/wecleman.c12
-rw-r--r--src/mame/includes/atari.h10
-rw-r--r--src/mame/machine/amiga.c2
-rw-r--r--src/mame/machine/archimds.c4
-rw-r--r--src/mame/machine/cubocd32.c6
-rw-r--r--src/mame/machine/cx4fn.c49
-rw-r--r--src/mame/machine/cx4oam.c19
-rw-r--r--src/mame/machine/dc.c8
-rw-r--r--src/mame/machine/harddriv.c2
-rw-r--r--src/mame/machine/kaneko16.c20
-rw-r--r--src/mame/machine/konamigx.c56
-rw-r--r--src/mame/machine/micro3d.c2
-rw-r--r--src/mame/machine/midyunit.c2
-rw-r--r--src/mame/machine/n64.c16
-rw-r--r--src/mame/machine/pcshare.c4
-rw-r--r--src/mame/machine/pitnrun.c4
-rw-r--r--src/mame/machine/scramble.c4
-rw-r--r--src/mame/machine/scudsp.c4
-rw-r--r--src/mame/machine/segaic16.c6
-rw-r--r--src/mame/machine/segas32.c18
-rw-r--r--src/mame/machine/seicop.c218
-rw-r--r--src/mame/machine/snes.c42
-rw-r--r--src/mame/machine/snescx4.c3
-rw-r--r--src/mame/machine/taitosj.c4
-rw-r--r--src/mame/machine/tatsumi.c8
-rw-r--r--src/mame/machine/toaplan1.c4
-rw-r--r--src/mame/machine/twincobr.c12
-rw-r--r--src/mame/video/astrocde.c8
-rw-r--r--src/mame/video/combatsc.c2
-rw-r--r--src/mame/video/dc.c22
-rw-r--r--src/mame/video/genesis.c2
-rw-r--r--src/mame/video/gp9001.c4
-rw-r--r--src/mame/video/hng64.c2
-rw-r--r--src/mame/video/model3.c24
-rw-r--r--src/mame/video/namcos22.c2
-rw-r--r--src/mame/video/ppu2c0x.c26
-rw-r--r--src/mame/video/snes.c4
-rw-r--r--src/mame/video/vrender0.c2
-rw-r--r--src/mame/video/williams.c10
-rw-r--r--src/mame/video/zaxxon.c10
218 files changed, 2065 insertions, 2215 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)
diff --git a/src/mame/audio/cage.c b/src/mame/audio/cage.c
index 154edb9ea11..acb9a0021ef 100644
--- a/src/mame/audio/cage.c
+++ b/src/mame/audio/cage.c
@@ -260,7 +260,7 @@ static void update_dma_state(address_space *space)
inc = (tms32031_io_regs[DMA_GLOBAL_CTL] >> 4) & 1;
for (i = 0; i < tms32031_io_regs[DMA_TRANSFER_COUNT]; i++)
{
- sound_data[i % STACK_SOUND_BUFSIZE] = memory_read_dword(space, addr * 4);
+ sound_data[i % STACK_SOUND_BUFSIZE] = space->read_dword(addr * 4);
addr += inc;
if (i % STACK_SOUND_BUFSIZE == STACK_SOUND_BUFSIZE - 1)
dmadac_transfer(&dmadac[0], DAC_BUFFER_CHANNELS, 1, DAC_BUFFER_CHANNELS, STACK_SOUND_BUFSIZE / DAC_BUFFER_CHANNELS, sound_data);
diff --git a/src/mame/audio/dcs.c b/src/mame/audio/dcs.c
index aad913275bb..62d9b8f1b92 100644
--- a/src/mame/audio/dcs.c
+++ b/src/mame/audio/dcs.c
@@ -1778,11 +1778,11 @@ static void reset_timer(running_machine *machine)
{
/* Road Burners: @ 28: JMP $0032 18032F, same code at $32 */
- if (memory_read_dword(dcs.program, 0x18*4) == 0x0c0030 && /* ENA SEC_REG */
- memory_read_dword(dcs.program, 0x19*4) == 0x804828 && /* SI = DM($0482) */
- memory_read_dword(dcs.program, 0x1a*4) == 0x904828 && /* DM($0482) = SI */
- memory_read_dword(dcs.program, 0x1b*4) == 0x0C0020 && /* DIS SEC_REG */
- memory_read_dword(dcs.program, 0x1c*4) == 0x0A001F) /* RTI */
+ if (dcs.program->read_dword(0x18*4) == 0x0c0030 && /* ENA SEC_REG */
+ dcs.program->read_dword(0x19*4) == 0x804828 && /* SI = DM($0482) */
+ dcs.program->read_dword(0x1a*4) == 0x904828 && /* DM($0482) = SI */
+ dcs.program->read_dword(0x1b*4) == 0x0C0020 && /* DIS SEC_REG */
+ dcs.program->read_dword(0x1c*4) == 0x0A001F) /* RTI */
{
dcs.timer_ignore = TRUE;
}
@@ -1952,7 +1952,7 @@ static TIMER_DEVICE_CALLBACK( dcs_irq )
for (i = 0; i < count; i++)
{
- buffer[i] = memory_read_word(dcs.data, reg * 2);
+ buffer[i] = dcs.data->read_word(reg * 2);
reg += dcs.incs;
}
@@ -2252,10 +2252,10 @@ static int preprocess_stage_1(running_machine *machine, UINT16 data)
if (transfer.writes_left & 1)
transfer.temp = data;
else
- memory_write_dword(dcs.program, transfer.start++ * 4, (transfer.temp << 8) | (data & 0xff));
+ dcs.program->write_dword(transfer.start++ * 4, (transfer.temp << 8) | (data & 0xff));
}
else
- memory_write_word(dcs.data, transfer.start++ * 2, data);
+ dcs.data->write_word(transfer.start++ * 2, data);
/* if we're done, start a timer to send the response words */
if (transfer.state == 0)
diff --git a/src/mame/audio/harddriv.c b/src/mame/audio/harddriv.c
index f8f58408457..0e4e81e7166 100644
--- a/src/mame/audio/harddriv.c
+++ b/src/mame/audio/harddriv.c
@@ -243,7 +243,7 @@ READ16_HANDLER( hdsnd68k_320ports_r )
{
harddriv_state *state = space->machine->driver_data<harddriv_state>();
address_space *iospace = cpu_get_address_space(state->sounddsp, ADDRESS_SPACE_IO);
- return memory_read_word(iospace, (offset & 7) << 1);
+ return iospace->read_word((offset & 7) << 1);
}
@@ -251,7 +251,7 @@ WRITE16_HANDLER( hdsnd68k_320ports_w )
{
harddriv_state *state = space->machine->driver_data<harddriv_state>();
address_space *iospace = cpu_get_address_space(state->sounddsp, ADDRESS_SPACE_IO);
- memory_write_word(iospace, (offset & 7) << 1, data);
+ iospace->write_word((offset & 7) << 1, data);
}
diff --git a/src/mame/audio/leland.c b/src/mame/audio/leland.c
index e622a5fbfc5..7411d1dcee4 100644
--- a/src/mame/audio/leland.c
+++ b/src/mame/audio/leland.c
@@ -429,7 +429,7 @@ static STREAM_UPDATE( leland_80186_dma_update )
/* sample-rate convert to the output frequency */
for (j = 0; j < samples && count > 0; j++)
{
- buffer[j] += ((int)memory_read_byte(dmaspace, source) - 0x80) * volume;
+ buffer[j] += ((int)dmaspace->read_byte(source) - 0x80) * volume;
frac += step;
source += frac >> 24;
count -= frac >> 24;
diff --git a/src/mame/drivers/39in1.c b/src/mame/drivers/39in1.c
index c157b4a865d..9c79fe10416 100644
--- a/src/mame/drivers/39in1.c
+++ b/src/mame/drivers/39in1.c
@@ -262,10 +262,11 @@ static void pxa255_dma_load_descriptor_and_start(running_machine* machine, int c
// Load the next descriptor
- dma_regs->dsadr[channel] = memory_read_dword_32le(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), dma_regs->ddadr[channel] + 0x4);
- dma_regs->dtadr[channel] = memory_read_dword_32le(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), dma_regs->ddadr[channel] + 0x8);
- dma_regs->dcmd[channel] = memory_read_dword_32le(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), dma_regs->ddadr[channel] + 0xc);
- dma_regs->ddadr[channel] = memory_read_dword_32le(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), dma_regs->ddadr[channel]);
+ address_space *space = machine->device<pxa255_device>("maincpu")->space(AS_PROGRAM);
+ dma_regs->dsadr[channel] = space->read_dword(dma_regs->ddadr[channel] + 0x4);
+ dma_regs->dtadr[channel] = space->read_dword(dma_regs->ddadr[channel] + 0x8);
+ dma_regs->dcmd[channel] = space->read_dword(dma_regs->ddadr[channel] + 0xc);
+ dma_regs->ddadr[channel] = space->read_dword(dma_regs->ddadr[channel]);
// Start our end-of-transfer timer
switch(channel)
@@ -301,12 +302,13 @@ static TIMER_CALLBACK( pxa255_dma_dma_end )
UINT16 temp16;
UINT32 temp32;
+ address_space *space = machine->device<pxa255_device>("maincpu")->space(AS_PROGRAM);
switch(param)
{
case 3:
for(index = 0; index < count; index += 4)
{
- state->words[index >> 2] = memory_read_dword_32le(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), sadr);
+ state->words[index >> 2] = space->read_dword(sadr);
state->samples[(index >> 1) + 0] = (INT16)(state->words[index >> 2] >> 16);
state->samples[(index >> 1) + 1] = (INT16)(state->words[index >> 2] & 0xffff);
sadr += 4;
@@ -319,18 +321,18 @@ static TIMER_CALLBACK( pxa255_dma_dma_end )
switch(dma_regs->dcmd[param] & PXA255_DCMD_SIZE)
{
case PXA255_DCMD_SIZE_8:
- temp8 = memory_read_byte_32le(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), sadr);
- memory_write_byte_32le(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), tadr, temp8);
+ temp8 = space->read_byte(sadr);
+ space->write_byte(tadr, temp8);
index++;
break;
case PXA255_DCMD_SIZE_16:
- temp16 = memory_read_word_32le(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), sadr);
- memory_write_word_32le(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), tadr, temp16);
+ temp16 = space->read_word(sadr);
+ space->write_word(tadr, temp16);
index += 2;
break;
case PXA255_DCMD_SIZE_32:
- temp32 = memory_read_dword_32le(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), sadr);
- memory_write_dword_32le(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), tadr, temp32);
+ temp32 = space->read_dword(sadr);
+ space->write_dword(tadr, temp32);
index += 4;
break;
default:
@@ -1053,10 +1055,10 @@ static void pxa255_lcd_load_dma_descriptor(address_space* space, UINT32 address,
_39in1_state *state = space->machine->driver_data<_39in1_state>();
PXA255_LCD_Regs *lcd_regs = &state->lcd_regs;
- lcd_regs->dma[channel].fdadr = memory_read_dword_32le(space, address);
- lcd_regs->dma[channel].fsadr = memory_read_dword_32le(space, address + 0x04);
- lcd_regs->dma[channel].fidr = memory_read_dword_32le(space, address + 0x08);
- lcd_regs->dma[channel].ldcmd = memory_read_dword_32le(space, address + 0x0c);
+ lcd_regs->dma[channel].fdadr = space->read_dword(address);
+ lcd_regs->dma[channel].fsadr = space->read_dword(address + 0x04);
+ lcd_regs->dma[channel].fidr = space->read_dword(address + 0x08);
+ lcd_regs->dma[channel].ldcmd = space->read_dword(address + 0x0c);
verboselog( space->machine, 4, "pxa255_lcd_load_dma_descriptor, address = %08x, channel = %d\n", address, channel);
verboselog( space->machine, 4, " DMA Frame Descriptor: %08x\n", lcd_regs->dma[channel].fdadr );
verboselog( space->machine, 4, " DMA Frame Source Address: %08x\n", lcd_regs->dma[channel].fsadr );
@@ -1101,22 +1103,24 @@ static void pxa255_lcd_dma_kickoff(running_machine* machine, int channel)
if(lcd_regs->dma[channel].ldcmd & PXA255_LDCMD_PAL)
{
+ address_space *space = machine->device<pxa255_device>("maincpu")->space(AS_PROGRAM);
int length = lcd_regs->dma[channel].ldcmd & 0x000fffff;
int index = 0;
for(index = 0; index < length; index += 2)
{
- UINT16 color = memory_read_word_32le(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), (lcd_regs->dma[channel].fsadr &~ 1) + index);
+ UINT16 color = space->read_word((lcd_regs->dma[channel].fsadr &~ 1) + index);
state->pxa255_lcd_palette[index >> 1] = (((((color >> 11) & 0x1f) << 3) | (color >> 13)) << 16) | (((((color >> 5) & 0x3f) << 2) | ((color >> 9) & 0x3)) << 8) | (((color & 0x1f) << 3) | ((color >> 2) & 0x7));
palette_set_color_rgb(machine, index >> 1, (((color >> 11) & 0x1f) << 3) | (color >> 13), (((color >> 5) & 0x3f) << 2) | ((color >> 9) & 0x3), ((color & 0x1f) << 3) | ((color >> 2) & 0x7));
}
}
else
{
+ address_space *space = machine->device<pxa255_device>("maincpu")->space(AS_PROGRAM);
int length = lcd_regs->dma[channel].ldcmd & 0x000fffff;
int index = 0;
for(index = 0; index < length; index++)
{
- state->pxa255_lcd_framebuffer[index] = memory_read_byte_32le(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), lcd_regs->dma[channel].fsadr + index);
+ state->pxa255_lcd_framebuffer[index] = space->read_byte(lcd_regs->dma[channel].fsadr + index);
}
}
}
@@ -1131,10 +1135,11 @@ static void pxa255_lcd_check_load_next_branch(running_machine* machine, int chan
{
verboselog( machine, 4, "pxa255_lcd_check_load_next_branch: Taking branch\n" );
lcd_regs->fbr[channel] &= ~1;
- //lcd_regs->fbr[channel] = (memory_read_dword_32le(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), lcd_regs->fbr[channel] & 0xfffffff0) & 0xfffffff0) | (lcd_regs->fbr[channel] & 0x00000003);
+ address_space *space = machine->device<pxa255_device>("maincpu")->space(AS_PROGRAM);
+ //lcd_regs->fbr[channel] = (space->read_dword(lcd_regs->fbr[channel] & 0xfffffff0) & 0xfffffff0) | (lcd_regs->fbr[channel] & 0x00000003);
//printf( "%08x\n", lcd_regs->fbr[channel] );
- pxa255_lcd_load_dma_descriptor(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), lcd_regs->fbr[channel] & 0xfffffff0, 0);
- lcd_regs->fbr[channel] = (memory_read_dword_32le(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), lcd_regs->fbr[channel] & 0xfffffff0) & 0xfffffff0) | (lcd_regs->fbr[channel] & 0x00000003);
+ pxa255_lcd_load_dma_descriptor(space, lcd_regs->fbr[channel] & 0xfffffff0, 0);
+ lcd_regs->fbr[channel] = (space->read_dword(lcd_regs->fbr[channel] & 0xfffffff0) & 0xfffffff0) | (lcd_regs->fbr[channel] & 0x00000003);
pxa255_lcd_dma_kickoff(machine, 0);
if(lcd_regs->fbr[channel] & 2)
{
@@ -1430,7 +1435,7 @@ static WRITE32_HANDLER( cpld_w )
if (cpu_get_pc(space->cpu) == 0x2874)
{
state->state = 2;
- state->magic = memory_read_byte_32le(space, 0x2d4ff0);
+ state->magic = space->read_byte(0x2d4ff0);
}
else if (offset == 0xa)
{
@@ -1456,7 +1461,8 @@ static DRIVER_INIT( 39in1 )
state->dmadac[1] = machine->device<dmadac_sound_device>("dac2");
state->eeprom = machine->device<eeprom_device>("eeprom");
- memory_install_read32_handler (cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0xa0151648, 0xa015164b, 0, 0, prot_cheater_r);
+ address_space *space = machine->device<pxa255_device>("maincpu")->space(AS_PROGRAM);
+ memory_install_read32_handler (space, 0xa0151648, 0xa015164b, 0, 0, prot_cheater_r);
}
static ADDRESS_MAP_START( 39in1_map, ADDRESS_SPACE_PROGRAM, 32 )
diff --git a/src/mame/drivers/asterix.c b/src/mame/drivers/asterix.c
index 7d14a9be646..5a0955a31ab 100644
--- a/src/mame/drivers/asterix.c
+++ b/src/mame/drivers/asterix.c
@@ -107,8 +107,8 @@ static WRITE16_HANDLER( protection_w )
{
case 0x64:
{
- UINT32 param1 = (memory_read_word(space, cmd & 0xffffff) << 16) | memory_read_word(space, (cmd & 0xffffff) + 2);
- UINT32 param2 = (memory_read_word(space, (cmd & 0xffffff) + 4) << 16) | memory_read_word(space, (cmd & 0xffffff) + 6);
+ UINT32 param1 = (space->read_word(cmd & 0xffffff) << 16) | space->read_word((cmd & 0xffffff) + 2);
+ UINT32 param2 = (space->read_word((cmd & 0xffffff) + 4) << 16) | space->read_word((cmd & 0xffffff) + 6);
switch (param1 >> 24)
{
@@ -119,7 +119,7 @@ static WRITE16_HANDLER( protection_w )
param2 &= 0xffffff;
while(size >= 0)
{
- memory_write_word(space, param2, memory_read_word(space, param1));
+ space->write_word(param2, space->read_word(param1));
param1 += 2;
param2 += 2;
size--;
@@ -147,10 +147,10 @@ static WRITE16_HANDLER( protection_w )
{
case 0x64:
{
- UINT32 param1 = (memory_read_word(space, cmd & 0xffffff) << 16)
- | memory_read_word(space, (cmd & 0xffffff) + 2);
- UINT32 param2 = (memory_read_word(space, (cmd & 0xffffff) + 4) << 16)
- | memory_read_word(space, (cmd & 0xffffff) + 6);
+ UINT32 param1 = (space->read_word(cmd & 0xffffff) << 16)
+ | space->read_word((cmd & 0xffffff) + 2);
+ UINT32 param2 = (space->read_word((cmd & 0xffffff) + 4) << 16)
+ | space->read_word((cmd & 0xffffff) + 6);
switch (param1 >> 24)
{
@@ -161,7 +161,7 @@ static WRITE16_HANDLER( protection_w )
param2 &= 0xffffff;
while(size >= 0)
{
- memory_write_word(space, param2, memory_read_word(space, param1));
+ space->write_word(param2, space->read_word(param1));
param1 += 2;
param2 += 2;
size--;
diff --git a/src/mame/drivers/atarigt.c b/src/mame/drivers/atarigt.c
index dcc00eab9ea..988654fef36 100644
--- a/src/mame/drivers/atarigt.c
+++ b/src/mame/drivers/atarigt.c
@@ -467,8 +467,8 @@ if (LOG_PROTECTION)
break;
case 0x275cc:
a6 = cpu_get_reg(space->cpu, M68K_A6);
- p1 = (memory_read_word(space, a6+8) << 16) | memory_read_word(space, a6+10);
- p2 = (memory_read_word(space, a6+12) << 16) | memory_read_word(space, a6+14);
+ p1 = (space->read_word(a6+8) << 16) | space->read_word(a6+10);
+ p2 = (space->read_word(a6+12) << 16) | space->read_word(a6+14);
logerror("Known Protection @ 275BC(%08X, %08X): R@%06X ", p1, p2, offset);
break;
case 0x275d2:
@@ -485,7 +485,7 @@ if (LOG_PROTECTION)
/* protection code from 3d8dc - 3d95a */
case 0x3d8f4:
a6 = cpu_get_reg(space->cpu, M68K_A6);
- p1 = (memory_read_word(space, a6+12) << 16) | memory_read_word(space, a6+14);
+ p1 = (space->read_word(a6+12) << 16) | space->read_word(a6+14);
logerror("Known Protection @ 3D8F4(%08X): R@%06X ", p1, offset);
break;
case 0x3d8fa:
@@ -496,7 +496,7 @@ if (LOG_PROTECTION)
/* protection code from 437fa - 43860 */
case 0x43814:
a6 = cpu_get_reg(space->cpu, M68K_A6);
- p1 = memory_read_dword(space, a6+14) & 0xffffff;
+ p1 = space->read_dword(a6+14) & 0xffffff;
logerror("Known Protection @ 43814(%08X): R@%06X ", p1, offset);
break;
case 0x4381c:
diff --git a/src/mame/drivers/atarisy4.c b/src/mame/drivers/atarisy4.c
index e9000ffaf08..7931a762163 100644
--- a/src/mame/drivers/atarisy4.c
+++ b/src/mame/drivers/atarisy4.c
@@ -819,7 +819,7 @@ void load_ldafile(address_space *space, const UINT8 *file)
{
UINT8 data = READ_CHAR();
sum += data;
- memory_write_byte(space, addr++, data);
+ space->write_byte(addr++, data);
} while (--len);
sum += READ_CHAR();
@@ -914,7 +914,7 @@ void load_hexfile(address_space *space, const UINT8 *file)
sum += data & 0xf;
if (record == 6)
- memory_write_byte(space, addr++, data);
+ space->write_byte(addr++, data);
len -= 2;
}
diff --git a/src/mame/drivers/attckufo.c b/src/mame/drivers/attckufo.c
index 9a3111a21e0..26a8a3afb74 100644
--- a/src/mame/drivers/attckufo.c
+++ b/src/mame/drivers/attckufo.c
@@ -172,13 +172,13 @@ static VIDEO_UPDATE( attckufo )
static int attckufo_dma_read( running_machine *machine, int offset )
{
attckufo_state *state = machine->driver_data<attckufo_state>();
- return memory_read_byte(state->maincpu->space(AS_PROGRAM), offset);
+ return state->maincpu->space(AS_PROGRAM)->read_byte(offset);
}
static int attckufo_dma_read_color( running_machine *machine, int offset )
{
attckufo_state *state = machine->driver_data<attckufo_state>();
- return memory_read_byte(state->maincpu->space(AS_PROGRAM), offset + 0x400);
+ return state->maincpu->space(AS_PROGRAM)->read_byte(offset + 0x400);
}
static const mos6560_interface attckufo_6560_intf =
diff --git a/src/mame/drivers/calchase.c b/src/mame/drivers/calchase.c
index 48dcab77d10..cba817e545d 100644
--- a/src/mame/drivers/calchase.c
+++ b/src/mame/drivers/calchase.c
@@ -228,7 +228,7 @@ static READ8_HANDLER( pc_dma_read_byte )
offs_t page_offset = (((offs_t) dma_offset[0][dma_channel]) << 16)
& 0xFF0000;
- return memory_read_byte(space, page_offset + offset);
+ return space->read_byte(page_offset + offset);
}
@@ -237,7 +237,7 @@ static WRITE8_HANDLER( pc_dma_write_byte )
offs_t page_offset = (((offs_t) dma_offset[0][dma_channel]) << 16)
& 0xFF0000;
- memory_write_byte(space, page_offset + offset, data);
+ space->write_byte(page_offset + offset, data);
}
static void set_dma_channel(running_device *device, int channel, int state)
diff --git a/src/mame/drivers/coolridr.c b/src/mame/drivers/coolridr.c
index c23b53c4c8b..bcafdd2ec30 100644
--- a/src/mame/drivers/coolridr.c
+++ b/src/mame/drivers/coolridr.c
@@ -450,7 +450,7 @@ static WRITE32_HANDLER( sysh1_txt_blit_w )
size = (attr_buff[6] / 4)+1;
for(txt_index = 0;txt_index < size; txt_index++)
{
- memory_write_dword(space,(dst_addr),txt_buff[txt_index]);
+ space->write_dword((dst_addr),txt_buff[txt_index]);
dst_addr+=4;
}
}
@@ -459,7 +459,7 @@ static WRITE32_HANDLER( sysh1_txt_blit_w )
{
static UINT32 clear_vram;
for(clear_vram=0x3f40000;clear_vram < 0x3f4ffff;clear_vram+=4)
- memory_write_dword(space,(clear_vram),0x00000000);
+ space->write_dword((clear_vram),0x00000000);
}
//else
// printf("CMD = %04x PARAM = %04x DATA = %08x\n",cmd,param,data);
@@ -542,7 +542,7 @@ static void sysh1_dma_transfer( address_space *space, UINT16 dma_index )
{
for(s_i=0;s_i<size;s_i+=4)
{
- memory_write_dword(space,dst,memory_read_dword(space,src));
+ space->write_dword(dst,space->read_dword(src));
dst+=4;
src+=4;
}
diff --git a/src/mame/drivers/crystal.c b/src/mame/drivers/crystal.c
index 382da09734d..c48a6c4e4be 100644
--- a/src/mame/drivers/crystal.c
+++ b/src/mame/drivers/crystal.c
@@ -162,12 +162,12 @@ static void IntReq( running_machine *machine, int num )
{
crystal_state *state = machine->driver_data<crystal_state>();
address_space *space = cpu_get_address_space(state->maincpu, ADDRESS_SPACE_PROGRAM);
- UINT32 IntEn = memory_read_dword(space, 0x01800c08);
- UINT32 IntPend = memory_read_dword(space, 0x01800c0c);
+ UINT32 IntEn = space->read_dword(0x01800c08);
+ UINT32 IntPend = space->read_dword(0x01800c0c);
if (IntEn & (1 << num))
{
IntPend |= (1 << num);
- memory_write_dword(space, 0x01800c0c, IntPend);
+ space->write_dword(0x01800c0c, IntPend);
cpu_set_input_line(state->maincpu, SE3208_INT, ASSERT_LINE);
}
#ifdef IDLE_LOOP_SPEEDUP
@@ -181,7 +181,7 @@ static READ32_HANDLER( FlipCount_r )
crystal_state *state = space->machine->driver_data<crystal_state>();
#ifdef IDLE_LOOP_SPEEDUP
- UINT32 IntPend = memory_read_dword(space, 0x01800c0c);
+ UINT32 IntPend = space->read_dword(0x01800c0c);
state->FlipCntRead++;
if (state->FlipCntRead >= 16 && !IntPend && state->FlipCount != 0)
cpu_suspend(state->maincpu, SUSPEND_REASON_SPIN, 1);
@@ -227,12 +227,12 @@ static READ32_HANDLER( Input_r )
static WRITE32_HANDLER( IntAck_w )
{
crystal_state *state = space->machine->driver_data<crystal_state>();
- UINT32 IntPend = memory_read_dword(space, 0x01800c0c);
+ UINT32 IntPend = space->read_dword(0x01800c0c);
if (mem_mask & 0xff)
{
IntPend &= ~(1 << (data & 0x1f));
- memory_write_dword(space, 0x01800c0c, IntPend);
+ space->write_dword(0x01800c0c, IntPend);
if (!IntPend)
cpu_set_input_line(state->maincpu, SE3208_INT, CLEAR_LINE);
}
@@ -244,7 +244,7 @@ static IRQ_CALLBACK( icallback )
{
crystal_state *state = device->machine->driver_data<crystal_state>();
address_space *space = cpu_get_address_space(device, ADDRESS_SPACE_PROGRAM);
- UINT32 IntPend = memory_read_dword(space, 0x01800c0c);
+ UINT32 IntPend = space->read_dword(0x01800c0c);
int i;
for (i = 0; i < 32; ++i)
@@ -287,7 +287,7 @@ INLINE void Timer_w( address_space *space, int which, UINT32 data, UINT32 mem_ma
if (((data ^ state->Timerctrl[which]) & 1) && (data & 1)) //Timer activate
{
int PD = (data >> 8) & 0xff;
- int TCV = memory_read_dword(space, 0x01801404 + which * 8);
+ int TCV = space->read_dword(0x01801404 + which * 8);
attotime period = attotime_mul(ATTOTIME_IN_HZ(43000000), (PD + 1) * (TCV + 1));
if (state->Timerctrl[which] & 2)
@@ -392,9 +392,9 @@ static WRITE32_HANDLER( PIO_w )
ds1302_clk_w(state->ds1302, 0, CLK ? 1 : 0);
if (ds1302_read(state->ds1302, 0))
- memory_write_dword(space, 0x01802008, memory_read_dword(space, 0x01802008) | 0x10000000);
+ space->write_dword(0x01802008, space->read_dword(0x01802008) | 0x10000000);
else
- memory_write_dword(space, 0x01802008, memory_read_dword(space, 0x01802008) & (~0x10000000));
+ space->write_dword(0x01802008, space->read_dword(0x01802008) & (~0x10000000));
COMBINE_DATA(&state->PIO);
}
@@ -406,37 +406,37 @@ INLINE void DMA_w( address_space *space, int which, UINT32 data, UINT32 mem_mask
if (((data ^ state->DMActrl[which]) & (1 << 10)) && (data & (1 << 10))) //DMAOn
{
UINT32 CTR = data;
- UINT32 SRC = memory_read_dword(space, 0x01800804 + which * 0x10);
- UINT32 DST = memory_read_dword(space, 0x01800808 + which * 0x10);
- UINT32 CNT = memory_read_dword(space, 0x0180080C + which * 0x10);
+ UINT32 SRC = space->read_dword(0x01800804 + which * 0x10);
+ UINT32 DST = space->read_dword(0x01800808 + which * 0x10);
+ UINT32 CNT = space->read_dword(0x0180080C + which * 0x10);
int i;
if (CTR & 0x2) //32 bits
{
for (i = 0; i < CNT; ++i)
{
- UINT32 v = memory_read_dword(space, SRC + i * 4);
- memory_write_dword(space, DST + i * 4, v);
+ UINT32 v = space->read_dword(SRC + i * 4);
+ space->write_dword(DST + i * 4, v);
}
}
else if (CTR & 0x1) //16 bits
{
for (i = 0; i < CNT; ++i)
{
- UINT16 v = memory_read_word(space, SRC + i * 2);
- memory_write_word(space, DST + i * 2, v);
+ UINT16 v = space->read_word(SRC + i * 2);
+ space->write_word(DST + i * 2, v);
}
}
else //8 bits
{
for (i = 0; i < CNT; ++i)
{
- UINT8 v = memory_read_byte(space, SRC + i);
- memory_write_byte(space, DST + i, v);
+ UINT8 v = space->read_byte(SRC + i);
+ space->write_byte(DST + i, v);
}
}
data &= ~(1 << 10);
- memory_write_dword(space, 0x0180080C + which * 0x10, 0);
+ space->write_dword(0x0180080C + which * 0x10, 0);
IntReq(space->machine, 7 + which);
}
COMBINE_DATA(&state->DMActrl[which]);
@@ -623,12 +623,12 @@ static MACHINE_RESET( crystal )
static UINT16 GetVidReg( address_space *space, UINT16 reg )
{
- return memory_read_word(space, 0x03000000 + reg);
+ return space->read_word(0x03000000 + reg);
}
static void SetVidReg( address_space *space, UINT16 reg, UINT16 val )
{
- memory_write_word(space, 0x03000000 + reg, val);
+ space->write_word(0x03000000 + reg, val);
}
@@ -704,7 +704,7 @@ static VIDEO_EOF(crystal)
tail = GetVidReg(space, 0x80);
while ((head & 0x7ff) != (tail & 0x7ff))
{
- UINT16 Packet0 = memory_read_word(space, 0x03800000 + head * 64);
+ UINT16 Packet0 = space->read_word(0x03800000 + head * 64);
if (Packet0 & 0x81)
DoFlip = 1;
head++;
diff --git a/src/mame/drivers/ddayjlc.c b/src/mame/drivers/ddayjlc.c
index d3ab1d82622..439a7158866 100644
--- a/src/mame/drivers/ddayjlc.c
+++ b/src/mame/drivers/ddayjlc.c
@@ -232,7 +232,7 @@ static WRITE8_HANDLER( i8257_LMSR_w )
for(i = 0; i < size; i++)
{
- memory_write_byte(space, dst++, memory_read_byte(space, src++));
+ space->write_byte(dst++, space->read_byte(src++));
}
state->e00x_l[0] = 0;
diff --git a/src/mame/drivers/deco32.c b/src/mame/drivers/deco32.c
index a0db333bc91..072499f3968 100644
--- a/src/mame/drivers/deco32.c
+++ b/src/mame/drivers/deco32.c
@@ -545,7 +545,7 @@ static WRITE32_HANDLER( tattass_control_w )
int d=readBitCount/8;
int m=7-(readBitCount%8);
int a=(byteAddr+d)%1024;
- int b=memory_read_byte(eeprom_space, a);
+ int b=eeprom_space->read_byte(a);
tattass_eprom_bit=(b>>m)&1;
@@ -562,7 +562,7 @@ static WRITE32_HANDLER( tattass_control_w )
int b=(buffer[24]<<7)|(buffer[25]<<6)|(buffer[26]<<5)|(buffer[27]<<4)
|(buffer[28]<<3)|(buffer[29]<<2)|(buffer[30]<<1)|(buffer[31]<<0);
- memory_write_byte(eeprom_space, byteAddr, b);
+ eeprom_space->write_byte(byteAddr, b);
}
lastClock=data&0x20;
return;
@@ -577,7 +577,7 @@ static WRITE32_HANDLER( tattass_control_w )
/* Check for read command */
if (buffer[0] && buffer[1]) {
- tattass_eprom_bit=(memory_read_byte(eeprom_space, byteAddr)>>7)&1;
+ tattass_eprom_bit=(eeprom_space->read_byte(byteAddr)>>7)&1;
readBitCount=1;
pendingCommand=1;
}
diff --git a/src/mame/drivers/dkong.c b/src/mame/drivers/dkong.c
index a825b83eea2..dec15f5c193 100644
--- a/src/mame/drivers/dkong.c
+++ b/src/mame/drivers/dkong.c
@@ -335,6 +335,9 @@ static WRITE8_DEVICE_HANDLER( p8257_ctl_w );
*
*************************************/
+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 Z80DMA_INTERFACE( dk3_dma )
{
DEVCB_CPU_INPUT_LINE("maincpu", INPUT_LINE_HALT),
@@ -513,7 +516,7 @@ static READ8_HANDLER( hb_dma_read_byte )
addr = ((bucket << 7) & 0x7c00) | (offset & 0x3ff);
- return memory_read_byte(space, addr);
+ return space->read_byte(addr);
}
static WRITE8_HANDLER( hb_dma_write_byte )
@@ -527,7 +530,7 @@ static WRITE8_HANDLER( hb_dma_write_byte )
addr = ((bucket << 7) & 0x7c00) | (offset & 0x3ff);
- memory_write_byte(space, addr, data);
+ space->write_byte(addr, data);
}
static READ8_DEVICE_HANDLER( p8257_ctl_r )
@@ -589,13 +592,13 @@ static READ8_HANDLER( dkongjr_in2_r )
static READ8_HANDLER( s2650_mirror_r )
{
- return memory_read_byte(space, 0x1000 + offset);
+ return space->read_byte(0x1000 + offset);
}
static WRITE8_HANDLER( s2650_mirror_w )
{
- memory_write_byte(space, 0x1000 + offset, data);
+ space->write_byte(0x1000 + offset, data);
}
diff --git a/src/mame/drivers/ertictac.c b/src/mame/drivers/ertictac.c
index 789c3ab90d2..f148f721e87 100644
--- a/src/mame/drivers/ertictac.c
+++ b/src/mame/drivers/ertictac.c
@@ -168,7 +168,7 @@ static TIMER_CALLBACK( ertictac_audio_tick )
{
address_space *space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM);
- dac_signed_data_w(space->machine->device("dac"), (0x80) | (memory_read_byte(space,vidc_sndcur)));
+ dac_signed_data_w(space->machine->device("dac"), (0x80) | (space->read_byte(vidc_sndcur)));
vidc_sndcur++;
diff --git a/src/mame/drivers/galpani2.c b/src/mame/drivers/galpani2.c
index 2b9420c6849..0bd9a1d5915 100644
--- a/src/mame/drivers/galpani2.c
+++ b/src/mame/drivers/galpani2.c
@@ -94,18 +94,18 @@ static void galpani2_write_kaneko(running_device *device)
{
for (tpattidx = 0; tpattidx < 6; tpattidx++)
{
- if (memory_read_byte(dstspace,i) == testpattern[tpattidx]) x = 1; //ram test fragment present
+ if (dstspace->read_byte(i) == testpattern[tpattidx]) x = 1; //ram test fragment present
}
}
if ( x == 0 )
{
- memory_write_byte(dstspace,0x100000,0x4b); //K
- memory_write_byte(dstspace,0x100001,0x41); //A
- memory_write_byte(dstspace,0x100002,0x4e); //N
- memory_write_byte(dstspace,0x100003,0x45); //E
- memory_write_byte(dstspace,0x100004,0x4b); //K
- memory_write_byte(dstspace,0x100005,0x4f); //O
+ dstspace->write_byte(0x100000,0x4b); //K
+ dstspace->write_byte(0x100001,0x41); //A
+ dstspace->write_byte(0x100002,0x4e); //N
+ dstspace->write_byte(0x100003,0x45); //E
+ dstspace->write_byte(0x100004,0x4b); //K
+ dstspace->write_byte(0x100005,0x4f); //O
}
}
@@ -118,8 +118,8 @@ static WRITE8_HANDLER( galpani2_mcu_init_w )
for ( mcu_address = 0x100010; mcu_address < (0x100010 + 6); mcu_address += 1 )
{
- mcu_data = memory_read_byte(srcspace, mcu_address );
- memory_write_byte(dstspace, mcu_address-0x10, mcu_data);
+ mcu_data = srcspace->read_byte(mcu_address );
+ dstspace->write_byte(mcu_address-0x10, mcu_data);
}
cputag_set_input_line(machine, "sub", INPUT_LINE_IRQ7, HOLD_LINE); //MCU Initialised
}
@@ -132,20 +132,20 @@ static void galpani2_mcu_nmi1(running_machine *machine)
for ( mcu_list = 0x100021; mcu_list < (0x100021 + 0x40); mcu_list += 4 )
{
- mcu_command = memory_read_byte(srcspace, mcu_list);
+ mcu_command = srcspace->read_byte(mcu_list);
mcu_address = 0x100000 +
- (memory_read_byte(srcspace, mcu_list + 1)<<8) +
- (memory_read_byte(srcspace, mcu_list + 2)<<0) ;
+ (srcspace->read_byte(mcu_list + 1)<<8) +
+ (srcspace->read_byte(mcu_list + 2)<<0) ;
- mcu_extra = memory_read_byte(srcspace, mcu_list + 3); //0xff for command $A and $2, 0x02 for others
+ mcu_extra = srcspace->read_byte(mcu_list + 3); //0xff for command $A and $2, 0x02 for others
if (mcu_command != 0)
{
logerror("%s : MCU [$%06X] endidx = $%02X / command = $%02X addr = $%04X ? = $%02X.\n",
cpuexec_describe_context(machine),
mcu_list,
- memory_read_byte(srcspace, 0x100020),
+ srcspace->read_byte(0x100020),
mcu_command,
mcu_address,
mcu_extra
@@ -158,51 +158,51 @@ static void galpani2_mcu_nmi1(running_machine *machine)
break;
case 0x02: //Copy N bytes from RAM2 to RAM1?, gp2se is the only one to use it, often!
- mcu_src = (memory_read_byte(srcspace, mcu_address + 2)<<8) +
- (memory_read_byte(srcspace, mcu_address + 3)<<0) ;
+ mcu_src = (srcspace->read_byte(mcu_address + 2)<<8) +
+ (srcspace->read_byte(mcu_address + 3)<<0) ;
- mcu_dst = (memory_read_byte(srcspace, mcu_address + 6)<<8) +
- (memory_read_byte(srcspace, mcu_address + 7)<<0) ;
+ mcu_dst = (srcspace->read_byte(mcu_address + 6)<<8) +
+ (srcspace->read_byte(mcu_address + 7)<<0) ;
- mcu_size = (memory_read_byte(srcspace, mcu_address + 8)<<8) +
- (memory_read_byte(srcspace, mcu_address + 9)<<0) ;
+ mcu_size = (srcspace->read_byte(mcu_address + 8)<<8) +
+ (srcspace->read_byte(mcu_address + 9)<<0) ;
logerror("%s : MCU executes command $%02X, %04X %02X-> %04x\n",cpuexec_describe_context(machine),mcu_command,mcu_src,mcu_size,mcu_dst);
for( ; mcu_size > 0 ; mcu_size-- )
{
mcu_src &= 0xffff; mcu_dst &= 0xffff;
- memory_write_byte(srcspace,0x100000 + mcu_dst,memory_read_byte(dstspace,0x100000 + mcu_src));
+ srcspace->write_byte(0x100000 + mcu_dst,dstspace->read_byte(0x100000 + mcu_src));
mcu_src ++; mcu_dst ++;
}
/* Raise a "job done" flag */
- memory_write_byte(srcspace,mcu_address+0,0xff);
- memory_write_byte(srcspace,mcu_address+1,0xff);
+ srcspace->write_byte(mcu_address+0,0xff);
+ srcspace->write_byte(mcu_address+1,0xff);
break;
case 0x0a: // Copy N bytes from RAM1 to RAM2
- mcu_src = (memory_read_byte(srcspace, mcu_address + 2)<<8) +
- (memory_read_byte(srcspace, mcu_address + 3)<<0) ;
+ mcu_src = (srcspace->read_byte(mcu_address + 2)<<8) +
+ (srcspace->read_byte(mcu_address + 3)<<0) ;
- mcu_dst = (memory_read_byte(srcspace, mcu_address + 6)<<8) +
- (memory_read_byte(srcspace, mcu_address + 7)<<0) ;
+ mcu_dst = (srcspace->read_byte(mcu_address + 6)<<8) +
+ (srcspace->read_byte(mcu_address + 7)<<0) ;
- mcu_size = (memory_read_byte(srcspace, mcu_address + 8)<<8) +
- (memory_read_byte(srcspace, mcu_address + 9)<<0) ;
+ mcu_size = (srcspace->read_byte(mcu_address + 8)<<8) +
+ (srcspace->read_byte(mcu_address + 9)<<0) ;
logerror("%s : MCU executes command $%02X, %04X %02X-> %04x\n",cpuexec_describe_context(machine),mcu_command,mcu_src,mcu_size,mcu_dst);
for( ; mcu_size > 0 ; mcu_size-- )
{
mcu_src &= 0xffff; mcu_dst &= 0xffff;
- memory_write_byte(dstspace,0x100000 + mcu_dst,memory_read_byte(srcspace,0x100000 + mcu_src));
+ dstspace->write_byte(0x100000 + mcu_dst,srcspace->read_byte(0x100000 + mcu_src));
mcu_src ++; mcu_dst ++;
}
/* Raise a "job done" flag */
- memory_write_byte(srcspace,mcu_address+0,0xff);
- memory_write_byte(srcspace,mcu_address+1,0xff);
+ srcspace->write_byte(mcu_address+0,0xff);
+ srcspace->write_byte(mcu_address+1,0xff);
break;
@@ -216,14 +216,14 @@ static void galpani2_mcu_nmi1(running_machine *machine)
//case 0x85: //? Do what?
default:
/* Raise a "job done" flag */
- memory_write_byte(srcspace,mcu_address+0,0xff);
- memory_write_byte(srcspace,mcu_address+1,0xff);
+ srcspace->write_byte(mcu_address+0,0xff);
+ srcspace->write_byte(mcu_address+1,0xff);
logerror("%s : MCU ERROR, unknown command $%02X\n",cpuexec_describe_context(machine),mcu_command);
}
/* Erase command (so that it won't be processed again)? */
- memory_write_byte(srcspace,mcu_list,0x00);
+ srcspace->write_byte(mcu_list,0x00);
}
}
diff --git a/src/mame/drivers/gamecstl.c b/src/mame/drivers/gamecstl.c
index a8cc61c3dee..b2ed61d5009 100644
--- a/src/mame/drivers/gamecstl.c
+++ b/src/mame/drivers/gamecstl.c
@@ -435,7 +435,7 @@ static READ8_HANDLER( pc_dma_read_byte )
offs_t page_offset = (((offs_t) dma_offset[0][dma_channel]) << 16)
& 0xFF0000;
- return memory_read_byte(space, page_offset + offset);
+ return space->read_byte(page_offset + offset);
}
@@ -444,7 +444,7 @@ static WRITE8_HANDLER( pc_dma_write_byte )
offs_t page_offset = (((offs_t) dma_offset[0][dma_channel]) << 16)
& 0xFF0000;
- memory_write_byte(space, page_offset + offset, data);
+ space->write_byte(page_offset + offset, data);
}
static void set_dma_channel(running_device *device, int channel, int state)
diff --git a/src/mame/drivers/guab.c b/src/mame/drivers/guab.c
index 854fb580d40..93a3b1532b1 100644
--- a/src/mame/drivers/guab.c
+++ b/src/mame/drivers/guab.c
@@ -576,8 +576,8 @@ static INPUT_CHANGED( coin_inserted )
address_space *space = cputag_get_address_space(field->port->machine, "maincpu", ADDRESS_SPACE_PROGRAM);
/* Get the current credit value and add the new coin value */
- credit = memory_read_dword(space, 0x8002c) + (UINT32)(FPTR)param;
- memory_write_dword(space, 0x8002c, credit);
+ credit = space->read_dword(0x8002c) + (UINT32)(FPTR)param;
+ space->write_dword(0x8002c, credit);
}
}
diff --git a/src/mame/drivers/harddriv.c b/src/mame/drivers/harddriv.c
index f273ce101ce..ba4fdba0a80 100644
--- a/src/mame/drivers/harddriv.c
+++ b/src/mame/drivers/harddriv.c
@@ -3969,12 +3969,12 @@ static READ32_HANDLER( rddsp32_speedup_r )
if (cpu_get_pc(space->cpu) == state->rddsp32_speedup_pc && (*state->rddsp32_speedup >> 16) == 0)
{
UINT32 r14 = cpu_get_reg(space->cpu, DSP32_R14);
- UINT32 r1 = memory_read_word(space, r14 - 0x14);
+ UINT32 r1 = space->read_word(r14 - 0x14);
int cycles_to_burn = 17 * 4 * (0x2bc - r1 - 2);
if (cycles_to_burn > 20 * 4)
{
cpu_eat_cycles(space->cpu, cycles_to_burn);
- memory_write_word(space, r14 - 0x14, r1 + cycles_to_burn / 17);
+ space->write_word(r14 - 0x14, r1 + cycles_to_burn / 17);
}
state->msp_speedup_count[0]++;
}
diff --git a/src/mame/drivers/hng64.c b/src/mame/drivers/hng64.c
index 379d02c9fc5..465d8eeb14a 100644
--- a/src/mame/drivers/hng64.c
+++ b/src/mame/drivers/hng64.c
@@ -604,8 +604,8 @@ static void hng64_do_dma(address_space *space)
{
UINT32 dat;
- dat = memory_read_dword(space,hng_dma_start);
- memory_write_dword(space,hng_dma_dst,dat);
+ dat = space->read_dword(hng_dma_start);
+ space->write_dword(hng_dma_dst,dat);
hng_dma_start+=4;
hng_dma_dst+=4;
hng_dma_len--;
@@ -995,17 +995,17 @@ static WRITE32_HANDLER( hng64_sprite_clear_even_w )
if(ACCESSING_BITS_16_31)
{
- memory_write_dword(space, 0x20000000+0x00+0x00+spr_offs, 0x00000000);
- memory_write_dword(space, 0x20000000+0x08+0x00+spr_offs, 0x00000000);
- memory_write_dword(space, 0x20000000+0x10+0x00+spr_offs, 0x00000000);
- memory_write_dword(space, 0x20000000+0x18+0x00+spr_offs, 0x00000000);
+ space->write_dword(0x20000000+0x00+0x00+spr_offs, 0x00000000);
+ space->write_dword(0x20000000+0x08+0x00+spr_offs, 0x00000000);
+ space->write_dword(0x20000000+0x10+0x00+spr_offs, 0x00000000);
+ space->write_dword(0x20000000+0x18+0x00+spr_offs, 0x00000000);
}
if(ACCESSING_BITS_8_15)
{
- memory_write_dword(space, 0x20000000+0x00+0x20+spr_offs, 0x00000000);
- memory_write_dword(space, 0x20000000+0x08+0x20+spr_offs, 0x00000000);
- memory_write_dword(space, 0x20000000+0x10+0x20+spr_offs, 0x00000000);
- memory_write_dword(space, 0x20000000+0x18+0x20+spr_offs, 0x00000000);
+ space->write_dword(0x20000000+0x00+0x20+spr_offs, 0x00000000);
+ space->write_dword(0x20000000+0x08+0x20+spr_offs, 0x00000000);
+ space->write_dword(0x20000000+0x10+0x20+spr_offs, 0x00000000);
+ space->write_dword(0x20000000+0x18+0x20+spr_offs, 0x00000000);
}
}
@@ -1017,17 +1017,17 @@ static WRITE32_HANDLER( hng64_sprite_clear_odd_w )
if(ACCESSING_BITS_16_31)
{
- memory_write_dword(space, 0x20000000+0x04+0x00+spr_offs, 0x00000000);
- memory_write_dword(space, 0x20000000+0x0c+0x00+spr_offs, 0x00000000);
- memory_write_dword(space, 0x20000000+0x14+0x00+spr_offs, 0x00000000);
- memory_write_dword(space, 0x20000000+0x1c+0x00+spr_offs, 0x00000000);
+ space->write_dword(0x20000000+0x04+0x00+spr_offs, 0x00000000);
+ space->write_dword(0x20000000+0x0c+0x00+spr_offs, 0x00000000);
+ space->write_dword(0x20000000+0x14+0x00+spr_offs, 0x00000000);
+ space->write_dword(0x20000000+0x1c+0x00+spr_offs, 0x00000000);
}
if(ACCESSING_BITS_0_15)
{
- memory_write_dword(space, 0x20000000+0x04+0x20+spr_offs, 0x00000000);
- memory_write_dword(space, 0x20000000+0x0c+0x20+spr_offs, 0x00000000);
- memory_write_dword(space, 0x20000000+0x14+0x20+spr_offs, 0x00000000);
- memory_write_dword(space, 0x20000000+0x1c+0x20+spr_offs, 0x00000000);
+ space->write_dword(0x20000000+0x04+0x20+spr_offs, 0x00000000);
+ space->write_dword(0x20000000+0x0c+0x20+spr_offs, 0x00000000);
+ space->write_dword(0x20000000+0x14+0x20+spr_offs, 0x00000000);
+ space->write_dword(0x20000000+0x1c+0x20+spr_offs, 0x00000000);
}
}
diff --git a/src/mame/drivers/jalmah.c b/src/mame/drivers/jalmah.c
index 6f21016ac3f..26c9d5fb11c 100644
--- a/src/mame/drivers/jalmah.c
+++ b/src/mame/drivers/jalmah.c
@@ -627,7 +627,7 @@ static WRITE16_HANDLER( urashima_dma_w )
{
UINT32 i;
for(i = 0; i < 0x200; i += 2)
- memory_write_word(space, 0x88200 + i, memory_read_word(space, 0x88400 + i));
+ space->write_word(0x88200 + i, space->read_word(0x88400 + i));
}
}
@@ -643,10 +643,10 @@ static void daireika_palette_dma(running_machine *machine, UINT16 val)
for(index_1 = 0; index_1 < 0x200; index_1 += 0x20)
{
tmp_addr = src_addr;
- src_addr = memory_read_dword(space,src_addr);
+ src_addr = space->read_dword(src_addr);
for(index_2 = 0; index_2 < 0x20; index_2 += 2)
- memory_write_word(space, 0x88000 + index_2 + index_1, memory_read_word(space, src_addr + index_2));
+ space->write_word(0x88000 + index_2 + index_1, space->read_word(src_addr + index_2));
src_addr = tmp_addr + 4;
}
diff --git a/src/mame/drivers/konamigx.c b/src/mame/drivers/konamigx.c
index 50a8bf93c89..e526117db7b 100644
--- a/src/mame/drivers/konamigx.c
+++ b/src/mame/drivers/konamigx.c
@@ -196,9 +196,9 @@ static void generate_sprites(address_space *space, UINT32 src, UINT32 spr, int c
for(i=0; i<count; i++) {
UINT32 adr = src + 0x100*i;
int pri;
- if(!memory_read_word(space, adr+2))
+ if(!space->read_word(adr+2))
continue;
- pri = memory_read_word(space, adr+28);
+ pri = space->read_word(adr+28);
if(pri < 256) {
sprites[ecount].pri = pri;
@@ -211,39 +211,39 @@ static void generate_sprites(address_space *space, UINT32 src, UINT32 spr, int c
for(i=0; i<ecount; i++) {
UINT32 adr = sprites[i].adr;
if(adr) {
- UINT32 set =(memory_read_word(space, adr) << 16)|memory_read_word(space, adr+2);
- UINT16 glob_x = memory_read_word(space, adr+4);
- UINT16 glob_y = memory_read_word(space, adr+8);
- UINT16 flip_x = memory_read_word(space, adr+12) ? 0x1000 : 0x0000;
- UINT16 flip_y = memory_read_word(space, adr+14) ? 0x2000 : 0x0000;
+ UINT32 set =(space->read_word(adr) << 16)|space->read_word(adr+2);
+ UINT16 glob_x = space->read_word(adr+4);
+ UINT16 glob_y = space->read_word(adr+8);
+ UINT16 flip_x = space->read_word(adr+12) ? 0x1000 : 0x0000;
+ UINT16 flip_y = space->read_word(adr+14) ? 0x2000 : 0x0000;
UINT16 glob_f = flip_x | (flip_y ^ 0x2000);
- UINT16 zoom_x = memory_read_word(space, adr+20);
- UINT16 zoom_y = memory_read_word(space, adr+22);
+ UINT16 zoom_x = space->read_word(adr+20);
+ UINT16 zoom_y = space->read_word(adr+22);
UINT16 color_val = 0x0000;
UINT16 color_mask = 0xffff;
UINT16 color_set = 0x0000;
UINT16 color_rotate = 0x0000;
UINT16 v;
- v = memory_read_word(space, adr+24);
+ v = space->read_word(adr+24);
if(v & 0x8000) {
color_mask = 0xf3ff;
color_val |= (v & 3) << 10;
}
- v = memory_read_word(space, adr+26);
+ v = space->read_word(adr+26);
if(v & 0x8000) {
color_mask &= 0xfcff;
color_val |= (v & 3) << 8;
}
- v = memory_read_word(space, adr+18);
+ v = space->read_word(adr+18);
if(v & 0x8000) {
color_mask &= 0xff1f;
color_val |= v & 0xe0;
}
- v = memory_read_word(space, adr+16);
+ v = space->read_word(adr+16);
if(v & 0x8000)
color_set = v & 0x1f;
if(v & 0x4000)
@@ -256,14 +256,14 @@ static void generate_sprites(address_space *space, UINT32 src, UINT32 spr, int c
if(set >= 0x200000 && set < 0xd00000)
{
- UINT16 count2 = memory_read_word(space, set);
+ UINT16 count2 = space->read_word(set);
set += 2;
while(count2) {
- UINT16 idx = memory_read_word(space, set);
- UINT16 flip = memory_read_word(space, set+2);
- UINT16 col = memory_read_word(space, set+4);
- short y = memory_read_word(space, set+6);
- short x = memory_read_word(space, set+8);
+ UINT16 idx = space->read_word(set);
+ UINT16 flip = space->read_word(set+2);
+ UINT16 col = space->read_word(set+4);
+ short y = space->read_word(set+6);
+ short x = space->read_word(set+8);
if(idx == 0xffff) {
set = (flip<<16) | col;
@@ -298,13 +298,13 @@ static void generate_sprites(address_space *space, UINT32 src, UINT32 spr, int c
if(color_rotate)
col = (col & 0xffe0) | ((col + color_rotate) & 0x1f);
- memory_write_word(space, spr , (flip ^ glob_f) | sprites[i].pri);
- memory_write_word(space, spr+ 2, idx);
- memory_write_word(space, spr+ 4, y);
- memory_write_word(space, spr+ 6, x);
- memory_write_word(space, spr+ 8, zoom_y);
- memory_write_word(space, spr+10, zoom_x);
- memory_write_word(space, spr+12, col);
+ space->write_word(spr , (flip ^ glob_f) | sprites[i].pri);
+ space->write_word(spr+ 2, idx);
+ space->write_word(spr+ 4, y);
+ space->write_word(spr+ 6, x);
+ space->write_word(spr+ 8, zoom_y);
+ space->write_word(spr+10, zoom_x);
+ space->write_word(spr+12, col);
spr += 16;
scount++;
if(scount == 256)
@@ -317,7 +317,7 @@ static void generate_sprites(address_space *space, UINT32 src, UINT32 spr, int c
}
}
while(scount < 256) {
- memory_write_word(space, spr, scount);
+ space->write_word(spr, scount);
scount++;
spr += 16;
}
@@ -375,7 +375,7 @@ static WRITE32_HANDLER( esc_w )
}
/* the master opcode can be at an unaligned address, so get it "safely" */
- opcode = (memory_read_word(space, data+2))|(memory_read_word(space, data)<<16);
+ opcode = (space->read_word(data+2))|(space->read_word(data)<<16);
/* if there's an OBJECT_MAGIC_ID, that means
there is a valid ESC command packet. */
@@ -383,15 +383,15 @@ static WRITE32_HANDLER( esc_w )
{
int i;
/* get the subop now */
- opcode = memory_read_byte(space, data+8);
- params = (memory_read_word(space, data+12) << 16) | memory_read_word(space, data+14);
+ opcode = space->read_byte(data+8);
+ params = (space->read_word(data+12) << 16) | space->read_word(data+14);
switch(opcode) {
case 5: // Reset
break;
case 2: // Load program
for(i=0; i<4096; i++)
- esc_program[i] = memory_read_byte(space, params+i);
+ esc_program[i] = space->read_byte(params+i);
/*
{
FILE *f;
@@ -406,10 +406,10 @@ static WRITE32_HANDLER( esc_w )
break;
case 1: // Run program
if(esc_cb) {
- UINT32 p1 = (memory_read_word(space, params+0)<<16) | memory_read_word(space, params+2);
- UINT32 p2 = (memory_read_word(space, params+4)<<16) | memory_read_word(space, params+6);
- UINT32 p3 = (memory_read_word(space, params+8)<<16) | memory_read_word(space, params+10);
- UINT32 p4 = (memory_read_word(space, params+12)<<16) | memory_read_word(space, params+14);
+ UINT32 p1 = (space->read_word(params+0)<<16) | space->read_word(params+2);
+ UINT32 p2 = (space->read_word(params+4)<<16) | space->read_word(params+6);
+ UINT32 p3 = (space->read_word(params+8)<<16) | space->read_word(params+10);
+ UINT32 p4 = (space->read_word(params+12)<<16) | space->read_word(params+14);
esc_cb(space, p1, p2, p3, p4);
}
break;
@@ -417,7 +417,7 @@ static WRITE32_HANDLER( esc_w )
// logerror("Unknown ESC opcode %d\n", opcode);
break;
}
- memory_write_byte(space, data+9, ESTATE_END);
+ space->write_byte(data+9, ESTATE_END);
if (konamigx_wrport1_1 & 0x10)
{
@@ -1063,20 +1063,20 @@ static WRITE32_HANDLER( type4_prot_w )
// memcpy from c01000 to c01400 for 0x400 bytes (startup check for type 4 games)
for (i = 0; i < 0x400; i += 2)
{
- memory_write_word(space, 0xc01400+i, memory_read_word(space, 0xc01000+i));
+ space->write_word(0xc01400+i, space->read_word(0xc01000+i));
}
}
else if(last_prot_op == 0x57a) // winspike
{
/* player 1 input buffer protection */
- memory_write_dword(space, 0xc10f00, memory_read_dword(space, 0xc00f10));
- memory_write_dword(space, 0xc10f04, memory_read_dword(space, 0xc00f14));
+ space->write_dword(0xc10f00, space->read_dword(0xc00f10));
+ space->write_dword(0xc10f04, space->read_dword(0xc00f14));
/* player 2 input buffer protection */
- memory_write_dword(space, 0xc10f20, memory_read_dword(space, 0xc00f20));
- memory_write_dword(space, 0xc10f24, memory_read_dword(space, 0xc00f24));
+ space->write_dword(0xc10f20, space->read_dword(0xc00f20));
+ space->write_dword(0xc10f24, space->read_dword(0xc00f24));
/* ... */
- memory_write_dword(space, 0xc0fe00, memory_read_dword(space, 0xc00f30));
- memory_write_dword(space, 0xc0fe04, memory_read_dword(space, 0xc00f34));
+ space->write_dword(0xc0fe00, space->read_dword(0xc00f30));
+ space->write_dword(0xc0fe04, space->read_dword(0xc00f34));
}
else if(last_prot_op == 0xd97) // rushhero
{
@@ -1088,7 +1088,7 @@ static WRITE32_HANDLER( type4_prot_w )
{
for (i = 0; i <= 0x10; i += 4)
{
- memory_write_dword(space, dst + i, memory_read_dword(space, src+i));
+ space->write_dword(dst + i, space->read_dword(src+i));
}
src -= 0x10;
@@ -1096,10 +1096,10 @@ static WRITE32_HANDLER( type4_prot_w )
}
/* Input buffer copiers, only this command is executed so it's safe to assume that's polled here */
- memory_write_byte(space, 0xc01cc0, ~memory_read_byte(space, 0xc00507));
- memory_write_byte(space, 0xc01cc1, ~memory_read_byte(space, 0xc00527));
- memory_write_byte(space, 0xc01cc4, ~memory_read_byte(space, 0xc00547));
- memory_write_byte(space, 0xc01cc5, ~memory_read_byte(space, 0xc00567));
+ space->write_byte(0xc01cc0, ~space->read_byte(0xc00507));
+ space->write_byte(0xc01cc1, ~space->read_byte(0xc00527));
+ space->write_byte(0xc01cc4, ~space->read_byte(0xc00547));
+ space->write_byte(0xc01cc5, ~space->read_byte(0xc00567));
}
else if(last_prot_op == 0xb16) // slamdnk2
{
@@ -1109,7 +1109,7 @@ static WRITE32_HANDLER( type4_prot_w )
for (spr = 0; spr < 0x100; spr++)
{
- memory_write_word(space, dst, memory_read_word(space, src));
+ space->write_word(dst, space->read_word(src));
src += 4;
dst += 2;
}
@@ -1121,14 +1121,14 @@ static WRITE32_HANDLER( type4_prot_w )
int adr;
//printf("GXT4: command %x %d (PC=%x)\n", last_prot_op, cc++, cpu_get_pc(space->cpu));
for (adr = 0; adr < 0x400; adr += 2)
- memory_write_word(space, 0xc01c00+adr, memory_read_word(space, 0xc01800+adr));
+ space->write_word(0xc01c00+adr, space->read_word(0xc01800+adr));
}
else if(last_prot_op == 0x115d) // vsnetscr screen 2
{
int adr;
//printf("GXT4: command %x %d (PC=%x)\n", last_prot_op, cc++, cpu_get_pc(space->cpu));
for (adr = 0; adr < 0x400; adr += 2)
- memory_write_word(space, 0xc18c00+adr, memory_read_word(space, 0xc18800+adr));
+ space->write_word(0xc18c00+adr, space->read_word(0xc18800+adr));
}
else
{
diff --git a/src/mame/drivers/konamim2.c b/src/mame/drivers/konamim2.c
index a76d0218e0d..7bfd57f2cd3 100644
--- a/src/mame/drivers/konamim2.c
+++ b/src/mame/drivers/konamim2.c
@@ -805,7 +805,7 @@ static void cde_dma_transfer(address_space *space, int channel, int next)
for (i=0; i < cde_dma[channel].next_length; i++)
{
- memory_write_byte(space, address, 0xff); // TODO: do the real transfer...
+ space->write_byte(address, 0xff); // TODO: do the real transfer...
address++;
}
}
diff --git a/src/mame/drivers/littlerb.c b/src/mame/drivers/littlerb.c
index e1fd8c082b4..77e4cd16f91 100644
--- a/src/mame/drivers/littlerb.c
+++ b/src/mame/drivers/littlerb.c
@@ -216,7 +216,7 @@ static void littlerb_data_write(running_machine *machine, UINT16 data, UINT16 me
address_space *vdp_space = machine->device<littlerb_vdp_device>("littlerbvdp")->space();
- memory_write_word_masked(vdp_space, addr*2, data, mem_mask);
+ vdp_space->write_word(addr*2, data, mem_mask);
// e000 / 2000 are used for palette writes, which should go to a RAMDAC, so probably mean no auto inc.
diff --git a/src/mame/drivers/lockon.c b/src/mame/drivers/lockon.c
index d8dfa525ff4..c1196b10d50 100644
--- a/src/mame/drivers/lockon.c
+++ b/src/mame/drivers/lockon.c
@@ -66,7 +66,7 @@ static READ16_HANDLER( main_gnd_r )
{
lockon_state *state = space->machine->driver_data<lockon_state>();
address_space *gndspace = cpu_get_address_space(state->ground, ADDRESS_SPACE_PROGRAM);
- return memory_read_word(gndspace, V30_GND_ADDR | offset * 2);
+ return gndspace->read_word(V30_GND_ADDR | offset * 2);
}
static WRITE16_HANDLER( main_gnd_w )
@@ -75,16 +75,16 @@ static WRITE16_HANDLER( main_gnd_w )
address_space *gndspace = cpu_get_address_space(state->ground, ADDRESS_SPACE_PROGRAM);
if (ACCESSING_BITS_0_7)
- memory_write_byte(gndspace, V30_GND_ADDR | (offset * 2 + 0), data);
+ gndspace->write_byte(V30_GND_ADDR | (offset * 2 + 0), data);
if (ACCESSING_BITS_8_15)
- memory_write_byte(gndspace, V30_GND_ADDR | (offset * 2 + 1), data >> 8);
+ gndspace->write_byte(V30_GND_ADDR | (offset * 2 + 1), data >> 8);
}
static READ16_HANDLER( main_obj_r )
{
lockon_state *state = space->machine->driver_data<lockon_state>();
address_space *objspace = cpu_get_address_space(state->object, ADDRESS_SPACE_PROGRAM);
- return memory_read_word(objspace, V30_OBJ_ADDR | offset * 2);
+ return objspace->read_word(V30_OBJ_ADDR | offset * 2);
}
static WRITE16_HANDLER( main_obj_w )
@@ -93,9 +93,9 @@ static WRITE16_HANDLER( main_obj_w )
address_space *objspace = cpu_get_address_space(state->object, ADDRESS_SPACE_PROGRAM);
if (ACCESSING_BITS_0_7)
- memory_write_byte(objspace, V30_OBJ_ADDR | (offset * 2 + 0), data);
+ objspace->write_byte(V30_OBJ_ADDR | (offset * 2 + 0), data);
if (ACCESSING_BITS_8_15)
- memory_write_byte(objspace, V30_OBJ_ADDR | (offset * 2 + 1), data >> 8);
+ objspace->write_byte(V30_OBJ_ADDR | (offset * 2 + 1), data >> 8);
}
static WRITE16_HANDLER( tst_w )
@@ -108,14 +108,14 @@ static WRITE16_HANDLER( tst_w )
address_space *objspace = cpu_get_address_space(state->object, ADDRESS_SPACE_PROGRAM);
if (ACCESSING_BITS_0_7)
- memory_write_byte(gndspace, V30_GND_ADDR | (offset * 2 + 0), data);
+ gndspace->write_byte(V30_GND_ADDR | (offset * 2 + 0), data);
if (ACCESSING_BITS_8_15)
- memory_write_byte(gndspace, V30_GND_ADDR | (offset * 2 + 1), data >> 8);
+ gndspace->write_byte(V30_GND_ADDR | (offset * 2 + 1), data >> 8);
if (ACCESSING_BITS_0_7)
- memory_write_byte(objspace, V30_OBJ_ADDR | (offset * 2 + 0), data);
+ objspace->write_byte(V30_OBJ_ADDR | (offset * 2 + 0), data);
if (ACCESSING_BITS_8_15)
- memory_write_byte(objspace, V30_OBJ_ADDR | (offset * 2 + 1), data >> 8);
+ objspace->write_byte(V30_OBJ_ADDR | (offset * 2 + 1), data >> 8);
}
}
@@ -123,14 +123,14 @@ static READ16_HANDLER( main_z80_r )
{
lockon_state *state = space->machine->driver_data<lockon_state>();
address_space *sndspace = cpu_get_address_space(state->audiocpu, ADDRESS_SPACE_PROGRAM);
- return 0xff00 | memory_read_byte(sndspace, offset);
+ return 0xff00 | sndspace->read_byte(offset);
}
static WRITE16_HANDLER( main_z80_w )
{
lockon_state *state = space->machine->driver_data<lockon_state>();
address_space *sndspace = cpu_get_address_space(state->audiocpu, ADDRESS_SPACE_PROGRAM);
- memory_write_byte(sndspace, offset, data);
+ sndspace->write_byte(offset, data);
}
static WRITE16_HANDLER( inten_w )
diff --git a/src/mame/drivers/mario.c b/src/mame/drivers/mario.c
index 0ced31f7be9..bcf24fb3372 100644
--- a/src/mame/drivers/mario.c
+++ b/src/mame/drivers/mario.c
@@ -101,6 +101,9 @@ write:
*
*************************************/
+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 Z80DMA_INTERFACE( mario_dma )
{
DEVCB_CPU_INPUT_LINE("maincpu", INPUT_LINE_HALT),
diff --git a/src/mame/drivers/mediagx.c b/src/mame/drivers/mediagx.c
index 34a696f3ff4..1f023d4d33c 100644
--- a/src/mame/drivers/mediagx.c
+++ b/src/mame/drivers/mediagx.c
@@ -846,7 +846,7 @@ static READ8_HANDLER( pc_dma_read_byte )
offs_t page_offset = (((offs_t) state->dma_offset[0][state->dma_channel]) << 16)
& 0xFF0000;
- return memory_read_byte(space, page_offset + offset);
+ return space->read_byte(page_offset + offset);
}
@@ -856,7 +856,7 @@ static WRITE8_HANDLER( pc_dma_write_byte )
offs_t page_offset = (((offs_t) state->dma_offset[0][state->dma_channel]) << 16)
& 0xFF0000;
- memory_write_byte(space, page_offset + offset, data);
+ space->write_byte(page_offset + offset, data);
}
static void set_dma_channel(running_device *device, int channel, int _state)
diff --git a/src/mame/drivers/megadriv.c b/src/mame/drivers/megadriv.c
index 48cc5a89835..7863f3fb471 100644
--- a/src/mame/drivers/megadriv.c
+++ b/src/mame/drivers/megadriv.c
@@ -193,7 +193,7 @@ static UINT16 read_next_instruction(address_space *space)
/* read original encrypted memory at that address */
recurse = 1;
- result = memory_read_word(space, cpu_get_pc(space->cpu));
+ result = space->read_word(cpu_get_pc(space->cpu));
recurse = 0;
return result;
}
diff --git a/src/mame/drivers/metalmx.c b/src/mame/drivers/metalmx.c
index 9a05626a70f..c46651936ba 100644
--- a/src/mame/drivers/metalmx.c
+++ b/src/mame/drivers/metalmx.c
@@ -455,8 +455,8 @@ static WRITE32_HANDLER( host_gsp_w )
{
address_space *gsp_space = cputag_get_address_space(space->machine, "gsp", ADDRESS_SPACE_PROGRAM);
- memory_write_word(gsp_space, (0xc0000000 + (offset << 5) + 0x10) / 8, data);
- memory_write_word(gsp_space, (0xc0000000 + (offset << 5))/ 8 , data >> 16);
+ gsp_space->write_word((0xc0000000 + (offset << 5) + 0x10) / 8, data);
+ gsp_space->write_word((0xc0000000 + (offset << 5))/ 8 , data >> 16);
}
static READ32_HANDLER( host_gsp_r )
@@ -464,8 +464,8 @@ static READ32_HANDLER( host_gsp_r )
address_space *gsp_space = cputag_get_address_space(space->machine, "gsp", ADDRESS_SPACE_PROGRAM);
UINT32 val;
- val = memory_read_word(gsp_space, (0xc0000000 + (offset << 5) + 0x10) / 8);
- val |= memory_read_word(gsp_space, (0xc0000000 + (offset << 5)) / 8) << 16;
+ val = gsp_space->read_word((0xc0000000 + (offset << 5) + 0x10) / 8);
+ val |= gsp_space->read_word((0xc0000000 + (offset << 5)) / 8) << 16;
return val;
}
diff --git a/src/mame/drivers/model3.c b/src/mame/drivers/model3.c
index 120633edf46..12c40d6cde1 100644
--- a/src/mame/drivers/model3.c
+++ b/src/mame/drivers/model3.c
@@ -1016,7 +1016,7 @@ static UINT32 scsi_fetch(running_machine *machine, UINT32 dsp)
{
address_space *space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM);
UINT32 result;
- result = memory_read_dword(space, dsp);
+ result = space->read_dword(dsp);
return FLIPENDIAN_INT32(result);
}
diff --git a/src/mame/drivers/moo.c b/src/mame/drivers/moo.c
index 9ec0db17414..287c5c7804f 100644
--- a/src/mame/drivers/moo.c
+++ b/src/mame/drivers/moo.c
@@ -236,11 +236,11 @@ static WRITE16_HANDLER( moo_prot_w )
while (length)
{
- a = memory_read_word(space, src1);
- b = memory_read_word(space, src2);
+ a = space->read_word(src1);
+ b = space->read_word(src2);
res = a + 2 * b;
- memory_write_word(space, dst, res);
+ space->write_word(dst, res);
src1 += 2;
src2 += 2;
diff --git a/src/mame/drivers/namcos22.c b/src/mame/drivers/namcos22.c
index a9f7a80beba..b7e37cd24ae 100644
--- a/src/mame/drivers/namcos22.c
+++ b/src/mame/drivers/namcos22.c
@@ -2435,7 +2435,7 @@ static WRITE32_HANDLER( alpinesa_prot_w )
for(i=0;i<4;i++)
{
mAlpineSurferProtData<<=8;
- mAlpineSurferProtData |= memory_read_byte(space, sptr+4+i );
+ mAlpineSurferProtData |= space->read_byte(sptr+4+i );
}
#endif
} /* alpinesa_prot_w */
diff --git a/src/mame/drivers/namcos23.c b/src/mame/drivers/namcos23.c
index 99341ace6b7..60051ad2bed 100644
--- a/src/mame/drivers/namcos23.c
+++ b/src/mame/drivers/namcos23.c
@@ -1917,7 +1917,7 @@ static void p3d_dma(address_space *space, UINT32 adr, UINT32 size)
UINT16 buffer[256];
int pos = 0;
while(pos < size) {
- UINT16 h = memory_read_word(space, adr+pos);
+ UINT16 h = space->read_word(adr+pos);
pos += 2;
@@ -1937,7 +1937,7 @@ static void p3d_dma(address_space *space, UINT32 adr, UINT32 size)
}
for(int i=0; i < psize; i++) {
- buffer[i] = memory_read_word(space, adr+pos);
+ buffer[i] = space->read_word(adr+pos);
pos += 2;
}
diff --git a/src/mame/drivers/neogeo.c b/src/mame/drivers/neogeo.c
index d8b0f235c4c..08c2fdfdafb 100644
--- a/src/mame/drivers/neogeo.c
+++ b/src/mame/drivers/neogeo.c
@@ -507,7 +507,7 @@ READ16_HANDLER( neogeo_unmapped_r )
else
{
state->recurse = 1;
- ret = memory_read_word(space, cpu_get_pc(space->cpu));
+ ret = space->read_word(cpu_get_pc(space->cpu));
state->recurse = 0;
}
diff --git a/src/mame/drivers/offtwall.c b/src/mame/drivers/offtwall.c
index a5c54f3c688..e8517f6a515 100644
--- a/src/mame/drivers/offtwall.c
+++ b/src/mame/drivers/offtwall.c
@@ -171,7 +171,7 @@ static READ16_HANDLER( bankrom_r )
ROM bank area, we need to return the correct value to give the proper checksum */
if ((offset == 0x3000 || offset == 0x3001) && cpu_get_previouspc(space->cpu) > 0x37000)
{
- UINT32 checksum = (memory_read_word(space, 0x3fd210) << 16) | memory_read_word(space, 0x3fd212);
+ UINT32 checksum = (space->read_word(0x3fd210) << 16) | space->read_word(0x3fd212);
UINT32 us = 0xaaaa5555 - checksum;
if (offset == 0x3001)
return us & 0xffff;
diff --git a/src/mame/drivers/pcat_dyn.c b/src/mame/drivers/pcat_dyn.c
index 32601915224..f8345c7b784 100644
--- a/src/mame/drivers/pcat_dyn.c
+++ b/src/mame/drivers/pcat_dyn.c
@@ -184,7 +184,7 @@ static READ8_HANDLER( pc_dma_read_byte )
offs_t page_offset = (((offs_t) dma_offset[0][dma_channel]) << 16)
& 0xFF0000;
- return memory_read_byte(space, page_offset + offset);
+ return space->read_byte(page_offset + offset);
}
@@ -193,7 +193,7 @@ static WRITE8_HANDLER( pc_dma_write_byte )
offs_t page_offset = (((offs_t) dma_offset[0][dma_channel]) << 16)
& 0xFF0000;
- memory_write_byte(space, page_offset + offset, data);
+ space->write_byte(page_offset + offset, data);
}
static void set_dma_channel(running_device *device, int channel, int state)
diff --git a/src/mame/drivers/pcxt.c b/src/mame/drivers/pcxt.c
index 96cad4c88a2..f5911ee0af2 100644
--- a/src/mame/drivers/pcxt.c
+++ b/src/mame/drivers/pcxt.c
@@ -563,7 +563,7 @@ static READ8_HANDLER( pc_dma_read_byte )
offs_t page_offset = (((offs_t) dma_offset[0][dma_channel]) << 16)
& 0xFF0000;
- return memory_read_byte(space, page_offset + offset);
+ return space->read_byte(page_offset + offset);
}
@@ -572,7 +572,7 @@ static WRITE8_HANDLER( pc_dma_write_byte )
offs_t page_offset = (((offs_t) dma_offset[0][dma_channel]) << 16)
& 0xFF0000;
- memory_write_byte(space, page_offset + offset, data);
+ space->write_byte(page_offset + offset, data);
}
static READ8_HANDLER(dma_page_select_r)
diff --git a/src/mame/drivers/photoply.c b/src/mame/drivers/photoply.c
index 3fb4d9b6a42..e4b1e2e57ce 100644
--- a/src/mame/drivers/photoply.c
+++ b/src/mame/drivers/photoply.c
@@ -132,7 +132,7 @@ static READ8_HANDLER( pc_dma_read_byte )
offs_t page_offset = (((offs_t) dma_offset[0][dma_channel]) << 16)
& 0xFF0000;
- return memory_read_byte(space, page_offset + offset);
+ return space->read_byte(page_offset + offset);
}
@@ -141,7 +141,7 @@ static WRITE8_HANDLER( pc_dma_write_byte )
offs_t page_offset = (((offs_t) dma_offset[0][dma_channel]) << 16)
& 0xFF0000;
- memory_write_byte(space, page_offset + offset, data);
+ space->write_byte(page_offset + offset, data);
}
static READ8_HANDLER(dma_page_select_r)
diff --git a/src/mame/drivers/pinkiri8.c b/src/mame/drivers/pinkiri8.c
index 2cebcbf4c7c..6a72e912f3e 100644
--- a/src/mame/drivers/pinkiri8.c
+++ b/src/mame/drivers/pinkiri8.c
@@ -438,7 +438,7 @@ static WRITE8_HANDLER( pinkiri8_vram_w )
prev_writes++;
vram_addr++;
- memory_write_byte_8le(vdp_space, vram_addr, data);
+ vdp_space->write_byte(vram_addr, data);
break;
}
}
diff --git a/src/mame/drivers/seattle.c b/src/mame/drivers/seattle.c
index 95a10fb52b2..c725792ecf1 100644
--- a/src/mame/drivers/seattle.c
+++ b/src/mame/drivers/seattle.c
@@ -947,19 +947,19 @@ static int galileo_dma_fetch_next(address_space *space, int which)
}
/* fetch the byte count */
- data = memory_read_dword(space, address); address += 4;
+ data = space->read_dword(address); address += 4;
galileo.reg[GREG_DMA0_COUNT + which] = data;
/* fetch the source address */
- data = memory_read_dword(space, address); address += 4;
+ data = space->read_dword(address); address += 4;
galileo.reg[GREG_DMA0_SOURCE + which] = data;
/* fetch the dest address */
- data = memory_read_dword(space, address); address += 4;
+ data = space->read_dword(address); address += 4;
galileo.reg[GREG_DMA0_DEST + which] = data;
/* fetch the next record address */
- data = memory_read_dword(space, address); address += 4;
+ data = space->read_dword(address); address += 4;
galileo.reg[GREG_DMA0_NEXT + which] = data;
return 1;
}
@@ -1016,7 +1016,7 @@ static void galileo_perform_dma(address_space *space, int which)
}
/* write the data and advance */
- voodoo_w(voodoo, (dstaddr & 0xffffff) / 4, memory_read_dword(space, srcaddr), 0xffffffff);
+ voodoo_w(voodoo, (dstaddr & 0xffffff) / 4, space->read_dword(srcaddr), 0xffffffff);
srcaddr += srcinc;
dstaddr += dstinc;
bytesleft -= 4;
@@ -1028,7 +1028,7 @@ static void galileo_perform_dma(address_space *space, int which)
{
while (bytesleft > 0)
{
- memory_write_byte(space, dstaddr, memory_read_byte(space, srcaddr));
+ space->write_byte(dstaddr, space->read_byte(srcaddr));
srcaddr += srcinc;
dstaddr += dstinc;
bytesleft--;
diff --git a/src/mame/drivers/segag80r.c b/src/mame/drivers/segag80r.c
index 09ad2e934df..70a5bd6c11d 100644
--- a/src/mame/drivers/segag80r.c
+++ b/src/mame/drivers/segag80r.c
@@ -188,11 +188,11 @@ static offs_t decrypt_offset(address_space *space, offs_t offset)
{
/* ignore anything but accesses via opcode $32 (LD $(XXYY),A) */
offs_t pc = cpu_get_previouspc(space->cpu);
- if ((UINT16)pc == 0xffff || memory_read_byte(space, pc) != 0x32)
+ if ((UINT16)pc == 0xffff || space->read_byte(pc) != 0x32)
return offset;
/* fetch the low byte of the address and munge it */
- return (offset & 0xff00) | (*sega_decrypt)(pc, memory_read_byte(space, pc + 1));
+ return (offset & 0xff00) | (*sega_decrypt)(pc, space->read_byte(pc + 1));
}
static WRITE8_HANDLER( mainram_w ) { mainram[decrypt_offset(space, offset)] = data; }
diff --git a/src/mame/drivers/segag80v.c b/src/mame/drivers/segag80v.c
index 5a2999384af..2112cb0d5a9 100644
--- a/src/mame/drivers/segag80v.c
+++ b/src/mame/drivers/segag80v.c
@@ -214,11 +214,11 @@ static offs_t decrypt_offset(address_space *space, offs_t offset)
{
/* ignore anything but accesses via opcode $32 (LD $(XXYY),A) */
offs_t pc = cpu_get_previouspc(space->cpu);
- if ((UINT16)pc == 0xffff || memory_read_byte(space, pc) != 0x32)
+ if ((UINT16)pc == 0xffff || space->read_byte(pc) != 0x32)
return offset;
/* fetch the low byte of the address and munge it */
- return (offset & 0xff00) | (*sega_decrypt)(pc, memory_read_byte(space, pc + 1));
+ return (offset & 0xff00) | (*sega_decrypt)(pc, space->read_byte(pc + 1));
}
static WRITE8_HANDLER( mainram_w ) { mainram[decrypt_offset(space, offset)] = data; }
diff --git a/src/mame/drivers/segas16a.c b/src/mame/drivers/segas16a.c
index 0ff162b6809..bd316c19d84 100644
--- a/src/mame/drivers/segas16a.c
+++ b/src/mame/drivers/segas16a.c
@@ -858,14 +858,14 @@ static void sjryuko_lamp_changed_w(running_machine *machine, UINT8 changed, UINT
INLINE UINT8 maincpu_byte_r(running_machine *machine, offs_t offset)
{
segas1x_state *state = machine->driver_data<segas1x_state>();
- return memory_read_byte(cpu_get_address_space(state->maincpu, ADDRESS_SPACE_PROGRAM), offset);
+ return downcast<cpu_device *>(state->maincpu)->space(AS_PROGRAM)->read_byte(offset);
}
INLINE void maincpu_byte_w(running_machine *machine, offs_t offset, UINT8 data)
{
segas1x_state *state = machine->driver_data<segas1x_state>();
- memory_write_byte(cpu_get_address_space(state->maincpu, ADDRESS_SPACE_PROGRAM), offset, data);
+ downcast<cpu_device *>(state->maincpu)->space(AS_PROGRAM)->write_byte(offset, data);
}
diff --git a/src/mame/drivers/segas32.c b/src/mame/drivers/segas32.c
index 274e5b9e21c..b02628de9f4 100644
--- a/src/mame/drivers/segas32.c
+++ b/src/mame/drivers/segas32.c
@@ -4063,7 +4063,7 @@ static WRITE16_HANDLER( f1en_comms_echo_w )
{
// pretend that slave is following master op, enables attract mode video with sound
if (ACCESSING_BITS_0_7)
- memory_write_byte( space, 0x810049, data );
+ space->write_byte( 0x810049, data );
}
static DRIVER_INIT( f1en )
diff --git a/src/mame/drivers/seta2.c b/src/mame/drivers/seta2.c
index ba6a217b8de..0d967b165e5 100644
--- a/src/mame/drivers/seta2.c
+++ b/src/mame/drivers/seta2.c
@@ -752,7 +752,7 @@ ADDRESS_MAP_END
The offset to use is stored in RAM at address 0x20BA16 */
static READ16_HANDLER( pzlbowl_protection_r )
{
- UINT32 address = (memory_read_word(space, 0x20ba16) << 16) | memory_read_word(space, 0x20ba18);
+ UINT32 address = (space->read_word(0x20ba16) << 16) | space->read_word(0x20ba18);
return memory_region(space->machine, "maincpu")[address - 2];
}
diff --git a/src/mame/drivers/sf.c b/src/mame/drivers/sf.c
index 4b5904e10a7..d068ce57f52 100644
--- a/src/mame/drivers/sf.c
+++ b/src/mame/drivers/sf.c
@@ -56,8 +56,8 @@ static WRITE16_HANDLER( soundcmd_w )
static void write_dword( address_space *space, offs_t offset, UINT32 data )
{
- memory_write_word(space, offset, data >> 16);
- memory_write_word(space, offset + 2, data);
+ space->write_word(offset, data >> 16);
+ space->write_word(offset + 2, data);
}
static WRITE16_HANDLER( protection_w )
@@ -71,10 +71,10 @@ static WRITE16_HANDLER( protection_w )
int map;
map = maplist
- [memory_read_byte(space, 0xffc006)]
- [(memory_read_byte(space, 0xffc003) << 1) + (memory_read_word(space, 0xffc004) >> 8)];
+ [space->read_byte(0xffc006)]
+ [(space->read_byte(0xffc003) << 1) + (space->read_word(0xffc004) >> 8)];
- switch (memory_read_byte(space, 0xffc684))
+ switch (space->read_byte(0xffc684))
{
case 1:
{
@@ -111,10 +111,10 @@ static WRITE16_HANDLER( protection_w )
int d1 = delta1[map] + 0xc0;
int d2 = delta2[map];
- memory_write_word(space, 0xffc680, d1);
- memory_write_word(space, 0xffc682, d2);
- memory_write_word(space, 0xffc00c, 0xc0);
- memory_write_word(space, 0xffc00e, 0);
+ space->write_word(0xffc680, d1);
+ space->write_word(0xffc682, d2);
+ space->write_word(0xffc00c, 0xc0);
+ space->write_word(0xffc00e, 0);
sf_fg_scroll_w(space, 0, d1, 0xffff);
sf_bg_scroll_w(space, 0, d2, 0xffff);
@@ -122,13 +122,13 @@ static WRITE16_HANDLER( protection_w )
}
case 4:
{
- int pos = memory_read_byte(space, 0xffc010);
+ int pos = space->read_byte(0xffc010);
pos = (pos + 1) & 3;
- memory_write_byte(space, 0xffc010, pos);
+ space->write_byte(0xffc010, pos);
if(!pos)
{
- int d1 = memory_read_word(space, 0xffc682);
- int off = memory_read_word(space, 0xffc00e);
+ int d1 = space->read_word(0xffc682);
+ int off = space->read_word(0xffc00e);
if (off!=512)
{
off++;
@@ -139,8 +139,8 @@ static WRITE16_HANDLER( protection_w )
off = 0;
d1 -= 512;
}
- memory_write_word(space, 0xffc682, d1);
- memory_write_word(space, 0xffc00e, off);
+ space->write_word(0xffc682, d1);
+ space->write_word(0xffc00e, off);
sf_bg_scroll_w(space, 0, d1, 0xffff);
}
break;
@@ -148,7 +148,7 @@ static WRITE16_HANDLER( protection_w )
default:
{
logerror("Write protection at %06x (%04x)\n", cpu_get_pc(space->cpu), data & 0xffff);
- logerror("*** Unknown protection %d\n", memory_read_byte(space, 0xffc684));
+ logerror("*** Unknown protection %d\n", space->read_byte(0xffc684));
break;
}
}
diff --git a/src/mame/drivers/stv.c b/src/mame/drivers/stv.c
index ee6a6ea68ec..b08fc6d4574 100644
--- a/src/mame/drivers/stv.c
+++ b/src/mame/drivers/stv.c
@@ -1506,18 +1506,18 @@ static void dma_direct_lv0(address_space *space)
for (; scu_size_0 > 0; scu_size_0-=scu_dst_add_0)
{
if(scu_dst_add_0 == 2)
- memory_write_word(space,scu_dst_0,memory_read_word(space,scu_src_0));
+ space->write_word(scu_dst_0,space->read_word(scu_src_0));
else if(scu_dst_add_0 == 8)
{
- memory_write_word(space,scu_dst_0,memory_read_word(space,scu_src_0));
- memory_write_word(space,scu_dst_0+2,memory_read_word(space,scu_src_0));
- memory_write_word(space,scu_dst_0+4,memory_read_word(space,scu_src_0+2));
- memory_write_word(space,scu_dst_0+6,memory_read_word(space,scu_src_0+2));
+ space->write_word(scu_dst_0,space->read_word(scu_src_0));
+ space->write_word(scu_dst_0+2,space->read_word(scu_src_0));
+ space->write_word(scu_dst_0+4,space->read_word(scu_src_0+2));
+ space->write_word(scu_dst_0+6,space->read_word(scu_src_0+2));
}
else
{
- memory_write_word(space,scu_dst_0,memory_read_word(space,scu_src_0));
- memory_write_word(space,scu_dst_0+2,memory_read_word(space,scu_src_0+2));
+ space->write_word(scu_dst_0,space->read_word(scu_src_0));
+ space->write_word(scu_dst_0+2,space->read_word(scu_src_0+2));
}
scu_dst_0+=scu_dst_add_0;
@@ -1615,11 +1615,11 @@ static void dma_direct_lv1(address_space *space)
for (; scu_size_1 > 0; scu_size_1-=scu_dst_add_1)
{
if(scu_dst_add_1 == 2)
- memory_write_word(space,scu_dst_1,memory_read_word(space,scu_src_1));
+ space->write_word(scu_dst_1,space->read_word(scu_src_1));
else
{
- memory_write_word(space,scu_dst_1,memory_read_word(space,scu_src_1));
- memory_write_word(space,scu_dst_1+2,memory_read_word(space,scu_src_1+2));
+ space->write_word(scu_dst_1,space->read_word(scu_src_1));
+ space->write_word(scu_dst_1+2,space->read_word(scu_src_1+2));
}
scu_dst_1+=scu_dst_add_1;
@@ -1716,11 +1716,11 @@ static void dma_direct_lv2(address_space *space)
for (; scu_size_2 > 0; scu_size_2-=scu_dst_add_2)
{
if(scu_dst_add_2 == 2)
- memory_write_word(space,scu_dst_2,memory_read_word(space,scu_src_2));
+ space->write_word(scu_dst_2,space->read_word(scu_src_2));
else
{
- memory_write_word(space,scu_dst_2,memory_read_word(space,scu_src_2));
- memory_write_word(space,scu_dst_2+2,memory_read_word(space,scu_src_2+2));
+ space->write_word(scu_dst_2,space->read_word(scu_src_2));
+ space->write_word(scu_dst_2+2,space->read_word(scu_src_2+2));
}
scu_dst_2+=scu_dst_add_2;
@@ -1760,9 +1760,9 @@ static void dma_indirect_lv0(address_space *space)
tmp_src = scu_index_0;
/*Thanks for Runik of Saturnin for pointing this out...*/
- scu_size_0 = memory_read_dword(space,scu_index_0);
- scu_src_0 = memory_read_dword(space,scu_index_0+8);
- scu_dst_0 = memory_read_dword(space,scu_index_0+4);
+ scu_size_0 = space->read_dword(scu_index_0);
+ scu_src_0 = space->read_dword(scu_index_0+8);
+ scu_dst_0 = space->read_dword(scu_index_0+4);
/*Indirect Mode end factor*/
if(scu_src_0 & 0x80000000)
@@ -1786,7 +1786,7 @@ static void dma_indirect_lv0(address_space *space)
for (; scu_size_0 > 0; scu_size_0-=scu_dst_add_0)
{
if(scu_dst_add_0 == 2)
- memory_write_word(space,scu_dst_0,memory_read_word(space,scu_src_0));
+ space->write_word(scu_dst_0,space->read_word(scu_src_0));
else
{
/* some games, eg columns97 are a bit weird, I'm not sure this is correct
@@ -1794,15 +1794,15 @@ static void dma_indirect_lv0(address_space *space)
can't access 2 byte boundaries, and the end of the sprite list never gets marked,
the length of the transfer is also set to a 2 byte boundary, maybe the add values
should be different, I don't know */
- memory_write_word(space,scu_dst_0,memory_read_word(space,scu_src_0));
- memory_write_word(space,scu_dst_0+2,memory_read_word(space,scu_src_0+2));
+ space->write_word(scu_dst_0,space->read_word(scu_src_0));
+ space->write_word(scu_dst_0+2,space->read_word(scu_src_0+2));
}
scu_dst_0+=scu_dst_add_0;
scu_src_0+=scu_src_add_0;
}
- //if(DRUP(0)) memory_write_dword(space,tmp_src+8,scu_src_0|job_done ? 0x80000000 : 0);
- //if(DWUP(0)) memory_write_dword(space,tmp_src+4,scu_dst_0);
+ //if(DRUP(0)) space->write_dword(tmp_src+8,scu_src_0|job_done ? 0x80000000 : 0);
+ //if(DWUP(0)) space->write_dword(tmp_src+4,scu_dst_0);
scu_index_0 = tmp_src+0xc;
@@ -1827,9 +1827,9 @@ static void dma_indirect_lv1(address_space *space)
do{
tmp_src = scu_index_1;
- scu_size_1 = memory_read_dword(space,scu_index_1);
- scu_src_1 = memory_read_dword(space,scu_index_1+8);
- scu_dst_1 = memory_read_dword(space,scu_index_1+4);
+ scu_size_1 = space->read_dword(scu_index_1);
+ scu_src_1 = space->read_dword(scu_index_1+8);
+ scu_dst_1 = space->read_dword(scu_index_1+4);
/*Indirect Mode end factor*/
if(scu_src_1 & 0x80000000)
@@ -1855,7 +1855,7 @@ static void dma_indirect_lv1(address_space *space)
{
if(scu_dst_add_1 == 2)
- memory_write_word(space,scu_dst_1,memory_read_word(space,scu_src_1));
+ space->write_word(scu_dst_1,space->read_word(scu_src_1));
else
{
/* some games, eg columns97 are a bit weird, I'm not sure this is correct
@@ -1863,15 +1863,15 @@ static void dma_indirect_lv1(address_space *space)
can't access 2 byte boundaries, and the end of the sprite list never gets marked,
the length of the transfer is also set to a 2 byte boundary, maybe the add values
should be different, I don't know */
- memory_write_word(space,scu_dst_1,memory_read_word(space,scu_src_1));
- memory_write_word(space,scu_dst_1+2,memory_read_word(space,scu_src_1+2));
+ space->write_word(scu_dst_1,space->read_word(scu_src_1));
+ space->write_word(scu_dst_1+2,space->read_word(scu_src_1+2));
}
scu_dst_1+=scu_dst_add_1;
scu_src_1+=scu_src_add_1;
}
- //if(DRUP(1)) memory_write_dword(space,tmp_src+8,scu_src_1|job_done ? 0x80000000 : 0);
- //if(DWUP(1)) memory_write_dword(space,tmp_src+4,scu_dst_1);
+ //if(DRUP(1)) space->write_dword(tmp_src+8,scu_src_1|job_done ? 0x80000000 : 0);
+ //if(DWUP(1)) space->write_dword(tmp_src+4,scu_dst_1);
scu_index_1 = tmp_src+0xc;
@@ -1896,9 +1896,9 @@ static void dma_indirect_lv2(address_space *space)
do{
tmp_src = scu_index_2;
- scu_size_2 = memory_read_dword(space,scu_index_2);
- scu_src_2 = memory_read_dword(space,scu_index_2+8);
- scu_dst_2 = memory_read_dword(space,scu_index_2+4);
+ scu_size_2 = space->read_dword(scu_index_2);
+ scu_src_2 = space->read_dword(scu_index_2+8);
+ scu_dst_2 = space->read_dword(scu_index_2+4);
/*Indirect Mode end factor*/
if(scu_src_2 & 0x80000000)
@@ -1922,7 +1922,7 @@ static void dma_indirect_lv2(address_space *space)
for (; scu_size_2 > 0; scu_size_2-=scu_dst_add_2)
{
if(scu_dst_add_2 == 2)
- memory_write_word(space,scu_dst_2,memory_read_word(space,scu_src_2));
+ space->write_word(scu_dst_2,space->read_word(scu_src_2));
else
{
/* some games, eg columns97 are a bit weird, I'm not sure this is correct
@@ -1930,16 +1930,16 @@ static void dma_indirect_lv2(address_space *space)
can't access 2 byte boundaries, and the end of the sprite list never gets marked,
the length of the transfer is also set to a 2 byte boundary, maybe the add values
should be different, I don't know */
- memory_write_word(space,scu_dst_2,memory_read_word(space,scu_src_2));
- memory_write_word(space,scu_dst_2+2,memory_read_word(space,scu_src_2+2));
+ space->write_word(scu_dst_2,space->read_word(scu_src_2));
+ space->write_word(scu_dst_2+2,space->read_word(scu_src_2+2));
}
scu_dst_2+=scu_dst_add_2;
scu_src_2+=scu_src_add_2;
}
- //if(DRUP(2)) memory_write_dword(space,tmp_src+8,scu_src_2|job_done ? 0x80000000 : 0);
- //if(DWUP(2)) memory_write_dword(space,tmp_src+4,scu_dst_2);
+ //if(DRUP(2)) space->write_dword(tmp_src+8,scu_src_2|job_done ? 0x80000000 : 0);
+ //if(DWUP(2)) space->write_dword(tmp_src+4,scu_dst_2);
scu_index_2 = tmp_src+0xc;
diff --git a/src/mame/drivers/suna8.c b/src/mame/drivers/suna8.c
index 8d6c5923c17..2ff9a3ae932 100644
--- a/src/mame/drivers/suna8.c
+++ b/src/mame/drivers/suna8.c
@@ -573,7 +573,7 @@ static WRITE8_HANDLER( sranger_prot_w )
{
/* check code at 0x2ce2 (in sranger), protection is so dire that I can't even exactly
estabilish if what I'm doing can be considered or not a kludge... -AS */
- memory_write_byte(space,0xcd99,0xff);
+ space->write_byte(0xcd99,0xff);
}
static ADDRESS_MAP_START( rranger_map, ADDRESS_SPACE_PROGRAM, 8 )
diff --git a/src/mame/drivers/suprnova.c b/src/mame/drivers/suprnova.c
index 4d14ff8bc62..9ab9dc0ac4d 100644
--- a/src/mame/drivers/suprnova.c
+++ b/src/mame/drivers/suprnova.c
@@ -876,7 +876,7 @@ MACHINE_DRIVER_END
static READ32_HANDLER( bios_skip_r )
{
#if BIOS_SKIP
- if ((cpu_get_pc(space->cpu)==0x6f8) || (cpu_get_pc(space->cpu)==0x6fa)) memory_write_byte(space, 0x06000029,1);
+ if ((cpu_get_pc(space->cpu)==0x6f8) || (cpu_get_pc(space->cpu)==0x6fa)) space->write_byte(0x06000029,1);
#endif
return skns_main_ram[0x00028/4];
}
diff --git a/src/mame/drivers/system1.c b/src/mame/drivers/system1.c
index 256f47c82df..a813e8e3f3f 100644
--- a/src/mame/drivers/system1.c
+++ b/src/mame/drivers/system1.c
@@ -555,11 +555,11 @@ static WRITE8_HANDLER( mcu_io_w )
switch ((mcu_control >> 3) & 3)
{
case 0:
- memory_write_byte(cputag_get_address_space(space->machine, "maincpu", ADDRESS_SPACE_PROGRAM), offset, data);
+ space->machine->device<z80_device>("maincpu")->space(AS_PROGRAM)->write_byte(offset, data);
break;
case 2:
- memory_write_byte(cputag_get_address_space(space->machine, "maincpu", ADDRESS_SPACE_IO), offset, data);
+ space->machine->device<z80_device>("maincpu")->space(AS_IO)->write_byte(offset, data);
break;
default:
@@ -575,13 +575,13 @@ static READ8_HANDLER( mcu_io_r )
switch ((mcu_control >> 3) & 3)
{
case 0:
- return memory_read_byte(cputag_get_address_space(space->machine, "maincpu", ADDRESS_SPACE_PROGRAM), offset);
+ return space->machine->device<z80_device>("maincpu")->space(AS_PROGRAM)->read_byte(offset);
case 1:
return memory_region(space->machine, "maincpu")[offset + 0x10000];
case 2:
- return memory_read_byte(cputag_get_address_space(space->machine, "maincpu", ADDRESS_SPACE_IO), offset);
+ return space->machine->device<z80_device>("maincpu")->space(AS_IO)->read_byte(offset);
default:
logerror("%03X: MCU movx read mode %02X offset %04X\n",
diff --git a/src/mame/drivers/taitowlf.c b/src/mame/drivers/taitowlf.c
index e1090c89745..71e7f5e524a 100644
--- a/src/mame/drivers/taitowlf.c
+++ b/src/mame/drivers/taitowlf.c
@@ -380,7 +380,7 @@ static READ8_HANDLER( pc_dma_read_byte )
offs_t page_offset = (((offs_t) dma_offset[0][dma_channel]) << 16)
& 0xFF0000;
- return memory_read_byte(space, page_offset + offset);
+ return space->read_byte(page_offset + offset);
}
@@ -389,7 +389,7 @@ static WRITE8_HANDLER( pc_dma_write_byte )
offs_t page_offset = (((offs_t) dma_offset[0][dma_channel]) << 16)
& 0xFF0000;
- memory_write_byte(space, page_offset + offset, data);
+ space->write_byte(page_offset + offset, data);
}
diff --git a/src/mame/drivers/thunderj.c b/src/mame/drivers/thunderj.c
index aba7b403718..fc743aaef8e 100644
--- a/src/mame/drivers/thunderj.c
+++ b/src/mame/drivers/thunderj.c
@@ -129,7 +129,7 @@ static READ16_HANDLER( thunderj_atarivc_r )
/* Use these lines to detect when things go south: */
#if 0
- if (memory_read_word(space, 0x163482) > 0xfff)
+ if (space->read_word(0x163482) > 0xfff)
mame_printf_debug("You're screwed!");
#endif
diff --git a/src/mame/drivers/tmnt.c b/src/mame/drivers/tmnt.c
index 1e80bfc8023..89c397a3a02 100644
--- a/src/mame/drivers/tmnt.c
+++ b/src/mame/drivers/tmnt.c
@@ -367,8 +367,8 @@ static READ16_HANDLER( punkshot_kludge_r )
static READ16_HANDLER( ssriders_protection_r )
{
tmnt_state *state = space->machine->driver_data<tmnt_state>();
- int data = memory_read_word(space, 0x105a0a);
- int cmd = memory_read_word(space, 0x1058fc);
+ int data = space->read_word(0x105a0a);
+ int cmd = space->read_word(0x1058fc);
switch (cmd)
{
@@ -395,9 +395,9 @@ static READ16_HANDLER( ssriders_protection_r )
case 0x8abc:
/* collision table */
- data = -memory_read_word(space, 0x105818);
+ data = -space->read_word(0x105818);
data = ((data / 8 - 4) & 0x1f) * 0x40;
- data += ((memory_read_word(space, 0x105cb0) +
+ data += ((space->read_word(0x105cb0) +
256 * k052109_r(state->k052109, 0x1a01) + k052109_r(state->k052109, 0x1a00) - 6) / 8 + 12) & 0x3f;
return data;
@@ -424,7 +424,7 @@ static WRITE16_HANDLER( ssriders_protection_w )
for (i = 0; i < 128; i++)
{
- if ((memory_read_word(space, 0x180006 + 128 * i) >> 8) == logical_pri)
+ if ((space->read_word(0x180006 + 128 * i) >> 8) == logical_pri)
{
k053245_word_w(state->k053245, 8 * i, hardware_pri, 0x00ff);
hardware_pri++;
@@ -967,9 +967,9 @@ static WRITE16_HANDLER( tmnt2_1c0800_w )
CellVar >>= 1;
- memory_write_word(space, dst + 0x00, 0x8000 | ((src[1] & 0xfc00) >> 2)); /* size, flip xy */
- memory_write_word(space, dst + 0x04, src[0]); /* code */
- memory_write_word(space, dst + 0x18, (src[1] & 0x3ff) ^ /* color, mirror, priority */
+ space->write_word(dst + 0x00, 0x8000 | ((src[1] & 0xfc00) >> 2)); /* size, flip xy */
+ space->write_word(dst + 0x04, src[0]); /* code */
+ space->write_word(dst + 0x18, (src[1] & 0x3ff) ^ /* color, mirror, priority */
(sunset_104000[CellVar + 0x00] & 0x0060));
/* base color modifier */
@@ -979,24 +979,24 @@ static WRITE16_HANDLER( tmnt2_1c0800_w )
/* Also, the bosses don't blink when they are about to die - don't know */
/* if this is correct or not. */
// if (state->sunset_104000[CellVar + 0x15] & 0x001f)
-// memory_write_word(dst + 0x18, (memory_read_word(space, dst + 0x18) & 0xffe0) |
+// dst + 0x18->write_word((space->read_word(dst + 0x18) & 0xffe0) |
// (state->sunset_104000[CellVar + 0x15] & 0x001f));
x = src[2];
if (state->sunset_104000[CellVar + 0x00] & 0x4000)
{
/* flip x */
- memory_write_word(space, dst + 0x00, memory_read_word(space, dst + 0x00) ^ 0x1000);
+ space->write_word(dst + 0x00, space->read_word(dst + 0x00) ^ 0x1000);
x = -x;
}
x += state->sunset_104000[CellVar + 0x06];
- memory_write_word(space, dst + 0x0c, x);
+ space->write_word(dst + 0x0c, x);
y = src[3];
y += state->sunset_104000[CellVar + 0x07];
/* don't do second offset for shadows */
if ((state->tmnt2_1c0800[0x08] & 0x00ff) != 0x01)
y += state->sunset_104000[CellVar + 0x08];
- memory_write_word(space, dst + 0x08, y);
+ space->write_word(dst + 0x08, y);
#if 0
logerror("copy command %04x sprite %08x data %08x: %04x%04x %04x%04x modifiers %08x:%04x%04x %04x%04x %04x%04x %04x%04x %04x%04x %04x%04x %04x%04x %04x%04x %04x%04x %04x%04x %04x%04x %04x%04x\n",
state->tmnt2_1c0800[0x05],
diff --git a/src/mame/drivers/tx1.c b/src/mame/drivers/tx1.c
index f22e60c0063..6e398b588a2 100644
--- a/src/mame/drivers/tx1.c
+++ b/src/mame/drivers/tx1.c
@@ -101,13 +101,13 @@ static INTERRUPT_GEN( z80_irq )
static READ16_HANDLER( z80_shared_r )
{
address_space *cpu2space = cputag_get_address_space(space->machine, "audio_cpu", ADDRESS_SPACE_PROGRAM);
- return memory_read_byte(cpu2space, offset);
+ return cpu2space->read_byte(offset);
}
static WRITE16_HANDLER( z80_shared_w )
{
address_space *cpu2space = cputag_get_address_space(space->machine, "audio_cpu", ADDRESS_SPACE_PROGRAM);
- memory_write_byte(cpu2space, offset, data & 0xff);
+ cpu2space->write_byte(offset, data & 0xff);
}
diff --git a/src/mame/drivers/wecleman.c b/src/mame/drivers/wecleman.c
index 970eb425926..cbbce1b1a09 100644
--- a/src/mame/drivers/wecleman.c
+++ b/src/mame/drivers/wecleman.c
@@ -495,7 +495,7 @@ static WRITE16_HANDLER( blitter_w )
for ( ; size > 0 ; size--)
{
/* maybe slower than a memcpy but safer (and errors are logged) */
- memory_write_word(space, dest, memory_read_word(space, src));
+ space->write_word(dest, space->read_word(src));
src += 2;
dest += 2;
}
@@ -508,23 +508,23 @@ static WRITE16_HANDLER( blitter_w )
int i, j, destptr;
/* Read offset of source from the list of blits */
- i = src + memory_read_word(space, list+2);
+ i = src + space->read_word(list+2);
j = i + (size<<1);
destptr = dest;
for (; i<j; destptr+=2, i+=2)
- memory_write_word(space, destptr, memory_read_word(space, i));
+ space->write_word(destptr, space->read_word(i));
destptr = dest + 14;
- i = memory_read_word(space, list) + spr_color_offs;
- memory_write_word(space, destptr, i);
+ i = space->read_word(list) + spr_color_offs;
+ space->write_word(destptr, i);
dest += 16;
list += 4;
}
/* hack for the blit to Sprites RAM - Sprite list end-marker */
- memory_write_word(space, dest, 0xFFFF);
+ space->write_word(dest, 0xFFFF);
}
}
}
diff --git a/src/mame/includes/atari.h b/src/mame/includes/atari.h
index 4d33ad2c979..5e624ace2c4 100644
--- a/src/mame/includes/atari.h
+++ b/src/mame/includes/atari.h
@@ -259,11 +259,11 @@ typedef struct {
UINT8 *uc_g3; /* used colors for gfx GTIA 3 */
} ANTIC;
-#define RDANTIC(space) memory_read_byte(space, antic.dpage+antic.doffs)
-#define RDVIDEO(space,o) memory_read_byte(space, antic.vpage+((antic.voffs+(o))&VOFFS))
-#define RDCHGEN(space,o) memory_read_byte(space, antic.chbase+(o))
-#define RDPMGFXS(space,o) memory_read_byte(space, antic.pmbase_s+(o)+(antic.scanline>>1))
-#define RDPMGFXD(space,o) memory_read_byte(space, antic.pmbase_d+(o)+antic.scanline)
+#define RDANTIC(space) space->read_byte(antic.dpage+antic.doffs)
+#define RDVIDEO(space,o) space->read_byte(antic.vpage+((antic.voffs+(o))&VOFFS))
+#define RDCHGEN(space,o) space->read_byte(antic.chbase+(o))
+#define RDPMGFXS(space,o) space->read_byte(antic.pmbase_s+(o)+(antic.scanline>>1))
+#define RDPMGFXD(space,o) space->read_byte(antic.pmbase_d+(o)+antic.scanline)
#define PREPARE() \
UINT32 *dst = (UINT32 *)&antic.cclock[PMOFFSET]
diff --git a/src/mame/machine/amiga.c b/src/mame/machine/amiga.c
index ba4b0818e14..0030d3fff75 100644
--- a/src/mame/machine/amiga.c
+++ b/src/mame/machine/amiga.c
@@ -306,7 +306,7 @@ static void amiga_m68k_reset(running_device *device)
/* set the overlay bit */
if ( IS_AGA(amiga_intf) )
{
- memory_write_byte( space, 0xbfa001, 1 );
+ space->write_byte( 0xbfa001, 1 );
}
else
{
diff --git a/src/mame/machine/archimds.c b/src/mame/machine/archimds.c
index 3570e8ec8c9..dec23cff478 100644
--- a/src/mame/machine/archimds.c
+++ b/src/mame/machine/archimds.c
@@ -114,7 +114,7 @@ static TIMER_CALLBACK( vidc_video_tick )
address_space *space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM);
static UINT8 *vram = memory_region(machine,"vram");
- vram[vidc_vidcur] = (memory_read_byte(space,vidc_vidstart+vidc_vidcur));
+ vram[vidc_vidcur] = (space->read_byte(vidc_vidstart+vidc_vidcur));
vidc_vidcur++;
@@ -133,7 +133,7 @@ static TIMER_CALLBACK( vidc_audio_tick )
{
address_space *space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM);
- dac_signed_data_w(space->machine->device("dac"), (memory_read_byte(space,vidc_sndcur)));
+ dac_signed_data_w(space->machine->device("dac"), (space->read_byte(vidc_sndcur)));
vidc_sndcur++;
diff --git a/src/mame/machine/cubocd32.c b/src/mame/machine/cubocd32.c
index 4ce18a97530..e7500e12c2b 100644
--- a/src/mame/machine/cubocd32.c
+++ b/src/mame/machine/cubocd32.c
@@ -488,7 +488,7 @@ static void akiko_setup_response( address_space *space, int len, UINT8 *r1 )
for( i = 0; i < len; i++ )
{
- memory_write_byte( space, resp_addr + ((akiko.cdrom_cmd_resp + i) & 0xff), resp_buffer[i] );
+ space->write_byte( resp_addr + ((akiko.cdrom_cmd_resp + i) & 0xff), resp_buffer[i] );
}
akiko.cdrom_cmd_resp = (akiko.cdrom_cmd_resp+len) & 0xff;
@@ -548,7 +548,7 @@ static void akiko_update_cdrom(address_space *space)
while ( akiko.cdrom_cmd_start != akiko.cdrom_cmd_end )
{
UINT32 cmd_addr = akiko.cdrom_address[1] + 0x200 + akiko.cdrom_cmd_start;
- int cmd = memory_read_byte( space, cmd_addr );
+ int cmd = space->read_byte( cmd_addr );
memset( resp, 0, sizeof( resp ) );
resp[0] = cmd;
@@ -590,7 +590,7 @@ static void akiko_update_cdrom(address_space *space)
for( i = 0; i < 13; i++ )
{
- cmdbuf[i] = memory_read_byte( space, cmd_addr );
+ cmdbuf[i] = space->read_byte( cmd_addr );
cmd_addr &= 0xffffff00;
cmd_addr += ( akiko.cdrom_cmd_start + i + 1 ) & 0xff;
}
diff --git a/src/mame/machine/cx4fn.c b/src/mame/machine/cx4fn.c
index 7ddc2cb950f..1f795f9c818 100644
--- a/src/mame/machine/cx4fn.c
+++ b/src/mame/machine/cx4fn.c
@@ -101,45 +101,46 @@ static void CX4_C4DrawWireFrame(running_machine *machine)
UINT8 Color;
INT32 i;
+ address_space *space = machine->device<cpu_device>("maincpu")->space(AS_PROGRAM);
for(i = cx4.ram[0x0295]; i > 0; i--, line += 5)
{
- if(memory_read_byte(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), line) == 0xff &&
- memory_read_byte(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), line + 1) == 0xff)
+ if(space->read_byte(line) == 0xff &&
+ space->read_byte(line + 1) == 0xff)
{
INT32 tmp = line - 5;
- while(memory_read_byte(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), tmp + 2) == 0xff &&
- memory_read_byte(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), tmp + 3) == 0xff &&
+ while(space->read_byte(tmp + 2) == 0xff &&
+ space->read_byte(tmp + 3) == 0xff &&
(tmp + 2) >= 0)
{
tmp -= 5;
}
point1 = (CX4_read(0x1f82) << 16) |
- (memory_read_byte(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), tmp + 2) << 8) |
- memory_read_byte(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), tmp + 3);
+ (space->read_byte(tmp + 2) << 8) |
+ space->read_byte(tmp + 3);
}
else
{
point1 = (CX4_read(0x1f82) << 16) |
- (memory_read_byte(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), line) << 8) |
- memory_read_byte(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), line + 1);
+ (space->read_byte(line) << 8) |
+ space->read_byte(line + 1);
}
point2 = (CX4_read(0x1f82) << 16) |
- (memory_read_byte(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), line + 2) << 8) |
- memory_read_byte(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), line + 3);
-
- X1=(memory_read_byte(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), point1 + 0) << 8) |
- memory_read_byte(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), point1 + 1);
- Y1=(memory_read_byte(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), point1 + 2) << 8) |
- memory_read_byte(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), point1 + 3);
- Z1=(memory_read_byte(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), point1 + 4) << 8) |
- memory_read_byte(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), point1 + 5);
- X2=(memory_read_byte(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), point2 + 0) << 8) |
- memory_read_byte(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), point2 + 1);
- Y2=(memory_read_byte(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), point2 + 2) << 8) |
- memory_read_byte(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), point2 + 3);
- Z2=(memory_read_byte(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), point2 + 4) << 8) |
- memory_read_byte(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), point2 + 5);
- Color = memory_read_byte(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), line + 4);
+ (space->read_byte(line + 2) << 8) |
+ space->read_byte(line + 3);
+
+ X1=(space->read_byte(point1 + 0) << 8) |
+ space->read_byte(point1 + 1);
+ Y1=(space->read_byte(point1 + 2) << 8) |
+ space->read_byte(point1 + 3);
+ Z1=(space->read_byte(point1 + 4) << 8) |
+ space->read_byte(point1 + 5);
+ X2=(space->read_byte(point2 + 0) << 8) |
+ space->read_byte(point2 + 1);
+ Y2=(space->read_byte(point2 + 2) << 8) |
+ space->read_byte(point2 + 3);
+ Z2=(space->read_byte(point2 + 4) << 8) |
+ space->read_byte(point2 + 5);
+ Color = space->read_byte(line + 4);
CX4_C4DrawLine(X1, Y1, Z1, X2, Y2, Z2, Color);
}
}
diff --git a/src/mame/machine/cx4oam.c b/src/mame/machine/cx4oam.c
index 6d0ae4ce0b0..74aa559864c 100644
--- a/src/mame/machine/cx4oam.c
+++ b/src/mame/machine/cx4oam.c
@@ -44,6 +44,7 @@ static void CX4_op00_00(running_machine *machine)
offset = (cx4.ram[0x626] & 3) * 2;
srcptr = 0x220;
+ address_space *space = machine->device<cpu_device>("maincpu")->space(AS_PROGRAM);
for(i = cx4.ram[0x620]; i > 0 && sprcount > 0; i--, srcptr += 16)
{
UINT32 spraddr = CX4_readl(srcptr + 7);
@@ -53,38 +54,38 @@ static void CX4_op00_00(running_machine *machine)
sprname = cx4.ram[srcptr + 5];
sprattr = cx4.ram[srcptr + 4] | cx4.ram[srcptr + 6];
- if(memory_read_byte(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), spraddr))
+ if(space->read_byte(spraddr))
{
INT16 x, y;
INT32 sprcnt;
- for(sprcnt = memory_read_byte(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), spraddr++); sprcnt > 0 && sprcount > 0; sprcnt--, spraddr += 4)
+ for(sprcnt = space->read_byte(spraddr++); sprcnt > 0 && sprcount > 0; sprcnt--, spraddr += 4)
{
- x = (INT8)memory_read_byte(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), spraddr + 1);
+ x = (INT8)space->read_byte(spraddr + 1);
if(sprattr & 0x40)
{
- x = -x - ((memory_read_byte(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), spraddr) & 0x20) ? 16 : 8);
+ x = -x - ((space->read_byte(spraddr) & 0x20) ? 16 : 8);
}
x += sprx;
if(x >= -16 && x <= 272)
{
- y = (INT8)memory_read_byte(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), spraddr + 2);
+ y = (INT8)space->read_byte(spraddr + 2);
if(sprattr & 0x80)
{
- y = -y - ((memory_read_byte(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), spraddr) & 0x20) ? 16 : 8);
+ y = -y - ((space->read_byte(spraddr) & 0x20) ? 16 : 8);
}
y += spry;
if(y >= -16 && y <= 224)
{
cx4.ram[oamptr ] = (UINT8)x;
cx4.ram[oamptr + 1] = (UINT8)y;
- cx4.ram[oamptr + 2] = sprname + memory_read_byte(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), spraddr + 3);
- cx4.ram[oamptr + 3] = sprattr ^ (memory_read_byte(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), spraddr) & 0xc0);
+ cx4.ram[oamptr + 2] = sprname + space->read_byte(spraddr + 3);
+ cx4.ram[oamptr + 3] = sprattr ^ (space->read_byte(spraddr) & 0xc0);
cx4.ram[oamptr2] &= ~(3 << offset);
if(x & 0x100)
{
cx4.ram[oamptr2] |= 1 << offset;
}
- if(memory_read_byte(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), spraddr) & 0x20)
+ if(space->read_byte(spraddr) & 0x20)
{
cx4.ram[oamptr2] |= 2 << offset;
}
diff --git a/src/mame/machine/dc.c b/src/mame/machine/dc.c
index 1e90b30c107..898f5fddc47 100644
--- a/src/mame/machine/dc.c
+++ b/src/mame/machine/dc.c
@@ -243,7 +243,7 @@ static void wave_dma_execute(address_space *space)
{
for(;size<wave_dma.size;size+=4)
{
- memory_write_dword_64le(space,dst,memory_read_dword(space,src));
+ space->write_dword(dst,space->read_dword(src));
src+=4;
dst+=4;
}
@@ -252,7 +252,7 @@ static void wave_dma_execute(address_space *space)
{
for(;size<wave_dma.size;size+=4)
{
- memory_write_dword_64le(space,src,memory_read_dword(space,dst));
+ space->write_dword(src,space->read_dword(dst));
src+=4;
dst+=4;
}
@@ -287,7 +287,7 @@ static void pvr_dma_execute(address_space *space)
{
for(;size<pvr_dma.size;size+=4)
{
- memory_write_dword_64le(space,dst,memory_read_dword(space,src));
+ space->write_dword(dst,space->read_dword(src));
src+=4;
dst+=4;
}
@@ -296,7 +296,7 @@ static void pvr_dma_execute(address_space *space)
{
for(;size<pvr_dma.size;size+=4)
{
- memory_write_dword_64le(space,src,memory_read_dword(space,dst));
+ space->write_dword(src,space->read_dword(dst));
src+=4;
dst+=4;
}
diff --git a/src/mame/machine/harddriv.c b/src/mame/machine/harddriv.c
index 1cbae42c046..777ca7536a1 100644
--- a/src/mame/machine/harddriv.c
+++ b/src/mame/machine/harddriv.c
@@ -1164,7 +1164,7 @@ READ16_HANDLER( hd68k_ds3_gdata_r )
while (count68k > 0 && state->adsp_data_memory[0x16e6] > 0)
{
- memory_write_word(space, destaddr, state->ds3_gdata);
+ space->write_word(destaddr, state->ds3_gdata);
{
state->adsp_data_memory[0x16e6]--;
state->ds3_gdata = state->adsp_pgm_memory[i6] >> 8;
diff --git a/src/mame/machine/kaneko16.c b/src/mame/machine/kaneko16.c
index c702305d35f..79b7ca6dab7 100644
--- a/src/mame/machine/kaneko16.c
+++ b/src/mame/machine/kaneko16.c
@@ -1818,7 +1818,7 @@ static int calc3_decompress_table(running_machine* machine, int tabnum, UINT8* d
for (i=0;i<0x80;i++)
{
- memory_write_byte(eeprom_space, i, memory_read_byte(space, calc3_eeprom_addr+0x200000+i));
+ eeprom_space->write_byte(i, space->read_byte(calc3_eeprom_addr+0x200000+i));
}
}
@@ -1918,7 +1918,7 @@ static int calc3_decompress_table(running_machine* machine, int tabnum, UINT8* d
{
if (space)
{
- memory_write_byte(space, dstoffset+i, dat);
+ space->write_byte(dstoffset+i, dat);
}
// debug, used to output tables at the start
@@ -1992,7 +1992,7 @@ static int calc3_decompress_table(running_machine* machine, int tabnum, UINT8* d
{
if (space)
{
- memory_write_byte(space, dstoffset+i, dat);
+ space->write_byte(dstoffset+i, dat);
}
// debug, used to output tables at the start
@@ -2111,7 +2111,7 @@ void calc3_mcu_run(running_machine *machine)
if ( calc3_mcu_status != (1|2|4|8) ) return;
- if (calc3_dsw_addr) memory_write_byte(space, calc3_dsw_addr+0x200000, ( ~input_port_read(machine, "DSW1"))&0xff); // // DSW // dsw actually updates in realtime - mcu reads+writes it every frame
+ if (calc3_dsw_addr) space->write_byte(calc3_dsw_addr+0x200000, ( ~input_port_read(machine, "DSW1"))&0xff); // // DSW // dsw actually updates in realtime - mcu reads+writes it every frame
//calc3_mcu_status = 0;
@@ -2152,7 +2152,7 @@ void calc3_mcu_run(running_machine *machine)
printf("Calc 3 Init Command - %04x ROM Checksum Address\n", cakc3_checkumaddress);
printf("Calc 3 Init Command - %08x Data Write Address\n", calc3_writeaddress);
#endif
- // memory_write_byte(space, calc3_dsw_addr+0x200000, ( ~input_port_read(machine, "DSW1"))&0xff); // // DSW // dsw actually updates in realtime - mcu reads+writes it every frame
+ // space->write_byte(calc3_dsw_addr+0x200000, ( ~input_port_read(machine, "DSW1"))&0xff); // // DSW // dsw actually updates in realtime - mcu reads+writes it every frame
kaneko16_mcu_ram[cakc3_checkumaddress / 2] = calc3_mcu_crc; // MCU Rom Checksum!
@@ -2168,7 +2168,7 @@ void calc3_mcu_run(running_machine *machine)
for (i=0;i<0x80;i++)
{
- memory_write_byte(space, calc3_eeprom_addr+0x200000+i, memory_read_byte(eeprom_space, i));
+ space->write_byte(calc3_eeprom_addr+0x200000+i, eeprom_space->read_byte(i));
}
}
@@ -2207,12 +2207,12 @@ void calc3_mcu_run(running_machine *machine)
printf("writing back address %08x to %08x %08x\n", calc3_writeaddress_current, commandaddr,write);
#endif
- memory_write_byte(space,write+0x200000, data_header[0]);
- memory_write_byte(space,write+0x200001, data_header[1]);
+ space->write_byte(write+0x200000, data_header[0]);
+ space->write_byte(write+0x200001, data_header[1]);
write=commandaddr+(char)commandunk;
- memory_write_word(space,write+0x200000, (calc3_writeaddress_current>>16)&0xffff);
- memory_write_word(space,write+0x200002, (calc3_writeaddress_current&0xffff));
+ space->write_word(write+0x200000, (calc3_writeaddress_current>>16)&0xffff);
+ space->write_word(write+0x200002, (calc3_writeaddress_current&0xffff));
calc3_writeaddress_current += ((length+3)&(~1));
}
diff --git a/src/mame/machine/konamigx.c b/src/mame/machine/konamigx.c
index b54ee8d8080..a247ab39d92 100644
--- a/src/mame/machine/konamigx.c
+++ b/src/mame/machine/konamigx.c
@@ -45,7 +45,7 @@ WRITE16_HANDLER( K055550_word_w )
lim = adr+bsize*count;
for(i=adr; i<lim; i+=2)
- memory_write_word(space, i, prot_data[0x1a/2]);
+ space->write_word(i, prot_data[0x1a/2]);
break;
// WARNING: The following cases are speculation based with questionable accuracy!(AAT)
@@ -76,41 +76,41 @@ WRITE16_HANDLER( K055550_word_w )
// let's hope GCC will inline the mem24bew calls
for (src=adr; src<srcend; src+=bsize)
{
- cx1 = (short)memory_read_word(space, src);
- sx1 = (short)memory_read_word(space, src + 2);
- wx1 = (short)memory_read_word(space, src + 4);
+ cx1 = (short)space->read_word(src);
+ sx1 = (short)space->read_word(src + 2);
+ wx1 = (short)space->read_word(src + 4);
- cy1 = (short)memory_read_word(space, src + 6);
- sy1 = (short)memory_read_word(space, src + 8);
- wy1 = (short)memory_read_word(space, src +10);
+ cy1 = (short)space->read_word(src + 6);
+ sy1 = (short)space->read_word(src + 8);
+ wy1 = (short)space->read_word(src +10);
- cz1 = (short)memory_read_word(space, src +12);
- sz1 = (short)memory_read_word(space, src +14);
- wz1 = (short)memory_read_word(space, src +16);
+ cz1 = (short)space->read_word(src +12);
+ sz1 = (short)space->read_word(src +14);
+ wz1 = (short)space->read_word(src +16);
count = i = src + skip;
tgt = src + bsize;
- for (; count<tgt; count++) memory_write_byte(space, count, 0);
+ for (; count<tgt; count++) space->write_byte(count, 0);
for (; tgt<tgtend; i++, tgt+=bsize)
{
- c2 = (short)memory_read_word(space, tgt);
- s2 = (short)memory_read_word(space, tgt + 2);
- w2 = (short)memory_read_word(space, tgt + 4);
+ c2 = (short)space->read_word(tgt);
+ s2 = (short)space->read_word(tgt + 2);
+ w2 = (short)space->read_word(tgt + 4);
if (abs((cx1+sx1)-(c2+s2))>=wx1+w2) continue; // X rejection
- c2 = (short)memory_read_word(space, tgt + 6);
- s2 = (short)memory_read_word(space, tgt + 8);
- w2 = (short)memory_read_word(space, tgt +10);
+ c2 = (short)space->read_word(tgt + 6);
+ s2 = (short)space->read_word(tgt + 8);
+ w2 = (short)space->read_word(tgt +10);
if (abs((cy1+sy1)-(c2+s2))>=wy1+w2) continue; // Y rejection
- c2 = (short)memory_read_word(space, tgt +12);
- s2 = (short)memory_read_word(space, tgt +14);
- w2 = (short)memory_read_word(space, tgt +16);
+ c2 = (short)space->read_word(tgt +12);
+ s2 = (short)space->read_word(tgt +14);
+ w2 = (short)space->read_word(tgt +16);
if (abs((cz1+sz1)-(c2+s2))>=wz1+w2) continue; // Z rejection
- memory_write_byte(space, i, 0x80); // collision confirmed
+ space->write_byte(i, 0x80); // collision confirmed
}
}
break;
@@ -184,13 +184,13 @@ WRITE16_HANDLER( K053990_martchmp_word_w )
if (element_size == 1)
for (i=src_count; i; i--)
{
- memory_write_byte(space, dst_addr, memory_read_byte(space, src_addr));
+ space->write_byte(dst_addr, space->read_byte(src_addr));
src_addr += src_skip;
dst_addr += dst_skip;
}
else for (i=src_count; i; i--)
{
- memory_write_word(space, dst_addr, memory_read_word(space, src_addr));
+ space->write_word(dst_addr, space->read_word(src_addr));
src_addr += src_skip;
dst_addr += dst_skip;
}
@@ -215,15 +215,15 @@ WRITE16_HANDLER( K053990_martchmp_word_w )
for (i=mod_count; i; i--)
{
- mod_val = memory_read_word(space, mod_addr);
+ mod_val = space->read_word(mod_addr);
mod_addr += mod_skip;
- mod_data = memory_read_word(space, src_addr);
+ mod_data = space->read_word(src_addr);
src_addr += src_skip;
mod_data += mod_val;
- memory_write_word(space, dst_addr, mod_data);
+ space->write_word(dst_addr, mod_data);
dst_addr += dst_skip;
}
break;
@@ -468,14 +468,14 @@ static WRITE32_HANDLER(fantjour_dma_w)
if(mode == 0x93)
for(i1=0; i1 <= sz2; i1++)
for(i2=0; i2 < db; i2+=4) {
- memory_write_dword(space, da, memory_read_dword(space, sa) ^ x);
+ space->write_dword(da, space->read_dword(sa) ^ x);
da += 4;
sa += 4;
}
else if(mode == 0x8f)
for(i1=0; i1 <= sz2; i1++)
for(i2=0; i2 < db; i2+=4) {
- memory_write_dword(space, da, x);
+ space->write_dword(da, x);
da += 4;
}
}
diff --git a/src/mame/machine/micro3d.c b/src/mame/machine/micro3d.c
index d8412ecc157..40ebd295d89 100644
--- a/src/mame/machine/micro3d.c
+++ b/src/mame/machine/micro3d.c
@@ -755,7 +755,7 @@ DRIVER_INIT( micro3d )
/* The Am29000 program seems to rely on RAM from 0x00470000 onwards being
non-zero on a reset, otherwise the 3D object data doesn't get uploaded! */
- memory_write_dword(space, 0x00470000, 0xa5a5a5a5);
+ space->write_dword(0x00470000, 0xa5a5a5a5);
state->mc68901.timer_a = timer_alloc(machine, mfp_timer_a_cb, NULL);
diff --git a/src/mame/machine/midyunit.c b/src/mame/machine/midyunit.c
index c13e608f11e..a381183c6a9 100644
--- a/src/mame/machine/midyunit.c
+++ b/src/mame/machine/midyunit.c
@@ -95,7 +95,7 @@ WRITE16_HANDLER( midyunit_cmos_enable_w )
{
if (data == 0x500)
{
- prot_result = memory_read_word(space, TOBYTE(0x10a4390)) << 4;
+ prot_result = space->read_word(TOBYTE(0x10a4390)) << 4;
logerror(" desired result = %04X\n", prot_result);
}
}
diff --git a/src/mame/machine/n64.c b/src/mame/machine/n64.c
index 9ecd5fe14f1..be37b7911b7 100644
--- a/src/mame/machine/n64.c
+++ b/src/mame/machine/n64.c
@@ -1303,8 +1303,8 @@ WRITE32_HANDLER( n64_pi_reg_w )
{
for (i=0; i < dma_length; i++)
{
- UINT8 b = memory_read_byte(space, pi_dram_addr);
- memory_write_byte(space, pi_cart_addr & 0x1fffffff, b);
+ UINT8 b = space->read_byte(pi_dram_addr);
+ space->write_byte(pi_cart_addr & 0x1fffffff, b);
pi_cart_addr += 1;
pi_dram_addr += 1;
}
@@ -1331,13 +1331,13 @@ WRITE32_HANDLER( n64_pi_reg_w )
{
for (i=0; i < dma_length; i++)
{
- /*UINT32 d = memory_read_dword(space, pi_cart_addr);
- memory_write_dword(space, pi_dram_addr, d);
+ /*UINT32 d = space->read_dword(pi_cart_addr);
+ space->write_dword(pi_dram_addr, d);
pi_cart_addr += 4;
pi_dram_addr += 4;*/
- UINT8 b = memory_read_byte(space, pi_cart_addr);
- memory_write_byte(space, pi_dram_addr & 0x1fffffff, b);
+ UINT8 b = space->read_byte(pi_cart_addr);
+ space->write_byte(pi_dram_addr & 0x1fffffff, b);
pi_cart_addr += 1;
pi_dram_addr += 1;
}
@@ -1347,8 +1347,8 @@ WRITE32_HANDLER( n64_pi_reg_w )
if (pi_first_dma)
{
// TODO: CIC-6105 has different address...
- memory_write_dword(space, 0x00000318, 0x400000);
- memory_write_dword(space, 0x000003f0, 0x800000);
+ space->write_dword(0x00000318, 0x400000);
+ space->write_dword(0x000003f0, 0x800000);
pi_first_dma = 0;
}
diff --git a/src/mame/machine/pcshare.c b/src/mame/machine/pcshare.c
index 80eb3e44a7e..a7f38564686 100644
--- a/src/mame/machine/pcshare.c
+++ b/src/mame/machine/pcshare.c
@@ -163,7 +163,7 @@ static READ8_HANDLER( pc_dma_read_byte )
offs_t page_offset = (((offs_t) dma_offset[0][dma_channel]) << 16)
& 0xFF0000;
- return memory_read_byte(space, page_offset + offset);
+ return space->read_byte(page_offset + offset);
}
@@ -172,7 +172,7 @@ static WRITE8_HANDLER( pc_dma_write_byte )
offs_t page_offset = (((offs_t) dma_offset[0][dma_channel]) << 16)
& 0xFF0000;
- memory_write_byte(space, page_offset + offset, data);
+ space->write_byte(page_offset + offset, data);
}
static READ8_HANDLER(dma_page_select_r)
diff --git a/src/mame/machine/pitnrun.c b/src/mame/machine/pitnrun.c
index 874a44917ea..f3f045620c9 100644
--- a/src/mame/machine/pitnrun.c
+++ b/src/mame/machine/pitnrun.c
@@ -121,11 +121,11 @@ WRITE8_HANDLER( pitnrun_68705_portB_w )
}
if (~data & 0x10)
{
- memory_write_byte(cpu0space, address, portA_out);
+ cpu0space->write_byte(address, portA_out);
}
if (~data & 0x20)
{
- portA_in = memory_read_byte(cpu0space, address);
+ portA_in = cpu0space->read_byte(address);
}
if (~data & 0x40)
{
diff --git a/src/mame/machine/scramble.c b/src/mame/machine/scramble.c
index efdba395859..29b3282cd5b 100644
--- a/src/mame/machine/scramble.c
+++ b/src/mame/machine/scramble.c
@@ -140,12 +140,12 @@ static WRITE8_HANDLER( cavelon_banksw_w )
READ8_HANDLER( hunchbks_mirror_r )
{
- return memory_read_byte(space, 0x1000+offset);
+ return space->read_byte(0x1000+offset);
}
WRITE8_HANDLER( hunchbks_mirror_w )
{
- memory_write_byte(space, 0x1000+offset,data);
+ space->write_byte(0x1000+offset,data);
}
const ppi8255_interface scramble_ppi_0_intf =
diff --git a/src/mame/machine/scudsp.c b/src/mame/machine/scudsp.c
index 8d0a1edd974..bc51e3ce800 100644
--- a/src/mame/machine/scudsp.c
+++ b/src/mame/machine/scudsp.c
@@ -649,7 +649,7 @@ static void dsp_dma( address_space *space )
if ( source >= 0x06000000 && source <= 0x060fffff )
{
- data = memory_read_dword(space, source );
+ data = space->read_dword(source );
}
else
{
@@ -687,7 +687,7 @@ static void dsp_dma( address_space *space )
#endif
for ( counter = 0; counter < transfer_cnt; counter++ )
{
- memory_write_dword(space, dest, dsp_get_mem_source_dma( dsp_mem, counter ) );
+ space->write_dword(dest, dsp_get_mem_source_dma( dsp_mem, counter ) );
dest += add;
}
diff --git a/src/mame/machine/segaic16.c b/src/mame/machine/segaic16.c
index 6f763739aa2..2b061ea41ff 100644
--- a/src/mame/machine/segaic16.c
+++ b/src/mame/machine/segaic16.c
@@ -83,7 +83,7 @@ READ16_HANDLER( segaic16_open_bus_r )
/* read original encrypted memory at that address */
recurse = 1;
- result = memory_read_word_16be(space, cpu_get_pc(space->cpu));
+ result = space->read_word(cpu_get_pc(space->cpu));
recurse = 0;
return result;
}
@@ -214,14 +214,14 @@ static void memory_mapper_w(address_space *space, struct memory_mapper_chip *chi
{
address_space *targetspace = cpu_get_address_space(chip->cpu, ADDRESS_SPACE_PROGRAM);
offs_t addr = (chip->regs[0x0a] << 17) | (chip->regs[0x0b] << 9) | (chip->regs[0x0c] << 1);
- memory_write_word(targetspace, addr, (chip->regs[0x00] << 8) | chip->regs[0x01]);
+ targetspace->write_word(addr, (chip->regs[0x00] << 8) | chip->regs[0x01]);
}
else if (data == 0x02)
{
address_space *targetspace = cpu_get_address_space(chip->cpu, ADDRESS_SPACE_PROGRAM);
offs_t addr = (chip->regs[0x07] << 17) | (chip->regs[0x08] << 9) | (chip->regs[0x09] << 1);
UINT16 result;
- result = memory_read_word(targetspace, addr);
+ result = targetspace->read_word(addr);
chip->regs[0x00] = result >> 8;
chip->regs[0x01] = result;
}
diff --git a/src/mame/machine/segas32.c b/src/mame/machine/segas32.c
index bbf2328da3a..7e1b13063fa 100644
--- a/src/mame/machine/segas32.c
+++ b/src/mame/machine/segas32.c
@@ -230,15 +230,15 @@ void darkedge_fd1149_vblank(running_device *device)
{
address_space *space = cpu_get_address_space(device, ADDRESS_SPACE_PROGRAM);
- memory_write_word(space, 0x20f072, 0);
- memory_write_word(space, 0x20f082, 0);
+ space->write_word(0x20f072, 0);
+ space->write_word(0x20f082, 0);
- if( memory_read_byte(space, 0x20a12c) != 0 )
+ if( space->read_byte(0x20a12c) != 0 )
{
- memory_write_byte(space, 0x20a12c, memory_read_byte(space, 0x20a12c)-1 );
+ space->write_byte(0x20a12c, space->read_byte(0x20a12c)-1 );
- if( memory_read_byte(space, 0x20a12c) == 0 )
- memory_write_byte(space, 0x20a12e, 1);
+ if( space->read_byte(0x20a12c) == 0 )
+ space->write_byte(0x20a12e, 1);
}
}
@@ -267,7 +267,7 @@ READ16_HANDLER( darkedge_protection_r )
WRITE16_HANDLER( dbzvrvs_protection_w )
{
- memory_write_word( space, 0x2080c8, memory_read_word( space, 0x200044 ) );
+ space->write_word( 0x2080c8, space->read_word( 0x200044 ) );
}
@@ -331,12 +331,12 @@ WRITE16_HANDLER( jleague_protection_w )
// Map team browser selection to opponent browser selection
// using same lookup table that V60 uses for sound sample mapping.
case 0:
- memory_write_byte( space, 0x20f708, memory_read_word( space, 0x7bbc0 + data*2 ) );
+ space->write_byte( 0x20f708, space->read_word( 0x7bbc0 + data*2 ) );
break;
// move on to team browser
case 4/2:
- memory_write_byte( space, 0x200016, data & 0xff );
+ space->write_byte( 0x200016, data & 0xff );
break;
default:
diff --git a/src/mame/machine/seicop.c b/src/mame/machine/seicop.c
index f043d59c5a0..20150df1495 100644
--- a/src/mame/machine/seicop.c
+++ b/src/mame/machine/seicop.c
@@ -1509,12 +1509,12 @@ static void protection_move_jsr(address_space *space,UINT32 work_ram,UINT8 k)
{
static UINT32 move_data,x_data,y_data;
/*Read the movement data to execute*/
- move_data = ((memory_read_word(space, work_ram+0x34)<<16) & 0xffff0000) |
- (memory_read_word(space, work_ram+0x36) & 0xffff);
+ move_data = ((space->read_word(work_ram+0x34)<<16) & 0xffff0000) |
+ (space->read_word(work_ram+0x36) & 0xffff);
/*Read the x/y axis of the sprite to change*/
- x_data = (memory_read_word(space, work_ram+0x8));
- y_data = (memory_read_word(space, work_ram+0x4));
+ x_data = (space->read_word(work_ram+0x8));
+ y_data = (space->read_word(work_ram+0x4));
/*it's bit sensitive AFAIK*/
/*move_data hi-word on player
$17 = walk floor
@@ -1556,8 +1556,8 @@ static void protection_move_jsr(address_space *space,UINT32 work_ram,UINT8 k)
break;
}
/*Write the new values to the sprite x/y data*/
- memory_write_word(space, work_ram+0x8,x_data);
- memory_write_word(space, work_ram+0x4,y_data);
+ space->write_word(work_ram+0x8,x_data);
+ space->write_word(work_ram+0x4,y_data);
}
@@ -1566,12 +1566,12 @@ static UINT16 hit_check;
static void protection_hit_jsr(address_space *space,UINT32 work_ram1,UINT32 work_ram2)
{
int x1,y1,x2,y2/*,hit1,hit2*/;
- x1 = (memory_read_word(space, work_ram1+0x8));
- y1 = (memory_read_word(space, work_ram1+0x4));
- //hit1 = (memory_read_word(space, work_ram1-));//this sprite is attacking
- x2 = (memory_read_word(space, work_ram2+0x8));
- y2 = (memory_read_word(space, work_ram2+0x4));
- //hit2 = (memory_read_word(space));
+ x1 = (space->read_word(work_ram1+0x8));
+ y1 = (space->read_word(work_ram1+0x4));
+ //hit1 = (space->read_word(work_ram1-));//this sprite is attacking
+ x2 = (space->read_word(work_ram2+0x8));
+ y2 = (space->read_word(work_ram2+0x4));
+ //hit2 = (space));
popmessage("%08x:x=%04x y=%04x %08x:x=%04x y=%04x",work_ram1,x1,y1,work_ram2,x2,y2);
@@ -1589,42 +1589,42 @@ static void moveprot_jsr(address_space *space)
{
static INT16 x_axis,y_axis;
static UINT16 move_data,distance,move_type;
- move_data = memory_read_word(space, cop_register[0]+0x36);
- x_axis = memory_read_word(space, cop_register[0]+0x08);
- y_axis = memory_read_word(space, cop_register[0]+0x04);
+ move_data = space->read_word(cop_register[0]+0x36);
+ x_axis = space->read_word(cop_register[0]+0x08);
+ y_axis = space->read_word(cop_register[0]+0x04);
distance = (move_data & 0xf);
move_type = (move_data & 0xf0)>>4;
switch(move_type)
{
case 0x0f://right
- memory_write_word(space, cop_register[0]+0x08,x_axis+distance);
- //memory_write_word(space, 0x110004,);
+ space->write_word(cop_register[0]+0x08,x_axis+distance);
+ //space->write_word(0x110004,);
break;
case 0x0b://up
- memory_write_word(space, cop_register[0]+0x04,y_axis-distance);
+ space->write_word(cop_register[0]+0x04,y_axis-distance);
break;
case 0x07://left
- memory_write_word(space, cop_register[0]+0x08,x_axis-distance);
+ space->write_word(cop_register[0]+0x08,x_axis-distance);
break;
case 0x03://down
- memory_write_word(space, cop_register[0]+0x04,y_axis+distance);
+ space->write_word(cop_register[0]+0x04,y_axis+distance);
break;
case 0x0d://up-right
- memory_write_word(space, cop_register[0]+0x08,x_axis+distance);
- memory_write_word(space, cop_register[0]+0x04,y_axis-distance);
+ space->write_word(cop_register[0]+0x08,x_axis+distance);
+ space->write_word(cop_register[0]+0x04,y_axis-distance);
break;
case 0x09://up-left
- memory_write_word(space, cop_register[0]+0x04,y_axis-distance);
- memory_write_word(space, cop_register[0]+0x08,x_axis-distance);
+ space->write_word(cop_register[0]+0x04,y_axis-distance);
+ space->write_word(cop_register[0]+0x08,x_axis-distance);
break;
case 0x01://down-right
- memory_write_word(space, cop_register[0]+0x04,y_axis+distance);
- memory_write_word(space, cop_register[0]+0x08,x_axis+distance);
+ space->write_word(cop_register[0]+0x04,y_axis+distance);
+ space->write_word(cop_register[0]+0x08,x_axis+distance);
break;
case 0x05://down-left
- memory_write_word(space, cop_register[0]+0x04,y_axis+distance);
- memory_write_word(space, cop_register[0]+0x08,x_axis-distance);
+ space->write_word(cop_register[0]+0x04,y_axis+distance);
+ space->write_word(cop_register[0]+0x08,x_axis-distance);
break;
default:
logerror("Warning: \"0x205\" command called with move_type parameter = %02x\n",move_type);
@@ -1632,11 +1632,11 @@ static void moveprot_jsr(address_space *space)
//down-right
//down-left
}
- //memory_write_word(space, 0x110008,x_axis+tmp);
- //memory_write_word(space, 0x110004,y_axis+tmp);
+ //space->write_word(0x110008,x_axis+tmp);
+ //space->write_word(0x110004,y_axis+tmp);
- //memory_write_word(space, 0x110008,x_axis);
- //memory_write_word(space, 0x110004,y_axis);
+ //space->write_word(0x110008,x_axis);
+ //space->write_word(0x110004,y_axis);
}
/*
@@ -1654,10 +1654,10 @@ static void moveprot_jsr(address_space *space)
static void move2prot_jsr(address_space *space)
{
static INT16 x_pl,y_pl,x_en,y_en,res;
- x_pl = memory_read_word(space, cop_register[1]+0x8);
- y_pl = memory_read_word(space, cop_register[1]+0x4);
- x_en = memory_read_word(space, cop_register[0]+0x8);
- y_en = memory_read_word(space, cop_register[0]+0x4);
+ x_pl = space->read_word(cop_register[1]+0x8);
+ y_pl = space->read_word(cop_register[1]+0x4);
+ x_en = space->read_word(cop_register[0]+0x8);
+ y_en = space->read_word(cop_register[0]+0x4);
res = 0;
if(x_en > x_pl)
@@ -1669,7 +1669,7 @@ static void move2prot_jsr(address_space *space)
//if(y_en > y_pl)
// res|=0x40;
- memory_write_word(space, cop_register[0]+0x36,res);
+ space->write_word(cop_register[0]+0x36,res);
}
#ifdef UNUSED_FUNCTION
@@ -1677,29 +1677,29 @@ static void move2prot_jsr(address_space *space)
static void move3x_prot_jsr(address_space *space)
{
static INT16 x_pl,x_en,x_dis;
- x_pl = memory_read_word(space, cop_register[1]+0x8);
- x_en = memory_read_word(space, cop_register[0]+0x8);
- x_dis = ((memory_read_word(space, cop_register[0]+0x34) & 0xf0) >> 4);
+ x_pl = space->read_word(cop_register[1]+0x8);
+ x_en = space->read_word(cop_register[0]+0x8);
+ x_dis = ((space->read_word(cop_register[0]+0x34) & 0xf0) >> 4);
if(x_en > x_pl)
x_dis^=0xffff;
- memory_write_word(space, cop_register[0]+0x36,-0x40);/*enable command*/
- memory_write_word(space, cop_register[0]+0x14,x_dis);
+ space->write_word(cop_register[0]+0x36,-0x40);/*enable command*/
+ space->write_word(cop_register[0]+0x14,x_dis);
}
static void move3y_prot_jsr(address_space *space)
{
static INT16 y_pl,y_en,y_dis;
- y_pl = memory_read_word(space, cop_register[1]+0x4);
- y_en = memory_read_word(space, cop_register[0]+0x4);
- y_dis = (memory_read_word(space, cop_register[0]+0x34) & 0xf);
+ y_pl = space->read_word(cop_register[1]+0x4);
+ y_en = space->read_word(cop_register[0]+0x4);
+ y_dis = (space->read_word(cop_register[0]+0x34) & 0xf);
if(y_en > y_pl)
y_dis^=0xffff;
- memory_write_word(space, cop_register[0]+0x36,-0x80);/*enable command*/
- memory_write_word(space, cop_register[0]+0x10,y_dis);
+ space->write_word(cop_register[0]+0x36,-0x80);/*enable command*/
+ space->write_word(cop_register[0]+0x10,y_dis);
}
#endif
@@ -1813,20 +1813,20 @@ static void dma_transfer(address_space *space)
//for(s_i = dma_size;s_i > 0;s_i--)
{
/*Sprite Color*/
- param = memory_read_word(space, 0x100400) & 0x3f;
+ param = space->read_word(0x100400) & 0x3f;
/*Write the entire parameters [offs+0]*/
- memory_write_word(space, cop_register[5]+4,memory_read_word(space, dma_src) + param);
+ space->write_word(cop_register[5]+4,space->read_word(dma_src) + param);
/*Sprite Priority (guess)*/
- //param = ((memory_read_word(space, 0x100400) & 0x40) ? 0x4000 : 0);
+ //param = ((space->read_word(0x100400) & 0x40) ? 0x4000 : 0);
/*Write the sprite number [offs+1]*/
- memory_write_word(space, cop_register[5]+6,memory_read_word(space, dma_src+2));
+ space->write_word(cop_register[5]+6,space->read_word(dma_src+2));
/*Sprite Relative x/y coords*/
- rel_xy = memory_read_word(space, dma_src+4); /*???*/
+ rel_xy = space->read_word(dma_src+4); /*???*/
/*temporary hardwired,it should point to 0x4c0/0x4a0*/
- abs_x = (memory_read_word(space, 0x110008) - memory_read_word(space, 0x10048e));
- abs_y = (memory_read_word(space, 0x110004) - memory_read_word(space, 0x10048c));
- memory_write_word(space, cop_register[5]+8,((rel_xy & 0x7f) + (abs_x) - ((rel_xy & 0x80) ? 0x80 : 0)) & 0x1ff);
- memory_write_word(space, cop_register[5]+10,(((rel_xy & 0x7f00) >> 8) + (abs_y) + (0x10) - ((rel_xy & 0x8000) ? 0x80 : 0)) & 0x1ff);
+ abs_x = (space->read_word(0x110008) - space->read_word(0x10048e));
+ abs_y = (space->read_word(0x110004) - space->read_word(0x10048c));
+ space->write_word(cop_register[5]+8,((rel_xy & 0x7f) + (abs_x) - ((rel_xy & 0x80) ? 0x80 : 0)) & 0x1ff);
+ space->write_word(cop_register[5]+10,(((rel_xy & 0x7f00) >> 8) + (abs_y) + (0x10) - ((rel_xy & 0x8000) ? 0x80 : 0)) & 0x1ff);
cop_register[5]+=8;
dma_src+=6;
}
@@ -1834,7 +1834,7 @@ static void dma_transfer(address_space *space)
/*
- switch(memory_read_word(space, cop_register[2]))
+ switch(space->read_word(cop_register[2]))
{
case 0xb4: xparam = 0x0c/2; break;
case 0xb8: xparam = 0x10/2; break;
@@ -1864,20 +1864,20 @@ static UINT16 check_calc(UINT16 param)
static UINT16 hit_check_jsr(address_space *space)
{
static INT16 xsrc,xdst,ysrc,ydst,xparam,yparam;
- xsrc = (memory_read_word(space, 0x110008));
- ysrc = (memory_read_word(space, 0x110004));
- xdst = (memory_read_word(space, 0x110048));
- ydst = (memory_read_word(space, 0x110044));
+ xsrc = (space->read_word(0x110008));
+ ysrc = (space->read_word(0x110004));
+ xdst = (space->read_word(0x110048));
+ ydst = (space->read_word(0x110044));
/*Here we check the destination sprite width*/
/*0x4a4/0x4c4*/
- xparam = check_calc(memory_read_word(space, cop_register[2]));
+ xparam = check_calc(space->read_word(cop_register[2]));
/*Here we check the destination sprite height*/
/*0x4a6/0x4c6*/
- yparam = check_calc(memory_read_word(space, cop_register[3]));
+ yparam = check_calc(space->read_word(cop_register[3]));
if(!xparam || !yparam)
- popmessage("SRC:%04x %04x DST:%04x %04x V:%08x %08x",xsrc,ysrc,xdst,ydst,memory_read_word(space, cop_register[2]),memory_read_word(space, cop_register[3]));
+ popmessage("SRC:%04x %04x DST:%04x %04x V:%08x %08x",xsrc,ysrc,xdst,ydst,space->read_word(cop_register[2]),space->read_word(cop_register[3]));
if(xdst >= (xsrc-xparam) && ydst >= (ysrc-yparam) &&
xdst <= (xsrc+xparam) && ydst <= (ysrc+yparam))
return 0;//sprites collide
@@ -1903,11 +1903,11 @@ static void cop2_move3_prot(address_space *space)
static INT16 y_pl,y_en;
static INT16 x_dis,y_dis;
static INT16 dir,dis;
- x_pl = memory_read_word(space, cop_register[1]+0x8);
- x_en = memory_read_word(space, cop_register[0]+0x8);
- dis = ((memory_read_word(space, cop_register[0]+0x34) & 0xf0) >> 4);
- y_pl = memory_read_word(space, cop_register[1]+0x4);
- y_en = memory_read_word(space, cop_register[0]+0x4);
+ x_pl = space->read_word(cop_register[1]+0x8);
+ x_en = space->read_word(cop_register[0]+0x8);
+ dis = ((space->read_word(cop_register[0]+0x34) & 0xf0) >> 4);
+ y_pl = space->read_word(cop_register[1]+0x4);
+ y_en = space->read_word(cop_register[0]+0x4);
/*
xxxx ---- select the direction of the enemy sprite
@@ -1946,7 +1946,7 @@ static void cop2_move3_prot(address_space *space)
dir = DOWN;
}
- memory_write_word(space, cop_register[0]+0x36,dir);
+ space->write_word(cop_register[0]+0x36,dir);
/*TODO*/
x_dis = (x_pl-x_en);
@@ -1970,8 +1970,8 @@ static void cop2_move3_prot(address_space *space)
//if(x_en > x_pl)
// x_dis^=0xffff;
- memory_write_word(space, cop_register[0]+0x10,y_dis);
- memory_write_word(space, cop_register[0]+0x14,x_dis);
+ space->write_word(cop_register[0]+0x10,y_dis);
+ space->write_word(cop_register[0]+0x14,x_dis);
}
/**/
@@ -1983,13 +1983,13 @@ static UINT16 cop2_hit_prot(address_space *space)
static INT16 param1,param2;
static INT16 val;
- param1 = memory_read_word(space, cop_register[2]);
- param2 = memory_read_word(space, cop_register[3]);
+ param1 = space->read_word(cop_register[2]);
+ param2 = space->read_word(cop_register[3]);
- xsrc = memory_read_word(space, cop_register[0]+0x8) + memory_read_word(space, cop_register[0]+0x14);
- ysrc = memory_read_word(space, cop_register[0]+0x4) + memory_read_word(space, cop_register[0]+0x10);
- xdst = memory_read_word(space, cop_register[1]+0x8) + memory_read_word(space, cop_register[1]+0x14);
- ydst = memory_read_word(space, cop_register[1]+0x4) + memory_read_word(space, cop_register[1]+0x10);
+ xsrc = space->read_word(cop_register[0]+0x8) + space->read_word(cop_register[0]+0x14);
+ ysrc = space->read_word(cop_register[0]+0x4) + space->read_word(cop_register[0]+0x10);
+ xdst = space->read_word(cop_register[1]+0x8) + space->read_word(cop_register[1]+0x14);
+ ydst = space->read_word(cop_register[1]+0x4) + space->read_word(cop_register[1]+0x10);
// xp = (param1 & 0x00f0) >> 4;
// yp = (param1 & 0x0f00) >> 8;
@@ -2019,9 +2019,9 @@ static void cop2_move2_prot(address_space *space)
static INT16 xsrc,ysrc;
static INT16 param2;
- xsrc = memory_read_word(space, cop_register[0]+0x14);
- ysrc = memory_read_word(space, cop_register[0]+0x10);
- param2 = memory_read_word(space, cop_register[3]);
+ xsrc = space->read_word(cop_register[0]+0x14);
+ ysrc = space->read_word(cop_register[0]+0x10);
+ param2 = space->read_word(cop_register[3]);
switch(param2)
{
@@ -2035,8 +2035,8 @@ static void cop2_move2_prot(address_space *space)
case 0x18: ysrc++; xsrc++; break; //down-right
}
- memory_write_word(space, cop_register[0]+0x14,xsrc);
- memory_write_word(space, cop_register[0]+0x10,ysrc);
+ space->write_word(cop_register[0]+0x14,xsrc);
+ space->write_word(cop_register[0]+0x10,ysrc);
}
@@ -2246,14 +2246,14 @@ INLINE void cop_ram_w(cop_state *cop, UINT16 offset, UINT16 data)
INLINE UINT32 r32(offs_t address)
{
- return (memory_read_word(space, address + 0) << 0) |
- (memory_read_word(space, address + 2) << 16);
+ return (space->read_word(address + 0) << 0) |
+ (space->read_word(address + 2) << 16);
}
INLINE void w32(offs_t address, UINT32 data)
{
- memory_write_word(space, address + 0, data >> 0);
- memory_write_word(space, address + 2, data >> 16);
+ space->write_word(address + 0, data >> 0);
+ space->write_word(address + 2, data >> 16);
}
@@ -2325,7 +2325,7 @@ WRITE16_HANDLER( raiden2_cop2_w )
int count = (cop_ram_r(cop, 0x47a) + 1) << 5;
COP_LOG(("%05X:COP RAM clear from %05X to %05X\n", cpu_get_pc(space->cpu), addr, addr + count));
while (count--)
- memory_write_byte(space, addr++, 0);
+ space->write_byte(addr++, 0);
}
else
{
@@ -2578,7 +2578,7 @@ static WRITE16_HANDLER( generic_cop_w )
for (i=address;i<address+length;i+=2)
{
- memory_write_word(space, i, 0x0000);
+ space->write_word(i, 0x0000);
}
}
break;
@@ -2763,30 +2763,30 @@ WRITE16_HANDLER( cupsoc_mcu_w )
case 0x8100:
{
UINT32 src = cop_register[0];
- memory_write_word(space, src+0x36,0xffc0);
+ space->write_word(src+0x36,0xffc0);
break;
}
case 0x8900:
{
UINT32 src = cop_register[0];
- memory_write_word(space, src+0x36,0xff80);
+ space->write_word(src+0x36,0xff80);
break;
}
/*Right*/
case 0x0205:
{
UINT32 src = cop_register[0];
- INT16 y = memory_read_word(space, src+0x4);
- INT16 x = memory_read_word(space, src+0x8);
- INT16 y_rel = memory_read_word(space, src+0x10);
- INT16 x_rel = memory_read_word(space, src+0x14);
- memory_write_word(space, src+0x4,(y+y_rel));
- memory_write_word(space, src+0x8,(x+x_rel));
+ INT16 y = space->read_word(src+0x4);
+ INT16 x = space->read_word(src+0x8);
+ INT16 y_rel = space->read_word(src+0x10);
+ INT16 x_rel = space->read_word(src+0x14);
+ space->write_word(src+0x4,(y+y_rel));
+ space->write_word(src+0x8,(x+x_rel));
/*logerror("%08x %08x %08x %08x %08x\n",cop_register[0],
- memory_read_word(space, cop_reg[0]+0x4),
- memory_read_word(space, cop_reg[0]+0x8),
- memory_read_word(space, cop_reg[0]+0x10),
- memory_read_word(space, cop_reg[0]+0x14));*/
+ space->read_word(cop_reg[0]+0x4),
+ space->read_word(cop_reg[0]+0x8),
+ space->read_word(cop_reg[0]+0x10),
+ space->read_word(cop_reg[0]+0x14));*/
break;
}
/*???*/
@@ -2794,10 +2794,10 @@ WRITE16_HANDLER( cupsoc_mcu_w )
{
//UINT32 dst = cop_register[0];
//UINT32 dst = cop_register[1];
- //memory_write_word(space, dst, mame_rand(space->machine)/*memory_read_word(space, src)*/);
- //memory_write_word(space, dst+2,mame_rand(space->machine)/*memory_read_word(space, src+2)*/);
- //memory_write_word(space, dst+4,mame_rand(space->machine)/*memory_read_word(space, src+4)*/);
- //memory_write_word(space, dst+6,mame_rand(space->machine)/*memory_read_word(space, src+6)*/);
+ //space->write_word(dst, mame_rand(space->machine)/*space->read_word(src)*/);
+ //space->write_word(dst+2,mame_rand(space->machine)/*space->read_word(src+2)*/);
+ //space->write_word(dst+4,mame_rand(space->machine)/*space->read_word(src+4)*/);
+ //space->write_word(dst+6,mame_rand(space->machine)/*space->read_word(src+6)*/);
//logerror("%04x\n",cop_register[0]);
break;
}
@@ -3038,8 +3038,8 @@ WRITE16_HANDLER( grainbow_mcu_w )
dma_src+=4;
//cop_register[5]+=4;
s_i = dma_size;
- //cop_register[5]+=((memory_read_word(space, 0x110000) & 0x000f) * 8);
- //memory_write_word(space, 0x1004c8,cop_register[5] & 0xffff);
+ //cop_register[5]+=((space->read_word(0x110000) & 0x000f) * 8);
+ //space->write_word(0x1004c8,cop_register[5] & 0xffff);
//dma_status = 1;
break;
}
@@ -3237,8 +3237,8 @@ WRITE16_HANDLER( legionna_mcu_w )
{
static UINT16 xy_data[2];
static UINT8 k;
- xy_data[0] = memory_read_word(space, cop_register[2]);
- xy_data[1] = memory_read_word(space, cop_register[3]);
+ xy_data[0] = space->read_word(cop_register[2]);
+ xy_data[1] = space->read_word(cop_register[3]);
k = (cop_mcu_ram[offset] == 0x0205) ? ENEMY : PLAYER;
protection_move_jsr(space,cop_register[0],k);
//protection_move_jsr(space,cop_register[1]); //???
diff --git a/src/mame/machine/snes.c b/src/mame/machine/snes.c
index e50bb99ab0d..65e72a2d3ee 100644
--- a/src/mame/machine/snes.c
+++ b/src/mame/machine/snes.c
@@ -92,8 +92,8 @@ static TIMER_CALLBACK( snes_reset_oam_address )
if (!(snes_ppu.screen_disabled)) //Reset OAM address, byuu says it happens at H=10
{
- memory_write_byte(space, OAMADDL, snes_ppu.oam.saved_address_low); /* Reset oam address */
- memory_write_byte(space, OAMADDH, snes_ppu.oam.saved_address_high);
+ space->write_byte(OAMADDL, snes_ppu.oam.saved_address_low); /* Reset oam address */
+ space->write_byte(OAMADDH, snes_ppu.oam.saved_address_high);
snes_ppu.oam.first_sprite = snes_ppu.oam.priority_rotation ? (snes_ppu.oam.address >> 1) & 127 : 0;
}
}
@@ -296,7 +296,7 @@ READ8_HANDLER( snes_open_bus_r )
return 0xff;
recurse = 1;
- result = memory_read_byte_8le(space, cpu_get_pc(space->cpu) - 1); //LAST opcode that's fetched on the bus
+ result = space->read_byte(cpu_get_pc(space->cpu) - 1); //LAST opcode that's fetched on the bus
recurse = 0;
return result;
}
@@ -476,7 +476,7 @@ READ8_HANDLER( snes_r_io )
switch (offset)
{
case WMDATA: /* Data to read from WRAM */
- value = memory_read_byte(space, 0x7e0000 + state->wram_address++);
+ value = space->read_byte(0x7e0000 + state->wram_address++);
state->wram_address &= 0x1ffff;
return value;
case OLDJOY1: /* Data for old NES controllers (JOYSER1) */
@@ -625,7 +625,7 @@ WRITE8_HANDLER( snes_w_io )
switch (offset)
{
case WMDATA: /* Data to write to WRAM */
- memory_write_byte(space, 0x7e0000 + state->wram_address++, data );
+ space->write_byte(0x7e0000 + state->wram_address++, data );
state->wram_address &= 0x1ffff;
return;
case WMADDL: /* Address to read/write to wram (low) */
@@ -914,7 +914,7 @@ READ8_HANDLER( snes_r_bank1 )
UINT16 address = offset & 0xffff;
if (address < 0x2000) /* Mirror of Low RAM */
- value = memory_read_byte(space, 0x7e0000 + address);
+ value = space->read_byte(0x7e0000 + address);
else if (address < 0x6000) /* I/O */
{
if (state->cart[0].mode == SNES_MODE_BSX && address >= 0x5000)
@@ -971,7 +971,7 @@ READ8_HANDLER( snes_r_bank2 )
UINT16 address = offset & 0xffff;
if (address < 0x2000) /* Mirror of Low RAM */
- value = memory_read_byte(space, 0x7e0000 + address);
+ value = space->read_byte(0x7e0000 + address);
else if (address < 0x6000) /* I/O */
{
if (state->cart[0].mode == SNES_MODE_BSX && address >= 0x5000)
@@ -1149,17 +1149,17 @@ READ8_HANDLER( snes_r_bank6 )
UINT16 address = offset & 0xffff;
if (state->has_addon_chip == HAS_SUPERFX)
- value = memory_read_byte(space, offset);
+ value = space->read_byte(offset);
else if (address < 0x8000)
{
if (state->cart[0].mode != SNES_MODE_25)
- value = memory_read_byte(space, offset);
+ value = space->read_byte(offset);
else if ((state->has_addon_chip == HAS_CX4) && (address >= 0x6000))
value = CX4_read(address - 0x6000);
else /* Mode 25 has SRAM not mirrored from lower banks */
{
if (address < 0x6000)
- value = memory_read_byte(space, offset);
+ value = space->read_byte(offset);
else if ((offset >= 0x300000) && (state->cart[0].sram > 0))
{
// int mask = state->cart[0].sram - 1; /* Limit SRAM size to what's actually present */
@@ -1229,7 +1229,7 @@ READ8_HANDLER( snes_r_bank7 )
else if ((state->cart[0].mode & 5) && !(state->has_addon_chip == HAS_SUPERFX)) /* Mode 20 & 22 */
{
if (address < 0x8000)
- value = memory_read_byte(space, 0x400000 + offset);
+ value = space->read_byte(0x400000 + offset);
else
value = snes_ram[0xc00000 + offset];
}
@@ -1250,7 +1250,7 @@ WRITE8_HANDLER( snes_w_bank1 )
UINT16 address = offset & 0xffff;
if (address < 0x2000) /* Mirror of Low RAM */
- memory_write_byte(space, 0x7e0000 + address, data);
+ space->write_byte(0x7e0000 + address, data);
else if (address < 0x6000) /* I/O */
{
if (state->cart[0].mode == SNES_MODE_BSX && address >= 0x5000)
@@ -1301,7 +1301,7 @@ WRITE8_HANDLER( snes_w_bank2 )
UINT16 address = offset & 0xffff;
if (address < 0x2000) /* Mirror of Low RAM */
- memory_write_byte(space, 0x7e0000 + address, data);
+ space->write_byte(0x7e0000 + address, data);
else if (address < 0x6000) /* I/O */
{
if (state->cart[0].mode == SNES_MODE_BSX && address >= 0x5000)
@@ -1410,17 +1410,17 @@ WRITE8_HANDLER( snes_w_bank6 )
UINT16 address = offset & 0xffff;
if (state->has_addon_chip == HAS_SUPERFX)
- memory_write_byte(space, offset, data);
+ space->write_byte(offset, data);
else if (address < 0x8000)
{
if ((state->has_addon_chip == HAS_CX4) && (address >= 0x6000))
CX4_write(space->machine, address - 0x6000, data);
else if (state->cart[0].mode != SNES_MODE_25)
- memory_write_byte(space, offset, data);
+ space->write_byte(offset, data);
else /* Mode 25 has SRAM not mirrored from lower banks */
{
if (address < 0x6000)
- memory_write_byte(space, offset, data);
+ space->write_byte(offset, data);
else if ((offset >= 0x300000) && (state->cart[0].sram > 0))
{
// int mask = state->cart[0].sram - 1; /* Limit SRAM size to what's actually present */
@@ -1611,7 +1611,7 @@ static void snes_init_ram( running_machine *machine )
/* make sure it happens to the 65816 (CPU 0) */
for (i = 0; i < (128*1024); i++)
{
- memory_write_byte(cpu0space, 0x7e0000 + i, 0x55);
+ cpu0space->write_byte(0x7e0000 + i, 0x55);
}
/* Inititialize registers/variables */
@@ -1981,7 +1981,7 @@ INLINE UINT8 snes_abus_read( address_space *space, UINT32 abus )
if (!dma_abus_valid(abus))
return 0;
- return memory_read_byte(space, abus);
+ return space->read_byte(abus);
}
INLINE void snes_dma_transfer( address_space *space, UINT8 dma, UINT32 abus, UINT16 bbus )
@@ -1997,7 +1997,7 @@ INLINE void snes_dma_transfer( address_space *space, UINT8 dma, UINT32 abus, UIN
{
//illegal WRAM->WRAM transfer (bus conflict)
//no read occurs; write does occur
- memory_write_byte(space, abus, 0x00);
+ space->write_byte(abus, 0x00);
return;
}
else
@@ -2005,7 +2005,7 @@ INLINE void snes_dma_transfer( address_space *space, UINT8 dma, UINT32 abus, UIN
if (!dma_abus_valid(abus))
return;
- memory_write_byte(space, abus, memory_read_byte(space, bbus));
+ space->write_byte(abus, space->read_byte(bbus));
return;
}
}
@@ -2020,7 +2020,7 @@ INLINE void snes_dma_transfer( address_space *space, UINT8 dma, UINT32 abus, UIN
}
else
{
- memory_write_byte(space, bbus, snes_abus_read(space, abus));
+ space->write_byte(bbus, snes_abus_read(space, abus));
return;
}
}
diff --git a/src/mame/machine/snescx4.c b/src/mame/machine/snescx4.c
index c8c83d53f79..3702102871a 100644
--- a/src/mame/machine/snescx4.c
+++ b/src/mame/machine/snescx4.c
@@ -108,9 +108,10 @@ static void CX4_transfer_data(running_machine *machine)
count = (cx4.reg[0x43]) | (cx4.reg[0x44] << 8);
dest = (cx4.reg[0x45]) | (cx4.reg[0x46] << 8);
+ address_space *space = machine->device<cpu_device>("maincpu")->space(AS_PROGRAM);
for(i=0;i<count;i++)
{
- CX4_write(machine, dest++, memory_read_byte(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), src++));
+ CX4_write(machine, dest++, space->read_byte(src++));
}
}
diff --git a/src/mame/machine/taitosj.c b/src/mame/machine/taitosj.c
index 3a9e20f7d50..6bacc28ea1b 100644
--- a/src/mame/machine/taitosj.c
+++ b/src/mame/machine/taitosj.c
@@ -219,7 +219,7 @@ WRITE8_HANDLER( taitosj_68705_portB_w )
address_space *cpu0space = cputag_get_address_space(space->machine, "maincpu", ADDRESS_SPACE_PROGRAM);
LOG(("%04x: 68705 write %02x to address %04x\n",cpu_get_pc(space->cpu), portA_out, address));
- memory_write_byte(cpu0space, address, portA_out);
+ cpu0space->write_byte(address, portA_out);
/* increase low 8 bits of latched address for burst writes */
address = (address & 0xff00) | ((address + 1) & 0xff);
@@ -227,7 +227,7 @@ WRITE8_HANDLER( taitosj_68705_portB_w )
if (~data & 0x20)
{
address_space *cpu0space = cputag_get_address_space(space->machine, "maincpu", ADDRESS_SPACE_PROGRAM);
- portA_in = memory_read_byte(cpu0space, address);
+ portA_in = cpu0space->read_byte(address);
LOG(("%04x: 68705 read %02x from address %04x\n", cpu_get_pc(space->cpu), portA_in, address));
}
if (~data & 0x40)
diff --git a/src/mame/machine/tatsumi.c b/src/mame/machine/tatsumi.c
index a232b8c4d25..d674393bbb2 100644
--- a/src/mame/machine/tatsumi.c
+++ b/src/mame/machine/tatsumi.c
@@ -85,7 +85,7 @@ READ16_HANDLER( apache3_v30_v20_r )
offset += 0x00000; // main ram
else
logerror("%08x: unmapped read z80 rom %08x\n", cpu_get_pc(space->cpu), offset);
- return 0xff00 | memory_read_byte(targetspace, offset);
+ return 0xff00 | targetspace->read_byte(offset);
}
WRITE16_HANDLER( apache3_v30_v20_w )
@@ -98,7 +98,7 @@ WRITE16_HANDLER( apache3_v30_v20_w )
/* Only 8 bits of the V30 data bus are connected - ignore writes to the other half */
if (ACCESSING_BITS_0_7)
{
- memory_write_byte(targetspace, offset, data & 0xff);
+ targetspace->write_byte(offset, data & 0xff);
}
}
@@ -156,7 +156,7 @@ READ16_HANDLER( roundup_v30_z80_r )
if (tatsumi_control_word & 0x20)
offset += 0x8000; /* Upper half */
- return 0xff00 | memory_read_byte(targetspace, offset);
+ return 0xff00 | targetspace->read_byte(offset);
}
WRITE16_HANDLER( roundup_v30_z80_w )
@@ -169,7 +169,7 @@ WRITE16_HANDLER( roundup_v30_z80_w )
if (tatsumi_control_word & 0x20)
offset += 0x8000; /* Upper half of Z80 address space */
- memory_write_byte(targetspace, offset, data & 0xff);
+ targetspace->write_byte(offset, data & 0xff);
}
}
diff --git a/src/mame/machine/toaplan1.c b/src/mame/machine/toaplan1.c
index 0aea9c6abfb..c8e4549c43d 100644
--- a/src/mame/machine/toaplan1.c
+++ b/src/mame/machine/toaplan1.c
@@ -95,7 +95,7 @@ READ16_HANDLER( demonwld_dsp_r )
UINT16 input_data = 0;
switch (main_ram_seg) {
case 0xc00000: mainspace = cputag_get_address_space(space->machine, "maincpu", ADDRESS_SPACE_PROGRAM);
- input_data = memory_read_word(mainspace, main_ram_seg + dsp_addr_w);
+ input_data = mainspace->read_word(main_ram_seg + dsp_addr_w);
break;
default: logerror("DSP PC:%04x Warning !!! IO reading from %08x (port 1)\n",cpu_get_previouspc(space->cpu),main_ram_seg + dsp_addr_w);
}
@@ -112,7 +112,7 @@ WRITE16_HANDLER( demonwld_dsp_w )
switch (main_ram_seg) {
case 0xc00000: if ((dsp_addr_w < 3) && (data == 0)) dsp_execute = 1;
mainspace = cputag_get_address_space(space->machine, "maincpu", ADDRESS_SPACE_PROGRAM);
- memory_write_word(mainspace, main_ram_seg + dsp_addr_w, data);
+ mainspace->write_word(main_ram_seg + dsp_addr_w, data);
break;
default: logerror("DSP PC:%04x Warning !!! IO writing to %08x (port 1)\n",cpu_get_previouspc(space->cpu),main_ram_seg + dsp_addr_w);
}
diff --git a/src/mame/machine/twincobr.c b/src/mame/machine/twincobr.c
index ed973639a1f..0fbd2b86e01 100644
--- a/src/mame/machine/twincobr.c
+++ b/src/mame/machine/twincobr.c
@@ -73,7 +73,7 @@ READ16_HANDLER( twincobr_dsp_r )
case 0x30000:
case 0x40000:
case 0x50000: mainspace = cputag_get_address_space(space->machine, "maincpu", ADDRESS_SPACE_PROGRAM);
- input_data = memory_read_word(mainspace, main_ram_seg + dsp_addr_w);
+ input_data = mainspace->read_word(main_ram_seg + dsp_addr_w);
break;
default: logerror("DSP PC:%04x Warning !!! IO reading from %08x (port 1)\n",cpu_get_previouspc(space->cpu),main_ram_seg + dsp_addr_w); break;
}
@@ -91,7 +91,7 @@ WRITE16_HANDLER( twincobr_dsp_w )
case 0x30000: if ((dsp_addr_w < 3) && (data == 0)) dsp_execute = 1;
case 0x40000:
case 0x50000: mainspace = cputag_get_address_space(space->machine, "maincpu", ADDRESS_SPACE_PROGRAM);
- memory_write_word(mainspace, main_ram_seg + dsp_addr_w, data);
+ mainspace->write_word(main_ram_seg + dsp_addr_w, data);
break;
default: logerror("DSP PC:%04x Warning !!! IO writing to %08x (port 1)\n",cpu_get_previouspc(space->cpu),main_ram_seg + dsp_addr_w); break;
}
@@ -123,8 +123,8 @@ READ16_HANDLER( wardner_dsp_r )
case 0x7000:
case 0x8000:
case 0xa000: mainspace = cputag_get_address_space(space->machine, "maincpu", ADDRESS_SPACE_PROGRAM);
- input_data = memory_read_byte(mainspace, main_ram_seg + (dsp_addr_w + 0))
- | (memory_read_byte(mainspace, main_ram_seg + (dsp_addr_w + 1)) << 8);
+ input_data = mainspace->read_byte(main_ram_seg + (dsp_addr_w + 0))
+ | (mainspace->read_byte(main_ram_seg + (dsp_addr_w + 1)) << 8);
break;
default: logerror("DSP PC:%04x Warning !!! IO reading from %08x (port 1)\n",cpu_get_previouspc(space->cpu),main_ram_seg + dsp_addr_w); break;
}
@@ -142,8 +142,8 @@ WRITE16_HANDLER( wardner_dsp_w )
case 0x7000: if ((dsp_addr_w < 3) && (data == 0)) dsp_execute = 1;
case 0x8000:
case 0xa000: mainspace = cputag_get_address_space(space->machine, "maincpu", ADDRESS_SPACE_PROGRAM);
- memory_write_byte(mainspace, main_ram_seg + (dsp_addr_w + 0), (data & 0xff));
- memory_write_byte(mainspace, main_ram_seg + (dsp_addr_w + 1), ((data >> 8) & 0xff));
+ mainspace->write_byte(main_ram_seg + (dsp_addr_w + 0), (data & 0xff));
+ mainspace->write_byte(main_ram_seg + (dsp_addr_w + 1), ((data >> 8) & 0xff));
break;
default: logerror("DSP PC:%04x Warning !!! IO writing to %08x (port 1)\n",cpu_get_previouspc(space->cpu),main_ram_seg + dsp_addr_w); break;
}
diff --git a/src/mame/video/astrocde.c b/src/mame/video/astrocde.c
index 981d87a81d8..08c639cf510 100644
--- a/src/mame/video/astrocde.c
+++ b/src/mame/video/astrocde.c
@@ -727,7 +727,7 @@ WRITE8_HANDLER( astrocade_funcgen_w )
/* OR/XOR */
if (funcgen_control & 0x30)
{
- UINT8 olddata = memory_read_byte(space, 0x4000 + offset);
+ UINT8 olddata = space->read_byte(0x4000 + offset);
/* compute any intercepts */
funcgen_intercept &= 0x0f;
@@ -748,7 +748,7 @@ WRITE8_HANDLER( astrocade_funcgen_w )
}
/* write the result */
- memory_write_byte(space, 0x4000 + offset, data);
+ space->write_byte(0x4000 + offset, data);
}
@@ -842,7 +842,7 @@ static void execute_blit(address_space *space)
if (curwidth == 0 && (pattern_mode & 0x08) != 0)
busdata = 0;
else
- busdata = memory_read_byte(space, busaddr);
+ busdata = space->read_byte(busaddr);
/* increment the appropriate address */
if ((pattern_mode & 0x01) == 0)
@@ -854,7 +854,7 @@ static void execute_blit(address_space *space)
/* address is selected between source/dest based on mode.d0 */
busaddr = ((pattern_mode & 0x01) != 0) ? pattern_source : pattern_dest;
- memory_write_byte(space, busaddr, busdata);
+ space->write_byte(busaddr, busdata);
/* increment the appropriate address */
if ((pattern_mode & 0x01) == 0)
diff --git a/src/mame/video/combatsc.c b/src/mame/video/combatsc.c
index 4051cdcfd6c..c8253878d52 100644
--- a/src/mame/video/combatsc.c
+++ b/src/mame/video/combatsc.c
@@ -520,7 +520,7 @@ static void bootleg_draw_sprites( running_machine *machine, bitmap_t *bitmap, co
address_space *space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM);
const gfx_element *gfx = machine->gfx[circuit + 2];
- int limit = circuit ? (memory_read_byte(space, 0xc2) * 256 + memory_read_byte(space, 0xc3)) : (memory_read_byte(space, 0xc0) * 256 + memory_read_byte(space, 0xc1));
+ int limit = circuit ? (space->read_byte(0xc2) * 256 + space->read_byte(0xc3)) : (space->read_byte(0xc0) * 256 + space->read_byte(0xc1));
const UINT8 *finish;
source += 0x1000;
diff --git a/src/mame/video/dc.c b/src/mame/video/dc.c
index d344a25dea4..281296e1eeb 100644
--- a/src/mame/video/dc.c
+++ b/src/mame/video/dc.c
@@ -1123,15 +1123,15 @@ WRITE64_HANDLER( pvr_ta_w )
{
UINT32 st[6];
- st[0]=memory_read_dword(space,(0x05000000+offsetra));
- st[1]=memory_read_dword(space,(0x05000004+offsetra)); // Opaque List Pointer
- st[2]=memory_read_dword(space,(0x05000008+offsetra)); // Opaque Modifier Volume List Pointer
- st[3]=memory_read_dword(space,(0x0500000c+offsetra)); // Translucent List Pointer
- st[4]=memory_read_dword(space,(0x05000010+offsetra)); // Translucent Modifier Volume List Pointer
+ st[0]=space->read_dword((0x05000000+offsetra));
+ st[1]=space->read_dword((0x05000004+offsetra)); // Opaque List Pointer
+ st[2]=space->read_dword((0x05000008+offsetra)); // Opaque Modifier Volume List Pointer
+ st[3]=space->read_dword((0x0500000c+offsetra)); // Translucent List Pointer
+ st[4]=space->read_dword((0x05000010+offsetra)); // Translucent Modifier Volume List Pointer
if (sizera == 6)
{
- st[5] = memory_read_dword(space,(0x05000014+offsetra)); // Punch Through List Pointer
+ st[5] = space->read_dword((0x05000014+offsetra)); // Punch Through List Pointer
offsetra+=0x18;
}
else
@@ -1980,7 +1980,7 @@ static void render_to_accumulation_buffer(running_machine *machine,bitmap_t *bit
rs=state_ta.renderselect;
c=pvrta_regs[ISP_BACKGND_T];
- c=memory_read_dword(space,0x05000000+((c&0xfffff8)>>1)+(3+3)*4);
+ c=space->read_dword(0x05000000+((c&0xfffff8)>>1)+(3+3)*4);
bitmap_fill(bitmap,cliprect,c);
@@ -2073,7 +2073,7 @@ static void pvr_accumulationbuffer_to_framebuffer(address_space *space, int x,in
((((data & 0x0000fc00) >> 10)) << 5) |
((((data & 0x00f80000) >> 19)) << 11);
- memory_write_word(space,realwriteoffs+xcnt*2, newdat);
+ space->write_word(realwriteoffs+xcnt*2, newdat);
}
}
}
@@ -2101,7 +2101,7 @@ static void pvr_accumulationbuffer_to_framebuffer(address_space *space, int x,in
((((data & 0x00f80000) >> 19)) << 10);
// alpha?
- memory_write_word(space,realwriteoffs+xcnt*2, newdat);
+ space->write_word(realwriteoffs+xcnt*2, newdat);
}
}
}
@@ -2125,7 +2125,7 @@ static void pvr_accumulationbuffer_to_framebuffer(address_space *space, int x,in
((((data & 0x0000fc00) >> 10)) << 5) |
((((data & 0x00f80000) >> 19)) << 11);
- memory_write_word(space,realwriteoffs+xcnt*2, newdat);
+ space->write_word(realwriteoffs+xcnt*2, newdat);
}
}
}
@@ -2152,7 +2152,7 @@ static void pvr_accumulationbuffer_to_framebuffer(address_space *space, int x,in
((((data & 0x0000fc00) >> 10)) << 5) |
((((data & 0x00f80000) >> 19)) << 11);
- memory_write_word(space,realwriteoffs+xcnt*2, newdat);
+ space->write_word(realwriteoffs+xcnt*2, newdat);
}
}
}
diff --git a/src/mame/video/genesis.c b/src/mame/video/genesis.c
index d3a761cc33d..8d24050f344 100644
--- a/src/mame/video/genesis.c
+++ b/src/mame/video/genesis.c
@@ -674,7 +674,7 @@ static void vdp_dma_68k(address_space *space)
/* handle the DMA */
for (count = 0; count < length; count++)
{
- vdp_data_w(space->machine, memory_read_word(space, source));
+ vdp_data_w(space->machine, space->read_word(source));
source += 2;
}
}
diff --git a/src/mame/video/gp9001.c b/src/mame/video/gp9001.c
index dfff1fc9836..866a4dfed0e 100644
--- a/src/mame/video/gp9001.c
+++ b/src/mame/video/gp9001.c
@@ -438,7 +438,7 @@ int gp9001_videoram16_r(gp9001vdp_device *vdp, offs_t offset)
{
int offs = vdp->gp9001_voffs;
vdp->gp9001_voffs++;
- return memory_read_word_16be(vdp->space(), offs*2);
+ return vdp->space()->read_word(offs*2);
}
@@ -446,7 +446,7 @@ void gp9001_videoram16_w(gp9001vdp_device *vdp, offs_t offset, UINT16 data, UINT
{
int offs = vdp->gp9001_voffs;
vdp->gp9001_voffs++;
- memory_write_word_masked_16be(vdp->space(), offs*2, data, mem_mask);
+ vdp->space()->write_word(offs*2, data, mem_mask);
}
WRITE16_DEVICE_HANDLER( gp9001_devvoffs_w )
diff --git a/src/mame/video/hng64.c b/src/mame/video/hng64.c
index a911b6b9df3..c4bd03a75e1 100644
--- a/src/mame/video/hng64.c
+++ b/src/mame/video/hng64.c
@@ -1485,7 +1485,7 @@ VIDEO_UPDATE( hng64 )
if ( input_code_pressed_once(screen->machine, KEYCODE_L) )
{
address_space *space = cputag_get_address_space(screen->machine, "maincpu", ADDRESS_SPACE_PROGRAM);
- memory_write_byte(space, 0x2f27c8, 0x2);
+ space->write_byte(0x2f27c8, 0x2);
}
#endif
diff --git a/src/mame/video/model3.c b/src/mame/video/model3.c
index df872a32c4e..fa1c2edaf6b 100644
--- a/src/mame/video/model3.c
+++ b/src/mame/video/model3.c
@@ -821,9 +821,9 @@ void real3d_display_list1_dma(address_space *space, UINT32 src, UINT32 dst, int
for(i=0; i < length; i+=4) {
UINT32 w;
if (byteswap) {
- w = BYTE_REVERSE32(memory_read_dword(space, src));
+ w = BYTE_REVERSE32(space->read_dword(src));
} else {
- w = memory_read_dword(space, src);
+ w = space->read_dword(src);
}
display_list_ram[d++] = w;
src += 4;
@@ -837,9 +837,9 @@ void real3d_display_list2_dma(address_space *space, UINT32 src, UINT32 dst, int
for(i=0; i < length; i+=4) {
UINT32 w;
if (byteswap) {
- w = BYTE_REVERSE32(memory_read_dword(space, src));
+ w = BYTE_REVERSE32(space->read_dword(src));
} else {
- w = memory_read_dword(space, src);
+ w = space->read_dword(src);
}
culling_ram[d++] = w;
src += 4;
@@ -853,11 +853,11 @@ void real3d_vrom_texture_dma(address_space *space, UINT32 src, UINT32 dst, int l
UINT32 address, header;
if (byteswap) {
- address = BYTE_REVERSE32(memory_read_dword(space, (src+0)));
- header = BYTE_REVERSE32(memory_read_dword(space, (src+4)));
+ address = BYTE_REVERSE32(space->read_dword((src+0)));
+ header = BYTE_REVERSE32(space->read_dword((src+4)));
} else {
- address = memory_read_dword(space, (src+0));
- header = memory_read_dword(space, (src+4));
+ address = space->read_dword((src+0));
+ header = space->read_dword((src+4));
}
real3d_upload_texture(space->machine, header, (UINT32*)&model3_vrom[address]);
}
@@ -869,9 +869,9 @@ void real3d_texture_fifo_dma(address_space *space, UINT32 src, int length, int b
for(i=0; i < length; i+=4) {
UINT32 w;
if (byteswap) {
- w = BYTE_REVERSE32(memory_read_dword(space, src));
+ w = BYTE_REVERSE32(space->read_dword(src));
} else {
- w = memory_read_dword(space, src);
+ w = space->read_dword(src);
}
texture_fifo[texture_fifo_pos] = w;
texture_fifo_pos++;
@@ -886,9 +886,9 @@ void real3d_polygon_ram_dma(address_space *space, UINT32 src, UINT32 dst, int le
for(i=0; i < length; i+=4) {
UINT32 w;
if (byteswap) {
- w = BYTE_REVERSE32(memory_read_dword(space, src));
+ w = BYTE_REVERSE32(space->read_dword(src));
} else {
- w = memory_read_dword(space, src);
+ w = space->read_dword(src);
}
polygon_ram[d++] = w;
src += 4;
diff --git a/src/mame/video/namcos22.c b/src/mame/video/namcos22.c
index ae701b604e8..f1f91945ce3 100644
--- a/src/mame/video/namcos22.c
+++ b/src/mame/video/namcos22.c
@@ -2406,7 +2406,7 @@ Dump( address_space *space, FILE *f, unsigned addr1, unsigned addr2, const char
int i;
for( i=0; i<16; i++ )
{
- data[i] = memory_read_byte(space, addr+i );
+ data[i] = space->read_byte(addr+i );
if( data[i] )
{
bHasNonZero = 1;
diff --git a/src/mame/video/ppu2c0x.c b/src/mame/video/ppu2c0x.c
index c6036f8d297..72fe84f0f6e 100644
--- a/src/mame/video/ppu2c0x.c
+++ b/src/mame/video/ppu2c0x.c
@@ -426,14 +426,14 @@ static void draw_background( running_device *device, UINT8 *line_priority )
pos = ((index1 & 0x380) >> 4) | ((index1 & 0x1f) >> 2);
page = (index1 & 0x0c00) >> 10;
address = 0x3c0 + pos;
- color_byte = memory_read_byte(ppu2c0x->space, (((page * 0x400) + address) & 0xfff) + 0x2000);
+ color_byte = ppu2c0x->space->read_byte((((page * 0x400) + address) & 0xfff) + 0x2000);
/* figure out which bits in the color table to use */
color_bits = ((index1 & 0x40) >> 4) + (index1 & 0x02);
// page2 is the output of the nametable read (this section is the FIRST read per tile!)
address = index1 & 0x3ff;
- page2 = memory_read_byte(ppu2c0x->space, index1);
+ page2 = ppu2c0x->space->read_byte(index1);
// 27/12/2002
if (ppu_latch)
@@ -451,8 +451,8 @@ static void draw_background( running_device *device, UINT8 *line_priority )
// plus something that accounts for y
address += scroll_y_fine;
- plane1 = memory_read_byte(ppu2c0x->space, (address & 0x1fff));
- plane2 = memory_read_byte(ppu2c0x->space, (address + 8) & 0x1fff);
+ plane1 = ppu2c0x->space->read_byte((address & 0x1fff));
+ plane2 = ppu2c0x->space->read_byte((address + 8) & 0x1fff);
/* render the pixel */
for (i = 0; i < 8; i++)
@@ -598,8 +598,8 @@ static void draw_sprites( running_device *device, UINT8 *line_priority )
if (size == 8)
index1 += ((sprite_page == 0) ? 0 : 0x1000);
- plane1 = memory_read_byte(ppu2c0x->space, (index1 + sprite_line + 0) & 0x1fff);
- plane2 = memory_read_byte(ppu2c0x->space, (index1 + sprite_line + 8) & 0x1fff);
+ plane1 = ppu2c0x->space->read_byte((index1 + sprite_line + 0) & 0x1fff);
+ plane2 = ppu2c0x->space->read_byte((index1 + sprite_line + 8) & 0x1fff);
/* if there are more than 8 sprites on this line, set the flag */
if (sprite_count == 8)
@@ -996,14 +996,14 @@ READ8_DEVICE_HANDLER( ppu2c0x_r )
if (ppu2c0x->videomem_addr >= 0x3f00)
{
- ppu2c0x->data_latch = memory_read_byte(ppu2c0x->space, ppu2c0x->videomem_addr);
+ ppu2c0x->data_latch = ppu2c0x->space->read_byte(ppu2c0x->videomem_addr);
// buffer the mirrored NT data
- ppu2c0x->buffered_data = memory_read_byte(ppu2c0x->space, ppu2c0x->videomem_addr & 0x2fff);
+ ppu2c0x->buffered_data = ppu2c0x->space->read_byte(ppu2c0x->videomem_addr & 0x2fff);
}
else
{
ppu2c0x->data_latch = ppu2c0x->buffered_data;
- ppu2c0x->buffered_data = memory_read_byte(ppu2c0x->space, ppu2c0x->videomem_addr);
+ ppu2c0x->buffered_data = ppu2c0x->space->read_byte(ppu2c0x->videomem_addr);
}
ppu2c0x->videomem_addr += ppu2c0x->add;
@@ -1153,12 +1153,12 @@ WRITE8_DEVICE_HANDLER( ppu2c0x_w )
if (tempAddr < 0x2000)
{
/* store the data */
- memory_write_byte(ppu2c0x->space, tempAddr, data);
+ ppu2c0x->space->write_byte(tempAddr, data);
}
else
{
- memory_write_byte(ppu2c0x->space, tempAddr, data);
+ ppu2c0x->space->write_byte(tempAddr, data);
}
/* increment the address */
ppu2c0x->videomem_addr += ppu2c0x->add;
@@ -1186,8 +1186,8 @@ void ppu2c0x_spriteram_dma( address_space *space, running_device *device, const
for (i = 0; i < SPRITERAM_SIZE; i++)
{
- UINT8 spriteData = memory_read_byte(space, address + i);
- memory_write_byte(space, 0x2004, spriteData);
+ UINT8 spriteData = space->read_byte(address + i);
+ space->write_byte(0x2004, spriteData);
}
// should last 513 CPU cycles.
diff --git a/src/mame/video/snes.c b/src/mame/video/snes.c
index e35d7e07975..88a29742888 100644
--- a/src/mame/video/snes.c
+++ b/src/mame/video/snes.c
@@ -2246,8 +2246,8 @@ WRITE8_HANDLER( snes_ppu_write )
case INIDISP: /* Initial settings for screen */
if ((snes_ppu.screen_disabled & 0x80) && (!(data & 0x80))) //a 1->0 force blank transition causes a reset OAM address
{
- memory_write_byte(space, OAMADDL, snes_ppu.oam.saved_address_low);
- memory_write_byte(space, OAMADDH, snes_ppu.oam.saved_address_high);
+ space->write_byte(OAMADDL, snes_ppu.oam.saved_address_low);
+ space->write_byte(OAMADDH, snes_ppu.oam.saved_address_high);
snes_ppu.oam.first_sprite = snes_ppu.oam.priority_rotation ? (snes_ppu.oam.address >> 1) & 127 : 0;
}
snes_ppu.screen_disabled = data & 0x80;
diff --git a/src/mame/video/vrender0.c b/src/mame/video/vrender0.c
index 7cb5a28ae2b..5d0f87a648a 100644
--- a/src/mame/video/vrender0.c
+++ b/src/mame/video/vrender0.c
@@ -397,7 +397,7 @@ static const _DrawTemplate DrawTile[]=
TILENAME(16,1,2),
};
-#define Packet(i) memory_read_word(space, PacketPtr + 2 * i)
+#define Packet(i) space->read_word(PacketPtr + 2 * i)
//Returns TRUE if the operation was a flip (sync or async)
int vrender0_ProcessPacket(running_device *device, UINT32 PacketPtr, UINT16 *Dest, UINT8 *TEXTURE)
diff --git a/src/mame/video/williams.c b/src/mame/video/williams.c
index c54e7f51918..2590f2a0636 100644
--- a/src/mame/video/williams.c
+++ b/src/mame/video/williams.c
@@ -606,7 +606,7 @@ WRITE8_HANDLER( williams2_blit_window_enable_w )
INLINE void blit_pixel(address_space *space, int offset, int srcdata, int data, int mask, int solid)
{
/* always read from video RAM regardless of the bank setting */
- int pix = (offset < 0xc000) ? williams_videoram[offset] : memory_read_byte(space, offset);
+ int pix = (offset < 0xc000) ? williams_videoram[offset] : space->read_byte(offset);
/* handle transparency */
if (data & 0x08)
@@ -626,7 +626,7 @@ INLINE void blit_pixel(address_space *space, int offset, int srcdata, int data,
/* note that we have to allow blits to non-video RAM (e.g. tileram) because those */
/* are not blocked by the window enable */
if (!williams_blitter_window_enable || offset < williams_blitter_clip_address || offset >= 0xc000)
- memory_write_byte(space, offset, pix);
+ space->write_byte(offset, pix);
}
@@ -666,7 +666,7 @@ static int blitter_core(address_space *space, int sstart, int dstart, int w, int
/* loop over the width */
for (j = w; j > 0; j--)
{
- blit_pixel(space, dest, blitter_remap[memory_read_byte(space, source)], data, keepmask, solid);
+ blit_pixel(space, dest, blitter_remap[space->read_byte(source)], data, keepmask, solid);
accesses += 2;
/* advance */
@@ -700,7 +700,7 @@ static int blitter_core(address_space *space, int sstart, int dstart, int w, int
dest = dstart & 0xffff;
/* left edge case */
- pixdata = blitter_remap[memory_read_byte(space, source)];
+ pixdata = blitter_remap[space->read_byte(source)];
blit_pixel(space, dest, (pixdata >> 4) & 0x0f, data, keepmask | 0xf0, solid);
accesses += 2;
@@ -710,7 +710,7 @@ static int blitter_core(address_space *space, int sstart, int dstart, int w, int
/* loop over the width */
for (j = w - 1; j > 0; j--)
{
- pixdata = (pixdata << 8) | blitter_remap[memory_read_byte(space, source)];
+ pixdata = (pixdata << 8) | blitter_remap[space->read_byte(source)];
blit_pixel(space, dest, (pixdata >> 4) & 0xff, data, keepmask, solid);
accesses += 2;
diff --git a/src/mame/video/zaxxon.c b/src/mame/video/zaxxon.c
index 99343fd401e..a352c27021b 100644
--- a/src/mame/video/zaxxon.c
+++ b/src/mame/video/zaxxon.c
@@ -304,11 +304,11 @@ WRITE8_HANDLER( congo_sprite_custom_w )
/* this is just a guess; the chip is hardwired to the spriteram */
while (count-- >= 0)
{
- UINT8 daddr = memory_read_byte(space, saddr + 0) * 4;
- spriteram[(daddr + 0) & 0xff] = memory_read_byte(space, saddr + 1);
- spriteram[(daddr + 1) & 0xff] = memory_read_byte(space, saddr + 2);
- spriteram[(daddr + 2) & 0xff] = memory_read_byte(space, saddr + 3);
- spriteram[(daddr + 3) & 0xff] = memory_read_byte(space, saddr + 4);
+ UINT8 daddr = space->read_byte(saddr + 0) * 4;
+ spriteram[(daddr + 0) & 0xff] = space->read_byte(saddr + 1);
+ spriteram[(daddr + 1) & 0xff] = space->read_byte(saddr + 2);
+ spriteram[(daddr + 2) & 0xff] = space->read_byte(saddr + 3);
+ spriteram[(daddr + 3) & 0xff] = space->read_byte(saddr + 4);
saddr += 0x20;
}
}