summaryrefslogtreecommitdiffstatshomepage
path: root/src/emu/ui.c
diff options
context:
space:
mode:
author Aaron Giles <aaron@aarongiles.com>2008-12-16 15:02:15 +0000
committer Aaron Giles <aaron@aarongiles.com>2008-12-16 15:02:15 +0000
commit98c40f06dbdd764d8c1ee1409f1103ec6ec68f45 (patch)
treefb17b450cbe8daff0fed0713af377dbcbf57be84 /src/emu/ui.c
parent76e6a7abc46429e548db632d8f7c8eddcf58ac57 (diff)
Made CPUs into proper devices. CPUs are now added in the
machine configuration just as any other device, and the standard CPU configuration is performed via the inline configuration macros. Change cpu_type from an enumeration into a pointer to the CPU's get_info function, very similar to device behavior. For now all CPUs are declared in cpuintrf.h, but eventually they should be declared in the CPU's header file, and the driver should #include that header. Added function cpu_get_type() to return the CPU type. Changed several cpu_* functions into macros that call through to the equivalent device_* function. The device system now maintains a parallel list of devices based on type, for faster iteration through all devices of a given type. Cleaned up code that looped over CPUs via the machine->cpu array to now loop using the type-based device list. Removed start/stop/reset/nvram functions from the device_config in favor of grabbing them as needed. Cleaned up the generic interrupt_enable code to work with CPU devices instead of numbers. Mapped the devtag_* functions to device_* functions via macros instead of parallel implementations.
Diffstat (limited to 'src/emu/ui.c')
-rw-r--r--src/emu/ui.c20
1 files changed, 11 insertions, 9 deletions
diff --git a/src/emu/ui.c b/src/emu/ui.c
index c4a4530598d..6032dbd3060 100644
--- a/src/emu/ui.c
+++ b/src/emu/ui.c
@@ -976,28 +976,30 @@ static astring *warnings_string(running_machine *machine, astring *string)
astring *game_info_astring(running_machine *machine, astring *string)
{
int scrcount = video_screen_count(machine->config);
- int cpunum, sndnum;
+ const device_config *scandevice;
+ const device_config *device;
+ int sndnum;
int count;
/* print description, manufacturer, and CPU: */
astring_printf(string, "%s\n%s %s\n\nCPU:\n", machine->gamedrv->description, machine->gamedrv->year, machine->gamedrv->manufacturer);
/* loop over all CPUs */
- for (cpunum = 0; cpunum < MAX_CPU && machine->config->cpu[cpunum].type != CPU_DUMMY; cpunum += count)
+ for (device = machine->cpu[0]; device != NULL; device = scandevice)
{
- cpu_type type = machine->config->cpu[cpunum].type;
- int clock = machine->config->cpu[cpunum].clock;
+ int clock = ((const cpu_config *)device->inline_config)->clock;
/* count how many identical CPUs we have */
- for (count = 1; cpunum + count < MAX_CPU; count++)
- if (machine->config->cpu[cpunum + count].type != type ||
- machine->config->cpu[cpunum + count].clock != clock)
- break;
+ count = 1;
+ for (scandevice = device->typenext; scandevice != NULL; scandevice = device->typenext)
+ if (cpu_get_type(device) != cpu_get_type(scandevice) ||
+ clock != ((const cpu_config *)scandevice->inline_config)->clock)
+ break;
/* if more than one, prepend a #x in front of the CPU name */
if (count > 1)
astring_catprintf(string, "%d" UTF8_MULTIPLY, count);
- astring_catc(string, cputype_get_name(type));
+ astring_catc(string, cpu_get_name(device));
/* display clock in kHz or MHz */
if (clock >= 1000000)