summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--.gitattributes1
-rw-r--r--src/emu/cpu/adsp2100/adsp2100.c6
-rw-r--r--src/emu/cpu/arm7/arm7.c2
-rw-r--r--src/emu/cpu/asap/asap.c2
-rw-r--r--src/emu/cpu/cdp1802/cdp1802.c4
-rw-r--r--src/emu/cpu/cop400/cop410.c6
-rw-r--r--src/emu/cpu/cop400/cop420.c6
-rw-r--r--src/emu/cpu/cop400/cop440.c6
-rw-r--r--src/emu/cpu/h83002/h8_16.c4
-rw-r--r--src/emu/cpu/h83002/h8_8.c4
-rw-r--r--src/emu/cpu/hd6309/hd6309.c2
-rw-r--r--src/emu/cpu/jaguar/jaguar.c2
-rw-r--r--src/emu/cpu/m6800/m6800.c42
-rw-r--r--src/emu/cpu/m68000/m68kcpu.c2
-rw-r--r--src/emu/cpu/m6809/m6809.c2
-rw-r--r--src/emu/cpu/mcs48/mcs48.c6
-rw-r--r--src/emu/cpu/mcs51/mcs51.c6
-rw-r--r--src/emu/cpu/mips/psx.c2
-rw-r--r--src/emu/cpu/sh2/sh2comn.c4
-rw-r--r--src/emu/cpu/sh4/sh4.c12
-rw-r--r--src/emu/cpu/tms32031/tms32031.c2
-rw-r--r--src/emu/cpu/tms34010/tms34010.c4
-rw-r--r--src/emu/cpu/z80/z80.c4
-rw-r--r--src/emu/cpuexec.c11
-rw-r--r--src/emu/cpuexec.h59
-rw-r--r--src/emu/cpuintrf.c207
-rw-r--r--src/emu/cpuintrf.h151
-rw-r--r--src/emu/debug/debugcmd.c18
-rw-r--r--src/emu/debug/debugcmt.c2
-rw-r--r--src/emu/debug/debugcpu.c114
-rw-r--r--src/emu/debug/debugcpu.h62
-rw-r--r--src/emu/debug/debugvw.c10
-rw-r--r--src/emu/emu.mak1
-rw-r--r--src/emu/machine/generic.c4
-rw-r--r--src/emu/mame.h2
-rw-r--r--src/emu/memory.c21
-rw-r--r--src/emu/memory.h7
-rw-r--r--src/emu/sound/3812intf.c8
-rw-r--r--src/emu/sound/aica.c2
-rw-r--r--src/emu/sound/ay8910.c4
-rw-r--r--src/emu/sound/pokey.c4
-rw-r--r--src/emu/sound/scsp.c2
-rw-r--r--src/emu/sound/ym2151.c2
-rw-r--r--src/emu/sound/ymf271.c4
-rw-r--r--src/emu/sound/ymz280b.c2
-rw-r--r--src/mame/drivers/malzak.c2
46 files changed, 324 insertions, 506 deletions
diff --git a/.gitattributes b/.gitattributes
index 4c85b281b92..62898d6e449 100644
--- a/.gitattributes
+++ b/.gitattributes
@@ -488,7 +488,6 @@ src/emu/cpu/z8000/z8000ops.c svneol=native#text/plain
src/emu/cpu/z8000/z8000tbl.c svneol=native#text/plain
src/emu/cpuexec.c svneol=native#text/plain
src/emu/cpuexec.h svneol=native#text/plain
-src/emu/cpuintrf.c svneol=native#text/plain
src/emu/cpuintrf.h svneol=native#text/plain
src/emu/crsshair.c svneol=native#text/plain
src/emu/crsshair.h svneol=native#text/plain
diff --git a/src/emu/cpu/adsp2100/adsp2100.c b/src/emu/cpu/adsp2100/adsp2100.c
index d071dbb101c..0b24e7884e2 100644
--- a/src/emu/cpu/adsp2100/adsp2100.c
+++ b/src/emu/cpu/adsp2100/adsp2100.c
@@ -685,9 +685,9 @@ static adsp2100_state *adsp21xx_init(const device_config *device, cpu_irq_callba
/* fetch device parameters */
adsp->device = device;
- adsp->program = cpu_get_address_space(device, ADDRESS_SPACE_PROGRAM);
- adsp->data = cpu_get_address_space(device, ADDRESS_SPACE_DATA);
- adsp->io = cpu_get_address_space(device, ADDRESS_SPACE_IO);
+ adsp->program = memory_find_address_space(device, ADDRESS_SPACE_PROGRAM);
+ adsp->data = memory_find_address_space(device, ADDRESS_SPACE_DATA);
+ adsp->io = memory_find_address_space(device, ADDRESS_SPACE_IO);
/* copy function pointers from the config */
if (config != NULL)
diff --git a/src/emu/cpu/arm7/arm7.c b/src/emu/cpu/arm7/arm7.c
index 095198a30c5..530b86cd1e5 100644
--- a/src/emu/cpu/arm7/arm7.c
+++ b/src/emu/cpu/arm7/arm7.c
@@ -81,7 +81,7 @@ static CPU_INIT( arm7 )
cpustate->irq_callback = irqcallback;
cpustate->device = device;
- cpustate->program = cpu_get_address_space(device, ADDRESS_SPACE_PROGRAM);
+ cpustate->program = memory_find_address_space(device, ADDRESS_SPACE_PROGRAM);
#if TEST_COPROC_FUNCS
// setup co-proc callbacks example
diff --git a/src/emu/cpu/asap/asap.c b/src/emu/cpu/asap/asap.c
index 14792a74391..f68d86afc61 100644
--- a/src/emu/cpu/asap/asap.c
+++ b/src/emu/cpu/asap/asap.c
@@ -429,7 +429,7 @@ static CPU_INIT( asap )
asap->src2val[i] = i;
asap->irq_callback = irqcallback;
asap->device = device;
- asap->program = cpu_get_address_space(device, ADDRESS_SPACE_PROGRAM);
+ asap->program = memory_find_address_space(device, ADDRESS_SPACE_PROGRAM);
}
static CPU_RESET( asap )
diff --git a/src/emu/cpu/cdp1802/cdp1802.c b/src/emu/cpu/cdp1802/cdp1802.c
index 9109e278641..344b0ce04db 100644
--- a/src/emu/cpu/cdp1802/cdp1802.c
+++ b/src/emu/cpu/cdp1802/cdp1802.c
@@ -893,8 +893,8 @@ static CPU_INIT( cdp1802 )
/* get address spaces */
- cpustate->program = cpu_get_address_space(device, ADDRESS_SPACE_PROGRAM);
- cpustate->io = cpu_get_address_space(device, ADDRESS_SPACE_IO);
+ cpustate->program = memory_find_address_space(device, ADDRESS_SPACE_PROGRAM);
+ cpustate->io = memory_find_address_space(device, ADDRESS_SPACE_IO);
/* set initial values */
diff --git a/src/emu/cpu/cop400/cop410.c b/src/emu/cpu/cop400/cop410.c
index 15e69c934b9..f2389121d03 100644
--- a/src/emu/cpu/cop400/cop410.c
+++ b/src/emu/cpu/cop400/cop410.c
@@ -184,9 +184,9 @@ static CPU_INIT( cop410 )
/* get address spaces */
- cop400->program = cpu_get_address_space(device, ADDRESS_SPACE_PROGRAM);
- cop400->data = cpu_get_address_space(device, ADDRESS_SPACE_DATA);
- cop400->io = cpu_get_address_space(device, ADDRESS_SPACE_IO);
+ cop400->program = memory_find_address_space(device, ADDRESS_SPACE_PROGRAM);
+ cop400->data = memory_find_address_space(device, ADDRESS_SPACE_DATA);
+ cop400->io = memory_find_address_space(device, ADDRESS_SPACE_IO);
/* set output pin masks */
diff --git a/src/emu/cpu/cop400/cop420.c b/src/emu/cpu/cop400/cop420.c
index e09a9bd966f..ca9a41e8ab5 100644
--- a/src/emu/cpu/cop400/cop420.c
+++ b/src/emu/cpu/cop400/cop420.c
@@ -186,9 +186,9 @@ static CPU_INIT( cop420 )
/* get address spaces */
- cop400->program = cpu_get_address_space(device, ADDRESS_SPACE_PROGRAM);
- cop400->data = cpu_get_address_space(device, ADDRESS_SPACE_DATA);
- cop400->io = cpu_get_address_space(device, ADDRESS_SPACE_IO);
+ cop400->program = memory_find_address_space(device, ADDRESS_SPACE_PROGRAM);
+ cop400->data = memory_find_address_space(device, ADDRESS_SPACE_DATA);
+ cop400->io = memory_find_address_space(device, ADDRESS_SPACE_IO);
/* set output pin masks */
diff --git a/src/emu/cpu/cop400/cop440.c b/src/emu/cpu/cop400/cop440.c
index 8914ddf7896..296bbe84d99 100644
--- a/src/emu/cpu/cop400/cop440.c
+++ b/src/emu/cpu/cop400/cop440.c
@@ -198,9 +198,9 @@ static CPU_INIT( cop444 )
/* get address spaces */
- cop400->program = cpu_get_address_space(device, ADDRESS_SPACE_PROGRAM);
- cop400->data = cpu_get_address_space(device, ADDRESS_SPACE_DATA);
- cop400->io = cpu_get_address_space(device, ADDRESS_SPACE_IO);
+ cop400->program = memory_find_address_space(device, ADDRESS_SPACE_PROGRAM);
+ cop400->data = memory_find_address_space(device, ADDRESS_SPACE_DATA);
+ cop400->io = memory_find_address_space(device, ADDRESS_SPACE_IO);
/* set output pin masks */
diff --git a/src/emu/cpu/h83002/h8_16.c b/src/emu/cpu/h83002/h8_16.c
index bc0ac9f38ab..db5bba39367 100644
--- a/src/emu/cpu/h83002/h8_16.c
+++ b/src/emu/cpu/h83002/h8_16.c
@@ -212,8 +212,8 @@ static CPU_INIT(h8)
h8->mode_8bit = 0;
- h8->program = cpu_get_address_space(device, ADDRESS_SPACE_PROGRAM);
- h8->io = cpu_get_address_space(device, ADDRESS_SPACE_IO);
+ h8->program = memory_find_address_space(device, ADDRESS_SPACE_PROGRAM);
+ h8->io = memory_find_address_space(device, ADDRESS_SPACE_IO);
state_save_register_device_item(device, 0, h8->h8err);
state_save_register_device_item_array(device, 0, h8->regs);
diff --git a/src/emu/cpu/h83002/h8_8.c b/src/emu/cpu/h83002/h8_8.c
index a89713225f9..09834958d13 100644
--- a/src/emu/cpu/h83002/h8_8.c
+++ b/src/emu/cpu/h83002/h8_8.c
@@ -222,8 +222,8 @@ static CPU_INIT(h8bit)
h8->mode_8bit = 1;
- h8->program = cpu_get_address_space(device, ADDRESS_SPACE_PROGRAM);
- h8->io = cpu_get_address_space(device, ADDRESS_SPACE_IO);
+ h8->program = memory_find_address_space(device, ADDRESS_SPACE_PROGRAM);
+ h8->io = memory_find_address_space(device, ADDRESS_SPACE_IO);
state_save_register_device_item(device, 0, h8->h8err);
state_save_register_device_item_array(device, 0, h8->regs);
diff --git a/src/emu/cpu/hd6309/hd6309.c b/src/emu/cpu/hd6309/hd6309.c
index 5a1a7fd7fba..271408effc6 100644
--- a/src/emu/cpu/hd6309/hd6309.c
+++ b/src/emu/cpu/hd6309/hd6309.c
@@ -513,7 +513,7 @@ static CPU_INIT( hd6309 )
m68_state->irq_callback = irqcallback;
m68_state->device = device;
- m68_state->program = cpu_get_address_space(device, ADDRESS_SPACE_PROGRAM);
+ m68_state->program = memory_find_address_space(device, ADDRESS_SPACE_PROGRAM);
/* setup regtable */
diff --git a/src/emu/cpu/jaguar/jaguar.c b/src/emu/cpu/jaguar/jaguar.c
index 3ec7ffde340..7c6a9744bad 100644
--- a/src/emu/cpu/jaguar/jaguar.c
+++ b/src/emu/cpu/jaguar/jaguar.c
@@ -409,7 +409,7 @@ static void init_common(int isdsp, const device_config *device, cpu_irq_callback
jaguar->irq_callback = irqcallback;
jaguar->device = device;
- jaguar->program = cpu_get_address_space(device, ADDRESS_SPACE_PROGRAM);
+ jaguar->program = memory_find_address_space(device, ADDRESS_SPACE_PROGRAM);
if (configdata != NULL)
jaguar->cpu_interrupt = configdata->cpu_int_callback;
diff --git a/src/emu/cpu/m6800/m6800.c b/src/emu/cpu/m6800/m6800.c
index 58e16695a2f..99495284d68 100644
--- a/src/emu/cpu/m6800/m6800.c
+++ b/src/emu/cpu/m6800/m6800.c
@@ -886,9 +886,9 @@ static CPU_INIT( m6800 )
{
m6800_state *cpustate = device->token;
- cpustate->program = cpu_get_address_space(device, ADDRESS_SPACE_PROGRAM);
- cpustate->data = cpu_get_address_space(device, ADDRESS_SPACE_DATA);
- cpustate->io = cpu_get_address_space(device, ADDRESS_SPACE_IO);
+ cpustate->program = memory_find_address_space(device, ADDRESS_SPACE_PROGRAM);
+ cpustate->data = memory_find_address_space(device, ADDRESS_SPACE_DATA);
+ cpustate->io = memory_find_address_space(device, ADDRESS_SPACE_IO);
// cpustate->subtype = SUBTYPE_M6800;
cpustate->insn = m6800_insn;
@@ -1283,9 +1283,9 @@ static CPU_INIT( m6801 )
cpustate->irq_callback = irqcallback;
cpustate->device = device;
- cpustate->program = cpu_get_address_space(device, ADDRESS_SPACE_PROGRAM);
- cpustate->data = cpu_get_address_space(device, ADDRESS_SPACE_DATA);
- cpustate->io = cpu_get_address_space(device, ADDRESS_SPACE_IO);
+ cpustate->program = memory_find_address_space(device, ADDRESS_SPACE_PROGRAM);
+ cpustate->data = memory_find_address_space(device, ADDRESS_SPACE_DATA);
+ cpustate->io = memory_find_address_space(device, ADDRESS_SPACE_IO);
cpustate->clock = device->clock / 4;
cpustate->m6800_rx_timer = timer_alloc(device->machine, m6800_rx_tick, cpustate);
@@ -1308,9 +1308,9 @@ static CPU_INIT( m6802 )
cpustate->irq_callback = irqcallback;
cpustate->device = device;
- cpustate->program = cpu_get_address_space(device, ADDRESS_SPACE_PROGRAM);
- cpustate->data = cpu_get_address_space(device, ADDRESS_SPACE_DATA);
- cpustate->io = cpu_get_address_space(device, ADDRESS_SPACE_IO);
+ cpustate->program = memory_find_address_space(device, ADDRESS_SPACE_PROGRAM);
+ cpustate->data = memory_find_address_space(device, ADDRESS_SPACE_DATA);
+ cpustate->io = memory_find_address_space(device, ADDRESS_SPACE_IO);
state_register(cpustate, "m6802");
}
@@ -1329,9 +1329,9 @@ static CPU_INIT( m6803 )
cpustate->irq_callback = irqcallback;
cpustate->device = device;
- cpustate->program = cpu_get_address_space(device, ADDRESS_SPACE_PROGRAM);
- cpustate->data = cpu_get_address_space(device, ADDRESS_SPACE_DATA);
- cpustate->io = cpu_get_address_space(device, ADDRESS_SPACE_IO);
+ cpustate->program = memory_find_address_space(device, ADDRESS_SPACE_PROGRAM);
+ cpustate->data = memory_find_address_space(device, ADDRESS_SPACE_DATA);
+ cpustate->io = memory_find_address_space(device, ADDRESS_SPACE_IO);
cpustate->clock = device->clock / 4;
cpustate->m6800_rx_timer = timer_alloc(device->machine, m6800_rx_tick, cpustate);
@@ -1669,9 +1669,9 @@ static CPU_INIT( m6808 )
cpustate->irq_callback = irqcallback;
cpustate->device = device;
- cpustate->program = cpu_get_address_space(device, ADDRESS_SPACE_PROGRAM);
- cpustate->data = cpu_get_address_space(device, ADDRESS_SPACE_DATA);
- cpustate->io = cpu_get_address_space(device, ADDRESS_SPACE_IO);
+ cpustate->program = memory_find_address_space(device, ADDRESS_SPACE_PROGRAM);
+ cpustate->data = memory_find_address_space(device, ADDRESS_SPACE_DATA);
+ cpustate->io = memory_find_address_space(device, ADDRESS_SPACE_IO);
state_register(cpustate, "m6808");
}
@@ -1691,9 +1691,9 @@ static CPU_INIT( hd63701 )
cpustate->irq_callback = irqcallback;
cpustate->device = device;
- cpustate->program = cpu_get_address_space(device, ADDRESS_SPACE_PROGRAM);
- cpustate->data = cpu_get_address_space(device, ADDRESS_SPACE_DATA);
- cpustate->io = cpu_get_address_space(device, ADDRESS_SPACE_IO);
+ cpustate->program = memory_find_address_space(device, ADDRESS_SPACE_PROGRAM);
+ cpustate->data = memory_find_address_space(device, ADDRESS_SPACE_DATA);
+ cpustate->io = memory_find_address_space(device, ADDRESS_SPACE_IO);
cpustate->clock = device->clock / 4;
cpustate->m6800_rx_timer = timer_alloc(device->machine, m6800_rx_tick, cpustate);
@@ -2041,9 +2041,9 @@ static CPU_INIT( nsc8105 )
// cpustate->subtype = SUBTYPE_NSC8105;
cpustate->device = device;
- cpustate->program = cpu_get_address_space(device, ADDRESS_SPACE_PROGRAM);
- cpustate->data = cpu_get_address_space(device, ADDRESS_SPACE_DATA);
- cpustate->io = cpu_get_address_space(device, ADDRESS_SPACE_IO);
+ cpustate->program = memory_find_address_space(device, ADDRESS_SPACE_PROGRAM);
+ cpustate->data = memory_find_address_space(device, ADDRESS_SPACE_DATA);
+ cpustate->io = memory_find_address_space(device, ADDRESS_SPACE_IO);
cpustate->insn = nsc8105_insn;
cpustate->cycles = cycles_nsc8105;
diff --git a/src/emu/cpu/m68000/m68kcpu.c b/src/emu/cpu/m68000/m68kcpu.c
index f23acb8ae34..0244b1c53bd 100644
--- a/src/emu/cpu/m68000/m68kcpu.c
+++ b/src/emu/cpu/m68000/m68kcpu.c
@@ -504,7 +504,7 @@ static CPU_INIT( m68k )
m68ki_cpu_core *m68k = device->token;
m68k->device = device;
- m68k->program = cpu_get_address_space(device, ADDRESS_SPACE_PROGRAM);
+ m68k->program = memory_find_address_space(device, ADDRESS_SPACE_PROGRAM);
m68k->int_ack_callback = irqcallback;
/* The first call to this function initializes the opcode handler jump table */
diff --git a/src/emu/cpu/m6809/m6809.c b/src/emu/cpu/m6809/m6809.c
index 4c3b876706f..b39bbd0fb32 100644
--- a/src/emu/cpu/m6809/m6809.c
+++ b/src/emu/cpu/m6809/m6809.c
@@ -373,7 +373,7 @@ static CPU_INIT( m6809 )
m68_state->irq_callback = irqcallback;
m68_state->device = device;
- m68_state->program = cpu_get_address_space(device, ADDRESS_SPACE_PROGRAM);
+ m68_state->program = memory_find_address_space(device, ADDRESS_SPACE_PROGRAM);
/* setup regtable */
diff --git a/src/emu/cpu/mcs48/mcs48.c b/src/emu/cpu/mcs48/mcs48.c
index d3261be0c61..11e6cc018c8 100644
--- a/src/emu/cpu/mcs48/mcs48.c
+++ b/src/emu/cpu/mcs48/mcs48.c
@@ -709,9 +709,9 @@ static void mcs48_init(const device_config *device, cpu_irq_callback irqcallback
cpustate->device = device;
cpustate->int_rom_size = romsize;
- cpustate->program = cpu_get_address_space(device, ADDRESS_SPACE_PROGRAM);
- cpustate->data = cpu_get_address_space(device, ADDRESS_SPACE_DATA);
- cpustate->io = cpu_get_address_space(device, ADDRESS_SPACE_IO);
+ cpustate->program = memory_find_address_space(device, ADDRESS_SPACE_PROGRAM);
+ cpustate->data = memory_find_address_space(device, ADDRESS_SPACE_DATA);
+ cpustate->io = memory_find_address_space(device, ADDRESS_SPACE_IO);
/* ensure that regptr is valid before get_info gets called */
update_regptr(cpustate);
diff --git a/src/emu/cpu/mcs51/mcs51.c b/src/emu/cpu/mcs51/mcs51.c
index 7c4636c4bf0..edd7066ce9d 100644
--- a/src/emu/cpu/mcs51/mcs51.c
+++ b/src/emu/cpu/mcs51/mcs51.c
@@ -2050,9 +2050,9 @@ static CPU_INIT( mcs51 )
mcs51_state->irq_callback = irqcallback;
mcs51_state->device = device;
- mcs51_state->program = cpu_get_address_space(device, ADDRESS_SPACE_PROGRAM);
- mcs51_state->data = cpu_get_address_space(device, ADDRESS_SPACE_DATA);
- mcs51_state->io = cpu_get_address_space(device, ADDRESS_SPACE_IO);
+ mcs51_state->program = memory_find_address_space(device, ADDRESS_SPACE_PROGRAM);
+ mcs51_state->data = memory_find_address_space(device, ADDRESS_SPACE_DATA);
+ mcs51_state->io = memory_find_address_space(device, ADDRESS_SPACE_IO);
mcs51_state->features = FEATURE_NONE;
mcs51_state->ram_mask = 0x7F; /* 128 bytes of ram */
diff --git a/src/emu/cpu/mips/psx.c b/src/emu/cpu/mips/psx.c
index 04f7e8a641a..cf1ea4d5728 100644
--- a/src/emu/cpu/mips/psx.c
+++ b/src/emu/cpu/mips/psx.c
@@ -1626,7 +1626,7 @@ static CPU_INIT( psxcpu )
psxcpu->irq_callback = irqcallback;
psxcpu->device = device;
- psxcpu->program = cpu_get_address_space(device, ADDRESS_SPACE_PROGRAM);
+ psxcpu->program = memory_find_address_space(device, ADDRESS_SPACE_PROGRAM);
mips_state_register( "psxcpu", device );
}
diff --git a/src/emu/cpu/sh2/sh2comn.c b/src/emu/cpu/sh2/sh2comn.c
index d3b32a7cde9..6654dd147d3 100644
--- a/src/emu/cpu/sh2/sh2comn.c
+++ b/src/emu/cpu/sh2/sh2comn.c
@@ -724,8 +724,8 @@ void sh2_common_init(SH2 *sh2, const device_config *device, cpu_irq_callback irq
}
sh2->irq_callback = irqcallback;
sh2->device = device;
- sh2->program = cpu_get_address_space(device, ADDRESS_SPACE_PROGRAM);
- sh2->internal = cpu_get_address_space(device, ADDRESS_SPACE_PROGRAM);
+ sh2->program = memory_find_address_space(device, ADDRESS_SPACE_PROGRAM);
+ sh2->internal = memory_find_address_space(device, ADDRESS_SPACE_PROGRAM);
state_save_register_device_item(device, 0, sh2->pc);
state_save_register_device_item(device, 0, sh2->r[15]);
diff --git a/src/emu/cpu/sh4/sh4.c b/src/emu/cpu/sh4/sh4.c
index b0265434e2c..a9427fbcafd 100644
--- a/src/emu/cpu/sh4/sh4.c
+++ b/src/emu/cpu/sh4/sh4.c
@@ -3270,9 +3270,9 @@ static CPU_RESET( sh4 )
sh4->ftcsr_read_callback = f;
sh4->irq_callback = save_irqcallback;
sh4->device = device;
- sh4->internal = cpu_get_address_space(device, ADDRESS_SPACE_PROGRAM);
- sh4->program = cpu_get_address_space(device, ADDRESS_SPACE_PROGRAM);
- sh4->io = cpu_get_address_space(device, ADDRESS_SPACE_IO);
+ sh4->internal = memory_find_address_space(device, ADDRESS_SPACE_PROGRAM);
+ sh4->program = memory_find_address_space(device, ADDRESS_SPACE_PROGRAM);
+ sh4->io = memory_find_address_space(device, ADDRESS_SPACE_IO);
sh4->dma_timer[0] = tsaved[0];
sh4->dma_timer[1] = tsaved[1];
@@ -3383,9 +3383,9 @@ static CPU_INIT( sh4 )
sh4->irq_callback = irqcallback;
sh4->device = device;
- sh4->internal = cpu_get_address_space(device, ADDRESS_SPACE_PROGRAM);
- sh4->program = cpu_get_address_space(device, ADDRESS_SPACE_PROGRAM);
- sh4->io = cpu_get_address_space(device, ADDRESS_SPACE_IO);
+ sh4->internal = memory_find_address_space(device, ADDRESS_SPACE_PROGRAM);
+ sh4->program = memory_find_address_space(device, ADDRESS_SPACE_PROGRAM);
+ sh4->io = memory_find_address_space(device, ADDRESS_SPACE_IO);
sh4_default_exception_priorities(sh4);
sh4->irln = 15;
sh4->test_irq = 0;
diff --git a/src/emu/cpu/tms32031/tms32031.c b/src/emu/cpu/tms32031/tms32031.c
index 57fe252a8e3..08e533fba42 100644
--- a/src/emu/cpu/tms32031/tms32031.c
+++ b/src/emu/cpu/tms32031/tms32031.c
@@ -364,7 +364,7 @@ static CPU_INIT( tms32031 )
tms->irq_callback = irqcallback;
tms->device = device;
- tms->program = cpu_get_address_space(device, ADDRESS_SPACE_PROGRAM);
+ tms->program = memory_find_address_space(device, ADDRESS_SPACE_PROGRAM);
/* copy in the xf write routines */
tms->bootoffset = (configdata != NULL) ? configdata->bootoffset : 0;
diff --git a/src/emu/cpu/tms34010/tms34010.c b/src/emu/cpu/tms34010/tms34010.c
index 42ca8e2517b..ab19ca3ec03 100644
--- a/src/emu/cpu/tms34010/tms34010.c
+++ b/src/emu/cpu/tms34010/tms34010.c
@@ -740,7 +740,7 @@ static CPU_RESET( tms34010 )
/* the first time we are run */
tms->reset_deferred = tms->config->halt_on_reset;
if (tms->config->halt_on_reset)
- tms34010_io_register_w(cpu_get_address_space(device, ADDRESS_SPACE_PROGRAM), REG_HSTCTLH, 0x8000, 0xffff);
+ tms34010_io_register_w(memory_find_address_space(device, ADDRESS_SPACE_PROGRAM), REG_HSTCTLH, 0x8000, 0xffff);
}
@@ -1636,7 +1636,7 @@ void tms34010_host_w(const device_config *cpu, int reg, int data)
/* control register */
case TMS34010_HOST_CONTROL:
tms->external_host_access = TRUE;
- space = cpu_get_address_space(tms->device, ADDRESS_SPACE_PROGRAM);
+ space = memory_find_address_space(tms->device, ADDRESS_SPACE_PROGRAM);
tms34010_io_register_w(space, REG_HSTCTLH, data & 0xff00, 0xffff);
tms34010_io_register_w(space, REG_HSTCTLL, data & 0x00ff, 0xffff);
tms->external_host_access = FALSE;
diff --git a/src/emu/cpu/z80/z80.c b/src/emu/cpu/z80/z80.c
index dbac35387e9..53582fa4b76 100644
--- a/src/emu/cpu/z80/z80.c
+++ b/src/emu/cpu/z80/z80.c
@@ -3447,8 +3447,8 @@ static CPU_INIT( z80 )
z80->daisy = z80daisy_init(device, device->static_config);
z80->irq_callback = irqcallback;
z80->device = device;
- z80->program = cpu_get_address_space(device, ADDRESS_SPACE_PROGRAM);
- z80->io = cpu_get_address_space(device, ADDRESS_SPACE_IO);
+ z80->program = memory_find_address_space(device, ADDRESS_SPACE_PROGRAM);
+ z80->io = memory_find_address_space(device, ADDRESS_SPACE_IO);
z80->IX = z80->IY = 0xffff; /* IX and IY are FFFF after a reset! */
z80->F = ZF; /* Zero flag is set */
diff --git a/src/emu/cpuexec.c b/src/emu/cpuexec.c
index 3f6b5002288..d60c8ebb89b 100644
--- a/src/emu/cpuexec.c
+++ b/src/emu/cpuexec.c
@@ -62,6 +62,7 @@ struct _cpu_class_data
/* execution lists */
const device_config *device; /* pointer back to our device */
cpu_class_data *next; /* pointer to the next CPU to execute, in order */
+ cpu_execute_func execute; /* execute function pointer */
/* cycle counting and executing */
int profiler; /* profiler tag */
@@ -325,11 +326,11 @@ void cpuexec_timeslice(running_machine *machine)
classdata->cycles_stolen = 0;
global->executingcpu = classdata->device;
if (!call_debugger)
- ran = cpu_execute(classdata->device, classdata->cycles_running);
+ ran = (*classdata->execute)(classdata->device, classdata->cycles_running);
else
{
debugger_start_cpu_hook(classdata->device, target);
- ran = cpu_execute(classdata->device, classdata->cycles_running);
+ ran = (*classdata->execute)(classdata->device, classdata->cycles_running);
debugger_stop_cpu_hook(classdata->device);
}
@@ -469,11 +470,6 @@ static DEVICE_START( cpu )
header->space[spacenum] = memory_find_address_space(device, spacenum);
header->set_info = (cpu_set_info_func)device_get_info_fct(device, CPUINFO_FCT_SET_INFO);
- header->execute = (cpu_execute_func)device_get_info_fct(device, CPUINFO_FCT_EXECUTE);
- header->burn = (cpu_burn_func)device_get_info_fct(device, CPUINFO_FCT_BURN);
- header->translate = (cpu_translate_func)device_get_info_fct(device, CPUINFO_FCT_TRANSLATE);
- header->disassemble = (cpu_disassemble_func)device_get_info_fct(device, CPUINFO_FCT_DISASSEMBLE);
- header->dasm_override = NULL;
/* fill in the input states and IRQ callback information */
for (line = 0; line < ARRAY_LENGTH(classdata->input); line++)
@@ -486,6 +482,7 @@ static DEVICE_START( cpu )
/* fill in the suspend states */
classdata->device = device;
+ classdata->execute = (cpu_execute_func)device_get_info_fct(device, CPUINFO_FCT_EXECUTE);
classdata->profiler = index + PROFILER_CPU1;
classdata->suspend = SUSPEND_REASON_RESET;
classdata->inttrigger = index + TRIGGER_INT;
diff --git a/src/emu/cpuexec.h b/src/emu/cpuexec.h
index 6bd1933259d..19028ae9272 100644
--- a/src/emu/cpuexec.h
+++ b/src/emu/cpuexec.h
@@ -49,6 +49,11 @@ enum
TYPE DEFINITIONS
***************************************************************************/
+/* opaque definition of CPU internal and debugging info */
+typedef struct _cpu_debug_data cpu_debug_data;
+
+
+/* interrupt callback for VBLANK and timed interrupts */
typedef void (*cpu_interrupt_func)(const device_config *device);
@@ -68,6 +73,16 @@ struct _cpu_config
};
+/* public data at the end of the device->token */
+typedef struct _cpu_class_header cpu_class_header;
+struct _cpu_class_header
+{
+ cpu_debug_data * debug; /* debugging data */
+ const address_space * space[ADDRESS_SPACES]; /* address spaces */
+ cpu_set_info_func set_info; /* this CPU's set_info function */
+};
+
+
/***************************************************************************
CPU DEVICE CONFIGURATION MACROS
@@ -133,6 +148,9 @@ struct _cpu_config
#define cputag_get_cpu(mach, tag) devtag_get_device(mach, CPU, tag)
/* helpers for using machine/cputag instead of cpu objects */
+#define cputag_reset(mach, tag) devtag_reset(mach, CPU, tag)
+#define cputag_get_index(mach, tag) cpu_get_index(cputag_get_cpu(mach, tag))
+#define cputag_get_address_space(mach, tag, space) cpu_get_address_space(cputag_get_cpu(mach, tag), space)
#define cputag_suspend(mach, tag, reason, eat) cpu_suspend(cputag_get_cpu(mach, tag), reason, eat)
#define cputag_resume(mach, tag, reason) cpu_resume(cputag_get_cpu(mach, tag), reason)
#define cputag_is_suspended(mach, tag, reason) cpu_is_suspended(cputag_get_cpu(mach, tag), reason)
@@ -292,7 +310,6 @@ void cpu_set_irq_callback(const device_config *cpu, cpu_irq_callback callback);
INLINE FUNCTIONS
***************************************************************************/
-
/*-------------------------------------------------
cpu_get_type - return the type of the
specified CPU
@@ -305,5 +322,45 @@ INLINE cpu_type cpu_get_type(const device_config *device)
}
+/*-------------------------------------------------
+ cpu_get_class_header - return a pointer to
+ the class header
+-------------------------------------------------*/
+
+INLINE cpu_class_header *cpu_get_class_header(const device_config *device)
+{
+ if (device->token != NULL)
+ return (cpu_class_header *)((UINT8 *)device->token + device->tokenbytes) - 1;
+ return NULL;
+}
+
+
+/*-------------------------------------------------
+ cpu_get_debug_data - return a pointer to
+ the given CPU's debugger data
+-------------------------------------------------*/
+
+INLINE cpu_debug_data *cpu_get_debug_data(const device_config *device)
+{
+ cpu_class_header *classheader = cpu_get_class_header(device);
+ return classheader->debug;
+}
+
+
+/*-------------------------------------------------
+ cpu_get_address_space - return a pointer to
+ the given CPU's address space
+-------------------------------------------------*/
+
+INLINE const address_space *cpu_get_address_space(const device_config *device, int spacenum)
+{
+ /* it is faster to pull this from the class header, but only after we've started */
+ if (device->token != NULL)
+ {
+ cpu_class_header *classheader = cpu_get_class_header(device);
+ return classheader->space[spacenum];
+ }
+ return memory_find_address_space(device, spacenum);
+}
#endif /* __CPUEXEC_H__ */
diff --git a/src/emu/cpuintrf.c b/src/emu/cpuintrf.c
deleted file mode 100644
index ee29aa20468..00000000000
--- a/src/emu/cpuintrf.c
+++ /dev/null
@@ -1,207 +0,0 @@
-/***************************************************************************
-
- cpuintrf.c
-
- Core CPU interface functions and definitions.
-
- Copyright Nicola Salmoria and the MAME Team.
- Visit http://mamedev.org for licensing and usage restrictions.
-
-***************************************************************************/
-
-#include "driver.h"
-
-/* mingw-gcc defines this */
-#undef i386
-
-
-/***************************************************************************
- DEBUGGING
-***************************************************************************/
-
-#define VERBOSE 0
-
-#define LOG(x) do { if (VERBOSE) logerror x; } while (0)
-
-
-
-/***************************************************************************
- CONSTANTS
-***************************************************************************/
-
-#define TEMP_STRING_POOL_ENTRIES 16
-#define MAX_STRING_LENGTH 256
-
-
-
-/***************************************************************************
- LIVE CPU ACCESSORS
-***************************************************************************/
-
-/*-------------------------------------------------
- cpu_get_physical_pc_byte - return the PC,
- corrected to a byte offset and translated to
- physical space, on a given CPU
--------------------------------------------------*/
-
-offs_t cpu_get_physical_pc_byte(const device_config *device)
-{
- const address_space *space = cpu_get_address_space(device, ADDRESS_SPACE_PROGRAM);
- offs_t pc;
-
- pc = memory_address_to_byte(space, device_get_info_int(device, CPUINFO_INT_PC));
- memory_address_physical(space, TRANSLATE_FETCH, &pc);
- return pc;
-}
-
-
-/*-------------------------------------------------
- cpu_dasm - disassemble a line at a given PC
- on a given CPU
--------------------------------------------------*/
-
-offs_t cpu_dasm(const device_config *device, char *buffer, offs_t pc, const UINT8 *oprom, const UINT8 *opram)
-{
- cpu_class_header *classheader = cpu_get_class_header(device);
- offs_t result = 0;
-
- /* check for disassembler override */
- if (classheader->dasm_override != NULL)
- result = (*classheader->dasm_override)(device, buffer, pc, oprom, opram);
-
- /* if we have a disassembler, run it */
- if (result == 0 && classheader->disassemble != NULL)
- result = (*classheader->disassemble)(device, buffer, pc, oprom, opram);
-
- /* if we still have nothing, output vanilla bytes */
- if (result == 0)
- {
- result = cpu_get_min_opcode_bytes(device);
- switch (result)
- {
- case 1:
- default:
- sprintf(buffer, "$%02X", *(UINT8 *)oprom);
- break;
-
- case 2:
- sprintf(buffer, "$%04X", *(UINT16 *)oprom);
- break;
-
- case 4:
- sprintf(buffer, "$%08X", *(UINT32 *)oprom);
- break;
-
- case 8:
- sprintf(buffer, "$%08X%08X", (UINT32)(*(UINT64 *)oprom >> 32), (UINT32)(*(UINT64 *)oprom >> 0));
- break;
- }
- }
-
- /* make sure we get good results */
- assert((result & DASMFLAG_LENGTHMASK) != 0);
-#ifdef MAME_DEBUG
-{
- const address_space *space = classheader->space[ADDRESS_SPACE_PROGRAM];
- int bytes = memory_address_to_byte(space, result & DASMFLAG_LENGTHMASK);
- assert(bytes >= cpu_get_min_opcode_bytes(device));
- assert(bytes <= cpu_get_max_opcode_bytes(device));
- (void) bytes; /* appease compiler */
-}
-#endif
-
- return result;
-}
-
-
-/*-------------------------------------------------
- cpu_set_dasm_override - set a dasm override
- handler
--------------------------------------------------*/
-
-void cpu_set_dasm_override(const device_config *device, cpu_disassemble_func dasm_override)
-{
- cpu_class_header *classheader = cpu_get_class_header(device);
- classheader->dasm_override = dasm_override;
-}
-
-
-
-/***************************************************************************
- DUMMY CPU DEFINITION
-***************************************************************************/
-
-typedef struct _dummy_context dummy_context;
-struct _dummy_context
-{
- int icount;
-};
-
-static CPU_INIT( dummy ) { }
-static CPU_RESET( dummy ) { }
-static CPU_EXIT( dummy ) { }
-static CPU_EXECUTE( dummy ) { return cycles; }
-
-static CPU_DISASSEMBLE( dummy )
-{
- strcpy(buffer, "???");
- return 1;
-}
-
-static CPU_SET_INFO( dummy )
-{
-}
-
-CPU_GET_INFO( dummy )
-{
- dummy_context *cpustate = (device != NULL) ? device->token : NULL;
- switch (state)
- {
- /* --- the following bits of info are returned as 64-bit signed integers --- */
- case CPUINFO_INT_CONTEXT_SIZE: info->i = sizeof(dummy_context); break;
- case CPUINFO_INT_INPUT_LINES: info->i = 1; break;
- case CPUINFO_INT_DEFAULT_IRQ_VECTOR: info->i = 0; break;
- case CPUINFO_INT_ENDIANNESS: info->i = ENDIANNESS_LITTLE; break;
- case CPUINFO_INT_CLOCK_MULTIPLIER: info->i = 1; break;
- case CPUINFO_INT_CLOCK_DIVIDER: info->i = 1; break;
- case CPUINFO_INT_MIN_INSTRUCTION_BYTES: info->i = 1; break;
- case CPUINFO_INT_MAX_INSTRUCTION_BYTES: info->i = 1; break;
- case CPUINFO_INT_MIN_CYCLES: info->i = 1; break;
- case CPUINFO_INT_MAX_CYCLES: info->i = 1; break;
-
- case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_PROGRAM: info->i = 8; break;
- case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_PROGRAM: info->i = 16; break;
- case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_PROGRAM: info->i = 0; break;
- case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_DATA: info->i = 0; break;
- case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_DATA: info->i = 0; break;
- case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_DATA: info->i = 0; break;
- case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_IO: info->i = 0; break;
- case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_IO: info->i = 0; break;
- case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_IO: info->i = 0; break;
-
- case CPUINFO_INT_INPUT_STATE + 0: info->i = 0; break;
-
- case CPUINFO_INT_PREVIOUSPC: info->i = 0; break;
- case CPUINFO_INT_PC: info->i = 0; break;
- case CPUINFO_INT_SP: info->i = 0; break;
-
- /* --- the following bits of info are returned as pointers to data or functions --- */
- case CPUINFO_FCT_SET_INFO: info->setinfo = CPU_SET_INFO_NAME(dummy); break;
- case CPUINFO_FCT_INIT: info->init = CPU_INIT_NAME(dummy); break;
- case CPUINFO_FCT_RESET: info->reset = CPU_RESET_NAME(dummy); break;
- case CPUINFO_FCT_EXIT: info->exit = CPU_EXIT_NAME(dummy); break;
- case CPUINFO_FCT_EXECUTE: info->execute = CPU_EXECUTE_NAME(dummy);break;
- case CPUINFO_FCT_BURN: info->burn = NULL; break;
- case CPUINFO_FCT_DISASSEMBLE: info->disassemble = CPU_DISASSEMBLE_NAME(dummy); break;
- case CPUINFO_PTR_INSTRUCTION_COUNTER: info->icount = &cpustate->icount; break;
-
- /* --- the following bits of info are returned as NULL-terminated strings --- */
- case CPUINFO_STR_NAME: strcpy(info->s, ""); break;
- case CPUINFO_STR_CORE_FAMILY: strcpy(info->s, "no CPU"); break;
- case CPUINFO_STR_CORE_VERSION: strcpy(info->s, "0.0"); break;
- case CPUINFO_STR_CORE_FILE: strcpy(info->s, __FILE__); break;
- case CPUINFO_STR_CORE_CREDITS: strcpy(info->s, "The MAME team"); break;
-
- case CPUINFO_STR_FLAGS: strcpy(info->s, "--"); break;
- }
-}
diff --git a/src/emu/cpuintrf.h b/src/emu/cpuintrf.h
index 4d01282ef21..ce9979fa033 100644
--- a/src/emu/cpuintrf.h
+++ b/src/emu/cpuintrf.h
@@ -25,7 +25,6 @@
CONSTANTS
***************************************************************************/
-#define MAX_CPU 8
#define MAX_INPUT_EVENTS 32
@@ -229,8 +228,18 @@ enum
MACROS
***************************************************************************/
-#define IRQ_CALLBACK(func) int func(const device_config *device, int irqline)
+/* device iteration helpers */
+#define cpu_count(config) device_list_items((config)->devicelist, CPU)
+#define cpu_first(config) device_list_first((config)->devicelist, CPU)
+#define cpu_next(previous) ((previous)->typenext)
+#define cpu_get_index(cpu) device_list_index((cpu)->machine->config->devicelist, CPU, (cpu)->tag)
+
+/* IRQ callback to be called by CPU cores when an IRQ is actually taken */
+#define IRQ_CALLBACK(func) int func(const device_config *device, int irqline)
+
+
+/* CPU interface functions */
#define CPU_GET_INFO_NAME(name) cpu_get_info_##name
#define CPU_GET_INFO(name) void CPU_GET_INFO_NAME(name)(const device_config *device, UINT32 state, cpuinfo *info)
#define CPU_GET_INFO_CALL(name) CPU_GET_INFO_NAME(name)(device, state, info)
@@ -304,8 +313,9 @@ enum
#define CPU_EXPORT_STRING_CALL(name) CPU_EXPORT_STRING_NAME(name)(device, baseptr, entry, string)
-
-#define cpu_get_index(cpu) device_list_index((cpu)->machine->config->devicelist, CPU, (cpu)->tag)
+/* base macro for defining CPU state entries */
+#define CPU_STATE_ENTRY(_index, _symbol, _format, _struct, _member, _datamask, _validmask, _flags) \
+ { _index, _validmask, offsetof(_struct, _member), _datamask, sizeof(((_struct *)0)->_member), _flags, _symbol, _format },
/* helpers for accessing common CPU state */
@@ -342,33 +352,21 @@ enum
#define cpu_set_reg(cpu, reg, val) device_set_info_int(cpu, CPUINFO_INT_REGISTER + (reg), (val))
-/* helpers for using machine/cputag instead of cpu objects */
-#define cputag_reset(mach, tag) device_reset(cputag_get_cpu(mach, tag))
-#define cputag_get_index(mach, tag) cpu_get_index(cputag_get_cpu(mach, tag))
-#define cputag_get_address_space(mach, tag, space) cpu_get_address_space(cputag_get_cpu(mach, tag), space)
-
-
-#define CPU_STATE_ENTRY(_index, _symbol, _format, _struct, _member, _datamask, _validmask, _flags) \
- { _index, _validmask, offsetof(_struct, _member), _datamask, sizeof(((_struct *)0)->_member), _flags, _symbol, _format },
-
-
/***************************************************************************
TYPE DEFINITIONS
***************************************************************************/
-/* opaque definition of CPU internal and debugging info */
-typedef struct _cpu_debug_data cpu_debug_data;
-
-
/* forward declaration of types */
typedef union _cpuinfo cpuinfo;
typedef struct _cpu_state_entry cpu_state_entry;
-/* define the various callback functions */
+/* IRQ callback to be called by CPU cores when an IRQ is actually taken */
typedef int (*cpu_irq_callback)(const device_config *device, int irqnum);
+
+/* CPU interface functions */
typedef void (*cpu_get_info_func)(const device_config *device, UINT32 state, cpuinfo *info);
typedef void (*cpu_set_info_func)(const device_config *device, UINT32 state, cpuinfo *info);
typedef void (*cpu_init_func)(const device_config *device, cpu_irq_callback irqcallback);
@@ -387,6 +385,10 @@ typedef void (*cpu_state_io_func)(const device_config *device, void *baseptr, co
typedef void (*cpu_string_io_func)(const device_config *device, void *baseptr, const cpu_state_entry *entry, char *string);
+/* a cpu_type is just a pointer to the CPU's get_info function */
+typedef cpu_get_info_func cpu_type;
+
+
/* structure describing a single item of exposed CPU state */
struct _cpu_state_entry
{
@@ -412,10 +414,6 @@ struct _cpu_state_table
};
-/* a cpu_type is just a pointer to the CPU's get_info function */
-typedef cpu_get_info_func cpu_type;
-
-
/* cpuinfo union used to pass data to/from the get_info/set_info functions */
union _cpuinfo
{
@@ -450,112 +448,5 @@ union _cpuinfo
};
-/* partial data hanging off of the classtoken */
-typedef struct _cpu_class_header cpu_class_header;
-struct _cpu_class_header
-{
- cpu_debug_data * debug; /* debugging data */
- const address_space * space[ADDRESS_SPACES]; /* address spaces */
-
- /* table of core functions */
- cpu_set_info_func set_info;
- cpu_execute_func execute;
- cpu_burn_func burn;
- cpu_translate_func translate;
- cpu_disassemble_func disassemble;
- cpu_disassemble_func dasm_override;
-};
-
-
-
-/***************************************************************************
- CPU DEFINITIONS
-***************************************************************************/
-
-#define cpu_count(config) device_list_items((config)->devicelist, CPU)
-#define cpu_first(config) device_list_first((config)->devicelist, CPU)
-#define cpu_next(previous) device_list_next((previous), CPU)
-
-
-CPU_GET_INFO( dummy );
-#define CPU_DUMMY CPU_GET_INFO_NAME( dummy )
-
-
-
-/***************************************************************************
- FUNCTION PROTOTYPES
-***************************************************************************/
-
-
-/* ----- live CPU accessors ----- */
-
-/* return the PC, corrected to a byte offset and translated to physical space, on a given CPU */
-offs_t cpu_get_physical_pc_byte(const device_config *cpu);
-
-/* disassemble a line at a given PC on a given CPU */
-offs_t cpu_dasm(const device_config *cpu, char *buffer, offs_t pc, const UINT8 *oprom, const UINT8 *opram);
-
-/* set a dasm override handler */
-void cpu_set_dasm_override(const device_config *cpu, cpu_disassemble_func dasm_override);
-
-
-
-/***************************************************************************
- INLINE FUNCTIONS
-***************************************************************************/
-
-/*-------------------------------------------------
- cpu_get_class_header - return a pointer to
- the class header
--------------------------------------------------*/
-
-INLINE cpu_class_header *cpu_get_class_header(const device_config *device)
-{
- if (device->token != NULL)
- return (cpu_class_header *)((UINT8 *)device->token + device->tokenbytes) - 1;
- return NULL;
-}
-
-
-/*-------------------------------------------------
- cpu_get_debug_data - return a pointer to
- the given CPU's debugger data
--------------------------------------------------*/
-
-INLINE cpu_debug_data *cpu_get_debug_data(const device_config *device)
-{
- cpu_class_header *classheader = cpu_get_class_header(device);
- return classheader->debug;
-}
-
-
-/*-------------------------------------------------
- cpu_get_address_space - return a pointer to
- the given CPU's address space
--------------------------------------------------*/
-
-INLINE const address_space *cpu_get_address_space(const device_config *device, int spacenum)
-{
- /* it is faster to pull this from the class header, but only after we've started */
- if (device->token != NULL)
- {
- cpu_class_header *classheader = cpu_get_class_header(device);
- return classheader->space[spacenum];
- }
- return memory_find_address_space(device, spacenum);
-}
-
-
-/*-------------------------------------------------
- cpu_execute - execute the requested cycles on
- a given CPU
--------------------------------------------------*/
-
-INLINE int cpu_execute(const device_config *device, int cycles)
-{
- cpu_class_header *classheader = cpu_get_class_header(device);
- return (*classheader->execute)(device, cycles);
-}
-
#endif /* __CPUINTRF_H__ */
diff --git a/src/emu/debug/debugcmd.c b/src/emu/debug/debugcmd.c
index a7044118a5d..0abed9ec682 100644
--- a/src/emu/debug/debugcmd.c
+++ b/src/emu/debug/debugcmd.c
@@ -1557,7 +1557,7 @@ static void execute_dump(running_machine *machine, int ref, int params, const ch
if (i + j <= endoffset)
{
offs_t curaddr = i + j;
- if (memory_address_physical(space, TRANSLATE_READ, &curaddr))
+ if (debug_cpu_translate(space, TRANSLATE_READ, &curaddr))
{
UINT8 byte = debug_read_byte(space, i + j, TRUE);
outdex += sprintf(&output[outdex], " %02X", byte);
@@ -1576,7 +1576,7 @@ static void execute_dump(running_machine *machine, int ref, int params, const ch
if (i + j <= endoffset)
{
offs_t curaddr = i + j;
- if (memory_address_physical(space, TRANSLATE_READ_DEBUG, &curaddr))
+ if (debug_cpu_translate(space, TRANSLATE_READ_DEBUG, &curaddr))
{
UINT16 word = debug_read_word(space, i + j, TRUE);
outdex += sprintf(&output[outdex], " %04X", word);
@@ -1595,7 +1595,7 @@ static void execute_dump(running_machine *machine, int ref, int params, const ch
if (i + j <= endoffset)
{
offs_t curaddr = i + j;
- if (memory_address_physical(space, TRANSLATE_READ_DEBUG, &curaddr))
+ if (debug_cpu_translate(space, TRANSLATE_READ_DEBUG, &curaddr))
{
UINT32 dword = debug_read_dword(space, i + j, TRUE);
outdex += sprintf(&output[outdex], " %08X", dword);
@@ -1614,7 +1614,7 @@ static void execute_dump(running_machine *machine, int ref, int params, const ch
if (i + j <= endoffset)
{
offs_t curaddr = i + j;
- if (memory_address_physical(space, TRANSLATE_READ_DEBUG, &curaddr))
+ if (debug_cpu_translate(space, TRANSLATE_READ_DEBUG, &curaddr))
{
UINT64 qword = debug_read_qword(space, i + j, TRUE);
outdex += sprintf(&output[outdex], " %08X%08X", (UINT32)(qword >> 32), (UINT32)qword);
@@ -1635,7 +1635,7 @@ static void execute_dump(running_machine *machine, int ref, int params, const ch
for (j = 0; j < 16 && (i + j) <= endoffset; j++)
{
offs_t curaddr = i + j;
- if (memory_address_physical(space, TRANSLATE_READ_DEBUG, &curaddr))
+ if (debug_cpu_translate(space, TRANSLATE_READ_DEBUG, &curaddr))
{
UINT8 byte = debug_read_byte(space, i + j, TRUE);
outdex += sprintf(&output[outdex], "%c", (byte >= 32 && byte < 128) ? byte : '.');
@@ -1809,7 +1809,7 @@ static void execute_dasm(running_machine *machine, int ref, int params, const ch
/* make sure we can translate the address */
tempaddr = pcbyte;
- if (memory_address_physical(space, TRANSLATE_FETCH_DEBUG, &tempaddr))
+ if (debug_cpu_translate(space, TRANSLATE_FETCH_DEBUG, &tempaddr))
{
UINT8 opbuf[64], argbuf[64];
@@ -1821,7 +1821,7 @@ static void execute_dasm(running_machine *machine, int ref, int params, const ch
}
/* disassemble the result */
- i += numbytes = cpu_dasm(space->cpu, disasm, offset + i, opbuf, argbuf) & DASMFLAG_LENGTHMASK;
+ i += numbytes = debug_cpu_disassemble(space->cpu, disasm, offset + i, opbuf, argbuf) & DASMFLAG_LENGTHMASK;
}
/* print the bytes */
@@ -2012,7 +2012,7 @@ static void execute_history(running_machine *machine, int ref, int params, const
argbuf[numbytes] = debug_read_opcode(space, pcbyte + numbytes, 1, TRUE);
}
- cpu_dasm(space->cpu, buffer, pc, opbuf, argbuf);
+ debug_cpu_disassemble(space->cpu, buffer, pc, opbuf, argbuf);
debug_console_printf(machine, "%0*X: %s\n", space->logaddrchars, pc, buffer);
}
@@ -2102,7 +2102,7 @@ static void execute_map(running_machine *machine, int ref, int params, const cha
{
static const char *const intnames[] = { "Read", "Write", "Fetch" };
taddress = memory_address_to_byte(space, address) & space->bytemask;
- if (memory_address_physical(space, intention, &taddress))
+ if (debug_cpu_translate(space, intention, &taddress))
{
const char *mapname = memory_get_handler_string(space, intention == TRANSLATE_WRITE_DEBUG, taddress);
debug_console_printf(machine, "%7s: %08X logical == %08X physical -> %s\n", intnames[intention & 3], (UINT32)address, memory_byte_to_address(space, taddress), mapname);
diff --git a/src/emu/debug/debugcmt.c b/src/emu/debug/debugcmt.c
index 8b7912dc5d8..6200c76d2d3 100644
--- a/src/emu/debug/debugcmt.c
+++ b/src/emu/debug/debugcmt.c
@@ -328,7 +328,7 @@ UINT32 debug_comment_get_opcode_crc32(const device_config *device, offs_t addres
argbuf[i] = debug_read_opcode(space, address + i, 1, TRUE);
}
- numbytes = cpu_dasm(device, buff, address & addrmask, opbuf, argbuf) & DASMFLAG_LENGTHMASK;
+ numbytes = debug_cpu_disassemble(device, buff, address & addrmask, opbuf, argbuf) & DASMFLAG_LENGTHMASK;
numbytes = memory_address_to_byte(space, numbytes);
crc = crc32(0, argbuf, numbytes);
diff --git a/src/emu/debug/debugcpu.c b/src/emu/debug/debugcpu.c
index 88154cbc2d8..df6a44abe19 100644
--- a/src/emu/debug/debugcpu.c
+++ b/src/emu/debug/debugcpu.c
@@ -203,6 +203,8 @@ void debug_cpu_init(running_machine *machine)
info->read = (cpu_read_func)device_get_info_fct(info->device, CPUINFO_FCT_READ);
info->write = (cpu_write_func)device_get_info_fct(info->device, CPUINFO_FCT_WRITE);
info->readop = (cpu_readop_func)device_get_info_fct(info->device, CPUINFO_FCT_READOP);
+ info->translate = (cpu_translate_func)device_get_info_fct(info->device, CPUINFO_FCT_TRANSLATE);
+ info->disassemble = (cpu_disassemble_func)device_get_info_fct(info->device, CPUINFO_FCT_DISASSEMBLE);
/* allocate a symbol table */
info->symtable = symtable_alloc(global->symtable, (void *)cpu);
@@ -360,6 +362,98 @@ symbol_table *debug_cpu_get_symtable(const device_config *device)
/***************************************************************************
+ MEMORY AND DISASSEMBLY HELPERS
+***************************************************************************/
+
+/*-------------------------------------------------
+ debug_cpu_translate - return the physical
+ address corresponding to the given logical
+ address
+-------------------------------------------------*/
+
+int debug_cpu_translate(const address_space *space, int intention, offs_t *address)
+{
+ cpu_debug_data *info = cpu_get_debug_data(space->cpu);
+ if (info->translate != NULL)
+ return (*info->translate)(space->cpu, space->spacenum, intention, address);
+ else
+ return TRUE;
+}
+
+
+/*-------------------------------------------------
+ debug_cpu_disassemble - disassemble a line at
+ a given PC on a given CPU
+-------------------------------------------------*/
+
+offs_t debug_cpu_disassemble(const device_config *device, char *buffer, offs_t pc, const UINT8 *oprom, const UINT8 *opram)
+{
+ cpu_debug_data *info = cpu_get_debug_data(device);
+ offs_t result = 0;
+
+ /* check for disassembler override */
+ if (info->dasm_override != NULL)
+ result = (*info->dasm_override)(device, buffer, pc, oprom, opram);
+
+ /* if we have a disassembler, run it */
+ if (result == 0 && info->disassemble != NULL)
+ result = (*info->disassemble)(device, buffer, pc, oprom, opram);
+
+ /* if we still have nothing, output vanilla bytes */
+ if (result == 0)
+ {
+ result = cpu_get_min_opcode_bytes(device);
+ switch (result)
+ {
+ case 1:
+ default:
+ sprintf(buffer, "$%02X", *(UINT8 *)oprom);
+ break;
+
+ case 2:
+ sprintf(buffer, "$%04X", *(UINT16 *)oprom);
+ break;
+
+ case 4:
+ sprintf(buffer, "$%08X", *(UINT32 *)oprom);
+ break;
+
+ case 8:
+ sprintf(buffer, "$%08X%08X", (UINT32)(*(UINT64 *)oprom >> 32), (UINT32)(*(UINT64 *)oprom >> 0));
+ break;
+ }
+ }
+
+ /* make sure we get good results */
+ assert((result & DASMFLAG_LENGTHMASK) != 0);
+#ifdef MAME_DEBUG
+{
+ const address_space *space = cpu_get_address_space(device, ADDRESS_SPACE_PROGRAM);
+ int bytes = memory_address_to_byte(space, result & DASMFLAG_LENGTHMASK);
+ assert(bytes >= cpu_get_min_opcode_bytes(device));
+ assert(bytes <= cpu_get_max_opcode_bytes(device));
+ (void) bytes; /* appease compiler */
+}
+#endif
+
+ return result;
+}
+
+
+/*-------------------------------------------------
+ debug_cpu_set_dasm_override - set an override
+ handler for disassembly
+-------------------------------------------------*/
+
+void debug_cpu_set_dasm_override(const device_config *device, cpu_disassemble_func dasm_override)
+{
+ cpu_debug_data *info = cpu_get_debug_data(device);
+ info->dasm_override = dasm_override;
+}
+
+
+
+/***************************************************************************
CORE DEBUGGER HOOKS
***************************************************************************/
@@ -1255,7 +1349,7 @@ UINT8 debug_read_byte(const address_space *space, offs_t address, int apply_tran
memory_set_debugger_access(space, global->debugger_access = TRUE);
/* translate if necessary; if not mapped, return 0xff */
- if (apply_translation && !memory_address_physical(space, TRANSLATE_READ_DEBUG, &address))
+ if (apply_translation && !debug_cpu_translate(space, TRANSLATE_READ_DEBUG, &address))
result = 0xff;
/* if there is a custom read handler, and it returns TRUE, use that value */
@@ -1308,7 +1402,7 @@ UINT16 debug_read_word(const address_space *space, offs_t address, int apply_tra
memory_set_debugger_access(space, global->debugger_access = TRUE);
/* translate if necessary; if not mapped, return 0xffff */
- if (apply_translation && !memory_address_physical(space, TRANSLATE_READ_DEBUG, &address))
+ if (apply_translation && !debug_cpu_translate(space, TRANSLATE_READ_DEBUG, &address))
result = 0xffff;
/* if there is a custom read handler, and it returns TRUE, use that value */
@@ -1363,7 +1457,7 @@ UINT32 debug_read_dword(const address_space *space, offs_t address, int apply_tr
memory_set_debugger_access(space, global->debugger_access = TRUE);
/* translate if necessary; if not mapped, return 0xffffffff */
- if (apply_translation && !memory_address_physical(space, TRANSLATE_READ_DEBUG, &address))
+ if (apply_translation && !debug_cpu_translate(space, TRANSLATE_READ_DEBUG, &address))
result = 0xffffffff;
/* if there is a custom read handler, and it returns TRUE, use that value */
@@ -1418,7 +1512,7 @@ UINT64 debug_read_qword(const address_space *space, offs_t address, int apply_tr
memory_set_debugger_access(space, global->debugger_access = TRUE);
/* translate if necessary; if not mapped, return 0xffffffffffffffff */
- if (apply_translation && !memory_address_physical(space, TRANSLATE_READ_DEBUG, &address))
+ if (apply_translation && !debug_cpu_translate(space, TRANSLATE_READ_DEBUG, &address))
result = ~(UINT64)0;
/* if there is a custom read handler, and it returns TRUE, use that value */
@@ -1454,7 +1548,7 @@ void debug_write_byte(const address_space *space, offs_t address, UINT8 data, in
memory_set_debugger_access(space, global->debugger_access = TRUE);
/* translate if necessary; if not mapped, we're done */
- if (apply_translation && !memory_address_physical(space, TRANSLATE_WRITE_DEBUG, &address))
+ if (apply_translation && !debug_cpu_translate(space, TRANSLATE_WRITE_DEBUG, &address))
;
/* if there is a custom write handler, and it returns TRUE, use that */
@@ -1507,7 +1601,7 @@ void debug_write_word(const address_space *space, offs_t address, UINT16 data, i
memory_set_debugger_access(space, global->debugger_access = TRUE);
/* translate if necessary; if not mapped, we're done */
- if (apply_translation && !memory_address_physical(space, TRANSLATE_WRITE_DEBUG, &address))
+ if (apply_translation && !debug_cpu_translate(space, TRANSLATE_WRITE_DEBUG, &address))
;
/* if there is a custom write handler, and it returns TRUE, use that */
@@ -1561,7 +1655,7 @@ void debug_write_dword(const address_space *space, offs_t address, UINT32 data,
memory_set_debugger_access(space, global->debugger_access = TRUE);
/* translate if necessary; if not mapped, we're done */
- if (apply_translation && !memory_address_physical(space, TRANSLATE_WRITE_DEBUG, &address))
+ if (apply_translation && !debug_cpu_translate(space, TRANSLATE_WRITE_DEBUG, &address))
;
/* if there is a custom write handler, and it returns TRUE, use that */
@@ -1615,7 +1709,7 @@ void debug_write_qword(const address_space *space, offs_t address, UINT64 data,
memory_set_debugger_access(space, global->debugger_access = TRUE);
/* translate if necessary; if not mapped, we're done */
- if (apply_translation && !memory_address_physical(space, TRANSLATE_WRITE_DEBUG, &address))
+ if (apply_translation && !debug_cpu_translate(space, TRANSLATE_WRITE_DEBUG, &address))
;
/* if there is a custom write handler, and it returns TRUE, use that */
@@ -1669,7 +1763,7 @@ UINT64 debug_read_opcode(const address_space *space, offs_t address, int size, i
}
/* translate to physical first */
- if (!memory_address_physical(space, TRANSLATE_FETCH_DEBUG, &address))
+ if (!debug_cpu_translate(space, TRANSLATE_FETCH_DEBUG, &address))
return ~(UINT64)0 & (~(UINT64)0 >> (64 - 8*size));
/* keep in physical range */
@@ -2262,7 +2356,7 @@ static UINT32 dasm_wrapped(const device_config *device, char *buffer, offs_t pc)
argbuf[numbytes] = debug_read_opcode(space, pcbyte + numbytes, 1, TRUE);
}
- return cpu_dasm(device, buffer, pc, opbuf, argbuf);
+ return debug_cpu_disassemble(device, buffer, pc, opbuf, argbuf);
}
diff --git a/src/emu/debug/debugcpu.h b/src/emu/debug/debugcpu.h
index 2a3fecb1497..2b70037fa15 100644
--- a/src/emu/debug/debugcpu.h
+++ b/src/emu/debug/debugcpu.h
@@ -100,29 +100,32 @@ struct _debug_hotspot_entry
/* In cpuintrf.h: typedef struct _cpu_debug_data cpu_debug_data; */
struct _cpu_debug_data
{
- const device_config *device; /* CPU device object */
- symbol_table * symtable; /* symbol table for expression evaluation */
- UINT32 flags; /* debugging flags for this CPU */
- UINT8 opwidth; /* width of an opcode */
- offs_t stepaddr; /* step target address for DEBUG_FLAG_STEPPING_OVER */
- int stepsleft; /* number of steps left until done */
- offs_t stopaddr; /* stop address for DEBUG_FLAG_STOP_PC */
- attotime stoptime; /* stop time for DEBUG_FLAG_STOP_TIME */
- int stopirq; /* stop IRQ number for DEBUG_FLAG_STOP_INTERRUPT */
- int stopexception; /* stop exception number for DEBUG_FLAG_STOP_EXCEPTION */
- attotime endexectime; /* ending time of the current execution */
- debug_trace_info trace; /* trace info */
- debug_cpu_breakpoint *bplist; /* list of breakpoints */
- debug_hotspot_entry *hotspots; /* hotspot list */
- offs_t pc_history[DEBUG_HISTORY_SIZE]; /* history of recent PCs */
- UINT32 pc_history_index; /* current history index */
- int hotspot_count; /* number of hotspots */
- int hotspot_threshhold; /* threshhold for the number of hits to print */
- cpu_read_func read; /* memory read routine */
- cpu_write_func write; /* memory write routine */
- cpu_readop_func readop; /* opcode read routine */
- debug_instruction_hook_func instrhook; /* per-instruction callback hook */
- debug_cpu_watchpoint *wplist[ADDRESS_SPACES]; /* watchpoint lists for each address space */
+ const device_config * device; /* CPU device object */
+ symbol_table * symtable; /* symbol table for expression evaluation */
+ UINT32 flags; /* debugging flags for this CPU */
+ UINT8 opwidth; /* width of an opcode */
+ offs_t stepaddr; /* step target address for DEBUG_FLAG_STEPPING_OVER */
+ int stepsleft; /* number of steps left until done */
+ offs_t stopaddr; /* stop address for DEBUG_FLAG_STOP_PC */
+ attotime stoptime; /* stop time for DEBUG_FLAG_STOP_TIME */
+ int stopirq; /* stop IRQ number for DEBUG_FLAG_STOP_INTERRUPT */
+ int stopexception; /* stop exception number for DEBUG_FLAG_STOP_EXCEPTION */
+ attotime endexectime; /* ending time of the current execution */
+ debug_trace_info trace; /* trace info */
+ debug_cpu_breakpoint * bplist; /* list of breakpoints */
+ debug_hotspot_entry * hotspots; /* hotspot list */
+ offs_t pc_history[DEBUG_HISTORY_SIZE]; /* history of recent PCs */
+ UINT32 pc_history_index; /* current history index */
+ int hotspot_count; /* number of hotspots */
+ int hotspot_threshhold; /* threshhold for the number of hits to print */
+ cpu_read_func read; /* memory read routine */
+ cpu_write_func write; /* memory write routine */
+ cpu_readop_func readop; /* opcode read routine */
+ cpu_translate_func translate; /* pointer to CPU's translate function */
+ cpu_disassemble_func disassemble; /* pointer to CPU's dissasemble function */
+ cpu_disassemble_func dasm_override; /* pointer to provided override function */
+ debug_instruction_hook_func instrhook; /* per-instruction callback hook */
+ debug_cpu_watchpoint * wplist[ADDRESS_SPACES]; /* watchpoint lists for each address space */
};
@@ -199,6 +202,19 @@ symbol_table *debug_cpu_get_symtable(const device_config *device);
+/* ----- memory and disassembly helpers ----- */
+
+/* return the physical address corresponding to the given logical address */
+int debug_cpu_translate(const address_space *space, int intention, offs_t *address);
+
+/* disassemble a line at a given PC on a given CPU */
+offs_t debug_cpu_disassemble(const device_config *device, char *buffer, offs_t pc, const UINT8 *oprom, const UINT8 *opram);
+
+/* set an override handler for disassembly */
+void debug_cpu_set_dasm_override(const device_config *device, cpu_disassemble_func dasm_override);
+
+
+
/* ----- core debugger hooks ----- */
/* the CPU execution system calls this hook before beginning execution for the given CPU */
diff --git a/src/emu/debug/debugvw.c b/src/emu/debug/debugvw.c
index 4c173e4de89..9099bff38a5 100644
--- a/src/emu/debug/debugvw.c
+++ b/src/emu/debug/debugvw.c
@@ -1730,8 +1730,8 @@ static offs_t disasm_view_find_pc_backwards(const address_space *space, offs_t t
/* get the disassembly, but only if mapped */
instlen = 1;
- if (memory_address_physical(space, TRANSLATE_FETCH, &physpcbyte))
- instlen = cpu_dasm(space->cpu, dasmbuffer, scanpc, &opbuf[1000 + scanpcbyte - targetpcbyte], &argbuf[1000 + scanpcbyte - targetpcbyte]) & DASMFLAG_LENGTHMASK;
+ if (debug_cpu_translate(space, TRANSLATE_FETCH, &physpcbyte))
+ instlen = debug_cpu_disassemble(space->cpu, dasmbuffer, scanpc, &opbuf[1000 + scanpcbyte - targetpcbyte], &argbuf[1000 + scanpcbyte - targetpcbyte]) & DASMFLAG_LENGTHMASK;
/* count this one */
instcount++;
@@ -1891,7 +1891,7 @@ static int disasm_view_recompute(debug_view *view, offs_t pc, int startline, int
/* make sure we can translate the address, and then disassemble the result */
physpcbyte = pcbyte;
- if (memory_address_physical(space, TRANSLATE_FETCH_DEBUG, &physpcbyte))
+ if (debug_cpu_translate(space, TRANSLATE_FETCH_DEBUG, &physpcbyte))
{
UINT8 opbuf[64], argbuf[64];
@@ -1903,7 +1903,7 @@ static int disasm_view_recompute(debug_view *view, offs_t pc, int startline, int
}
/* disassemble the result */
- pc += numbytes = cpu_dasm(space->cpu, buffer, pc & space->logaddrmask, opbuf, argbuf) & DASMFLAG_LENGTHMASK;
+ pc += numbytes = debug_cpu_disassemble(space->cpu, buffer, pc & space->logaddrmask, opbuf, argbuf) & DASMFLAG_LENGTHMASK;
}
else
strcpy(buffer, "<unmapped>");
@@ -3021,7 +3021,7 @@ static int memory_view_read(debug_view_memory *memdata, UINT8 size, offs_t offs,
offs_t dummyaddr = offs;
int ismapped;
- ismapped = memdata->no_translation ? TRUE : memory_address_physical(space, TRANSLATE_READ_DEBUG, &dummyaddr);
+ ismapped = memdata->no_translation ? TRUE : debug_cpu_translate(space, TRANSLATE_READ_DEBUG, &dummyaddr);
*data = ~(UINT64)0;
if (ismapped)
{
diff --git a/src/emu/emu.mak b/src/emu/emu.mak
index 2deb5aba128..4cb5f0da192 100644
--- a/src/emu/emu.mak
+++ b/src/emu/emu.mak
@@ -42,7 +42,6 @@ EMUOBJS = \
$(EMUOBJ)/clifront.o \
$(EMUOBJ)/config.o \
$(EMUOBJ)/cpuexec.o \
- $(EMUOBJ)/cpuintrf.o \
$(EMUOBJ)/crsshair.o \
$(EMUOBJ)/debugger.o \
$(EMUOBJ)/devintrf.o \
diff --git a/src/emu/machine/generic.c b/src/emu/machine/generic.c
index d4b08f1d761..ca1577fa7f9 100644
--- a/src/emu/machine/generic.c
+++ b/src/emu/machine/generic.c
@@ -34,8 +34,8 @@ UINT32 *generic_nvram32;
/* memory card status */
static int memcard_inserted;
-/* interrupt status */
-static UINT8 interrupt_enable[MAX_CPU];
+/* interrupt status for up to 8 CPUs */
+static UINT8 interrupt_enable[8];
diff --git a/src/emu/mame.h b/src/emu/mame.h
index ce872636026..61aaa5ab2fd 100644
--- a/src/emu/mame.h
+++ b/src/emu/mame.h
@@ -149,7 +149,7 @@ struct _running_machine
const input_port_config *portconfig; /* points to a list of input port configurations */
/* CPU information */
- const device_config * cpu[MAX_CPU]; /* array of CPU devices */
+ const device_config * cpu[8]; /* array of first 8 CPU devices */
/* game-related information */
const game_driver * gamedrv; /* points to the definition of the game machine */
diff --git a/src/emu/memory.c b/src/emu/memory.c
index 7435731bd1f..cc8028a1112 100644
--- a/src/emu/memory.c
+++ b/src/emu/memory.c
@@ -1317,27 +1317,6 @@ UINT64 *_memory_install_device_handler64(const address_space *space, const devic
/***************************************************************************
- MISCELLANEOUS UTILITIES
-***************************************************************************/
-
-/*-------------------------------------------------
- memory_address_physical - return the physical
- address corresponding to the given logical
- address
--------------------------------------------------*/
-
-int memory_address_physical(const address_space *space, int intention, offs_t *address)
-{
- cpu_class_header *classheader = cpu_get_class_header(space->cpu);
- if (classheader->translate != NULL)
- return (*classheader->translate)(space->cpu, space->spacenum, intention, address);
- else
- return TRUE;
-}
-
-
-
-/***************************************************************************
DEBUGGER HELPERS
***************************************************************************/
diff --git a/src/emu/memory.h b/src/emu/memory.h
index 5f2f6fc7c5f..1bd3d0fa612 100644
--- a/src/emu/memory.h
+++ b/src/emu/memory.h
@@ -940,13 +940,6 @@ UINT64 *_memory_install_device_handler64(const address_space *space, const devic
-/* ----- miscellaneous utilities ----- */
-
-/* return the physical address corresponding to the given logical address */
-int memory_address_physical(const address_space *space, int intention, offs_t *address);
-
-
-
/* ----- debugger helpers ----- */
/* return a string describing the handler at a particular offset */
diff --git a/src/emu/sound/3812intf.c b/src/emu/sound/3812intf.c
index f108d9b67ff..59224ba23fb 100644
--- a/src/emu/sound/3812intf.c
+++ b/src/emu/sound/3812intf.c
@@ -408,7 +408,7 @@ static unsigned char Y8950PortHandler_r(void *param)
{
struct y8950_info *info = param;
/* temporary hack until this is converted to a device */
- const address_space *space = cpu_get_address_space(info->device->machine->cpu[0], ADDRESS_SPACE_PROGRAM);
+ const address_space *space = memory_find_address_space(info->device->machine->cpu[0], ADDRESS_SPACE_PROGRAM);
if (info->intf->portread)
return info->intf->portread(space,info->index);
return 0;
@@ -418,7 +418,7 @@ static void Y8950PortHandler_w(void *param,unsigned char data)
{
struct y8950_info *info = param;
/* temporary hack until this is converted to a device */
- const address_space *space = cpu_get_address_space(info->device->machine->cpu[0], ADDRESS_SPACE_PROGRAM);
+ const address_space *space = memory_find_address_space(info->device->machine->cpu[0], ADDRESS_SPACE_PROGRAM);
if (info->intf->portwrite)
info->intf->portwrite(space,info->index,data);
}
@@ -427,7 +427,7 @@ static unsigned char Y8950KeyboardHandler_r(void *param)
{
struct y8950_info *info = param;
/* temporary hack until this is converted to a device */
- const address_space *space = cpu_get_address_space(info->device->machine->cpu[0], ADDRESS_SPACE_PROGRAM);
+ const address_space *space = memory_find_address_space(info->device->machine->cpu[0], ADDRESS_SPACE_PROGRAM);
if (info->intf->keyboardread)
return info->intf->keyboardread(space,info->index);
return 0;
@@ -437,7 +437,7 @@ static void Y8950KeyboardHandler_w(void *param,unsigned char data)
{
struct y8950_info *info = param;
/* temporary hack until this is converted to a device */
- const address_space *space = cpu_get_address_space(info->device->machine->cpu[0], ADDRESS_SPACE_PROGRAM);
+ const address_space *space = memory_find_address_space(info->device->machine->cpu[0], ADDRESS_SPACE_PROGRAM);
if (info->intf->keyboardwrite)
info->intf->keyboardwrite(space,info->index,data);
}
diff --git a/src/emu/sound/aica.c b/src/emu/sound/aica.c
index 79751093268..098e3b000b4 100644
--- a/src/emu/sound/aica.c
+++ b/src/emu/sound/aica.c
@@ -720,7 +720,7 @@ static void AICA_UpdateSlotReg(struct _AICA *AICA,int s,int r)
static void AICA_UpdateReg(struct _AICA *AICA, int reg)
{
/* temporary hack until this is converted to a device */
- const address_space *space = cpu_get_address_space(AICA->device->machine->cpu[0], ADDRESS_SPACE_PROGRAM);
+ const address_space *space = memory_find_address_space(AICA->device->machine->cpu[0], ADDRESS_SPACE_PROGRAM);
switch(reg&0xff)
{
case 0x4:
diff --git a/src/emu/sound/ay8910.c b/src/emu/sound/ay8910.c
index bdf22cfea72..c4a60573943 100644
--- a/src/emu/sound/ay8910.c
+++ b/src/emu/sound/ay8910.c
@@ -387,7 +387,7 @@ INLINE UINT16 mix_3D(ay8910_context *psg)
static void ay8910_write_reg(ay8910_context *psg, int r, int v)
{
/* temporary hack until this is converted to a device */
- const address_space *space = cpu_get_address_space(psg->device->machine->cpu[0], ADDRESS_SPACE_PROGRAM);
+ const address_space *space = memory_find_address_space(psg->device->machine->cpu[0], ADDRESS_SPACE_PROGRAM);
//if (r >= 11 && r <= 13 ) printf("%d %x %02x\n", PSG->index, r, v);
psg->regs[r] = v;
@@ -783,7 +783,7 @@ int ay8910_read_ym(void *chip)
{
ay8910_context *psg = chip;
/* temporary hack until this is converted to a device */
- const address_space *space = cpu_get_address_space(psg->device->machine->cpu[0], ADDRESS_SPACE_PROGRAM);
+ const address_space *space = memory_find_address_space(psg->device->machine->cpu[0], ADDRESS_SPACE_PROGRAM);
int r = psg->register_latch;
if (r > 15) return 0;
diff --git a/src/emu/sound/pokey.c b/src/emu/sound/pokey.c
index 2ecafef7f1e..5c16e91ee84 100644
--- a/src/emu/sound/pokey.c
+++ b/src/emu/sound/pokey.c
@@ -833,7 +833,7 @@ static int pokey_register_r(int chip, int offs)
}
#endif
- space = cpu_get_address_space(p->device->machine->cpu[0], ADDRESS_SPACE_PROGRAM);
+ space = memory_find_address_space(p->device->machine->cpu[0], ADDRESS_SPACE_PROGRAM);
switch (offs & 15)
{
case POT0_C: case POT1_C: case POT2_C: case POT3_C:
@@ -985,7 +985,7 @@ static void pokey_register_w(int chip, int offs, int data)
{
struct POKEYregisters *p = sndti_token(SOUND_POKEY, chip);
/* temporary hack until this is converted to a device */
- const address_space *space = cpu_get_address_space(p->device->machine->cpu[0], ADDRESS_SPACE_PROGRAM);
+ const address_space *space = memory_find_address_space(p->device->machine->cpu[0], ADDRESS_SPACE_PROGRAM);
int ch_mask = 0, new_val;
#ifdef MAME_DEBUG
diff --git a/src/emu/sound/scsp.c b/src/emu/sound/scsp.c
index 3375fb5e975..0222b3597e2 100644
--- a/src/emu/sound/scsp.c
+++ b/src/emu/sound/scsp.c
@@ -698,7 +698,7 @@ static void SCSP_UpdateSlotReg(struct _SCSP *SCSP,int s,int r)
static void SCSP_UpdateReg(struct _SCSP *SCSP, int reg)
{
/* temporary hack until this is converted to a device */
- const address_space *space = cpu_get_address_space(SCSP->device->machine->cpu[0], ADDRESS_SPACE_PROGRAM);
+ const address_space *space = memory_find_address_space(SCSP->device->machine->cpu[0], ADDRESS_SPACE_PROGRAM);
switch(reg&0x3f)
{
case 0x2:
diff --git a/src/emu/sound/ym2151.c b/src/emu/sound/ym2151.c
index 86e61430353..61a3e015709 100644
--- a/src/emu/sound/ym2151.c
+++ b/src/emu/sound/ym2151.c
@@ -1046,7 +1046,7 @@ void ym2151_write_reg(void *_chip, int r, int v)
{
YM2151 *chip = _chip;
/* temporary hack until this is converted to a device */
- const address_space *space = cpu_get_address_space(chip->device->machine->cpu[0], ADDRESS_SPACE_PROGRAM);
+ const address_space *space = memory_find_address_space(chip->device->machine->cpu[0], ADDRESS_SPACE_PROGRAM);
YM2151Operator *op = &chip->oper[ (r&0x07)*4+((r&0x18)>>3) ];
/* adjust bus to 8 bits */
diff --git a/src/emu/sound/ymf271.c b/src/emu/sound/ymf271.c
index a1c755c8e2d..368f4e7b75e 100644
--- a/src/emu/sound/ymf271.c
+++ b/src/emu/sound/ymf271.c
@@ -1375,7 +1375,7 @@ static TIMER_CALLBACK( ymf271_timer_b_tick )
static UINT8 ymf271_read_ext_memory(YMF271Chip *chip, UINT32 address)
{
/* temporary hack until this is converted to a device */
- const address_space *space = cpu_get_address_space(chip->device->machine->cpu[0], ADDRESS_SPACE_PROGRAM);
+ const address_space *space = memory_find_address_space(chip->device->machine->cpu[0], ADDRESS_SPACE_PROGRAM);
if( chip->ext_mem_read ) {
return chip->ext_mem_read(space,address);
} else {
@@ -1388,7 +1388,7 @@ static UINT8 ymf271_read_ext_memory(YMF271Chip *chip, UINT32 address)
static void ymf271_write_ext_memory(YMF271Chip *chip, UINT32 address, UINT8 data)
{
/* temporary hack until this is converted to a device */
- const address_space *space = cpu_get_address_space(chip->device->machine->cpu[0], ADDRESS_SPACE_PROGRAM);
+ const address_space *space = memory_find_address_space(chip->device->machine->cpu[0], ADDRESS_SPACE_PROGRAM);
if( chip->ext_mem_write ) {
chip->ext_mem_write(space, address, data);
}
diff --git a/src/emu/sound/ymz280b.c b/src/emu/sound/ymz280b.c
index 8a4435a5e4d..53e69771e71 100644
--- a/src/emu/sound/ymz280b.c
+++ b/src/emu/sound/ymz280b.c
@@ -869,7 +869,7 @@ static void write_to_register(struct YMZ280BChip *chip, int data)
if (chip->ext_ram_write)
{
/* temporary hack until this is converted to a device */
- const address_space *space = cpu_get_address_space(chip->device->machine->cpu[0], ADDRESS_SPACE_PROGRAM);
+ const address_space *space = memory_find_address_space(chip->device->machine->cpu[0], ADDRESS_SPACE_PROGRAM);
chip->ext_ram_write(space, chip->rom_readback_addr, data);
}
else
diff --git a/src/mame/drivers/malzak.c b/src/mame/drivers/malzak.c
index 5e24d038582..c45b338d702 100644
--- a/src/mame/drivers/malzak.c
+++ b/src/mame/drivers/malzak.c
@@ -171,7 +171,7 @@ static WRITE8_HANDLER( port40_w )
// Bits 1-3 are all set high upon death, until the game continues
// Bit 6 is used only in Malzak II, and is set high after checking
// the selected version
-// logerror("S2650 [0x%04x]: port 0x40 write: 0x%02x\n",cpu_get_physical_pc_byte(space->machine->cpu[0]),data);
+// logerror("S2650 [0x%04x]: port 0x40 write: 0x%02x\n",cpu_get_pc(space->machine->cpu[0]),data);
if(data & 0x40)
malzak_bank1 = 1;
else