summaryrefslogtreecommitdiffstatshomepage
path: root/src/emu
diff options
context:
space:
mode:
author Aaron Giles <aaron@aarongiles.com>2012-09-11 16:29:26 +0000
committer Aaron Giles <aaron@aarongiles.com>2012-09-11 16:29:26 +0000
commitd1a2c2e7a36796de9619ec4d9f81ea755178412d (patch)
treee210e894a1cda37c5407eaa0ff5a1e89b97cbfe3 /src/emu
parent0aa418e85b7f7aad5088bc96c9da0c371b15b2f2 (diff)
Add ambiguous execute() and memory() methods to the
device_execute/memory_interfaces respectively in order to catch unnecessary usage of the corresponding device_t methods. Removed all existing redundant usage. [Aaron Giles]
Diffstat (limited to 'src/emu')
-rw-r--r--src/emu/diexec.h4
-rw-r--r--src/emu/dimemory.h4
-rw-r--r--src/emu/distate.h14
-rw-r--r--src/emu/machine/latch8.c2
-rw-r--r--src/emu/sound/scsp.c4
-rw-r--r--src/emu/video/pc_cga.c20
-rw-r--r--src/emu/video/pc_vga.c6
7 files changed, 24 insertions, 30 deletions
diff --git a/src/emu/diexec.h b/src/emu/diexec.h
index ecfeba6eba8..03ac4e76bc8 100644
--- a/src/emu/diexec.h
+++ b/src/emu/diexec.h
@@ -220,6 +220,10 @@ public:
// required operation overrides
void run() { execute_run(); }
+ // deliberately ambiguous functions; if you have the execute interface
+ // just use it
+ device_execute_interface &execute() { return *this; }
+
protected:
// internal helpers
void run_thread_wrapper();
diff --git a/src/emu/dimemory.h b/src/emu/dimemory.h
index c6efce57ebe..fa1df6c8382 100644
--- a/src/emu/dimemory.h
+++ b/src/emu/dimemory.h
@@ -123,6 +123,10 @@ public:
bool write(address_spacenum spacenum, offs_t offset, int size, UINT64 value) { return memory_write(spacenum, offset, size, value); }
bool readop(offs_t offset, int size, UINT64 &value) { return memory_readop(offset, size, value); }
+ // deliberately ambiguous functions; if you have the memory interface
+ // just use it
+ device_memory_interface &memory() { return *this; }
+
protected:
// required overrides
virtual const address_space_config *memory_space_config(address_spacenum spacenum) const = 0;
diff --git a/src/emu/distate.h b/src/emu/distate.h
index 286ca2f8823..2893fa88741 100644
--- a/src/emu/distate.h
+++ b/src/emu/distate.h
@@ -233,18 +233,4 @@ inline offs_t device_t::safe_pcbase()
}
-//-------------------------------------------------
-// device_state - return a pointer to the device
-// state interface for this device
-//-------------------------------------------------
-
-inline device_state_interface *device_state(device_t *device)
-{
- device_state_interface *intf;
- if (!device->interface(intf))
- throw emu_fatalerror("Device '%s' does not have state interface", device->tag());
- return intf;
-}
-
-
#endif /* __DISTATE_H__ */
diff --git a/src/emu/machine/latch8.c b/src/emu/machine/latch8.c
index d84fd06f8f4..6a40e336d92 100644
--- a/src/emu/machine/latch8.c
+++ b/src/emu/machine/latch8.c
@@ -82,7 +82,7 @@ READ8_DEVICE_HANDLER( latch8_r )
if (latch8->has_read)
{
/* temporary hack until all relevant systems are devices */
- address_space *space = device->machine().firstcpu->memory().space(AS_PROGRAM);
+ address_space *space = device->machine().firstcpu->space(AS_PROGRAM);
int i;
for (i=0; i<8; i++)
{
diff --git a/src/emu/sound/scsp.c b/src/emu/sound/scsp.c
index 4254525c24a..7407a62c040 100644
--- a/src/emu/sound/scsp.c
+++ b/src/emu/sound/scsp.c
@@ -702,7 +702,7 @@ static void SCSP_UpdateSlotReg(scsp_state *scsp,int s,int r)
static void SCSP_UpdateReg(scsp_state *scsp, int reg)
{
/* temporary hack until this is converted to a device */
- address_space *space = scsp->device->machine().firstcpu->memory().space(AS_PROGRAM);
+ address_space *space = scsp->device->machine().firstcpu->space(AS_PROGRAM);
switch(reg&0x3f)
{
@@ -1325,7 +1325,7 @@ WRITE16_DEVICE_HANDLER( scsp_w )
case 0x416:
COMBINE_DATA(&scsp->dma_regs[((offset-0x412)/2) & 3]);
if(ACCESSING_BITS_8_15 && offset*2 == 0x416)
- dma_scsp(device->machine().firstcpu->memory().space(AS_PROGRAM), scsp);
+ dma_scsp(device->machine().firstcpu->space(AS_PROGRAM), scsp);
break;
case 0x42a: //check main cpu IRQ
scsp->main_irq(1);
diff --git a/src/emu/video/pc_cga.c b/src/emu/video/pc_cga.c
index 7c5e11e9871..579b336eda7 100644
--- a/src/emu/video/pc_cga.c
+++ b/src/emu/video/pc_cga.c
@@ -329,11 +329,11 @@ static int internal_pc_cga_video_start(running_machine &machine)
static VIDEO_START( pc_cga )
{
int buswidth;
- address_space *space = machine.firstcpu->memory().space(AS_PROGRAM);
- address_space *spaceio = machine.firstcpu->memory().space(AS_IO);
+ address_space *space = machine.firstcpu->space(AS_PROGRAM);
+ address_space *spaceio = machine.firstcpu->space(AS_IO);
space->install_readwrite_bank(0xb8000, 0xbbfff, 0, 0x04000, "bank11" );
- buswidth = machine.firstcpu->memory().space_config(AS_PROGRAM)->m_databus_width;
+ buswidth = machine.firstcpu->space_config(AS_PROGRAM)->m_databus_width;
UINT64 mask = 0;
switch(buswidth)
{
@@ -370,12 +370,12 @@ static VIDEO_START( pc_cga )
static VIDEO_START( pc_cga32k )
{
int buswidth;
- address_space *space = machine.firstcpu->memory().space(AS_PROGRAM);
- address_space *spaceio = machine.firstcpu->memory().space(AS_IO);
+ address_space *space = machine.firstcpu->space(AS_PROGRAM);
+ address_space *spaceio = machine.firstcpu->space(AS_IO);
space->install_readwrite_bank(0xb8000, 0xbffff, "bank11" );
- buswidth = machine.firstcpu->memory().space_config(AS_PROGRAM)->m_databus_width;
+ buswidth = machine.firstcpu->space_config(AS_PROGRAM)->m_databus_width;
UINT64 mask = 0;
switch(buswidth)
{
@@ -1201,8 +1201,8 @@ static WRITE8_HANDLER( pc_cga8_w )
case 0x0f:
// Not sure if some all CGA cards have ability to upload char definition
// The original CGA card had a char rom
- UINT8 buswidth = space->machine().firstcpu->memory().space_config(AS_PROGRAM)->m_databus_width;
- address_space *space_prg = space->machine().firstcpu->memory().space(AS_PROGRAM);
+ UINT8 buswidth = space->machine().firstcpu->space_config(AS_PROGRAM)->m_databus_width;
+ address_space *space_prg = space->machine().firstcpu->space(AS_PROGRAM);
cga.p3df = data;
if (data & 1) {
UINT64 mask = 0;
@@ -1635,8 +1635,8 @@ static VIDEO_START( pc1512 )
cga.videoram_size = 0x10000;
cga.videoram = auto_alloc_array(machine, UINT8, 0x10000 );
- address_space *space = machine.firstcpu->memory().space( AS_PROGRAM );
- address_space *io_space = machine.firstcpu->memory().space( AS_IO );
+ address_space *space = machine.firstcpu->space( AS_PROGRAM );
+ address_space *io_space = machine.firstcpu->space( AS_IO );
space->install_read_bank( 0xb8000, 0xbbfff, 0, 0x0C000, "bank1" );
machine.root_device().membank("bank1")->set_base(cga.videoram + videoram_offset[0]);
diff --git a/src/emu/video/pc_vga.c b/src/emu/video/pc_vga.c
index d07e232e5f8..4706ecb6726 100644
--- a/src/emu/video/pc_vga.c
+++ b/src/emu/video/pc_vga.c
@@ -2015,7 +2015,7 @@ void pc_vga_io_init(running_machine &machine, address_space *mem_space, offs_t m
int buswidth;
UINT64 mask = 0;
- buswidth = machine.firstcpu->memory().space_config(AS_PROGRAM)->m_databus_width;
+ buswidth = machine.firstcpu->space_config(AS_PROGRAM)->m_databus_width;
switch(buswidth)
{
case 8:
@@ -2440,7 +2440,7 @@ void pc_svga_trident_io_init(running_machine &machine, address_space *mem_space,
int buswidth;
UINT64 mask = 0;
- buswidth = machine.firstcpu->memory().space_config(AS_PROGRAM)->m_databus_width;
+ buswidth = machine.firstcpu->space_config(AS_PROGRAM)->m_databus_width;
switch(buswidth)
{
case 8:
@@ -4461,7 +4461,7 @@ void pc_vga_gamtor_io_init(running_machine &machine, address_space *mem_space, o
int buswidth;
UINT64 mask = 0;
- buswidth = machine.firstcpu->memory().space_config(AS_PROGRAM)->m_databus_width;
+ buswidth = machine.firstcpu->space_config(AS_PROGRAM)->m_databus_width;
switch(buswidth)
{
case 8: