Remove remaining references to machine->cpu[n]. Removed cpu[n] array.

Replaced with machine->firstcpu which is a fast access to the head
of the list of CPUs.
This commit is contained in:
Aaron Giles 2009-09-08 09:13:10 +00:00
parent 3d59122bb2
commit 96d7f2cf3b
24 changed files with 272 additions and 289 deletions

View File

@ -47,7 +47,7 @@ enum
}; };
#define M6502_IRQ_LINE 0 #define M6502_IRQ_LINE 0
/* use cpu_set_input_line(machine->cpu[cpu], M6502_SET_OVERFLOW, level) /* use cpu_set_input_line(cpudevice, M6502_SET_OVERFLOW, level)
to change level of the so input line to change level of the so input line
positiv edge sets overflow flag */ positiv edge sets overflow flag */
#define M6502_SET_OVERFLOW 1 #define M6502_SET_OVERFLOW 1

View File

@ -34,7 +34,7 @@ enum
}; };
#define M6509_IRQ_LINE M6502_IRQ_LINE #define M6509_IRQ_LINE M6502_IRQ_LINE
/* use cpu_set_input_line(machine->cpu[cpu], M6509_SET_OVERFLOW, level) /* use cpu_set_input_line(cpudevice, M6509_SET_OVERFLOW, level)
to change level of the so input line to change level of the so input line
positiv edge sets overflow flag */ positiv edge sets overflow flag */
#define M6509_SET_OVERFLOW 3 #define M6509_SET_OVERFLOW 3

View File

@ -1711,7 +1711,7 @@ static void null_iot(const device_config *device, int op2, int nac, int mb, int
if (LOG_IOT_EXTRA) if (LOG_IOT_EXTRA)
{ {
if (op2 == 000) if (op2 == 000)
logerror("IOT sync instruction: mb=0%06o, pc=0%06o\n", (unsigned) mb, (unsigned) cpu_get_reg(device->machine->cpu[0], PDP1_PC)); logerror("IOT sync instruction: mb=0%06o, pc=0%06o\n", (unsigned) mb, (unsigned) cpu_get_reg(device, PDP1_PC));
} }
if (LOG) if (LOG)
{ {

View File

@ -20,8 +20,8 @@ enum
PDP1_IO_COMPLETE /* hack, do not use directly, use pdp1_pulse_iot_done instead */ PDP1_IO_COMPLETE /* hack, do not use directly, use pdp1_pulse_iot_done instead */
}; };
#define pdp1_pulse_start_clear() cpu_set_reg(machine->cpu[0], PDP1_START_CLEAR, 0) #define pdp1_pulse_start_clear(cpudevice) cpu_set_reg(cpudevice, PDP1_START_CLEAR, 0)
#define pdp1_pulse_iot_done() cpu_set_reg(machine->cpu[0], PDP1_IO_COMPLETE, 0) #define pdp1_pulse_iot_done(cpudevice) cpu_set_reg(cpudevice, PDP1_IO_COMPLETE, 0)
typedef void (*pdp1_extern_iot_func)(const device_config *device, int op2, int nac, int mb, int *io, int ac); typedef void (*pdp1_extern_iot_func)(const device_config *device, int op2, int nac, int mb, int *io, int ac);
typedef void (*pdp1_read_binary_word_func)(const device_config *device); typedef void (*pdp1_read_binary_word_func)(const device_config *device);

View File

@ -21,8 +21,8 @@ enum
TX0_IO_COMPLETE /* hack, do not use directly, use tx0_pulse_io_complete instead */ TX0_IO_COMPLETE /* hack, do not use directly, use tx0_pulse_io_complete instead */
}; };
#define tx0_pulse_reset() cpu_set_reg(machine->cpu[0], TX0_RESET, 0) #define tx0_pulse_reset(cpudevice) cpu_set_reg(cpudevice, TX0_RESET, 0)
#define tx0_pulse_io_complete() cpu_set_reg(machine->cpu[0], TX0_IO_COMPLETE, 0) #define tx0_pulse_io_complete(cpudevice) cpu_set_reg(cpudevice, TX0_IO_COMPLETE, 0)
typedef struct _tx0_reset_param_t tx0_reset_param_t; typedef struct _tx0_reset_param_t tx0_reset_param_t;
struct _tx0_reset_param_t struct _tx0_reset_param_t

View File

@ -1139,7 +1139,7 @@ VIDEO_UPDATE( tms340x0 )
int x; int x;
/* find the owning CPU */ /* find the owning CPU */
for (cpu = screen->machine->cpu[0]; cpu != NULL; cpu = cpu->typenext) for (cpu = screen->machine->firstcpu; cpu != NULL; cpu = cpu_next(cpu))
{ {
cpu_type type = cpu_get_type(cpu); cpu_type type = cpu_get_type(cpu);
if (type == CPU_TMS34010 || type == CPU_TMS34020) if (type == CPU_TMS34010 || type == CPU_TMS34020)

View File

@ -460,10 +460,6 @@ static DEVICE_START( cpu )
header = cpu_get_class_header(device); header = cpu_get_class_header(device);
classdata = get_class_data(device); classdata = get_class_data(device);
/* add ourself to the global array */
if (index < ARRAY_LENGTH(device->machine->cpu))
device->machine->cpu[index] = device;
/* build the header */ /* build the header */
header->debug = NULL; header->debug = NULL;
header->set_info = (cpu_set_info_func)device_get_info_fct(device, CPUINFO_FCT_SET_INFO); header->set_info = (cpu_set_info_func)device_get_info_fct(device, CPUINFO_FCT_SET_INFO);
@ -1113,7 +1109,7 @@ void cpuexec_trigger(running_machine *machine, int trigger)
const device_config *cpu; const device_config *cpu;
/* look for suspended CPUs waiting for this trigger and unsuspend them */ /* look for suspended CPUs waiting for this trigger and unsuspend them */
for (cpu = machine->cpu[0]; cpu != NULL; cpu = cpu->typenext) for (cpu = machine->firstcpu; cpu != NULL; cpu = cpu_next(cpu))
{ {
cpu_class_data *classdata = get_class_data(cpu); cpu_class_data *classdata = get_class_data(cpu);
@ -1306,14 +1302,15 @@ static void update_clock_information(const device_config *device)
static void compute_perfect_interleave(running_machine *machine) static void compute_perfect_interleave(running_machine *machine)
{ {
if (machine->cpu[0] != NULL) const device_config *firstcpu = machine->firstcpu;
if (firstcpu != NULL)
{ {
attoseconds_t smallest = get_minimum_quantum(machine->cpu[0]); attoseconds_t smallest = get_minimum_quantum(firstcpu);
attoseconds_t perfect = ATTOSECONDS_PER_SECOND - 1; attoseconds_t perfect = ATTOSECONDS_PER_SECOND - 1;
const device_config *cpu; const device_config *cpu;
/* start with a huge time factor and find the 2nd smallest cycle time */ /* start with a huge time factor and find the 2nd smallest cycle time */
for (cpu = machine->cpu[0]->typenext; cpu != NULL; cpu = cpu->typenext) for (cpu = cpu_next(firstcpu); cpu != NULL; cpu = cpu_next(cpu))
{ {
attoseconds_t curquantum = get_minimum_quantum(cpu); attoseconds_t curquantum = get_minimum_quantum(cpu);
@ -1348,7 +1345,7 @@ static void on_vblank(const device_config *device, void *param, int vblank_state
const device_config *cpu; const device_config *cpu;
/* find any CPUs that have this screen as their VBLANK interrupt source */ /* find any CPUs that have this screen as their VBLANK interrupt source */
for (cpu = device->machine->cpu[0]; cpu != NULL; cpu = cpu->typenext) for (cpu = device->machine->firstcpu; cpu != NULL; cpu = cpu_next(cpu))
{ {
const cpu_config *config = (const cpu_config *)cpu->inline_config; const cpu_config *config = (const cpu_config *)cpu->inline_config;
cpu_class_data *classdata = get_class_data(cpu); cpu_class_data *classdata = get_class_data(cpu);
@ -1616,7 +1613,7 @@ static void rebuild_execute_list(running_machine *machine)
*tailptr = NULL; *tailptr = NULL;
/* first iterate over non-suspended CPUs */ /* first iterate over non-suspended CPUs */
for (curcpu = machine->cpu[0]; curcpu != NULL; curcpu = curcpu->typenext) for (curcpu = machine->firstcpu; curcpu != NULL; curcpu = cpu_next(curcpu))
{ {
cpu_class_data *classdata = get_class_data(curcpu); cpu_class_data *classdata = get_class_data(curcpu);
if (classdata->suspend == 0) if (classdata->suspend == 0)
@ -1628,7 +1625,7 @@ static void rebuild_execute_list(running_machine *machine)
} }
/* then add the suspended CPUs */ /* then add the suspended CPUs */
for (curcpu = machine->cpu[0]; curcpu != NULL; curcpu = curcpu->typenext) for (curcpu = machine->firstcpu; curcpu != NULL; curcpu = cpu_next(curcpu))
{ {
cpu_class_data *classdata = get_class_data(curcpu); cpu_class_data *classdata = get_class_data(curcpu);
if (classdata->suspend != 0) if (classdata->suspend != 0)

View File

@ -335,7 +335,7 @@ void debug_command_init(running_machine *machine)
debug_console_register_command(machine, "hardreset", CMDFLAG_NONE, 0, 0, 1, execute_hardreset); debug_console_register_command(machine, "hardreset", CMDFLAG_NONE, 0, 0, 1, execute_hardreset);
/* ask all the CPUs if they would like to register functions or symbols */ /* ask all the CPUs if they would like to register functions or symbols */
for (cpu = machine->cpu[0]; cpu != NULL; cpu = cpu->typenext) for (cpu = machine->firstcpu; cpu != NULL; cpu = cpu_next(cpu))
{ {
cpu_debug_init_func debug_init; cpu_debug_init_func debug_init;
debug_init = (cpu_debug_init_func)device_get_info_fct(cpu, CPUINFO_FCT_DEBUG_INIT); debug_init = (cpu_debug_init_func)device_get_info_fct(cpu, CPUINFO_FCT_DEBUG_INIT);
@ -361,7 +361,7 @@ static void debug_command_exit(running_machine *machine)
const device_config *cpu; const device_config *cpu;
/* turn off all traces */ /* turn off all traces */
for (cpu = machine->cpu[0]; cpu != NULL; cpu = cpu->typenext) for (cpu = machine->firstcpu; cpu != NULL; cpu = cpu_next(cpu))
debug_cpu_trace(cpu, NULL, 0, NULL); debug_cpu_trace(cpu, NULL, 0, NULL);
if (cheat.length) if (cheat.length)
@ -510,14 +510,14 @@ int debug_command_parameter_cpu(running_machine *machine, const char *param, con
return FALSE; return FALSE;
} }
/* if we got a valid one, return */
*result = device_list_find_by_index(machine->config->devicelist, CPU, cpunum);
if (*result != NULL)
return TRUE;
/* if out of range, complain */ /* if out of range, complain */
if (cpunum >= ARRAY_LENGTH(machine->cpu) || machine->cpu[cpunum] == NULL) debug_console_printf(machine, "Invalid CPU index %d\n", (UINT32)cpunum);
{ return FALSE;
debug_console_printf(machine, "Invalid CPU index %d\n", (UINT32)cpunum);
return FALSE;
}
*result = machine->cpu[cpunum];
return TRUE;
} }
@ -957,7 +957,7 @@ static void execute_focus(running_machine *machine, int ref, int params, const c
debug_cpu_ignore_cpu(cpu, 0); debug_cpu_ignore_cpu(cpu, 0);
/* then loop over CPUs and set the ignore flags on all other CPUs */ /* then loop over CPUs and set the ignore flags on all other CPUs */
for (scancpu = machine->cpu[0]; scancpu != NULL; scancpu = scancpu->typenext) for (scancpu = machine->firstcpu; scancpu != NULL; scancpu = cpu_next(scancpu))
if (scancpu != cpu) if (scancpu != cpu)
debug_cpu_ignore_cpu(scancpu, 1); debug_cpu_ignore_cpu(scancpu, 1);
debug_console_printf(machine, "Now focused on CPU '%s'\n", cpu->tag); debug_console_printf(machine, "Now focused on CPU '%s'\n", cpu->tag);
@ -980,7 +980,7 @@ static void execute_ignore(running_machine *machine, int ref, int params, const
if (params == 0) if (params == 0)
{ {
/* loop over all CPUs */ /* loop over all CPUs */
for (cpu = machine->cpu[0]; cpu != NULL; cpu = cpu->typenext) for (cpu = machine->firstcpu; cpu != NULL; cpu = cpu_next(cpu))
{ {
const cpu_debug_data *cpuinfo = cpu_get_debug_data(cpu); const cpu_debug_data *cpuinfo = cpu_get_debug_data(cpu);
@ -1012,7 +1012,7 @@ static void execute_ignore(running_machine *machine, int ref, int params, const
for (paramnum = 0; paramnum < params; paramnum++) for (paramnum = 0; paramnum < params; paramnum++)
{ {
/* make sure this isn't the last live CPU */ /* make sure this isn't the last live CPU */
for (cpu = machine->cpu[0]; cpu != NULL; cpu = cpu->typenext) for (cpu = machine->firstcpu; cpu != NULL; cpu = cpu_next(cpu))
if (cpu != cpuwhich[paramnum] && (cpu_get_debug_data(cpu)->flags & DEBUG_FLAG_OBSERVING) != 0) if (cpu != cpuwhich[paramnum] && (cpu_get_debug_data(cpu)->flags & DEBUG_FLAG_OBSERVING) != 0)
break; break;
if (cpu == NULL) if (cpu == NULL)
@ -1044,7 +1044,7 @@ static void execute_observe(running_machine *machine, int ref, int params, const
if (params == 0) if (params == 0)
{ {
/* loop over all CPUs */ /* loop over all CPUs */
for (cpu = machine->cpu[0]; cpu != NULL; cpu = cpu->typenext) for (cpu = machine->firstcpu; cpu != NULL; cpu = cpu_next(cpu))
{ {
const cpu_debug_data *cpuinfo = cpu_get_debug_data(cpu); const cpu_debug_data *cpuinfo = cpu_get_debug_data(cpu);
@ -1196,7 +1196,7 @@ static void execute_bpclear(running_machine *machine, int ref, int params, const
{ {
const device_config *cpu; const device_config *cpu;
for (cpu = machine->cpu[0]; cpu != NULL; cpu = cpu->typenext) for (cpu = machine->firstcpu; cpu != NULL; cpu = cpu_next(cpu))
{ {
const cpu_debug_data *cpuinfo = cpu_get_debug_data(cpu); const cpu_debug_data *cpuinfo = cpu_get_debug_data(cpu);
debug_cpu_breakpoint *bp; debug_cpu_breakpoint *bp;
@ -1234,7 +1234,7 @@ static void execute_bpdisenable(running_machine *machine, int ref, int params, c
{ {
const device_config *cpu; const device_config *cpu;
for (cpu = machine->cpu[0]; cpu != NULL; cpu = cpu->typenext) for (cpu = machine->firstcpu; cpu != NULL; cpu = cpu_next(cpu))
{ {
const cpu_debug_data *cpuinfo = cpu_get_debug_data(cpu); const cpu_debug_data *cpuinfo = cpu_get_debug_data(cpu);
debug_cpu_breakpoint *bp; debug_cpu_breakpoint *bp;
@ -1273,7 +1273,7 @@ static void execute_bplist(running_machine *machine, int ref, int params, const
char buffer[256]; char buffer[256];
/* loop over all CPUs */ /* loop over all CPUs */
for (cpu = machine->cpu[0]; cpu != NULL; cpu = cpu->typenext) for (cpu = machine->firstcpu; cpu != NULL; cpu = cpu_next(cpu))
{ {
const cpu_debug_data *cpuinfo = cpu_get_debug_data(cpu); const cpu_debug_data *cpuinfo = cpu_get_debug_data(cpu);
@ -1370,7 +1370,7 @@ static void execute_wpclear(running_machine *machine, int ref, int params, const
{ {
const device_config *cpu; const device_config *cpu;
for (cpu = machine->cpu[0]; cpu != NULL; cpu = cpu->typenext) for (cpu = machine->firstcpu; cpu != NULL; cpu = cpu_next(cpu))
{ {
const cpu_debug_data *cpuinfo = cpu_get_debug_data(cpu); const cpu_debug_data *cpuinfo = cpu_get_debug_data(cpu);
int spacenum; int spacenum;
@ -1413,7 +1413,7 @@ static void execute_wpdisenable(running_machine *machine, int ref, int params, c
{ {
const device_config *cpu; const device_config *cpu;
for (cpu = machine->cpu[0]; cpu != NULL; cpu = cpu->typenext) for (cpu = machine->firstcpu; cpu != NULL; cpu = cpu_next(cpu))
{ {
const cpu_debug_data *cpuinfo = cpu_get_debug_data(cpu); const cpu_debug_data *cpuinfo = cpu_get_debug_data(cpu);
int spacenum; int spacenum;
@ -1457,7 +1457,7 @@ static void execute_wplist(running_machine *machine, int ref, int params, const
char buffer[256]; char buffer[256];
/* loop over all CPUs */ /* loop over all CPUs */
for (cpu = machine->cpu[0]; cpu != NULL; cpu = cpu->typenext) for (cpu = machine->firstcpu; cpu != NULL; cpu = cpu_next(cpu))
{ {
const cpu_debug_data *cpuinfo = cpu_get_debug_data(cpu); const cpu_debug_data *cpuinfo = cpu_get_debug_data(cpu);
int spacenum; int spacenum;
@ -1509,7 +1509,7 @@ static void execute_hotspot(running_machine *machine, int ref, int params, const
int cleared = FALSE; int cleared = FALSE;
/* loop over CPUs and find live spots */ /* loop over CPUs and find live spots */
for (cpu = machine->cpu[0]; cpu != NULL; cpu = cpu->typenext) for (cpu = machine->firstcpu; cpu != NULL; cpu = cpu_next(cpu))
{ {
const cpu_debug_data *cpuinfo = cpu_get_debug_data(cpu); const cpu_debug_data *cpuinfo = cpu_get_debug_data(cpu);

View File

@ -54,31 +54,24 @@
typedef struct _debug_comment debug_comment; typedef struct _debug_comment debug_comment;
struct _debug_comment struct _debug_comment
{ {
UINT8 is_valid; UINT8 is_valid;
UINT32 address; UINT32 address;
char text[DEBUG_COMMENT_MAX_LINE_LENGTH]; char text[DEBUG_COMMENT_MAX_LINE_LENGTH];
rgb_t color; rgb_t color;
UINT32 crc; UINT32 crc;
}; };
typedef struct _comment_group comment_group;
struct _comment_group /* in debugcpu.h -- typedef struct _debug_cpu_comment_group debug_cpu_comment_group; */
struct _debug_cpu_comment_group
{ {
int comment_count; int comment_count;
UINT32 change_count; UINT32 change_count;
debug_comment *comment_info[DEBUG_COMMENT_MAX_NUM]; debug_comment * comment_info[DEBUG_COMMENT_MAX_NUM];
}; };
/***************************************************************************
GLOBAL VARIABLES
***************************************************************************/
static comment_group *debug_comments;
/*************************************************************************** /***************************************************************************
FUNCTION PROTOTYPES FUNCTION PROTOTYPES
***************************************************************************/ ***************************************************************************/
@ -90,9 +83,7 @@ static void debug_comment_free(running_machine *machine);
/*************************************************************************** /***************************************************************************
INITIALIZATION
Initialization
***************************************************************************/ ***************************************************************************/
/*------------------------------------------------------------------------- /*-------------------------------------------------------------------------
@ -102,22 +93,18 @@ static void debug_comment_free(running_machine *machine);
int debug_comment_init(running_machine *machine) int debug_comment_init(running_machine *machine)
{ {
int numcpu; const device_config *cpu;
for (numcpu = 0; numcpu < ARRAY_LENGTH(machine->cpu); numcpu++) /* allocate memory for the comments */
if (machine->cpu[numcpu] == NULL) for (cpu = machine->firstcpu; cpu != NULL; cpu = cpu_next(cpu))
break;
if (numcpu > 0)
{ {
/* allocate enough comment groups for the total # of cpu's */ cpu_debug_data *cpudata = cpu_get_debug_data(cpu);
debug_comments = auto_alloc_array_clear(machine, comment_group, numcpu); cpudata->comments = auto_alloc(machine, debug_cpu_comment_group);
/* automatically load em up */
debug_comment_load(machine);
add_exit_callback(machine, debug_comment_exit);
} }
/* automatically load em up */
debug_comment_load(machine);
add_exit_callback(machine, debug_comment_exit);
return 1; return 1;
} }
@ -130,10 +117,10 @@ int debug_comment_init(running_machine *machine)
int debug_comment_add(const device_config *device, offs_t addr, const char *comment, rgb_t color, UINT32 c_crc) int debug_comment_add(const device_config *device, offs_t addr, const char *comment, rgb_t color, UINT32 c_crc)
{ {
int cpu_num = cpu_get_index(device); debug_cpu_comment_group *comments = cpu_get_debug_data(device)->comments;
int i = 0; int insert_point = comments->comment_count;
int insert_point = debug_comments[cpu_num].comment_count;
int match = 0; int match = 0;
int i = 0;
/* Create a new item to insert into the list */ /* Create a new item to insert into the list */
debug_comment *insert_me = alloc_or_die(debug_comment); debug_comment *insert_me = alloc_or_die(debug_comment);
@ -144,15 +131,15 @@ int debug_comment_add(const device_config *device, offs_t addr, const char *comm
strcpy(insert_me->text, comment); strcpy(insert_me->text, comment);
/* Find the insert point */ /* Find the insert point */
for (i = 0; i < debug_comments[cpu_num].comment_count; i++) for (i = 0; i < comments->comment_count; i++)
{ {
if (insert_me->address < debug_comments[cpu_num].comment_info[i]->address) if (insert_me->address < comments->comment_info[i]->address)
{ {
insert_point = i; insert_point = i;
break; break;
} }
else if (insert_me->address == debug_comments[cpu_num].comment_info[i]->address && else if (insert_me->address == comments->comment_info[i]->address &&
insert_me->crc == debug_comments[cpu_num].comment_info[i]->crc) insert_me->crc == comments->comment_info[i]->crc)
{ {
insert_point = i; insert_point = i;
match = 1; match = 1;
@ -163,9 +150,9 @@ int debug_comment_add(const device_config *device, offs_t addr, const char *comm
/* Got an exact match? Just replace */ /* Got an exact match? Just replace */
if (match == 1) if (match == 1)
{ {
free(debug_comments[cpu_num].comment_info[insert_point]); free(comments->comment_info[insert_point]);
debug_comments[cpu_num].comment_info[insert_point] = insert_me; comments->comment_info[insert_point] = insert_me;
debug_comments[cpu_num].change_count++; comments->change_count++;
/* force an update of disassembly views */ /* force an update of disassembly views */
debug_view_update_type(device->machine, DVT_DISASSEMBLY); debug_view_update_type(device->machine, DVT_DISASSEMBLY);
@ -174,13 +161,13 @@ int debug_comment_add(const device_config *device, offs_t addr, const char *comm
/* Otherwise insert */ /* Otherwise insert */
/* First, shift the list down */ /* First, shift the list down */
for (i = debug_comments[cpu_num].comment_count; i >= insert_point; i--) for (i = comments->comment_count; i >= insert_point; i--)
debug_comments[cpu_num].comment_info[i] = debug_comments[cpu_num].comment_info[i-1]; comments->comment_info[i] = comments->comment_info[i-1];
/* do the insertion */ /* do the insertion */
debug_comments[cpu_num].comment_info[insert_point] = insert_me; comments->comment_info[insert_point] = insert_me;
debug_comments[cpu_num].comment_count++; comments->comment_count++;
debug_comments[cpu_num].change_count++; comments->change_count++;
/* force an update of disassembly views */ /* force an update of disassembly views */
debug_view_update_type(device->machine, DVT_DISASSEMBLY); debug_view_update_type(device->machine, DVT_DISASSEMBLY);
@ -197,35 +184,27 @@ int debug_comment_add(const device_config *device, offs_t addr, const char *comm
int debug_comment_remove(const device_config *device, offs_t addr, UINT32 c_crc) int debug_comment_remove(const device_config *device, offs_t addr, UINT32 c_crc)
{ {
int cpu_num = cpu_get_index(device); debug_cpu_comment_group *comments = cpu_get_debug_data(device)->comments;
int i;
int remove_index = -1; int remove_index = -1;
int i;
for (i = 0; i < debug_comments[cpu_num].comment_count; i++) for (i = 0; i < comments->comment_count; i++)
{ if (comments->comment_info[i]->address == addr) /* got an address match */
if (debug_comments[cpu_num].comment_info[i]->address == addr) /* got an address match */ if (comments->comment_info[i]->crc == c_crc)
{
if (debug_comments[cpu_num].comment_info[i]->crc == c_crc)
{
remove_index = i; remove_index = i;
}
}
}
/* The comment doesn't exist? */ /* The comment doesn't exist? */
if (remove_index == -1) if (remove_index == -1)
return 0; return 0;
/* Okay, it's there, now remove it */ /* Okay, it's there, now remove it */
free(debug_comments[cpu_num].comment_info[remove_index]); free(comments->comment_info[remove_index]);
for (i = remove_index; i < debug_comments[cpu_num].comment_count-1; i++) for (i = remove_index; i < comments->comment_count-1; i++)
{ comments->comment_info[i] = comments->comment_info[i+1];
debug_comments[cpu_num].comment_info[i] = debug_comments[cpu_num].comment_info[i+1];
}
debug_comments[cpu_num].comment_count--; comments->comment_count--;
debug_comments[cpu_num].change_count++; comments->change_count++;
/* force an update of disassembly views */ /* force an update of disassembly views */
debug_view_update_type(device->machine, DVT_DISASSEMBLY); debug_view_update_type(device->machine, DVT_DISASSEMBLY);
@ -242,21 +221,17 @@ int debug_comment_remove(const device_config *device, offs_t addr, UINT32 c_crc)
const char *debug_comment_get_text(const device_config *device, offs_t addr, UINT32 c_crc) const char *debug_comment_get_text(const device_config *device, offs_t addr, UINT32 c_crc)
{ {
int cpu_num = cpu_get_index(device); debug_cpu_comment_group *comments = cpu_get_debug_data(device)->comments;
int i; int i;
/* inefficient - should use bsearch - but will be a little tricky with multiple comments per addr */ /* inefficient - should use bsearch - but will be a little tricky with multiple comments per addr */
for (i = 0; i < debug_comments[cpu_num].comment_count; i++) for (i = 0; i < comments->comment_count; i++)
{ if (comments->comment_info[i]->address == addr) /* got an address match */
if (debug_comments[cpu_num].comment_info[i]->address == addr) /* got an address match */
{ {
/* now check the bank information to be sure */ /* now check the bank information to be sure */
if (debug_comments[cpu_num].comment_info[i]->crc == c_crc) if (comments->comment_info[i]->crc == c_crc)
{ return comments->comment_info[i]->text;
return debug_comments[cpu_num].comment_info[i]->text;
}
} }
}
return 0x00; return 0x00;
} }
@ -269,7 +244,8 @@ const char *debug_comment_get_text(const device_config *device, offs_t addr, UIN
int debug_comment_get_count(const device_config *device) int debug_comment_get_count(const device_config *device)
{ {
return debug_comments[cpu_get_index(device)].comment_count; debug_cpu_comment_group *comments = cpu_get_debug_data(device)->comments;
return comments->comment_count;
} }
@ -280,7 +256,8 @@ int debug_comment_get_count(const device_config *device)
UINT32 debug_comment_get_change_count(const device_config *device) UINT32 debug_comment_get_change_count(const device_config *device)
{ {
return debug_comments[cpu_get_index(device)].change_count; debug_cpu_comment_group *comments = cpu_get_debug_data(device)->comments;
return comments->change_count;
} }
/*------------------------------------------------------------------------- /*-------------------------------------------------------------------------
@ -290,12 +267,14 @@ UINT32 debug_comment_get_change_count(const device_config *device)
UINT32 debug_comment_all_change_count(running_machine *machine) UINT32 debug_comment_all_change_count(running_machine *machine)
{ {
int i ; const device_config *cpu;
UINT32 retVal = 0; UINT32 retVal = 0;
for (i = 0; i < ARRAY_LENGTH(machine->cpu); i++) for (cpu = machine->firstcpu; cpu != NULL; cpu = cpu_next(cpu))
if (machine->cpu[i] != NULL) {
retVal += debug_comments[i].change_count ; debug_cpu_comment_group *comments = cpu_get_debug_data(cpu)->comments;
retVal += comments->change_count;
}
return retVal; return retVal;
} }
@ -342,41 +321,35 @@ UINT32 debug_comment_get_opcode_crc32(const device_config *device, offs_t addres
void debug_comment_dump(const device_config *device, offs_t addr) void debug_comment_dump(const device_config *device, offs_t addr)
{ {
int cpu_num = cpu_get_index(device); debug_cpu_comment_group *comments = cpu_get_debug_data(device)->comments;
int i; int i;
int ff = 0; int ff = 0;
if (addr == -1) if (addr == -1)
{ {
for (i = 0; i < debug_comments[cpu_num].comment_count; i++) for (i = 0; i < comments->comment_count; i++)
{ if (comments->comment_info[i]->is_valid)
if (debug_comments[cpu_num].comment_info[i]->is_valid) logerror("%d : %s (%d %d)\n", i, comments->comment_info[i]->text,
{ comments->comment_info[i]->address,
logerror("%d : %s (%d %d)\n", i, debug_comments[cpu_num].comment_info[i]->text, comments->comment_info[i]->crc);
debug_comments[cpu_num].comment_info[i]->address,
debug_comments[cpu_num].comment_info[i]->crc);
}
}
} }
else else
{ {
UINT32 c_crc = debug_comment_get_opcode_crc32(device, addr); UINT32 c_crc = debug_comment_get_opcode_crc32(device, addr);
for (i = 0; i < debug_comments[cpu_num].comment_count; i++) for (i = 0; i < comments->comment_count; i++)
{ if (comments->comment_info[i]->address == addr) /* got an address match */
if (debug_comments[cpu_num].comment_info[i]->address == addr) /* got an address match */
{ {
/* now check the bank information to be sure */ /* now check the bank information to be sure */
if (debug_comments[cpu_num].comment_info[i]->crc == c_crc) if (comments->comment_info[i]->crc == c_crc)
{ {
logerror("%d : %s (%d %d)\n", addr, logerror("%d : %s (%d %d)\n", addr,
debug_comments[cpu_num].comment_info[addr]->text, comments->comment_info[addr]->text,
debug_comments[cpu_num].comment_info[addr]->address, comments->comment_info[addr]->address,
debug_comments[cpu_num].comment_info[addr]->crc); comments->comment_info[addr]->crc);
ff = 1; ff = 1;
} }
} }
}
if (!ff) logerror("No comment exists for address : 0x%x\n", addr); if (!ff) logerror("No comment exists for address : 0x%x\n", addr);
} }
@ -389,49 +362,51 @@ void debug_comment_dump(const device_config *device, offs_t addr)
int debug_comment_save(running_machine *machine) int debug_comment_save(running_machine *machine)
{ {
int i, j; int j;
char crc_buf[20]; char crc_buf[20];
xml_data_node *root = xml_file_create(); xml_data_node *root = xml_file_create();
xml_data_node *commentnode, *systemnode; xml_data_node *commentnode, *systemnode;
int total_comments = 0; int total_comments = 0;
const device_config *cpu;
/* if we don't have a root, bail */ /* if we don't have a root, bail */
if (!root) if (root == NULL)
return 0; return 0;
/* create a comment node */ /* create a comment node */
commentnode = xml_add_child(root, "mamecommentfile", NULL); commentnode = xml_add_child(root, "mamecommentfile", NULL);
if (!commentnode) if (commentnode == NULL)
goto error; goto error;
xml_set_attribute_int(commentnode, "version", COMMENT_VERSION); xml_set_attribute_int(commentnode, "version", COMMENT_VERSION);
/* create a system node */ /* create a system node */
systemnode = xml_add_child(commentnode, "system", NULL); systemnode = xml_add_child(commentnode, "system", NULL);
if (!systemnode) if (systemnode == NULL)
goto error; goto error;
xml_set_attribute(systemnode, "name", machine->gamedrv->name); xml_set_attribute(systemnode, "name", machine->gamedrv->name);
/* for each cpu */ /* for each cpu */
for (i = 0; i < ARRAY_LENGTH(machine->cpu); i++) for (cpu = machine->firstcpu; cpu != NULL; cpu = cpu_next(cpu))
if (machine->cpu[i] != NULL) {
{ debug_cpu_comment_group *comments = cpu_get_debug_data(cpu)->comments;
xml_data_node *curnode = xml_add_child(systemnode, "cpu", NULL);
if (!curnode)
goto error;
xml_set_attribute_int(curnode, "num", i);
for (j = 0; j < debug_comments[i].comment_count; j++) xml_data_node *curnode = xml_add_child(systemnode, "cpu", NULL);
{ if (curnode == NULL)
xml_data_node *datanode = xml_add_child(curnode, "comment", xml_normalize_string(debug_comments[i].comment_info[j]->text)); goto error;
if (!datanode) xml_set_attribute(curnode, "tag", cpu->tag);
goto error;
xml_set_attribute_int(datanode, "address", debug_comments[i].comment_info[j]->address); for (j = 0; j < comments->comment_count; j++)
xml_set_attribute_int(datanode, "color", debug_comments[i].comment_info[j]->color); {
sprintf(crc_buf, "%08X", debug_comments[i].comment_info[j]->crc); xml_data_node *datanode = xml_add_child(curnode, "comment", xml_normalize_string(comments->comment_info[j]->text));
xml_set_attribute(datanode, "crc", crc_buf); if (datanode == NULL)
total_comments++; goto error;
} xml_set_attribute_int(datanode, "address", comments->comment_info[j]->address);
xml_set_attribute_int(datanode, "color", comments->comment_info[j]->color);
sprintf(crc_buf, "%08X", comments->comment_info[j]->crc);
xml_set_attribute(datanode, "crc", crc_buf);
total_comments++;
} }
}
/* flush the file */ /* flush the file */
if (total_comments > 0) if (total_comments > 0)
@ -484,19 +459,19 @@ int debug_comment_load(running_machine *machine)
static int debug_comment_load_xml(running_machine *machine, mame_file *fp) static int debug_comment_load_xml(running_machine *machine, mame_file *fp)
{ {
int i, j; int j;
xml_data_node *root, *commentnode, *systemnode, *cpunode, *datanode; xml_data_node *root, *commentnode, *systemnode, *cpunode, *datanode;
const char *name; const char *name;
int version; int version;
/* read the file */ /* read the file */
root = xml_file_read(mame_core_file(fp), NULL); root = xml_file_read(mame_core_file(fp), NULL);
if (!root) if (root == NULL)
goto error; goto error;
/* find the config node */ /* find the config node */
commentnode = xml_get_sibling(root->child, "mamecommentfile"); commentnode = xml_get_sibling(root->child, "mamecommentfile");
if (!commentnode) if (commentnode == NULL)
goto error; goto error;
/* validate the config data version */ /* validate the config data version */
@ -510,29 +485,30 @@ static int debug_comment_load_xml(running_machine *machine, mame_file *fp)
if (strcmp(name, machine->gamedrv->name) != 0) if (strcmp(name, machine->gamedrv->name) != 0)
goto error; goto error;
i = 0;
for (cpunode = xml_get_sibling(systemnode->child, "cpu"); cpunode; cpunode = xml_get_sibling(cpunode->next, "cpu")) for (cpunode = xml_get_sibling(systemnode->child, "cpu"); cpunode; cpunode = xml_get_sibling(cpunode->next, "cpu"))
{ {
j = 0; const device_config *cpu = cputag_get_cpu(machine, xml_get_attribute_string(cpunode, "tag", ""));
if (cpu != NULL)
for (datanode = xml_get_sibling(cpunode->child, "comment"); datanode; datanode = xml_get_sibling(datanode->next, "comment"))
{ {
/* Malloc the comment */ debug_cpu_comment_group *comments = cpu_get_debug_data(cpu)->comments;
debug_comments[i].comment_info[j] = (debug_comment*) malloc(sizeof(debug_comment)); j = 0;
debug_comments[i].comment_info[j]->address = xml_get_attribute_int(datanode, "address", 0); for (datanode = xml_get_sibling(cpunode->child, "comment"); datanode; datanode = xml_get_sibling(datanode->next, "comment"))
debug_comments[i].comment_info[j]->color = xml_get_attribute_int(datanode, "color", 0); {
sscanf(xml_get_attribute_string(datanode, "crc", 0), "%08X", &debug_comments[i].comment_info[j]->crc); /* Malloc the comment */
strcpy(debug_comments[i].comment_info[j]->text, datanode->value); comments->comment_info[j] = (debug_comment*) malloc(sizeof(debug_comment));
debug_comments[i].comment_info[j]->is_valid = 1;
j++; comments->comment_info[j]->address = xml_get_attribute_int(datanode, "address", 0);
comments->comment_info[j]->color = xml_get_attribute_int(datanode, "color", 0);
sscanf(xml_get_attribute_string(datanode, "crc", 0), "%08X", &comments->comment_info[j]->crc);
strcpy(comments->comment_info[j]->text, datanode->value);
comments->comment_info[j]->is_valid = 1;
j++;
}
comments->comment_count = j;
} }
debug_comments[i].comment_count = j;
i++;
} }
/* free the parser */ /* free the parser */
@ -564,16 +540,19 @@ static void debug_comment_exit(running_machine *machine)
static void debug_comment_free(running_machine *machine) static void debug_comment_free(running_machine *machine)
{ {
int i, j; const device_config *cpu;
for (i = 0; i < ARRAY_LENGTH(machine->cpu); i++) for (cpu = machine->firstcpu; cpu != NULL; cpu = cpu_next(cpu))
if (machine->cpu[i] != NULL) {
debug_cpu_comment_group *comments = cpu_get_debug_data(cpu)->comments;
if (comments != NULL)
{ {
for (j = 0; j < debug_comments[i].comment_count; j++) int j;
{
free(debug_comments[i].comment_info[j]);
}
debug_comments[i].comment_count = 0; for (j = 0; j < comments->comment_count; j++)
free(comments->comment_info[j]);
comments->comment_count = 0;
} }
}
} }

View File

@ -183,7 +183,7 @@ void debug_cpu_init(running_machine *machine)
} }
/* loop over CPUs and build up their info */ /* loop over CPUs and build up their info */
for (cpu = machine->cpu[0]; cpu != NULL; cpu = cpu->typenext) for (cpu = machine->firstcpu; cpu != NULL; cpu = cpu_next(cpu))
{ {
cpu_class_header *classheader = cpu_get_class_header(cpu); cpu_class_header *classheader = cpu_get_class_header(cpu);
cpu_debug_data *info; cpu_debug_data *info;
@ -249,7 +249,7 @@ void debug_cpu_init(running_machine *machine)
} }
/* first CPU is visible by default */ /* first CPU is visible by default */
global->visiblecpu = machine->cpu[0]; global->visiblecpu = machine->firstcpu;
/* add callback for breaking on VBLANK */ /* add callback for breaking on VBLANK */
if (machine->primary_screen != NULL) if (machine->primary_screen != NULL)
@ -269,7 +269,7 @@ void debug_cpu_flush_traces(running_machine *machine)
{ {
const device_config *cpu; const device_config *cpu;
for (cpu = machine->cpu[0]; cpu != NULL; cpu = cpu->typenext) for (cpu = machine->firstcpu; cpu != NULL; cpu = cpu_next(cpu))
{ {
cpu_debug_data *info = cpu_get_debug_data(cpu); cpu_debug_data *info = cpu_get_debug_data(cpu);
@ -1014,7 +1014,7 @@ int debug_cpu_breakpoint_clear(running_machine *machine, int bpnum)
const device_config *cpu; const device_config *cpu;
/* loop over CPUs and find the requested breakpoint */ /* loop over CPUs and find the requested breakpoint */
for (cpu = machine->cpu[0]; cpu != NULL; cpu = cpu->typenext) for (cpu = machine->firstcpu; cpu != NULL; cpu = cpu_next(cpu))
{ {
cpu_debug_data *info = cpu_get_debug_data(cpu); cpu_debug_data *info = cpu_get_debug_data(cpu);
for (pbp = NULL, bp = info->bplist; bp != NULL; pbp = bp, bp = bp->next) for (pbp = NULL, bp = info->bplist; bp != NULL; pbp = bp, bp = bp->next)
@ -1055,7 +1055,7 @@ int debug_cpu_breakpoint_enable(running_machine *machine, int bpnum, int enable)
const device_config *cpu; const device_config *cpu;
/* loop over CPUs and find the requested breakpoint */ /* loop over CPUs and find the requested breakpoint */
for (cpu = machine->cpu[0]; cpu != NULL; cpu = cpu->typenext) for (cpu = machine->firstcpu; cpu != NULL; cpu = cpu_next(cpu))
{ {
cpu_debug_data *info = cpu_get_debug_data(cpu); cpu_debug_data *info = cpu_get_debug_data(cpu);
for (bp = info->bplist; bp != NULL; bp = bp->next) for (bp = info->bplist; bp != NULL; bp = bp->next)
@ -1123,7 +1123,7 @@ int debug_cpu_watchpoint_clear(running_machine *machine, int wpnum)
int spacenum; int spacenum;
/* loop over CPUs and find the requested watchpoint */ /* loop over CPUs and find the requested watchpoint */
for (cpu = machine->cpu[0]; cpu != NULL; cpu = cpu->typenext) for (cpu = machine->firstcpu; cpu != NULL; cpu = cpu_next(cpu))
{ {
cpu_debug_data *info = cpu_get_debug_data(cpu); cpu_debug_data *info = cpu_get_debug_data(cpu);
@ -1166,7 +1166,7 @@ int debug_cpu_watchpoint_enable(running_machine *machine, int wpnum, int enable)
int spacenum; int spacenum;
/* loop over CPUs and address spaces and find the requested watchpoint */ /* loop over CPUs and address spaces and find the requested watchpoint */
for (cpu = machine->cpu[0]; cpu != NULL; cpu = cpu->typenext) for (cpu = machine->firstcpu; cpu != NULL; cpu = cpu_next(cpu))
{ {
cpu_debug_data *info = cpu_get_debug_data(cpu); cpu_debug_data *info = cpu_get_debug_data(cpu);
@ -1934,7 +1934,7 @@ static void debug_cpu_exit(running_machine *machine)
int spacenum; int spacenum;
/* loop over all watchpoints and breakpoints to free their memory */ /* loop over all watchpoints and breakpoints to free their memory */
for (cpu = machine->cpu[0]; cpu != NULL; cpu = cpu->typenext) for (cpu = machine->firstcpu; cpu != NULL; cpu = cpu_next(cpu))
{ {
cpu_debug_data *info = cpu_get_debug_data(cpu); cpu_debug_data *info = cpu_get_debug_data(cpu);
@ -1989,7 +1989,7 @@ static void reset_transient_flags(running_machine *machine)
const device_config *cpu; const device_config *cpu;
/* loop over CPUs and reset the transient flags */ /* loop over CPUs and reset the transient flags */
for (cpu = machine->cpu[0]; cpu != NULL; cpu = cpu->typenext) for (cpu = machine->firstcpu; cpu != NULL; cpu = cpu_next(cpu))
cpu_get_debug_data(cpu)->flags &= ~DEBUG_FLAG_TRANSIENT; cpu_get_debug_data(cpu)->flags &= ~DEBUG_FLAG_TRANSIENT;
} }
@ -2445,11 +2445,11 @@ static UINT32 dasm_wrapped(const device_config *device, char *buffer, offs_t pc)
static const device_config *expression_cpu_index(running_machine *machine, const char *tag) static const device_config *expression_cpu_index(running_machine *machine, const char *tag)
{ {
int index; const device_config *cpu;
for (index = 0; index < ARRAY_LENGTH(machine->cpu); index++) for (cpu = machine->firstcpu; cpu != NULL; cpu = cpu_next(cpu))
if (machine->cpu[index] != NULL && mame_stricmp(machine->cpu[index]->tag, tag) == 0) if (mame_stricmp(cpu->tag, tag) == 0)
return machine->cpu[index]; return cpu;
return NULL; return NULL;
} }

View File

@ -71,6 +71,7 @@ typedef int (*debug_instruction_hook_func)(const device_config *device, offs_t c
typedef struct _debug_cpu_breakpoint debug_cpu_breakpoint; typedef struct _debug_cpu_breakpoint debug_cpu_breakpoint;
typedef struct _debug_cpu_watchpoint debug_cpu_watchpoint; typedef struct _debug_cpu_watchpoint debug_cpu_watchpoint;
typedef struct _debug_cpu_comment_group debug_cpu_comment_group;
typedef struct _debug_trace_info debug_trace_info; typedef struct _debug_trace_info debug_trace_info;
@ -126,6 +127,7 @@ struct _cpu_debug_data
cpu_disassemble_func dasm_override; /* pointer to provided override function */ cpu_disassemble_func dasm_override; /* pointer to provided override function */
debug_instruction_hook_func instrhook; /* per-instruction callback hook */ debug_instruction_hook_func instrhook; /* per-instruction callback hook */
debug_cpu_watchpoint * wplist[ADDRESS_SPACES]; /* watchpoint lists for each address space */ debug_cpu_watchpoint * wplist[ADDRESS_SPACES]; /* watchpoint lists for each address space */
debug_cpu_comment_group *comments; /* disassembly comments */
}; };

View File

@ -1046,7 +1046,7 @@ static const registers_subview_item *registers_view_enumerate_subviews(running_m
int curindex = 0; int curindex = 0;
/* iterate over CPUs with program address spaces */ /* iterate over CPUs with program address spaces */
for (cpu = machine->cpu[0]; cpu != NULL; cpu = cpu->typenext) for (cpu = machine->firstcpu; cpu != NULL; cpu = cpu_next(cpu))
{ {
registers_subview_item *subview; registers_subview_item *subview;
@ -1187,7 +1187,7 @@ static void registers_view_recompute(debug_view *view)
/* if no CPU, reset to the first one */ /* if no CPU, reset to the first one */
if (regdata->device == NULL) if (regdata->device == NULL)
regdata->device = view->machine->cpu[0]; regdata->device = view->machine->firstcpu;
table = cpu_get_state_table(regdata->device); table = cpu_get_state_table(regdata->device);
/* reset the view parameters */ /* reset the view parameters */
@ -1512,7 +1512,7 @@ static const disasm_subview_item *disasm_view_enumerate_subviews(running_machine
int curindex = 0; int curindex = 0;
/* iterate over CPUs with program address spaces */ /* iterate over CPUs with program address spaces */
for (cpu = machine->cpu[0]; cpu != NULL; cpu = cpu->typenext) for (cpu = machine->firstcpu; cpu != NULL; cpu = cpu_next(cpu))
{ {
const address_space *space = cpu_get_address_space(cpu, ADDRESS_SPACE_PROGRAM); const address_space *space = cpu_get_address_space(cpu, ADDRESS_SPACE_PROGRAM);
if (space != NULL) if (space != NULL)
@ -1569,7 +1569,7 @@ static int disasm_view_alloc(debug_view *view)
debug_view_expression_alloc(&dasmdata->expression); debug_view_expression_alloc(&dasmdata->expression);
/* count the number of comments */ /* count the number of comments */
for (cpu = view->machine->cpu[0]; cpu != NULL; cpu = cpu->typenext) for (cpu = view->machine->firstcpu; cpu != NULL; cpu = cpu_next(cpu))
total_comments += debug_comment_get_count(cpu); total_comments += debug_comment_get_count(cpu);
/* initialize */ /* initialize */
@ -2433,7 +2433,7 @@ static const memory_subview_item *memory_view_enumerate_subviews(running_machine
int itemnum; int itemnum;
/* first add all the CPUs' address spaces */ /* first add all the CPUs' address spaces */
for (cpu = machine->cpu[0]; cpu != NULL; cpu = cpu->typenext) for (cpu = machine->firstcpu; cpu != NULL; cpu = cpu_next(cpu))
for (spacenum = 0; spacenum < ADDRESS_SPACES; spacenum++) for (spacenum = 0; spacenum < ADDRESS_SPACES; spacenum++)
{ {
const address_space *space = cpu_get_address_space(cpu, spacenum); const address_space *space = cpu_get_address_space(cpu, spacenum);

View File

@ -262,7 +262,7 @@ static DEVICE_START( via6522 )
/* Default clock is from CPU1 */ /* Default clock is from CPU1 */
if (device->clock == 0) if (device->clock == 0)
device_set_clock(device, device->machine->cpu[0]->clock); device_set_clock(device, device->machine->firstcpu->clock);
} }

View File

@ -584,7 +584,7 @@ WRITE8_HANDLER(kbdc8042_8_w)
* the bits low set in the command byte. The only pulse that has * the bits low set in the command byte. The only pulse that has
* an effect currently is bit 0, which pulses the CPU's reset line * an effect currently is bit 0, which pulses the CPU's reset line
*/ */
cpu_set_input_line(space->machine->cpu[0], INPUT_LINE_RESET, PULSE_LINE); cpu_set_input_line(space->machine->firstcpu, INPUT_LINE_RESET, PULSE_LINE);
at_8042_set_outport(space->machine, kbdc8042.outport | 0x02, 0); at_8042_set_outport(space->machine, kbdc8042.outport | 0x02, 0);
break; break;
} }

View File

@ -40,7 +40,6 @@ static UINT8 interrupt_enable[8];
/*************************************************************************** /***************************************************************************
FUNCTION PROTOTYPES FUNCTION PROTOTYPES
***************************************************************************/ ***************************************************************************/
@ -51,6 +50,23 @@ static void interrupt_reset(running_machine *machine);
/***************************************************************************
INLINE FUNCTIONS
***************************************************************************/
/*-------------------------------------------------
interrupt_enabled - return true if interrupts
are enabled for the given CPU
-------------------------------------------------*/
INLINE int interrupt_enabled(const device_config *device)
{
int cpunum = cpu_get_index(device);
return (cpunum >= ARRAY_LENGTH(interrupt_enable) || interrupt_enable[cpunum]);
}
/*************************************************************************** /***************************************************************************
INITIALIZATION INITIALIZATION
***************************************************************************/ ***************************************************************************/
@ -568,7 +584,7 @@ static void interrupt_reset(running_machine *machine)
int cpunum; int cpunum;
/* on a reset, enable all interrupts */ /* on a reset, enable all interrupts */
for (cpunum = 0; cpunum < ARRAY_LENGTH(machine->cpu); cpunum++) for (cpunum = 0; cpunum < ARRAY_LENGTH(interrupt_enable); cpunum++)
interrupt_enable[cpunum] = 1; interrupt_enable[cpunum] = 1;
} }
@ -645,7 +661,8 @@ void cpu_interrupt_enable(const device_config *device, int enabled)
assert_always(device != NULL, "cpu_interrupt_enable() called for invalid cpu!"); assert_always(device != NULL, "cpu_interrupt_enable() called for invalid cpu!");
/* set the new state */ /* set the new state */
interrupt_enable[cpunum] = enabled; if (cpunum < ARRAY_LENGTH(interrupt_enable))
interrupt_enable[cpunum] = enabled;
/* make sure there are no queued interrupts */ /* make sure there are no queued interrupts */
if (enabled == 0) if (enabled == 0)
@ -671,7 +688,7 @@ WRITE8_HANDLER( interrupt_enable_w )
READ8_HANDLER( interrupt_enable_r ) READ8_HANDLER( interrupt_enable_r )
{ {
return interrupt_enable[cpu_get_index(space->cpu)]; return interrupt_enabled(space->cpu);
} }
@ -680,61 +697,49 @@ READ8_HANDLER( interrupt_enable_r )
INTERRUPT GENERATION CALLBACK HELPERS INTERRUPT GENERATION CALLBACK HELPERS
***************************************************************************/ ***************************************************************************/
/*-------------------------------------------------
irqn_line_set - set the given IRQ line to the
specified state on the active CPU
-------------------------------------------------*/
INLINE void irqn_line_set(const device_config *device, int line, int state)
{
if (interrupt_enable[cpu_get_index(device)])
cpu_set_input_line(device, line, state);
}
/*------------------------------------------------- /*-------------------------------------------------
NMI callbacks NMI callbacks
-------------------------------------------------*/ -------------------------------------------------*/
INTERRUPT_GEN( nmi_line_pulse ) { irqn_line_set(device, INPUT_LINE_NMI, PULSE_LINE); } INTERRUPT_GEN( nmi_line_pulse ) { if (interrupt_enabled(device)) cpu_set_input_line(device, INPUT_LINE_NMI, PULSE_LINE); }
INTERRUPT_GEN( nmi_line_assert ) { irqn_line_set(device, INPUT_LINE_NMI, ASSERT_LINE); } INTERRUPT_GEN( nmi_line_assert ) { if (interrupt_enabled(device)) cpu_set_input_line(device, INPUT_LINE_NMI, ASSERT_LINE); }
/*------------------------------------------------- /*-------------------------------------------------
IRQn callbacks IRQn callbacks
-------------------------------------------------*/ -------------------------------------------------*/
INTERRUPT_GEN( irq0_line_hold ) { irqn_line_set(device, 0, HOLD_LINE); } INTERRUPT_GEN( irq0_line_hold ) { if (interrupt_enabled(device)) cpu_set_input_line(device, 0, HOLD_LINE); }
INTERRUPT_GEN( irq0_line_pulse ) { if (interrupt_enable[cpu_get_index(device)]) generic_pulse_irq_line(device, 0); } INTERRUPT_GEN( irq0_line_pulse ) { if (interrupt_enabled(device)) generic_pulse_irq_line(device, 0); }
INTERRUPT_GEN( irq0_line_assert ) { irqn_line_set(device, 0, ASSERT_LINE); } INTERRUPT_GEN( irq0_line_assert ) { if (interrupt_enabled(device)) cpu_set_input_line(device, 0, ASSERT_LINE); }
INTERRUPT_GEN( irq1_line_hold ) { irqn_line_set(device, 1, HOLD_LINE); } INTERRUPT_GEN( irq1_line_hold ) { if (interrupt_enabled(device)) cpu_set_input_line(device, 1, HOLD_LINE); }
INTERRUPT_GEN( irq1_line_pulse ) { if (interrupt_enable[cpu_get_index(device)]) generic_pulse_irq_line(device, 1); } INTERRUPT_GEN( irq1_line_pulse ) { if (interrupt_enabled(device)) generic_pulse_irq_line(device, 1); }
INTERRUPT_GEN( irq1_line_assert ) { irqn_line_set(device, 1, ASSERT_LINE); } INTERRUPT_GEN( irq1_line_assert ) { if (interrupt_enabled(device)) cpu_set_input_line(device, 1, ASSERT_LINE); }
INTERRUPT_GEN( irq2_line_hold ) { irqn_line_set(device, 2, HOLD_LINE); } INTERRUPT_GEN( irq2_line_hold ) { if (interrupt_enabled(device)) cpu_set_input_line(device, 2, HOLD_LINE); }
INTERRUPT_GEN( irq2_line_pulse ) { if (interrupt_enable[cpu_get_index(device)]) generic_pulse_irq_line(device, 2); } INTERRUPT_GEN( irq2_line_pulse ) { if (interrupt_enabled(device)) generic_pulse_irq_line(device, 2); }
INTERRUPT_GEN( irq2_line_assert ) { irqn_line_set(device, 2, ASSERT_LINE); } INTERRUPT_GEN( irq2_line_assert ) { if (interrupt_enabled(device)) cpu_set_input_line(device, 2, ASSERT_LINE); }
INTERRUPT_GEN( irq3_line_hold ) { irqn_line_set(device, 3, HOLD_LINE); } INTERRUPT_GEN( irq3_line_hold ) { if (interrupt_enabled(device)) cpu_set_input_line(device, 3, HOLD_LINE); }
INTERRUPT_GEN( irq3_line_pulse ) { if (interrupt_enable[cpu_get_index(device)]) generic_pulse_irq_line(device, 3); } INTERRUPT_GEN( irq3_line_pulse ) { if (interrupt_enabled(device)) generic_pulse_irq_line(device, 3); }
INTERRUPT_GEN( irq3_line_assert ) { irqn_line_set(device, 3, ASSERT_LINE); } INTERRUPT_GEN( irq3_line_assert ) { if (interrupt_enabled(device)) cpu_set_input_line(device, 3, ASSERT_LINE); }
INTERRUPT_GEN( irq4_line_hold ) { irqn_line_set(device, 4, HOLD_LINE); } INTERRUPT_GEN( irq4_line_hold ) { if (interrupt_enabled(device)) cpu_set_input_line(device, 4, HOLD_LINE); }
INTERRUPT_GEN( irq4_line_pulse ) { if (interrupt_enable[cpu_get_index(device)]) generic_pulse_irq_line(device, 4); } INTERRUPT_GEN( irq4_line_pulse ) { if (interrupt_enabled(device)) generic_pulse_irq_line(device, 4); }
INTERRUPT_GEN( irq4_line_assert ) { irqn_line_set(device, 4, ASSERT_LINE); } INTERRUPT_GEN( irq4_line_assert ) { if (interrupt_enabled(device)) cpu_set_input_line(device, 4, ASSERT_LINE); }
INTERRUPT_GEN( irq5_line_hold ) { irqn_line_set(device, 5, HOLD_LINE); } INTERRUPT_GEN( irq5_line_hold ) { if (interrupt_enabled(device)) cpu_set_input_line(device, 5, HOLD_LINE); }
INTERRUPT_GEN( irq5_line_pulse ) { if (interrupt_enable[cpu_get_index(device)]) generic_pulse_irq_line(device, 5); } INTERRUPT_GEN( irq5_line_pulse ) { if (interrupt_enabled(device)) generic_pulse_irq_line(device, 5); }
INTERRUPT_GEN( irq5_line_assert ) { irqn_line_set(device, 5, ASSERT_LINE); } INTERRUPT_GEN( irq5_line_assert ) { if (interrupt_enabled(device)) cpu_set_input_line(device, 5, ASSERT_LINE); }
INTERRUPT_GEN( irq6_line_hold ) { irqn_line_set(device, 6, HOLD_LINE); } INTERRUPT_GEN( irq6_line_hold ) { if (interrupt_enabled(device)) cpu_set_input_line(device, 6, HOLD_LINE); }
INTERRUPT_GEN( irq6_line_pulse ) { if (interrupt_enable[cpu_get_index(device)]) generic_pulse_irq_line(device, 6); } INTERRUPT_GEN( irq6_line_pulse ) { if (interrupt_enabled(device)) generic_pulse_irq_line(device, 6); }
INTERRUPT_GEN( irq6_line_assert ) { irqn_line_set(device, 6, ASSERT_LINE); } INTERRUPT_GEN( irq6_line_assert ) { if (interrupt_enabled(device)) cpu_set_input_line(device, 6, ASSERT_LINE); }
INTERRUPT_GEN( irq7_line_hold ) { irqn_line_set(device, 7, HOLD_LINE); } INTERRUPT_GEN( irq7_line_hold ) { if (interrupt_enabled(device)) cpu_set_input_line(device, 7, HOLD_LINE); }
INTERRUPT_GEN( irq7_line_pulse ) { if (interrupt_enable[cpu_get_index(device)]) generic_pulse_irq_line(device, 7); } INTERRUPT_GEN( irq7_line_pulse ) { if (interrupt_enabled(device)) generic_pulse_irq_line(device, 7); }
INTERRUPT_GEN( irq7_line_assert ) { irqn_line_set(device, 7, ASSERT_LINE); } INTERRUPT_GEN( irq7_line_assert ) { if (interrupt_enabled(device)) cpu_set_input_line(device, 7, ASSERT_LINE); }

View File

@ -84,7 +84,7 @@ READ8_DEVICE_HANDLER( latch8_r )
if (latch8->has_read) if (latch8->has_read)
{ {
/* temporary hack until all relevant systems are devices */ /* temporary hack until all relevant systems are devices */
const address_space *space = cpu_get_address_space(device->machine->cpu[0], ADDRESS_SPACE_PROGRAM); const address_space *space = cpu_get_address_space(device->machine->firstcpu, ADDRESS_SPACE_PROGRAM);
int i; int i;
for (i=0; i<8; i++) for (i=0; i<8; i++)
{ {

View File

@ -47,7 +47,7 @@ static TIMER_CALLBACK( tmp68301_timer_callback )
tmp68301_irq_vector[level] = IVNR & 0x00e0; tmp68301_irq_vector[level] = IVNR & 0x00e0;
tmp68301_irq_vector[level] += 4+i; tmp68301_irq_vector[level] += 4+i;
cpu_set_input_line(machine->cpu[0],level,HOLD_LINE); cpu_set_input_line(machine->firstcpu,level,HOLD_LINE);
} }
if (TCR & 0x0080) // N/1 if (TCR & 0x0080) // N/1
@ -90,7 +90,7 @@ static void tmp68301_update_timer( running_machine *machine, int i )
{ {
int scale = (TCR & 0x3c00)>>10; // P4..1 int scale = (TCR & 0x3c00)>>10; // P4..1
if (scale > 8) scale = 8; if (scale > 8) scale = 8;
duration = attotime_mul(ATTOTIME_IN_HZ(cpu_get_clock(machine->cpu[0])), (1 << scale) * max); duration = attotime_mul(ATTOTIME_IN_HZ(cpu_get_clock(machine->firstcpu)), (1 << scale) * max);
} }
break; break;
} }
@ -115,7 +115,7 @@ MACHINE_RESET( tmp68301 )
for (i = 0; i < 3; i++) for (i = 0; i < 3; i++)
tmp68301_IE[i] = 0; tmp68301_IE[i] = 0;
cpu_set_irq_callback(machine->cpu[0], tmp68301_irq_callback); cpu_set_irq_callback(machine->firstcpu, tmp68301_irq_callback);
} }
/* Update the IRQ state based on all possible causes */ /* Update the IRQ state based on all possible causes */
@ -145,7 +145,7 @@ static void update_irq_state(running_machine *machine)
tmp68301_IE[i] = 0; // Interrupts are edge triggerred tmp68301_IE[i] = 0; // Interrupts are edge triggerred
cpu_set_input_line(machine->cpu[0],level,HOLD_LINE); cpu_set_input_line(machine->firstcpu,level,HOLD_LINE);
} }
} }
} }

View File

@ -240,7 +240,7 @@ INLINE void eat_all_cpu_cycles(running_machine *machine)
{ {
const device_config *cpu; const device_config *cpu;
for (cpu = machine->cpu[0]; cpu != NULL; cpu = cpu->typenext) for (cpu = machine->firstcpu; cpu != NULL; cpu = cpu_next(cpu))
cpu_eat_cycles(cpu, 1000000000); cpu_eat_cycles(cpu, 1000000000);
} }
@ -1399,7 +1399,6 @@ static int parse_ini_file(core_options *options, const char *name)
static running_machine *create_machine(const game_driver *driver) static running_machine *create_machine(const game_driver *driver)
{ {
running_machine *machine; running_machine *machine;
int cpunum;
/* allocate memory for the machine */ /* allocate memory for the machine */
machine = (running_machine *)malloc(sizeof(*machine)); machine = (running_machine *)malloc(sizeof(*machine));
@ -1428,9 +1427,7 @@ static running_machine *create_machine(const game_driver *driver)
} }
/* find devices */ /* find devices */
machine->cpu[0] = cpu_first(machine->config); machine->firstcpu = cpu_first(machine->config);
for (cpunum = 1; cpunum < ARRAY_LENGTH(machine->cpu) && machine->cpu[cpunum - 1] != NULL; cpunum++)
machine->cpu[cpunum] = machine->cpu[cpunum - 1]->typenext;
machine->primary_screen = video_screen_first(machine->config); machine->primary_screen = video_screen_first(machine->config);
/* attach this machine to all the devices in the configuration */ /* attach this machine to all the devices in the configuration */

View File

@ -152,7 +152,7 @@ struct _running_machine
const input_port_config *portconfig; /* points to a list of input port configurations */ const input_port_config *portconfig; /* points to a list of input port configurations */
/* CPU information */ /* CPU information */
const device_config * cpu[8]; /* array of first 8 CPU devices */ const device_config * firstcpu; /* first CPU (allows for quick iteration via typenext) */
/* game-related information */ /* game-related information */
const game_driver * gamedrv; /* points to the definition of the game machine */ const game_driver * gamedrv; /* points to the definition of the game machine */

View File

@ -705,7 +705,7 @@ static void SCSP_UpdateSlotReg(struct _SCSP *SCSP,int s,int r)
static void SCSP_UpdateReg(struct _SCSP *SCSP, int reg) static void SCSP_UpdateReg(struct _SCSP *SCSP, int reg)
{ {
/* temporary hack until this is converted to a device */ /* temporary hack until this is converted to a device */
const address_space *space = memory_find_address_space(SCSP->device->machine->cpu[0], ADDRESS_SPACE_PROGRAM); const address_space *space = memory_find_address_space(SCSP->device->machine->firstcpu, ADDRESS_SPACE_PROGRAM);
switch(reg&0x3f) switch(reg&0x3f)
{ {
case 0x2: case 0x2:
@ -1208,7 +1208,7 @@ static void dma_scsp(const address_space *space, struct _SCSP *SCSP)
/*Job done,request a dma end irq*/ /*Job done,request a dma end irq*/
if(scsp_regs[0x1e/2] & 0x10) if(scsp_regs[0x1e/2] & 0x10)
cpu_set_input_line(space->machine->cpu[2],dma_transfer_end,HOLD_LINE); cpu_set_input_line(device_list_find_by_index(space->machine->config->devicelist, CPU, 2),dma_transfer_end,HOLD_LINE);
} }
#ifdef UNUSED_FUNCTION #ifdef UNUSED_FUNCTION
@ -1312,7 +1312,7 @@ WRITE16_DEVICE_HANDLER( scsp_w )
SCSP->scsp_dtlg = scsp_regs[0x416/2] & 0x0ffe; SCSP->scsp_dtlg = scsp_regs[0x416/2] & 0x0ffe;
if(scsp_dexe) if(scsp_dexe)
{ {
dma_scsp(cpu_get_address_space(device->machine->cpu[0], ADDRESS_SPACE_PROGRAM), SCSP); dma_scsp(cpu_get_address_space(device->machine->firstcpu, ADDRESS_SPACE_PROGRAM), SCSP);
scsp_regs[0x416/2]^=0x1000;//disable starting bit scsp_regs[0x416/2]^=0x1000;//disable starting bit
} }
break; break;
@ -1320,7 +1320,7 @@ WRITE16_DEVICE_HANDLER( scsp_w )
case 0x42a: case 0x42a:
if(stv_scu && !(stv_scu[40] & 0x40) /*&& scsp_regs[0x42c/2] & 0x20*/)/*Main CPU allow sound irq*/ if(stv_scu && !(stv_scu[40] & 0x40) /*&& scsp_regs[0x42c/2] & 0x20*/)/*Main CPU allow sound irq*/
{ {
cpu_set_input_line_and_vector(device->machine->cpu[0], 9, HOLD_LINE , 0x46); cpu_set_input_line_and_vector(device->machine->firstcpu, 9, HOLD_LINE , 0x46);
logerror("SCSP: Main CPU interrupt\n"); logerror("SCSP: Main CPU interrupt\n");
} }
break; break;

View File

@ -978,7 +978,7 @@ astring *game_info_astring(running_machine *machine, astring *string)
astring_printf(string, "%s\n%s %s\n\nCPU:\n", machine->gamedrv->description, machine->gamedrv->year, machine->gamedrv->manufacturer); astring_printf(string, "%s\n%s %s\n\nCPU:\n", machine->gamedrv->description, machine->gamedrv->year, machine->gamedrv->manufacturer);
/* loop over all CPUs */ /* loop over all CPUs */
for (device = machine->cpu[0]; device != NULL; device = scandevice) for (device = machine->firstcpu; device != NULL; device = scandevice)
{ {
/* count how many identical CPUs we have */ /* count how many identical CPUs we have */
count = 1; count = 1;
@ -1454,13 +1454,13 @@ static slider_state *slider_init(running_machine *machine)
/* add CPU overclocking (cheat only) */ /* add CPU overclocking (cheat only) */
if (options_get_bool(mame_options(), OPTION_CHEAT)) if (options_get_bool(mame_options(), OPTION_CHEAT))
{ {
for (item = 0; item < ARRAY_LENGTH(machine->cpu); item++) for (device = machine->firstcpu; device != NULL; device = cpu_next(device))
if (machine->cpu[item] != NULL) {
{ void *param = (void *)device;
astring_printf(string, "Overclock CPU %s", machine->cpu[item]->tag); astring_printf(string, "Overclock CPU %s", device->tag);
*tailptr = slider_alloc(machine, astring_c(string), 10, 1000, 2000, 1, slider_overclock, (void *)(FPTR)item); *tailptr = slider_alloc(machine, astring_c(string), 10, 1000, 2000, 1, slider_overclock, param);
tailptr = &(*tailptr)->next; tailptr = &(*tailptr)->next;
} }
} }
/* add screen parameters */ /* add screen parameters */
@ -1628,12 +1628,12 @@ static INT32 slider_adjuster(running_machine *machine, void *arg, astring *strin
static INT32 slider_overclock(running_machine *machine, void *arg, astring *string, INT32 newval) static INT32 slider_overclock(running_machine *machine, void *arg, astring *string, INT32 newval)
{ {
int which = (FPTR)arg; const device_config *cpu = (const device_config *)arg;
if (newval != SLIDER_NOCHANGE) if (newval != SLIDER_NOCHANGE)
cpu_set_clockscale(machine->cpu[which], (float)newval * 0.001f); cpu_set_clockscale(cpu, (float)newval * 0.001f);
if (string != NULL) if (string != NULL)
astring_printf(string, "%3.0f%%", floor(cpu_get_clockscale(machine->cpu[which]) * 100.0f + 0.5f)); astring_printf(string, "%3.0f%%", floor(cpu_get_clockscale(cpu) * 100.0f + 0.5f));
return floor(cpu_get_clockscale(machine->cpu[which]) * 1000.0f + 0.5f); return floor(cpu_get_clockscale(cpu) * 1000.0f + 0.5f);
} }

View File

@ -325,7 +325,7 @@ static TIMER_CALLBACK( scanline_interrupt_callback )
emu_timer *timer = get_scanline_interrupt_timer_for_screen(screen); emu_timer *timer = get_scanline_interrupt_timer_for_screen(screen);
/* generate the interrupt */ /* generate the interrupt */
atarigen_scanline_int_gen(machine->cpu[0]); atarigen_scanline_int_gen(cputag_get_cpu(machine, "maincpu"));
/* set a new timer to go off at the same scan line next frame */ /* set a new timer to go off at the same scan line next frame */
timer_adjust_oneshot(timer, video_screen_get_frame_period(screen), 0); timer_adjust_oneshot(timer, video_screen_get_frame_period(screen), 0);
@ -858,7 +858,7 @@ static TIMER_CALLBACK( delayed_6502_sound_w )
/* set up the states and signal the sound interrupt to the main CPU */ /* set up the states and signal the sound interrupt to the main CPU */
atarigen_sound_to_cpu = param; atarigen_sound_to_cpu = param;
atarigen_sound_to_cpu_ready = 1; atarigen_sound_to_cpu_ready = 1;
atarigen_sound_int_gen(machine->cpu[0]); atarigen_sound_int_gen(cputag_get_cpu(machine, "maincpu"));
} }
@ -1238,7 +1238,7 @@ static void atarivc_common_w(const device_config *screen, offs_t offset, UINT16
/* scanline IRQ ack here */ /* scanline IRQ ack here */
case 0x1e: case 0x1e:
/* hack: this should be a device */ /* hack: this should be a device */
atarigen_scanline_int_ack_w(cpu_get_address_space(screen->machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0, 0, 0xffff); atarigen_scanline_int_ack_w(cputag_get_address_space(screen->machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0, 0, 0xffff);
break; break;
/* log anything else */ /* log anything else */
@ -1468,6 +1468,8 @@ int atarigen_get_hblank(const device_config *screen)
void atarigen_halt_until_hblank_0(const device_config *screen) void atarigen_halt_until_hblank_0(const device_config *screen)
{ {
const device_config *cpu = cputag_get_cpu(screen->machine, "maincpu");
/* halt the CPU until the next HBLANK */ /* halt the CPU until the next HBLANK */
int hpos = video_screen_get_hpos(screen); int hpos = video_screen_get_hpos(screen);
int width = video_screen_get_width(screen); int width = video_screen_get_width(screen);
@ -1480,8 +1482,8 @@ void atarigen_halt_until_hblank_0(const device_config *screen)
/* halt and set a timer to wake up */ /* halt and set a timer to wake up */
fraction = (double)(hblank - hpos) / (double)width; fraction = (double)(hblank - hpos) / (double)width;
timer_set(screen->machine, double_to_attotime(attotime_to_double(video_screen_get_scan_period(screen)) * fraction), NULL, 0, unhalt_cpu); timer_set(screen->machine, double_to_attotime(attotime_to_double(video_screen_get_scan_period(screen)) * fraction), (void *)cpu, 0, unhalt_cpu);
cpu_set_input_line(screen->machine->cpu[0], INPUT_LINE_HALT, ASSERT_LINE); cpu_set_input_line(cpu, INPUT_LINE_HALT, ASSERT_LINE);
} }
@ -1569,7 +1571,8 @@ WRITE32_HANDLER( atarigen_666_paletteram32_w )
static TIMER_CALLBACK( unhalt_cpu ) static TIMER_CALLBACK( unhalt_cpu )
{ {
cpu_set_input_line(machine->cpu[param], INPUT_LINE_HALT, CLEAR_LINE); const device_config *cpu = (const device_config *)ptr;
cpu_set_input_line(cpu, INPUT_LINE_HALT, CLEAR_LINE);
} }

View File

@ -1276,7 +1276,7 @@ WRITE16_HANDLER( avgdvg_reset_word_w )
MACHINE_RESET( avgdvg ) MACHINE_RESET( avgdvg )
{ {
avgdvg_reset_w (cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM),0,0); avgdvg_reset_w (cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM),0,0);
} }

View File

@ -497,8 +497,8 @@ static void video_update_common(const device_config *screen, bitmap_t *bitmap, c
/* iterate over rows */ /* iterate over rows */
for (y = cliprect->min_y; y <= cliprect->max_y; y++) for (y = cliprect->min_y; y <= cliprect->max_y; y++)
{ {
UINT16 *fgbase = BITMAP_ADDR16(fgpixmap, y, 0); UINT16 *fgbase = BITMAP_ADDR16(fgpixmap, y & 0xff, 0);
UINT16 *sprbase = BITMAP_ADDR16(sprite_bitmap, y, 0); UINT16 *sprbase = BITMAP_ADDR16(sprite_bitmap, y & 0xff, 0);
UINT16 *dstbase = BITMAP_ADDR16(bitmap, y, 0); UINT16 *dstbase = BITMAP_ADDR16(bitmap, y, 0);
int bgy = (y + bgyscroll) & 0x1ff; int bgy = (y + bgyscroll) & 0x1ff;
int bgxscroll = bgrowscroll[y / 8]; int bgxscroll = bgrowscroll[y / 8];