summaryrefslogtreecommitdiffstatshomepage
path: root/src/emu/cpu/pic16c62x/pic16c62x.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/emu/cpu/pic16c62x/pic16c62x.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/emu/cpu/pic16c62x/pic16c62x.c')
-rw-r--r--src/emu/cpu/pic16c62x/pic16c62x.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/emu/cpu/pic16c62x/pic16c62x.c b/src/emu/cpu/pic16c62x/pic16c62x.c
index b47a9b6a7ec..cbfae296c8d 100644
--- a/src/emu/cpu/pic16c62x/pic16c62x.c
+++ b/src/emu/cpu/pic16c62x/pic16c62x.c
@@ -87,13 +87,13 @@ struct _pic16c62x_state
int inst_cycles;
- const device_config *device;
+ running_device *device;
const address_space *program;
const address_space *data;
const address_space *io;
};
-INLINE pic16c62x_state *get_safe_token(const device_config *device)
+INLINE pic16c62x_state *get_safe_token(running_device *device)
{
assert(device != NULL);
assert(device->token != NULL);
@@ -917,7 +917,7 @@ static void pic16c62x_soft_reset(pic16c62x_state *cpustate)
pic16c62x_reset_regs(cpustate);
}
-void pic16c62x_set_config(const device_config *cpu, int data)
+void pic16c62x_set_config(running_device *cpu, int data)
{
pic16c62x_state *cpustate = get_safe_token(cpu);
i">0, /* opportunity to initialize things first */ CONFIG_TYPE_CONTROLLER, /* loading from controller file */ CONFIG_TYPE_DEFAULT, /* loading from default.cfg */ CONFIG_TYPE_GAME, /* loading from game.cfg */ CONFIG_TYPE_FINAL /* opportunity to finish initialization */ }; /************************************* * * Type definitions * *************************************/ typedef delegate<void (int, xml_data_node *)> config_saveload_delegate; /************************************* * * Function prototypes * *************************************/ void config_init(running_machine &machine); void config_register(running_machine &machine, const char *nodename, config_saveload_delegate load, config_saveload_delegate save); int config_load_settings(running_machine &machine); void config_save_settings(running_machine &machine); #endif /* __CONFIG_H__ */