summaryrefslogtreecommitdiffstatshomepage
path: root/src/emu/cpu/sc61860
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/sc61860
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/sc61860')
-rw-r--r--src/emu/cpu/sc61860/sc61860.c8
-rw-r--r--src/emu/cpu/sc61860/sc61860.h18
2 files changed, 13 insertions, 13 deletions
diff --git a/src/emu/cpu/sc61860/sc61860.c b/src/emu/cpu/sc61860/sc61860.c
index af5563eaefd..bda92d779f1 100644
--- a/src/emu/cpu/sc61860/sc61860.c
+++ b/src/emu/cpu/sc61860/sc61860.c
@@ -55,12 +55,12 @@ struct _sc61860_state
struct { int t2ms, t512ms; int count;} timer;
- const device_config *device;
+ running_device *device;
const address_space *program;
int icount;
};
-INLINE sc61860_state *get_safe_token(const device_config *device)
+INLINE sc61860_state *get_safe_token(running_device *device)
{
assert(device != NULL);
assert(device->token != NULL);
@@ -69,7 +69,7 @@ INLINE sc61860_state *get_safe_token(const device_config *device)
return (sc61860_state *)device->token;
}
-UINT8 *sc61860_internal_ram(const device_config *device)
+UINT8 *sc61860_internal_ram(running_device *device)
{
sc61860_state *cpustate = get_safe_token(device);
return cpustate->ram;
@@ -104,7 +104,7 @@ static CPU_RESET( sc61860 )
static CPU_INIT( sc61860 )
{
sc61860_state *cpustate = get_safe_token(device);
- cpustate->config = (sc61860_cpu_core *) device->static_config;
+ cpustate->config = (sc61860_cpu_core *) device->baseconfig().static_config;
timer_pulse(device->machine, ATTOTIME_IN_HZ(500), cpustate, 0, sc61860_2ms_tick);
cpustate->device = device;
cpustate->program = device->space(AS_PROGRAM);
diff --git a/src/emu/cpu/sc61860/sc61860.h b/src/emu/cpu/sc61860/sc61860.h
index a475afb6e43..cc8dc6b9bbd 100644
--- a/src/emu/cpu/sc61860/sc61860.h
+++ b/src/emu/cpu/sc61860/sc61860.h
@@ -40,20 +40,20 @@
typedef struct _sc61860_cpu_core sc61860_cpu_core;
struct _sc61860_cpu_core
{
- int (*reset)(const device_config *device);
- int (*brk)(const device_config *device);
- int (*x)(const device_config *device);
- int (*ina)(const device_config *device);
- void (*outa)(const device_config *device, int);
- int (*inb)(const device_config *device);
- void (*outb)(const device_config *device, int);
- void (*outc)(const device_config *device, int);
+ int (*reset)(running_device *device);
+ int (*brk)(running_device *device);
+ int (*x)(running_device *device);
+ int (*ina)(running_device *device);
+ void (*outa)(running_device *device, int);
+ int (*inb)(running_device *device);
+ void (*outb)(running_device *device, int);
+ void (*outc)(running_device *device, int);
};
CPU_DISASSEMBLE( sc61860 );
/* this is though for power on/off of the sharps */
-UINT8 *sc61860_internal_ram(const device_config *device);
+UINT8 *sc61860_internal_ram(running_device *device);
CPU_GET_INFO( sc61860 );
#define CPU_SC61860 CPU_GET_INFO_NAME( sc61860 )