summaryrefslogtreecommitdiffstatshomepage
path: root/src/mame/drivers/r2dtank.c
diff options
context:
space:
mode:
author Aaron Giles <aaron@aarongiles.com>2010-01-18 09:34:43 +0000
committer Aaron Giles <aaron@aarongiles.com>2010-01-18 09:34:43 +0000
commite738b79785852050ce8b83e369a7fc4dd46a071b (patch)
tree1ac39e9f40790b375c57fea4e5d56ca8d132babc /src/mame/drivers/r2dtank.c
parent3f87f47a2ecdccb9d9627d0d52b76f262becb949 (diff)
Correct a long-standing design flaw: device configuration state
is now separate from runtime device state. I have larger plans for devices, so there is some temporary scaffolding to hold everything together, but this first step does separate things out. There is a new class 'running_device' which represents the state of a live device. A list of these running_devices sits in machine->devicelist and is created when a running_machine is instantiated. To access the configuration state, use device->baseconfig() which returns a reference to the configuration. The list of running_devices in machine->devicelist has a 1:1 correspondance with the list of device configurations in machine->config->devicelist, and most navigation options work equally on either (scanning by class, type, etc.) For the most part, drivers will now deal with running_device objects instead of const device_config objects. In fact, in order to do this patch, I did the following global search & replace: const device_config -> running_device device->static_config -> device->baseconfig().static_config device->inline_config -> device->baseconfig().inline_config and then fixed up the compiler errors that fell out. Some specifics: Removed device_get_info_* functions and replaced them with methods called get_config_*. Added methods for get_runtime_* to access runtime state from the running_device. DEVICE_GET_INFO callbacks are only passed a device_config *. This means they have no access to the token or runtime state at all. For most cases this is fine. Added new DEVICE_GET_RUNTIME_INFO callback that is passed the running_device for accessing data that is live at runtime. In the future this will go away to make room for a cleaner mechanism. Cleaned up the handoff of memory regions from the memory subsystem to the devices.
Diffstat (limited to 'src/mame/drivers/r2dtank.c')
-rw-r--r--src/mame/drivers/r2dtank.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/mame/drivers/r2dtank.c b/src/mame/drivers/r2dtank.c
index e6e08d9c96e..9f5fafccb59 100644
--- a/src/mame/drivers/r2dtank.c
+++ b/src/mame/drivers/r2dtank.c
@@ -73,8 +73,8 @@ static WRITE_LINE_DEVICE_HANDLER( flipscreen_w );
static WRITE_LINE_DEVICE_HANDLER( main_cpu_irq )
{
- const device_config *pia0 = devtag_get_device(device->machine, "pia_main");
- const device_config *pia1 = devtag_get_device(device->machine, "pia_audio");
+ running_device *pia0 = devtag_get_device(device->machine, "pia_main");
+ running_device *pia1 = devtag_get_device(device->machine, "pia_audio");
int combined_state = pia6821_get_irq_a(pia0) | pia6821_get_irq_b(pia0) |
pia6821_get_irq_a(pia1) | pia6821_get_irq_b(pia1);
@@ -206,7 +206,7 @@ static const ay8910_interface ay8910_2_interface =
static WRITE8_DEVICE_HANDLER( ttl74123_output_changed )
{
- const device_config *pia = devtag_get_device(device->machine, "pia_main");
+ running_device *pia = devtag_get_device(device->machine, "pia_main");
pia6821_ca1_w(pia, 0, data);
ttl74123_output = data;
}
@@ -383,7 +383,7 @@ static const mc6845_interface mc6845_intf =
static VIDEO_UPDATE( r2dtank )
{
- const device_config *mc6845 = devtag_get_device(screen->machine, "crtc");
+ running_device *mc6845 = devtag_get_device(screen->machine, "crtc");
mc6845_update(mc6845, bitmap, cliprect);
return 0;