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.
This commit is contained in:
Aaron Giles 2008-12-16 15:02:15 +00:00
parent 76e6a7abc4
commit 98c40f06db
93 changed files with 1997 additions and 3205 deletions

View File

@ -12,7 +12,7 @@
#include "debugger.h"
#include "cubeqcpu.h"
#include "cpuexec.h"
#include "driver.h"
/***************************************************************************

View File

@ -151,7 +151,7 @@ static void InitDasm16C5x(void)
OpInizialized = 1;
}
CPU_DISASSEMBLE( pic16C5x )
CPU_DISASSEMBLE( pic16c5x )
{
int a, b, d, f, k; /* these can all be filled in by parsing an instruction */
int i;

View File

@ -682,7 +682,7 @@ static const pic16c5x_opcode_00x opcode_00x[16]=
* Inits CPU emulation
****************************************************************************/
static CPU_INIT( pic16C5x )
static CPU_INIT( pic16c5x )
{
pic16c5x_state *cpustate = device->token;
@ -730,7 +730,7 @@ static CPU_INIT( pic16C5x )
* Reset registers to their initial values
****************************************************************************/
static void pic16C5x_reset_regs(pic16c5x_state *cpustate)
static void pic16c5x_reset_regs(pic16c5x_state *cpustate)
{
cpustate->PC = cpustate->reset_vector;
cpustate->CONFIG = cpustate->temp_config;
@ -747,10 +747,10 @@ static void pic16C5x_reset_regs(pic16c5x_state *cpustate)
cpustate->inst_cycles = 0;
}
static void pic16C5x_soft_reset(pic16c5x_state *cpustate)
static void pic16c5x_soft_reset(pic16c5x_state *cpustate)
{
cpustate->STATUS &= 0x1f;
pic16C5x_reset_regs(cpustate);
pic16c5x_reset_regs(cpustate);
}
void pic16c5x_set_config(const device_config *cpu, int data)
@ -766,7 +766,7 @@ void pic16c5x_set_config(const device_config *cpu, int data)
* Shut down CPU emulation
****************************************************************************/
static CPU_EXIT( pic16C5x )
static CPU_EXIT( pic16c5x )
{
/* nothing to do */
}
@ -776,7 +776,7 @@ static CPU_EXIT( pic16C5x )
* WatchDog
****************************************************************************/
static void pic16C5x_update_watchdog(pic16c5x_state *cpustate, int counts)
static void pic16c5x_update_watchdog(pic16c5x_state *cpustate, int counts)
{
/* WatchDog is set up to count 18,000 (0x464f hex) ticks to provide */
/* the timeout period of 0.018ms based on a 4MHz input clock. */
@ -802,12 +802,12 @@ static void pic16C5x_update_watchdog(pic16c5x_state *cpustate, int counts)
if (cpustate->prescaler >= (1 << PS)) { /* Prescale values from 1 to 128 */
cpustate->prescaler = 0;
CLR(cpustate, TO_FLAG);
pic16C5x_soft_reset(cpustate);
pic16c5x_soft_reset(cpustate);
}
}
else {
CLR(cpustate, TO_FLAG);
pic16C5x_soft_reset(cpustate);
pic16c5x_soft_reset(cpustate);
}
}
}
@ -818,7 +818,7 @@ static void pic16C5x_update_watchdog(pic16c5x_state *cpustate, int counts)
* Update Timer
****************************************************************************/
static void pic16C5x_update_timer(pic16c5x_state *cpustate, int counts)
static void pic16c5x_update_timer(pic16c5x_state *cpustate, int counts)
{
if (PSA == 0) {
cpustate->prescaler += counts;
@ -837,7 +837,7 @@ static void pic16C5x_update_timer(pic16c5x_state *cpustate, int counts)
* Execute IPeriod. Return 0 if emulation should be stopped
****************************************************************************/
static CPU_EXECUTE( pic16C5x )
static CPU_EXECUTE( pic16c5x )
{
pic16c5x_state *cpustate = device->token;
int T0_in;
@ -850,7 +850,7 @@ static CPU_EXECUTE( pic16C5x )
cpustate->inst_cycles = 1;
debugger_instruction_hook(device, cpustate->PC);
if (WDTE) {
pic16C5x_update_watchdog(cpustate, 1);
pic16c5x_update_watchdog(cpustate, 1);
}
}
else
@ -876,12 +876,12 @@ static CPU_EXECUTE( pic16C5x )
T0_in = S_T0_IN;
if (T0SE) { /* Count rising edge */
if (POSITIVE_EDGE_T0) {
pic16C5x_update_timer(cpustate, 1);
pic16c5x_update_timer(cpustate, 1);
}
}
else { /* Count falling edge */
if (NEGATIVE_EDGE_T0) {
pic16C5x_update_timer(cpustate, 1);
pic16c5x_update_timer(cpustate, 1);
}
}
cpustate->old_T0 = T0_in;
@ -891,11 +891,11 @@ static CPU_EXECUTE( pic16C5x )
cpustate->delay_timer--;
}
else {
pic16C5x_update_timer(cpustate, cpustate->inst_cycles);
pic16c5x_update_timer(cpustate, cpustate->inst_cycles);
}
}
if (WDTE) {
pic16C5x_update_watchdog(cpustate, cpustate->inst_cycles);
pic16c5x_update_watchdog(cpustate, cpustate->inst_cycles);
}
}
@ -912,7 +912,7 @@ static CPU_EXECUTE( pic16C5x )
* Generic set_info
**************************************************************************/
static CPU_SET_INFO( pic16C5x )
static CPU_SET_INFO( pic16c5x )
{
pic16c5x_state *cpustate = device->token;
@ -946,7 +946,7 @@ static CPU_SET_INFO( pic16C5x )
* Generic get_info
**************************************************************************/
static CPU_GET_INFO( pic16C5x )
static CPU_GET_INFO( pic16c5x )
{
pic16c5x_state *cpustate = (device != NULL) ? device->token : NULL;
@ -995,13 +995,13 @@ static CPU_GET_INFO( pic16C5x )
case CPUINFO_INT_REGISTER + PIC16C5x_FSR: info->i = (cpustate->FSR & cpustate->picRAMmask); break;
/* --- the following bits of info are returned as pointers to data or functions --- */
case CPUINFO_PTR_SET_INFO: info->setinfo = CPU_SET_INFO_NAME(pic16C5x); break;
case CPUINFO_PTR_INIT: info->init = CPU_INIT_NAME(pic16C5x); break;
case CPUINFO_PTR_SET_INFO: info->setinfo = CPU_SET_INFO_NAME(pic16c5x); break;
case CPUINFO_PTR_INIT: info->init = CPU_INIT_NAME(pic16c5x); break;
case CPUINFO_PTR_RESET: /* set per-CPU */ break;
case CPUINFO_PTR_EXIT: info->exit = CPU_EXIT_NAME(pic16C5x); break;
case CPUINFO_PTR_EXECUTE: info->execute = CPU_EXECUTE_NAME(pic16C5x); break;
case CPUINFO_PTR_EXIT: info->exit = CPU_EXIT_NAME(pic16c5x); break;
case CPUINFO_PTR_EXECUTE: info->execute = CPU_EXECUTE_NAME(pic16c5x); break;
case CPUINFO_PTR_BURN: info->burn = NULL; break;
case CPUINFO_PTR_DISASSEMBLE: info->disassemble = CPU_DISASSEMBLE_NAME(pic16C5x); break;
case CPUINFO_PTR_DISASSEMBLE: info->disassemble = CPU_DISASSEMBLE_NAME(pic16c5x); break;
case CPUINFO_PTR_INSTRUCTION_COUNTER: info->icount = &cpustate->icount; break;
/* --- the following bits of info are returned as NULL-terminated strings --- */
@ -1066,14 +1066,14 @@ ADDRESS_MAP_END
* PIC16C54 Reset
****************************************************************************/
static CPU_RESET( pic16C54 )
static CPU_RESET( pic16c54 )
{
pic16c5x_state *cpustate = device->token;
cpustate->picmodel = 0x16C54;
cpustate->picRAMmask = 0x1f;
cpustate->reset_vector = 0x1ff;
pic16C5x_reset_regs(cpustate);
pic16c5x_reset_regs(cpustate);
cpustate->STATUS = 0x00;
SET(cpustate, TO_FLAG);
SET(cpustate, PD_FLAG);
@ -1084,19 +1084,19 @@ static CPU_RESET( pic16C54 )
* CPU-specific get_info
**************************************************************************/
CPU_GET_INFO( pic16C54 )
CPU_GET_INFO( pic16c54 )
{
switch (state)
{
/* --- the following bits of info are returned as pointers to data or functions --- */
case CPUINFO_PTR_RESET: info->reset = CPU_RESET_NAME(pic16C54); break;
case CPUINFO_PTR_RESET: info->reset = CPU_RESET_NAME(pic16c54); break;
case CPUINFO_PTR_INTERNAL_MEMORY_MAP + ADDRESS_SPACE_PROGRAM: info->internal_map16 = ADDRESS_MAP_NAME(pic16c54_rom); break;
case CPUINFO_PTR_INTERNAL_MEMORY_MAP + ADDRESS_SPACE_DATA: info->internal_map8 = ADDRESS_MAP_NAME(pic16c54_ram); break;
/* --- the following bits of info are returned as NULL-terminated strings --- */
case CPUINFO_STR_NAME: strcpy(info->s, "PIC16C54"); break;
default: CPU_GET_INFO_CALL(pic16C5x); break;
default: CPU_GET_INFO_CALL(pic16c5x); break;
}
}
#endif
@ -1120,14 +1120,14 @@ ADDRESS_MAP_END
* PIC16C55 Reset
****************************************************************************/
static CPU_RESET( pic16C55 )
static CPU_RESET( pic16c55 )
{
pic16c5x_state *cpustate = device->token;
cpustate->picmodel = 0x16C55;
cpustate->picRAMmask = 0x1f;
cpustate->reset_vector = 0x1ff;
pic16C5x_reset_regs(cpustate);
pic16c5x_reset_regs(cpustate);
cpustate->STATUS = 0x00;
SET(cpustate, TO_FLAG);
SET(cpustate, PD_FLAG);
@ -1138,19 +1138,19 @@ static CPU_RESET( pic16C55 )
* CPU-specific get_info
**************************************************************************/
CPU_GET_INFO( pic16C55 )
CPU_GET_INFO( pic16c55 )
{
switch (state)
{
/* --- the following bits of info are returned as pointers to data or functions --- */
case CPUINFO_PTR_RESET: info->reset = CPU_RESET_NAME(pic16C55); break;
case CPUINFO_PTR_RESET: info->reset = CPU_RESET_NAME(pic16c55); break;
case CPUINFO_PTR_INTERNAL_MEMORY_MAP + ADDRESS_SPACE_PROGRAM: info->internal_map16 = ADDRESS_MAP_NAME(pic16c55_rom); break;
case CPUINFO_PTR_INTERNAL_MEMORY_MAP + ADDRESS_SPACE_DATA: info->internal_map8 = ADDRESS_MAP_NAME(pic16c55_ram); break;
/* --- the following bits of info are returned as NULL-terminated strings --- */
case CPUINFO_STR_NAME: strcpy(info->s, "PIC16C55"); break;
default: CPU_GET_INFO_CALL(pic16C5x); break;
default: CPU_GET_INFO_CALL(pic16c5x); break;
}
}
#endif
@ -1174,14 +1174,14 @@ ADDRESS_MAP_END
* PIC16C56 Reset
****************************************************************************/
static CPU_RESET( pic16C56 )
static CPU_RESET( pic16c56 )
{
pic16c5x_state *cpustate = device->token;
cpustate->picmodel = 0x16C56;
cpustate->picRAMmask = 0x1f;
cpustate->reset_vector = 0x3ff;
pic16C5x_reset_regs(cpustate);
pic16c5x_reset_regs(cpustate);
cpustate->STATUS = 0x00;
SET(cpustate, TO_FLAG);
SET(cpustate, PD_FLAG);
@ -1192,12 +1192,12 @@ static CPU_RESET( pic16C56 )
* CPU-specific get_info
**************************************************************************/
CPU_GET_INFO( pic16C56 )
CPU_GET_INFO( pic16c56 )
{
switch (state)
{
/* --- the following bits of info are returned as pointers to data or functions --- */
case CPUINFO_PTR_RESET: info->reset = CPU_RESET_NAME(pic16C56); break;
case CPUINFO_PTR_RESET: info->reset = CPU_RESET_NAME(pic16c56); break;
case CPUINFO_PTR_INTERNAL_MEMORY_MAP + ADDRESS_SPACE_PROGRAM: info->internal_map16 = ADDRESS_MAP_NAME(pic16c56_rom); break;
case CPUINFO_PTR_INTERNAL_MEMORY_MAP + ADDRESS_SPACE_DATA: info->internal_map8 = ADDRESS_MAP_NAME(pic16c56_ram); break;
@ -1206,7 +1206,7 @@ CPU_GET_INFO( pic16C56 )
/* --- the following bits of info are returned as NULL-terminated strings --- */
case CPUINFO_STR_NAME: strcpy(info->s, "PIC16C56"); break;
default: CPU_GET_INFO_CALL(pic16C5x); break;
default: CPU_GET_INFO_CALL(pic16c5x); break;
}
}
#endif
@ -1233,14 +1233,14 @@ ADDRESS_MAP_END
* PIC16C57 Reset
****************************************************************************/
static CPU_RESET( pic16C57 )
static CPU_RESET( pic16c57 )
{
pic16c5x_state *cpustate = device->token;
cpustate->picmodel = 0x16C57;
cpustate->picRAMmask = 0x7f;
cpustate->reset_vector = 0x7ff;
pic16C5x_reset_regs(cpustate);
pic16c5x_reset_regs(cpustate);
cpustate->STATUS = 0x00;
SET(cpustate, TO_FLAG);
SET(cpustate, PD_FLAG);
@ -1251,12 +1251,12 @@ static CPU_RESET( pic16C57 )
* CPU-specific get_info
**************************************************************************/
CPU_GET_INFO( pic16C57 )
CPU_GET_INFO( pic16c57 )
{
switch (state)
{
/* --- the following bits of info are returned as pointers to data or functions --- */
case CPUINFO_PTR_RESET: info->reset = CPU_RESET_NAME(pic16C57); break;
case CPUINFO_PTR_RESET: info->reset = CPU_RESET_NAME(pic16c57); break;
case CPUINFO_PTR_INTERNAL_MEMORY_MAP + ADDRESS_SPACE_PROGRAM: info->internal_map16 = ADDRESS_MAP_NAME(pic16c57_rom); break;
case CPUINFO_PTR_INTERNAL_MEMORY_MAP + ADDRESS_SPACE_DATA: info->internal_map8 = ADDRESS_MAP_NAME(pic16c57_ram); break;
@ -1266,7 +1266,7 @@ CPU_GET_INFO( pic16C57 )
/* --- the following bits of info are returned as NULL-terminated strings --- */
case CPUINFO_STR_NAME: strcpy(info->s, "PIC16C57"); break;
default: CPU_GET_INFO_CALL(pic16C5x); break;
default: CPU_GET_INFO_CALL(pic16c5x); break;
}
}
#endif
@ -1293,14 +1293,14 @@ ADDRESS_MAP_END
* PIC16C58 Reset
****************************************************************************/
static CPU_RESET( pic16C58 )
static CPU_RESET( pic16c58 )
{
pic16c5x_state *cpustate = device->token;
cpustate->picmodel = 0x16C58;
cpustate->picRAMmask = 0x7f;
cpustate->reset_vector = 0x7ff;
pic16C5x_reset_regs(cpustate);
pic16c5x_reset_regs(cpustate);
cpustate->STATUS = 0x00;
SET(cpustate, TO_FLAG);
SET(cpustate, PD_FLAG);
@ -1311,12 +1311,12 @@ static CPU_RESET( pic16C58 )
* CPU-specific get_info
**************************************************************************/
CPU_GET_INFO( pic16C58 )
CPU_GET_INFO( pic16c58 )
{
switch (state)
{
/* --- the following bits of info are returned as pointers to data or functions --- */
case CPUINFO_PTR_RESET: info->reset = CPU_RESET_NAME(pic16C58); break;
case CPUINFO_PTR_RESET: info->reset = CPU_RESET_NAME(pic16c58); break;
case CPUINFO_PTR_INTERNAL_MEMORY_MAP + ADDRESS_SPACE_PROGRAM: info->internal_map16 = ADDRESS_MAP_NAME(pic16c58_rom); break;
case CPUINFO_PTR_INTERNAL_MEMORY_MAP + ADDRESS_SPACE_DATA: info->internal_map8 = ADDRESS_MAP_NAME(pic16c58_ram); break;
@ -1326,7 +1326,7 @@ CPU_GET_INFO( pic16C58 )
/* --- the following bits of info are returned as NULL-terminated strings --- */
case CPUINFO_STR_NAME: strcpy(info->s, "PIC16C58"); break;
default: CPU_GET_INFO_CALL(pic16C5x); break;
default: CPU_GET_INFO_CALL(pic16c5x); break;
}
}
#endif

View File

@ -129,7 +129,7 @@ CPU_GET_INFO( pic16C58 );
#if (HAS_PIC16C54) || (HAS_PIC16C55) || (HAS_PIC16C56) || (HAS_PIC16C57) || (HAS_PIC16C58)
CPU_DISASSEMBLE( pic16C5x );
CPU_DISASSEMBLE( pic16c5x );
#endif

View File

@ -27,7 +27,7 @@ struct _se3208_state_t
UINT8 IRQ;
UINT8 NMI;
int SE3208_ICount;
int icount;
};
#define FLAG_C 0x0080
@ -1702,7 +1702,7 @@ static void BuildTable(void)
OpTable[i]=DecodeOp(i);
}
static CPU_RESET( SE3208 )
static CPU_RESET( se3208 )
{
se3208_state_t *se3208_state = device->token;
@ -1745,11 +1745,11 @@ static void SE3208_Interrupt(se3208_state_t *se3208_state)
}
static CPU_EXECUTE( SE3208 )
static CPU_EXECUTE( se3208 )
{
se3208_state_t *se3208_state = device->token;
se3208_state->SE3208_ICount=cycles;
se3208_state->icount=cycles;
do
{
UINT16 Opcode=memory_decrypted_read_word(se3208_state->program, WORD_XOR_LE(se3208_state->PC));
@ -1769,13 +1769,13 @@ static CPU_EXECUTE( SE3208 )
{
SE3208_Interrupt(se3208_state);
}
--(se3208_state->SE3208_ICount);
} while(se3208_state->SE3208_ICount>0);
--(se3208_state->icount);
} while(se3208_state->icount>0);
return cycles-se3208_state->SE3208_ICount;
return cycles-se3208_state->icount;
}
static CPU_INIT( SE3208 )
static CPU_INIT( se3208 )
{
se3208_state_t *se3208_state = device->token;
@ -1786,7 +1786,7 @@ static CPU_INIT( SE3208 )
se3208_state->program = memory_find_address_space(device, ADDRESS_SPACE_PROGRAM);
}
static CPU_EXIT( SE3208 )
static CPU_EXIT( se3208 )
{
if(OpTable)
free(OpTable);
@ -1802,7 +1802,7 @@ static void set_irq_line(se3208_state_t *se3208_state, int line,int state)
}
static CPU_SET_INFO( SE3208 )
static CPU_SET_INFO( se3208 )
{
se3208_state_t *se3208_state = device->token;
@ -1830,7 +1830,7 @@ static CPU_SET_INFO( SE3208 )
}
CPU_GET_INFO( SE3208 )
CPU_GET_INFO( se3208 )
{
se3208_state_t *se3208_state = (device != NULL) ? device->token : NULL;
@ -1879,14 +1879,14 @@ CPU_GET_INFO( SE3208 )
case CPUINFO_INT_REGISTER + SE3208_R7: info->i = se3208_state->R[ 7]; break;
/* --- the following bits of info are returned as pointers to data or functions --- */
case CPUINFO_PTR_SET_INFO: info->setinfo = CPU_SET_INFO_NAME(SE3208); break;
case CPUINFO_PTR_INIT: info->init = CPU_INIT_NAME(SE3208); break;
case CPUINFO_PTR_RESET: info->reset = CPU_RESET_NAME(SE3208); break;
case CPUINFO_PTR_EXIT: info->exit = CPU_EXIT_NAME(SE3208); break;
case CPUINFO_PTR_EXECUTE: info->execute = CPU_EXECUTE_NAME(SE3208);break;
case CPUINFO_PTR_SET_INFO: info->setinfo = CPU_SET_INFO_NAME(se3208); break;
case CPUINFO_PTR_INIT: info->init = CPU_INIT_NAME(se3208); break;
case CPUINFO_PTR_RESET: info->reset = CPU_RESET_NAME(se3208); break;
case CPUINFO_PTR_EXIT: info->exit = CPU_EXIT_NAME(se3208); break;
case CPUINFO_PTR_EXECUTE: info->execute = CPU_EXECUTE_NAME(se3208);break;
case CPUINFO_PTR_BURN: info->burn = NULL; break;
case CPUINFO_PTR_DISASSEMBLE: info->disassemble = CPU_DISASSEMBLE_NAME(SE3208); break;
case CPUINFO_PTR_INSTRUCTION_COUNTER: info->icount = &se3208_state->SE3208_ICount; break;
case CPUINFO_PTR_DISASSEMBLE: info->disassemble = CPU_DISASSEMBLE_NAME(se3208); break;
case CPUINFO_PTR_INSTRUCTION_COUNTER: info->icount = &se3208_state->icount; break;
/* --- the following bits of info are returned as NULL-terminated strings --- */
case CPUINFO_STR_NAME: strcpy(info->s, "SE3208"); break;

View File

@ -8,6 +8,6 @@ enum
#define SE3208_INT 0
extern CPU_GET_INFO( SE3208 );
extern CPU_GET_INFO( se3208 );
CPU_DISASSEMBLE( SE3208 );
CPU_DISASSEMBLE( se3208 );

View File

@ -1400,7 +1400,7 @@ static _OP DecodeOp(UINT16 Opcode)
}
CPU_DISASSEMBLE( SE3208 )
CPU_DISASSEMBLE( se3208 )
{
UINT16 Opcode;

View File

@ -104,7 +104,7 @@ static void sh2_timer_activate(SH2 *sh2)
sh2->frc_base = cpu_get_total_cycles(sh2->device);
timer_adjust_oneshot(sh2->timer, cpu_clocks_to_attotime(sh2->device, max_delta), 0);
} else {
logerror("SH2.%d: Timer event in %d cycles of external clock", cpu_get_index(sh2->device), max_delta);
logerror("SH2.%s: Timer event in %d cycles of external clock", sh2->device->tag, max_delta);
}
}
}
@ -141,7 +141,7 @@ TIMER_CALLBACK( sh2_dmac_callback )
int dma = param & 1;
SH2 *sh2 = ptr;
LOG(("SH2.%d: DMA %d complete\n", cpu_get_index(sh2->device), dma));
LOG(("SH2.%s: DMA %d complete\n", sh2->device->tag, dma));
sh2->m[0x63+4*dma] |= 2;
sh2->dma_timer_active[dma] = 0;
sh2_recalc_irq(sh2);
@ -309,7 +309,7 @@ WRITE32_HANDLER( sh2_internal_w )
case 0x04: // TIER, FTCSR, FRC
if((mem_mask & 0x00ffffff) != 0)
sh2_timer_resync(sh2);
// printf("SH2.%d: TIER write %04x @ %04x\n", cpu_get_index(sh2->device), data >> 16, mem_mask>>16);
// printf("SH2.%s: TIER write %04x @ %04x\n", sh2->device->tag, data >> 16, mem_mask>>16);
sh2->m[4] = (sh2->m[4] & ~(ICF|OCFA|OCFB|OVF)) | (old & sh2->m[4] & (ICF|OCFA|OCFB|OVF));
COMBINE_DATA(&sh2->frc);
if((mem_mask & 0x00ffffff) != 0)
@ -317,7 +317,7 @@ WRITE32_HANDLER( sh2_internal_w )
sh2_recalc_irq(sh2);
break;
case 0x05: // OCRx, TCR, TOCR
// printf("SH2.%d: TCR write %08x @ %08x\n", cpu_get_index(sh2->device), data, mem_mask);
// printf("SH2.%s: TCR write %08x @ %08x\n", sh2->device->tag, data, mem_mask);
sh2_timer_resync(sh2);
if(sh2->m[5] & 0x10)
sh2->ocrb = (sh2->ocrb & (~mem_mask >> 16)) | ((data & mem_mask) >> 16);
@ -533,7 +533,7 @@ void sh2_set_frt_input(const device_config *device, int state)
sh2_timer_resync(sh2);
sh2->icr = sh2->frc;
sh2->m[4] |= ICF;
logerror("SH2.%d: ICF activated (%x)\n", cpu_get_index(sh2->device), sh2->pc & AM);
logerror("SH2.%s: ICF activated (%x)\n", sh2->device->tag, sh2->pc & AM);
sh2_recalc_irq(sh2);
}

View File

@ -628,7 +628,7 @@ static CPU_INIT( tms34010 )
/* allocate a scanline timer and set it to go off at the start */
tms->scantimer = timer_alloc(device->machine, scanline_callback, tms);
timer_adjust_oneshot(tms->scantimer, attotime_zero, index);
timer_adjust_oneshot(tms->scantimer, attotime_zero, 0);
/* allocate the shiftreg */
tms->shiftreg = auto_malloc(SHIFTREG_SIZE);
@ -737,19 +737,13 @@ static TIMER_CALLBACK( internal_interrupt_callback )
{
tms34010_state *tms = ptr;
int type = param;
int cpunum;
/* call through to the CPU to generate the int */
IOREG(tms, REG_INTPEND) |= type;
LOG(("TMS34010 '%s' set internal interrupt $%04x\n", tms->device->tag, type));
/* generate triggers so that spin loops can key off them */
for (cpunum = 0; cpunum < ARRAY_LENGTH(machine->cpu); cpunum++)
if (machine->cpu[cpunum] == tms->device)
{
cpu_triggerint(machine->cpu[cpunum]);
break;
}
cpu_triggerint(tms->device);
}
@ -893,8 +887,7 @@ static TIMER_CALLBACK( scanline_callback )
tms34010_state *tms = ptr;
const rectangle *current_visarea;
int vsblnk, veblnk, vtotal;
int vcount = param >> 8;
int cpunum = param & 0xff;
int vcount = param;
int enabled;
int master;
@ -1025,7 +1018,7 @@ static TIMER_CALLBACK( scanline_callback )
/* note that we add !master (0 or 1) as a attoseconds value; this makes no practical difference */
/* but helps ensure that masters are updated first before slaves */
timer_adjust_oneshot(tms->scantimer, attotime_add_attoseconds(video_screen_get_time_until_pos(tms->screen, vcount, 0), !master), cpunum | (vcount << 8));
timer_adjust_oneshot(tms->scantimer, attotime_add_attoseconds(video_screen_get_time_until_pos(tms->screen, vcount, 0), !master), vcount);
}
@ -1068,23 +1061,19 @@ VIDEO_UPDATE( tms340x0 )
pen_t blackpen = get_black_pen(screen->machine);
tms34010_display_params params;
tms34010_state *tms = NULL;
int cpunum = -1;
const device_config *cpu;
int x;
/* find the owning CPU */
for (cpunum = 0; cpunum < ARRAY_LENGTH(screen->machine->cpu); cpunum++)
for (cpu = screen->machine->cpu[0]; cpu != NULL; cpu = cpu->typenext)
{
const device_config *cpudevice = screen->machine->cpu[cpunum];
if (cpudevice != NULL)
cpu_type type = cpu_get_type(cpu);
if (type == CPU_TMS34010 || type == CPU_TMS34020)
{
const cpu_class_header *classdata = cpudevice->classtoken;
if (classdata->cputype == CPU_TMS34010 || classdata->cputype == CPU_TMS34020)
{
tms = cpudevice->token;
if (tms->config != NULL && tms->config->scanline_callback != NULL && tms->screen == screen)
break;
tms = NULL;
}
tms = cpu->token;
if (tms->config != NULL && tms->config->scanline_callback != NULL && tms->screen == screen)
break;
tms = NULL;
}
}
if (tms == NULL)
@ -1259,7 +1248,7 @@ WRITE16_HANDLER( tms34010_io_register_w )
}
// if (LOG_CONTROL_REGS)
// logerror("CPU#%d@%08X: %s = %04X (%d)\n", cpunum, cpu_get_pc(space->cpu), ioreg_name[offset], IOREG(tms, offset), video_screen_get_vpos(tms->screen));
// logerror("%s: %s = %04X (%d)\n", cpuexec_describe_context(tms->device->machine), ioreg_name[offset], IOREG(tms, offset), video_screen_get_vpos(tms->screen));
}
@ -1296,7 +1285,7 @@ WRITE16_HANDLER( tms34020_io_register_w )
IOREG(tms, offset) = data;
// if (LOG_CONTROL_REGS)
// logerror("CPU#%d@%08X: %s = %04X (%d)\n", cpunum, cpu_get_pc(space->cpu), ioreg020_name[offset], IOREG(tms, offset), video_screen_get_vpos(tms->screen));
// logerror("%s: %s = %04X (%d)\n", cpuexec_describe_context(device->machine), ioreg020_name[offset], IOREG(tms, offset), video_screen_get_vpos(tms->screen));
switch (offset)
{
@ -1455,7 +1444,7 @@ READ16_HANDLER( tms34010_io_register_r )
int result, total;
// if (LOG_CONTROL_REGS)
// logerror("CPU#%d@%08X: read %s\n", cpunum, cpu_get_pc(space->cpu), ioreg_name[offset]);
// logerror("%s: read %s\n", cpuexec_describe_context(device->machine), ioreg_name[offset]);
switch (offset)
{
@ -1498,7 +1487,7 @@ READ16_HANDLER( tms34020_io_register_r )
int result, total;
// if (LOG_CONTROL_REGS)
// logerror("CPU#%d@%08X: read %s\n", cpunum, cpu_get_pc(space->cpu), ioreg_name[offset]);
// logerror("%s: read %s\n", cpuexec_describe_context(device->machine), ioreg_name[offset]);
switch (offset)
{

View File

@ -6,8 +6,7 @@
***************************************************************************/
#include "cpuintrf.h"
#include "mame.h"
#include "driver.h"
#include "z80daisy.h"

File diff suppressed because it is too large Load Diff

View File

@ -49,31 +49,86 @@ enum
TYPE DEFINITIONS
***************************************************************************/
typedef void (*cpu_interrupt_func)(const device_config *device);
/* CPU description for drivers */
typedef struct _cpu_config cpu_config;
struct _cpu_config
{
cpu_type type; /* index for the CPU type */
int flags; /* flags; see #defines below */
int clock; /* in Hertz */
const addrmap_token *address_map[ADDRESS_SPACES][2]; /* 2 memory maps per address space */
void (*vblank_interrupt)(const device_config *device); /* for interrupts tied to VBLANK */
int vblank_interrupts_per_frame;/* usually 1 */
const char * vblank_interrupt_screen; /* the screen that causes the VBLANK interrupt */
void (*timed_interrupt)(const device_config *device); /* for interrupts not tied to VBLANK */
attoseconds_t timed_interrupt_period; /* period for periodic interrupts */
const void * reset_param; /* parameter for cpu_reset */
const char * tag;
cpu_type type; /* index for the CPU type */
UINT32 flags; /* flags; see #defines below */
UINT32 clock; /* in Hertz */
const addrmap_token *address_map[ADDRESS_SPACES]; /* 2 memory maps per address space */
const addrmap_token *address_map2[ADDRESS_SPACES]; /* 2 memory maps per address space */
cpu_interrupt_func vblank_interrupt; /* for interrupts tied to VBLANK */
int vblank_interrupts_per_frame;/* usually 1 */
const char * vblank_interrupt_screen; /* the screen that causes the VBLANK interrupt */
cpu_interrupt_func timed_interrupt; /* for interrupts not tied to VBLANK */
UINT64 timed_interrupt_period; /* period for periodic interrupts */
};
/***************************************************************************
CPU DEVICE CONFIGURATION MACROS
***************************************************************************/
#define MDRV_CPU_ADD(_tag, _type, _clock) \
MDRV_DEVICE_ADD(_tag, CPU) \
MDRV_DEVICE_CONFIG_DATA32(cpu_config, type, CPU_##_type) \
MDRV_DEVICE_CONFIG_DATA32(cpu_config, clock, _clock)
#define MDRV_CPU_REMOVE(_tag) \
MDRV_DEVICE_REMOVE(_tag, CPU)
#define MDRV_CPU_MODIFY(_tag) \
MDRV_DEVICE_MODIFY(_tag, CPU)
#define MDRV_CPU_REPLACE(_tag, _type, _clock) \
MDRV_DEVICE_REMOVE(_tag, CPU) \
MDRV_DEVICE_ADD(_tag, CPU) \
MDRV_DEVICE_CONFIG_DATA32(cpu_config, type, CPU_##_type) \
MDRV_DEVICE_CONFIG_DATA32(cpu_config, clock, _clock)
#define MDRV_CPU_FLAGS(_flags) \
MDRV_DEVICE_CONFIG_DATA32(cpu_config, flags, _flags)
#define MDRV_CPU_CONFIG(_config) \
MDRV_DEVICE_CONFIG(_config)
#define MDRV_CPU_PROGRAM_MAP(_map1, _map2) \
MDRV_DEVICE_CONFIG_DATAPTR_ARRAY(cpu_config, address_map, ADDRESS_SPACE_PROGRAM, ADDRESS_MAP_NAME(_map1)) \
MDRV_DEVICE_CONFIG_DATAPTR_ARRAY(cpu_config, address_map2, ADDRESS_SPACE_PROGRAM, ADDRESS_MAP_NAME(_map2))
#define MDRV_CPU_DATA_MAP(_map1, _map2) \
MDRV_DEVICE_CONFIG_DATAPTR_ARRAY(cpu_config, address_map, ADDRESS_SPACE_DATA, ADDRESS_MAP_NAME(_map1)) \
MDRV_DEVICE_CONFIG_DATAPTR_ARRAY(cpu_config, address_map2, ADDRESS_SPACE_DATA, ADDRESS_MAP_NAME(_map2))
#define MDRV_CPU_IO_MAP(_map1, _map2) \
MDRV_DEVICE_CONFIG_DATAPTR_ARRAY(cpu_config, address_map, ADDRESS_SPACE_IO, ADDRESS_MAP_NAME(_map1)) \
MDRV_DEVICE_CONFIG_DATAPTR_ARRAY(cpu_config, address_map2, ADDRESS_SPACE_IO, ADDRESS_MAP_NAME(_map2))
#define MDRV_CPU_VBLANK_INT(_tag, _func) \
MDRV_DEVICE_CONFIG_DATAPTR(cpu_config, vblank_interrupt, _func) \
MDRV_DEVICE_CONFIG_DATAPTR(cpu_config, vblank_interrupt_screen, _tag) \
MDRV_DEVICE_CONFIG_DATA32(cpu_config, vblank_interrupts_per_frame, 0)
#define MDRV_CPU_PERIODIC_INT(_func, _rate) \
MDRV_DEVICE_CONFIG_DATAPTR(cpu_config, timed_interrupt, _func) \
MDRV_DEVICE_CONFIG_DATA64(cpu_config, timed_interrupt_period, UINT64_ATTOTIME_IN_HZ(_rate))
/***************************************************************************
MACROS
***************************************************************************/
#define INTERRUPT_GEN(func) void func(const device_config *device)
/* return a pointer to the given CPU by tag */
#define cputag_get_cpu(mach, tag) devtag_get_device(mach, CPU, tag)
/* helpers for using machine/cputag instead of cpu objects */
#define cputag_suspend(mach, tag, reason, eat) cpu_suspend(cputag_get_cpu(mach, tag), reason, eat)
#define cputag_resume(mach, tag, reason) cpu_resume(cputag_get_cpu(mach, tag), reason)
@ -96,9 +151,6 @@ struct _cpu_config
/* ----- core CPU execution ----- */
/* temporary function to allocate a fake CPU device for each CPU */
const device_config *cpuexec_create_cpu_device(const cpu_config *config);
/* prepare CPUs for execution */
void cpuexec_init(running_machine *machine);
@ -110,10 +162,15 @@ void cpuexec_boost_interleave(running_machine *machine, attotime timeslice_time,
/* ----- global helpers ----- */
/* ----- CPU device interface ----- */
/* return a pointer to the given CPU by tag */
const device_config *cputag_get_cpu(running_machine *machine, const char *tag);
/* device get info callback */
#define CPU DEVICE_GET_INFO_NAME(cpu)
DEVICE_GET_INFO( cpu );
/* ----- global helpers ----- */
/* abort execution for the current timeslice */
void cpuexec_abort_timeslice(running_machine *machine);
@ -227,4 +284,23 @@ void cpu_set_input_line_and_vector(const device_config *cpu, int line, int state
void cpu_set_irq_callback(const device_config *cpu, cpu_irq_callback callback);
/***************************************************************************
INLINE FUNCTIONS
***************************************************************************/
/*-------------------------------------------------
cpu_get_type - return the type of the
specified CPU
-------------------------------------------------*/
INLINE cpu_type cpu_get_type(const device_config *device)
{
const cpu_config *config = device->inline_config;
return config->type;
}
#endif /* __CPUEXEC_H__ */

File diff suppressed because it is too large Load Diff

View File

@ -20,11 +20,15 @@
#include "state.h"
// mingw has this defined for 32-bit compiles
#undef i386
/***************************************************************************
CONSTANTS
***************************************************************************/
#define MAX_CPU 8
#define MAX_CPU 8
#define MAX_INPUT_EVENTS 32
@ -73,11 +77,9 @@ enum
/* --- the following bits of info are returned as 64-bit signed integers --- */
CPUINFO_INT_FIRST = DEVINFO_INT_FIRST,
/* direct map to device data */
CPUINFO_INT_CONTEXT_SIZE = DEVINFO_INT_TOKEN_BYTES, /* R/O: size of CPU context in bytes */
/* CPU-specific additions */
CPUINFO_INT_INPUT_LINES = DEVINFO_INT_CLASS_SPECIFIC, /* R/O: number of input lines */
CPUINFO_INT_CONTEXT_SIZE = DEVINFO_INT_CLASS_SPECIFIC, /* R/O: size of CPU context in bytes */
CPUINFO_INT_INPUT_LINES, /* R/O: number of input lines */
CPUINFO_INT_OUTPUT_LINES, /* R/O: number of output lines */
CPUINFO_INT_DEFAULT_IRQ_VECTOR, /* R/O: default IRQ vector */
CPUINFO_INT_ENDIANNESS, /* R/O: either ENDIANNESS_BIG or ENDIANNESS_LITTLE */
@ -126,10 +128,11 @@ enum
/* --- the following bits of info are returned as pointers to functions --- */
CPUINFO_FCT_FIRST = DEVINFO_FCT_FIRST,
/* CPU-specific additions */
/* direct map to device data */
CPUINFO_PTR_RESET = DEVINFO_FCT_RESET, /* R/O: void (*reset)(const device_config *device) */
CPUINFO_PTR_EXIT = DEVINFO_FCT_STOP, /* R/O: void (*exit)(const device_config *device) */
/* CPU-specific additions */
CPUINFO_PTR_SET_INFO = DEVINFO_FCT_CLASS_SPECIFIC, /* R/O: void (*set_info)(const device_config *device, UINT32 state, INT64 data, void *ptr) */
CPUINFO_PTR_INIT, /* R/O: void (*init)(const device_config *device, int index, int clock, int (*irqcallback)(const device_config *device, int)) */
CPUINFO_PTR_EXECUTE, /* R/O: int (*execute)(const device_config *device, int cycles) */
@ -207,238 +210,6 @@ enum
#define DASMFLAG_STEP_OVER_EXTRA(x) ((x) << DASMFLAG_OVERINSTSHIFT)
/* list of all possible CPUs we might be compiled with */
enum _cpu_type
{
CPU_DUMMY,
CPU_Z80,
CPU_Z180,
CPU_8080,
CPU_8085A,
CPU_M6502,
CPU_M65C02,
CPU_M65SC02,
CPU_M65CE02,
CPU_M6509,
CPU_M6510,
CPU_M6510T,
CPU_M7501,
CPU_M8502,
CPU_N2A03,
CPU_DECO16,
CPU_M4510,
CPU_H6280,
CPU_I8086,
CPU_I8088,
CPU_I80186,
CPU_I80188,
CPU_I80286,
CPU_V20,
CPU_V25,
CPU_V30,
CPU_V33,
CPU_V35,
CPU_V60,
CPU_V70,
CPU_I8035,
CPU_I8048,
CPU_I8648,
CPU_I8748,
CPU_MB8884,
CPU_N7751,
CPU_I8039,
CPU_I8049,
CPU_I8749,
CPU_M58715,
CPU_I8041,
CPU_I8741,
CPU_I8042,
CPU_I8242,
CPU_I8742,
CPU_I8031,
CPU_I8032,
CPU_I8051,
CPU_I8052,
CPU_I8751,
CPU_I8752,
CPU_I80C31,
CPU_I80C32,
CPU_I80C51,
CPU_I80C52,
CPU_I87C51,
CPU_I87C52,
CPU_AT89C4051,
CPU_DS5002FP,
CPU_M6800,
CPU_M6801,
CPU_M6802,
CPU_M6803,
CPU_M6808,
CPU_HD63701,
CPU_NSC8105,
CPU_M6805,
CPU_M68705,
CPU_HD63705,
CPU_HD6309,
CPU_M6809,
CPU_M6809E,
CPU_KONAMI,
CPU_M68000,
CPU_M68008,
CPU_M68010,
CPU_M68EC020,
CPU_M68020,
CPU_M68040,
CPU_T11,
CPU_S2650,
CPU_TMS34010,
CPU_TMS34020,
CPU_TI990_10,
CPU_TMS9900,
CPU_TMS9980,
CPU_TMS9995,
CPU_Z8000,
CPU_TMS32010,
CPU_TMS32025,
CPU_TMS32026,
CPU_TMS32031,
CPU_TMS32032,
CPU_TMS32051,
CPU_CCPU,
CPU_ADSP2100,
CPU_ADSP2101,
CPU_ADSP2104,
CPU_ADSP2105,
CPU_ADSP2115,
CPU_ADSP2181,
CPU_PSXCPU,
CPU_ASAP,
CPU_UPD7810,
CPU_UPD7807,
CPU_UPD7801,
CPU_UPD78C05,
CPU_UPD78C06,
CPU_JAGUARGPU,
CPU_JAGUARDSP,
CPU_CQUESTSND,
CPU_CQUESTROT,
CPU_CQUESTLIN,
CPU_R3000BE,
CPU_R3000LE,
CPU_R3041BE,
CPU_R3041LE,
CPU_R4600BE,
CPU_R4600LE,
CPU_R4650BE,
CPU_R4650LE,
CPU_R4700BE,
CPU_R4700LE,
CPU_R5000BE,
CPU_R5000LE,
CPU_QED5271BE,
CPU_QED5271LE,
CPU_RM7000BE,
CPU_RM7000LE,
CPU_ARM,
CPU_ARM7,
CPU_SH1,
CPU_SH2,
CPU_SH4,
CPU_DSP32C,
CPU_PIC16C54,
CPU_PIC16C55,
CPU_PIC16C56,
CPU_PIC16C57,
CPU_PIC16C58,
CPU_G65816,
CPU_SPC700,
CPU_E116T,
CPU_E116XT,
CPU_E116XS,
CPU_E116XSR,
CPU_E132N,
CPU_E132T,
CPU_E132XN,
CPU_E132XT,
CPU_E132XS,
CPU_E132XSR,
CPU_GMS30C2116,
CPU_GMS30C2132,
CPU_GMS30C2216,
CPU_GMS30C2232,
CPU_I386,
CPU_I486,
CPU_PENTIUM,
CPU_MEDIAGX,
CPU_I960,
CPU_H83002,
CPU_H83007,
CPU_H83044,
CPU_H83334,
CPU_V810,
CPU_M37702,
CPU_M37710,
CPU_PPC403GA,
CPU_PPC403GCX,
CPU_PPC601,
CPU_PPC602,
CPU_PPC603,
CPU_PPC603E,
CPU_PPC603R,
CPU_PPC604,
CPU_MPC8240,
CPU_SE3208,
CPU_MC68HC11,
CPU_ADSP21062,
CPU_DSP56156,
CPU_RSP,
CPU_ALPHA8201,
CPU_ALPHA8301,
CPU_CDP1802,
CPU_COP401,
CPU_COP410,
CPU_COP411,
CPU_COP402,
CPU_COP420,
CPU_COP421,
CPU_COP422,
CPU_COP404,
CPU_COP424,
CPU_COP425,
CPU_COP426,
CPU_COP444,
CPU_COP445,
CPU_TMP90840,
CPU_TMP90841,
CPU_TMP91640,
CPU_TMP91641,
CPU_APEXC,
CPU_CP1610,
CPU_F8,
CPU_LH5801,
CPU_PDP1,
CPU_SATURN,
CPU_SC61860,
CPU_TX0_64KW,
CPU_TX0_8KW,
CPU_LR35902,
CPU_TMS7000,
CPU_TMS7000_EXL,
CPU_SM8500,
CPU_V30MZ,
CPU_MB8841,
CPU_MB8842,
CPU_MB8843,
CPU_MB8844,
CPU_MB86233,
CPU_SSP1601,
CPU_MINX,
CPU_CXD8661R,
CPU_COUNT
};
typedef enum _cpu_type cpu_type;
/***************************************************************************
MACROS
@ -503,6 +274,10 @@ typedef enum _cpu_type cpu_type;
#define CPU_VALIDITY_CHECK_CALL(name) CPU_VALIDITY_CHECK_NAME(name)(driver, config)
#define cpu_get_index(cpu) device_list_index((cpu)->machine->config->devicelist, CPU, (cpu)->tag)
/* helpers for accessing common CPU state */
#define cpu_get_context_size(cpu) cpu_get_info_int(cpu, CPUINFO_INT_CONTEXT_SIZE)
#define cpu_get_input_lines(cpu) cpu_get_info_int(cpu, CPUINFO_INT_INPUT_LINES)
@ -573,7 +348,7 @@ typedef enum _cpu_type cpu_type;
TYPE DEFINITIONS
***************************************************************************/
/* opaque definition of CPU debugging info */
/* opaque definition of CPU internal and debugging info */
typedef struct _cpu_debug_data cpu_debug_data;
@ -597,10 +372,13 @@ typedef int (*cpu_write_func)(const device_config *device, int space, UINT32 off
typedef int (*cpu_readop_func)(const device_config *device, UINT32 offset, int size, UINT64 *value);
typedef void (*cpu_debug_init_func)(const device_config *device);
typedef offs_t (*cpu_disassemble_func)(const device_config *device, char *buffer, offs_t pc, const UINT8 *oprom, const UINT8 *opram);
typedef int (*cpu_validity_check_func)(const game_driver *driver, const void *config);
/* a cpu_type is just a pointer to the CPU's get_info function */
typedef cpu_get_info_func cpu_type;
/* cpuinfo union used to pass data to/from the get_info/set_info functions */
union _cpuinfo
{
@ -635,16 +413,11 @@ typedef struct _cpu_class_header cpu_class_header;
struct _cpu_class_header
{
int index; /* index of this CPU */
cpu_type cputype; /* type index of this CPU */
cpu_debug_data * debug; /* debugging data */
const address_space * space[ADDRESS_SPACES]; /* address spaces */
/* table of core functions */
cpu_get_info_func get_info;
cpu_set_info_func set_info;
cpu_init_func init;
cpu_reset_func reset;
cpu_exit_func exit;
cpu_execute_func execute;
cpu_burn_func burn;
cpu_translate_func translate;
@ -652,13 +425,478 @@ struct _cpu_class_header
cpu_disassemble_func dasm_override;
/* other frequently-needed information */
INT8 address_shift[ADDRESS_SPACES];
UINT32 clock_divider;
UINT32 clock_multiplier;
};
/***************************************************************************
CPU DEFINITIONS
***************************************************************************/
#define cpu_count(config) device_list_items((config)->devicelist, CPU)
#define cpu_first(config) device_list_first((config)->devicelist, CPU)
#define cpu_next(previous) device_list_next((previous), CPU)
/* signal a reset for a given CPU */
#define cpu_reset device_reset
/* eventually all drivers should include the CPU core's header, which should define these */
CPU_GET_INFO( dummy );
#define CPU_DUMMY CPU_GET_INFO_NAME( dummy )
CPU_GET_INFO( z80 );
#define CPU_Z80 CPU_GET_INFO_NAME( z80 )
CPU_GET_INFO( z180 );
#define CPU_Z180 CPU_GET_INFO_NAME( z180 )
CPU_GET_INFO( i8080 );
#define CPU_8080 CPU_GET_INFO_NAME( i8080 )
CPU_GET_INFO( i8085 );
#define CPU_8085A CPU_GET_INFO_NAME( i8085 )
CPU_GET_INFO( m6502 );
#define CPU_M6502 CPU_GET_INFO_NAME( m6502 )
CPU_GET_INFO( m65c02 );
#define CPU_M65C02 CPU_GET_INFO_NAME( m65c02 )
CPU_GET_INFO( m65sc02 );
#define CPU_M65SC02 CPU_GET_INFO_NAME( m65sc02 )
CPU_GET_INFO( m65ce02 );
#define CPU_M65CE02 CPU_GET_INFO_NAME( m65ce02 )
CPU_GET_INFO( m6509 );
#define CPU_M6509 CPU_GET_INFO_NAME( m6509 )
CPU_GET_INFO( m6510 );
#define CPU_M6510 CPU_GET_INFO_NAME( m6510 )
CPU_GET_INFO( m6510t );
#define CPU_M6510T CPU_GET_INFO_NAME( m6510t )
CPU_GET_INFO( m7501 );
#define CPU_M7501 CPU_GET_INFO_NAME( m7501 )
CPU_GET_INFO( m8502 );
#define CPU_M8502 CPU_GET_INFO_NAME( m8502 )
CPU_GET_INFO( n2a03 );
#define CPU_N2A03 CPU_GET_INFO_NAME( n2a03 )
CPU_GET_INFO( deco16 );
#define CPU_DECO16 CPU_GET_INFO_NAME( deco16 )
CPU_GET_INFO( m4510 );
#define CPU_M4510 CPU_GET_INFO_NAME( m4510 )
CPU_GET_INFO( h6280 );
#define CPU_H6280 CPU_GET_INFO_NAME( h6280 )
CPU_GET_INFO( i8086 );
#define CPU_I8086 CPU_GET_INFO_NAME( i8086 )
CPU_GET_INFO( i8088 );
#define CPU_I8088 CPU_GET_INFO_NAME( i8088 )
CPU_GET_INFO( i80186 );
#define CPU_I80186 CPU_GET_INFO_NAME( i80186 )
CPU_GET_INFO( i80188 );
#define CPU_I80188 CPU_GET_INFO_NAME( i80188 )
CPU_GET_INFO( i80286 );
#define CPU_I80286 CPU_GET_INFO_NAME( i80286 )
CPU_GET_INFO( v20 );
#define CPU_V20 CPU_GET_INFO_NAME( v20 )
CPU_GET_INFO( v25 );
#define CPU_V25 CPU_GET_INFO_NAME( v25 )
CPU_GET_INFO( v30 );
#define CPU_V30 CPU_GET_INFO_NAME( v30 )
CPU_GET_INFO( v33 );
#define CPU_V33 CPU_GET_INFO_NAME( v33 )
CPU_GET_INFO( v35 );
#define CPU_V35 CPU_GET_INFO_NAME( v35 )
CPU_GET_INFO( v60 );
#define CPU_V60 CPU_GET_INFO_NAME( v60 )
CPU_GET_INFO( v70 );
#define CPU_V70 CPU_GET_INFO_NAME( v70 )
CPU_GET_INFO( i8035 );
#define CPU_I8035 CPU_GET_INFO_NAME( i8035 )
CPU_GET_INFO( i8048 );
#define CPU_I8048 CPU_GET_INFO_NAME( i8048 )
CPU_GET_INFO( i8648 );
#define CPU_I8648 CPU_GET_INFO_NAME( i8648 )
CPU_GET_INFO( i8748 );
#define CPU_I8748 CPU_GET_INFO_NAME( i8748 )
CPU_GET_INFO( mb8884 );
#define CPU_MB8884 CPU_GET_INFO_NAME( mb8884 )
CPU_GET_INFO( n7751 );
#define CPU_N7751 CPU_GET_INFO_NAME( n7751 )
CPU_GET_INFO( i8039 );
#define CPU_I8039 CPU_GET_INFO_NAME( i8039 )
CPU_GET_INFO( i8049 );
#define CPU_I8049 CPU_GET_INFO_NAME( i8049 )
CPU_GET_INFO( i8749 );
#define CPU_I8749 CPU_GET_INFO_NAME( i8749 )
CPU_GET_INFO( m58715 );
#define CPU_M58715 CPU_GET_INFO_NAME( m58715 )
CPU_GET_INFO( i8041 );
#define CPU_I8041 CPU_GET_INFO_NAME( i8041 )
CPU_GET_INFO( i8741 );
#define CPU_I8741 CPU_GET_INFO_NAME( i8741 )
CPU_GET_INFO( i8042 );
#define CPU_I8042 CPU_GET_INFO_NAME( i8042 )
CPU_GET_INFO( i8242 );
#define CPU_I8242 CPU_GET_INFO_NAME( i8242 )
CPU_GET_INFO( i8742 );
#define CPU_I8742 CPU_GET_INFO_NAME( i8742 )
CPU_GET_INFO( i8031 );
#define CPU_I8031 CPU_GET_INFO_NAME( i8031 )
CPU_GET_INFO( i8032 );
#define CPU_I8032 CPU_GET_INFO_NAME( i8032 )
CPU_GET_INFO( i8051 );
#define CPU_I8051 CPU_GET_INFO_NAME( i8051 )
CPU_GET_INFO( i8052 );
#define CPU_I8052 CPU_GET_INFO_NAME( i8052 )
CPU_GET_INFO( i8751 );
#define CPU_I8751 CPU_GET_INFO_NAME( i8751 )
CPU_GET_INFO( i8752 );
#define CPU_I8752 CPU_GET_INFO_NAME( i8752 )
CPU_GET_INFO( i80c31 );
#define CPU_I80C31 CPU_GET_INFO_NAME( i80c31 )
CPU_GET_INFO( i80c32 );
#define CPU_I80C32 CPU_GET_INFO_NAME( i80c32 )
CPU_GET_INFO( i80c51 );
#define CPU_I80C51 CPU_GET_INFO_NAME( i80c51 )
CPU_GET_INFO( i80c52 );
#define CPU_I80C52 CPU_GET_INFO_NAME( i80c52 )
CPU_GET_INFO( i87c51 );
#define CPU_I87C51 CPU_GET_INFO_NAME( i87c51 )
CPU_GET_INFO( i87c52 );
#define CPU_I87C52 CPU_GET_INFO_NAME( i87c52 )
CPU_GET_INFO( at89c4051 );
#define CPU_AT89C4051 CPU_GET_INFO_NAME( at89c4051 )
CPU_GET_INFO( ds5002fp );
#define CPU_DS5002FP CPU_GET_INFO_NAME( ds5002fp )
CPU_GET_INFO( m6800 );
#define CPU_M6800 CPU_GET_INFO_NAME( m6800 )
CPU_GET_INFO( m6801 );
#define CPU_M6801 CPU_GET_INFO_NAME( m6801 )
CPU_GET_INFO( m6802 );
#define CPU_M6802 CPU_GET_INFO_NAME( m6802 )
CPU_GET_INFO( m6803 );
#define CPU_M6803 CPU_GET_INFO_NAME( m6803 )
CPU_GET_INFO( m6808 );
#define CPU_M6808 CPU_GET_INFO_NAME( m6808 )
CPU_GET_INFO( hd63701 );
#define CPU_HD63701 CPU_GET_INFO_NAME( hd63701 )
CPU_GET_INFO( nsc8105 );
#define CPU_NSC8105 CPU_GET_INFO_NAME( nsc8105 )
CPU_GET_INFO( m6805 );
#define CPU_M6805 CPU_GET_INFO_NAME( m6805 )
CPU_GET_INFO( m68705 );
#define CPU_M68705 CPU_GET_INFO_NAME( m68705 )
CPU_GET_INFO( hd63705 );
#define CPU_HD63705 CPU_GET_INFO_NAME( hd63705 )
CPU_GET_INFO( hd6309 );
#define CPU_HD6309 CPU_GET_INFO_NAME( hd6309 )
CPU_GET_INFO( m6809 );
#define CPU_M6809 CPU_GET_INFO_NAME( m6809 )
CPU_GET_INFO( m6809e );
#define CPU_M6809E CPU_GET_INFO_NAME( m6809e )
CPU_GET_INFO( konami );
#define CPU_KONAMI CPU_GET_INFO_NAME( konami )
CPU_GET_INFO( m68000 );
#define CPU_M68000 CPU_GET_INFO_NAME( m68000 )
CPU_GET_INFO( m68008 );
#define CPU_M68008 CPU_GET_INFO_NAME( m68008 )
CPU_GET_INFO( m68010 );
#define CPU_M68010 CPU_GET_INFO_NAME( m68010 )
CPU_GET_INFO( m68ec020 );
#define CPU_M68EC020 CPU_GET_INFO_NAME( m68ec020 )
CPU_GET_INFO( m68020 );
#define CPU_M68020 CPU_GET_INFO_NAME( m68020 )
CPU_GET_INFO( m68040 );
#define CPU_M68040 CPU_GET_INFO_NAME( m68040 )
CPU_GET_INFO( t11 );
#define CPU_T11 CPU_GET_INFO_NAME( t11 )
CPU_GET_INFO( s2650 );
#define CPU_S2650 CPU_GET_INFO_NAME( s2650 )
CPU_GET_INFO( tms34010 );
#define CPU_TMS34010 CPU_GET_INFO_NAME( tms34010 )
CPU_GET_INFO( tms34020 );
#define CPU_TMS34020 CPU_GET_INFO_NAME( tms34020 )
CPU_GET_INFO( ti990_10 );
#define CPU_TI990_10 CPU_GET_INFO_NAME( ti990_10 )
CPU_GET_INFO( tms9900 );
#define CPU_TMS9900 CPU_GET_INFO_NAME( tms9900 )
CPU_GET_INFO( tms9980a );
#define CPU_TMS9980 CPU_GET_INFO_NAME( tms9980a )
CPU_GET_INFO( tms9995 );
#define CPU_TMS9995 CPU_GET_INFO_NAME( tms9995 )
CPU_GET_INFO( z8000 );
#define CPU_Z8000 CPU_GET_INFO_NAME( z8000 )
CPU_GET_INFO( tms32010 );
#define CPU_TMS32010 CPU_GET_INFO_NAME( tms32010 )
CPU_GET_INFO( tms32025 );
#define CPU_TMS32025 CPU_GET_INFO_NAME( tms32025 )
CPU_GET_INFO( tms32026 );
#define CPU_TMS32026 CPU_GET_INFO_NAME( tms32026 )
CPU_GET_INFO( tms32031 );
#define CPU_TMS32031 CPU_GET_INFO_NAME( tms32031 )
CPU_GET_INFO( tms32032 );
#define CPU_TMS32032 CPU_GET_INFO_NAME( tms32032 )
CPU_GET_INFO( tms32051 );
#define CPU_TMS32051 CPU_GET_INFO_NAME( tms32051 )
CPU_GET_INFO( ccpu );
#define CPU_CCPU CPU_GET_INFO_NAME( ccpu )
CPU_GET_INFO( adsp2100 );
#define CPU_ADSP2100 CPU_GET_INFO_NAME( adsp2100 )
CPU_GET_INFO( adsp2101 );
#define CPU_ADSP2101 CPU_GET_INFO_NAME( adsp2101 )
CPU_GET_INFO( adsp2104 );
#define CPU_ADSP2104 CPU_GET_INFO_NAME( adsp2104 )
CPU_GET_INFO( adsp2105 );
#define CPU_ADSP2105 CPU_GET_INFO_NAME( adsp2105 )
CPU_GET_INFO( adsp2115 );
#define CPU_ADSP2115 CPU_GET_INFO_NAME( adsp2115 )
CPU_GET_INFO( adsp2181 );
#define CPU_ADSP2181 CPU_GET_INFO_NAME( adsp2181 )
CPU_GET_INFO( psxcpu );
#define CPU_PSXCPU CPU_GET_INFO_NAME( psxcpu )
CPU_GET_INFO( asap );
#define CPU_ASAP CPU_GET_INFO_NAME( asap )
CPU_GET_INFO( upd7810 );
#define CPU_UPD7810 CPU_GET_INFO_NAME( upd7810 )
CPU_GET_INFO( upd7807 );
#define CPU_UPD7807 CPU_GET_INFO_NAME( upd7807 )
CPU_GET_INFO( upd7801 );
#define CPU_UPD7801 CPU_GET_INFO_NAME( upd7801 )
CPU_GET_INFO( upd78C05 );
#define CPU_UPD78C05 CPU_GET_INFO_NAME( upd78C05 )
CPU_GET_INFO( upd78C06 );
#define CPU_UPD78C06 CPU_GET_INFO_NAME( upd78C06 )
CPU_GET_INFO( jaguargpu );
#define CPU_JAGUARGPU CPU_GET_INFO_NAME( jaguargpu )
CPU_GET_INFO( jaguardsp );
#define CPU_JAGUARDSP CPU_GET_INFO_NAME( jaguardsp )
CPU_GET_INFO( cquestsnd );
#define CPU_CQUESTSND CPU_GET_INFO_NAME( cquestsnd )
CPU_GET_INFO( cquestrot );
#define CPU_CQUESTROT CPU_GET_INFO_NAME( cquestrot )
CPU_GET_INFO( cquestlin );
#define CPU_CQUESTLIN CPU_GET_INFO_NAME( cquestlin )
CPU_GET_INFO( r3000be );
#define CPU_R3000BE CPU_GET_INFO_NAME( r3000be )
CPU_GET_INFO( r3000le );
#define CPU_R3000LE CPU_GET_INFO_NAME( r3000le )
CPU_GET_INFO( r3041be );
#define CPU_R3041BE CPU_GET_INFO_NAME( r3041be )
CPU_GET_INFO( r3041le );
#define CPU_R3041LE CPU_GET_INFO_NAME( r3041le )
CPU_GET_INFO( r4600be );
#define CPU_R4600BE CPU_GET_INFO_NAME( r4600be )
CPU_GET_INFO( r4600le );
#define CPU_R4600LE CPU_GET_INFO_NAME( r4600le )
CPU_GET_INFO( r4650be );
#define CPU_R4650BE CPU_GET_INFO_NAME( r4650be )
CPU_GET_INFO( r4650le );
#define CPU_R4650LE CPU_GET_INFO_NAME( r4650le )
CPU_GET_INFO( r4700be );
#define CPU_R4700BE CPU_GET_INFO_NAME( r4700be )
CPU_GET_INFO( r4700le );
#define CPU_R4700LE CPU_GET_INFO_NAME( r4700le )
CPU_GET_INFO( r5000be );
#define CPU_R5000BE CPU_GET_INFO_NAME( r5000be )
CPU_GET_INFO( r5000le );
#define CPU_R5000LE CPU_GET_INFO_NAME( r5000le )
CPU_GET_INFO( qed5271be );
#define CPU_QED5271BE CPU_GET_INFO_NAME( qed5271be )
CPU_GET_INFO( qed5271le );
#define CPU_QED5271LE CPU_GET_INFO_NAME( qed5271le )
CPU_GET_INFO( rm7000be );
#define CPU_RM7000BE CPU_GET_INFO_NAME( rm7000be )
CPU_GET_INFO( rm7000le );
#define CPU_RM7000LE CPU_GET_INFO_NAME( rm7000le )
CPU_GET_INFO( arm );
#define CPU_ARM CPU_GET_INFO_NAME( arm )
CPU_GET_INFO( arm7 );
#define CPU_ARM7 CPU_GET_INFO_NAME( arm7 )
CPU_GET_INFO( sh1 );
#define CPU_SH1 CPU_GET_INFO_NAME( sh1 )
CPU_GET_INFO( sh2 );
#define CPU_SH2 CPU_GET_INFO_NAME( sh2 )
CPU_GET_INFO( sh4 );
#define CPU_SH4 CPU_GET_INFO_NAME( sh4 )
CPU_GET_INFO( dsp32c );
#define CPU_DSP32C CPU_GET_INFO_NAME( dsp32c )
CPU_GET_INFO( pic16c54 );
#define CPU_PIC16C54 CPU_GET_INFO_NAME( pic16c54 )
CPU_GET_INFO( pic16c55 );
#define CPU_PIC16C55 CPU_GET_INFO_NAME( pic16c55 )
CPU_GET_INFO( pic16c56 );
#define CPU_PIC16C56 CPU_GET_INFO_NAME( pic16c56 )
CPU_GET_INFO( pic16c57 );
#define CPU_PIC16C57 CPU_GET_INFO_NAME( pic16c57 )
CPU_GET_INFO( pic16c58 );
#define CPU_PIC16C58 CPU_GET_INFO_NAME( pic16c58 )
CPU_GET_INFO( g65816 );
#define CPU_G65816 CPU_GET_INFO_NAME( g65816 )
CPU_GET_INFO( spc700 );
#define CPU_SPC700 CPU_GET_INFO_NAME( spc700 )
CPU_GET_INFO( e116t );
#define CPU_E116T CPU_GET_INFO_NAME( e116t )
CPU_GET_INFO( e116xt );
#define CPU_E116XT CPU_GET_INFO_NAME( e116xt )
CPU_GET_INFO( e116xs );
#define CPU_E116XS CPU_GET_INFO_NAME( e116xs )
CPU_GET_INFO( e116xsr );
#define CPU_E116XSR CPU_GET_INFO_NAME( e116xsr )
CPU_GET_INFO( e132n );
#define CPU_E132N CPU_GET_INFO_NAME( e132n )
CPU_GET_INFO( e132t );
#define CPU_E132T CPU_GET_INFO_NAME( e132t )
CPU_GET_INFO( e132xn );
#define CPU_E132XN CPU_GET_INFO_NAME( e132xn )
CPU_GET_INFO( e132xt );
#define CPU_E132XT CPU_GET_INFO_NAME( e132xt )
CPU_GET_INFO( e132xs );
#define CPU_E132XS CPU_GET_INFO_NAME( e132xs )
CPU_GET_INFO( e132xsr );
#define CPU_E132XSR CPU_GET_INFO_NAME( e132xsr )
CPU_GET_INFO( gms30c2116 );
#define CPU_GMS30C2116 CPU_GET_INFO_NAME( gms30c2116 )
CPU_GET_INFO( gms30c2132 );
#define CPU_GMS30C2132 CPU_GET_INFO_NAME( gms30c2132 )
CPU_GET_INFO( gms30c2216 );
#define CPU_GMS30C2216 CPU_GET_INFO_NAME( gms30c2216 )
CPU_GET_INFO( gms30c2232 );
#define CPU_GMS30C2232 CPU_GET_INFO_NAME( gms30c2232 )
CPU_GET_INFO( i386 );
#define CPU_I386 CPU_GET_INFO_NAME( i386 )
CPU_GET_INFO( i486 );
#define CPU_I486 CPU_GET_INFO_NAME( i486 )
CPU_GET_INFO( pentium );
#define CPU_PENTIUM CPU_GET_INFO_NAME( pentium )
CPU_GET_INFO( mediagx );
#define CPU_MEDIAGX CPU_GET_INFO_NAME( mediagx )
CPU_GET_INFO( i960 );
#define CPU_I960 CPU_GET_INFO_NAME( i960 )
CPU_GET_INFO( h8_3002 );
#define CPU_H83002 CPU_GET_INFO_NAME( h8_3002 )
CPU_GET_INFO( h8_3007 );
#define CPU_H83007 CPU_GET_INFO_NAME( h8_3007 )
CPU_GET_INFO( h8_3044 );
#define CPU_H83044 CPU_GET_INFO_NAME( h8_3044 )
CPU_GET_INFO( h8_3334 );
#define CPU_H83334 CPU_GET_INFO_NAME( h8_3334 )
CPU_GET_INFO( v810 );
#define CPU_V810 CPU_GET_INFO_NAME( v810 )
CPU_GET_INFO( m37702 );
#define CPU_M37702 CPU_GET_INFO_NAME( m37702 )
CPU_GET_INFO( m37710 );
#define CPU_M37710 CPU_GET_INFO_NAME( m37710 )
CPU_GET_INFO( ppc403ga );
#define CPU_PPC403GA CPU_GET_INFO_NAME( ppc403ga )
CPU_GET_INFO( ppc403gcx );
#define CPU_PPC403GCX CPU_GET_INFO_NAME( ppc403gcx )
CPU_GET_INFO( ppc601 );
#define CPU_PPC601 CPU_GET_INFO_NAME( ppc601 )
CPU_GET_INFO( ppc602 );
#define CPU_PPC602 CPU_GET_INFO_NAME( ppc602 )
CPU_GET_INFO( ppc603 );
#define CPU_PPC603 CPU_GET_INFO_NAME( ppc603 )
CPU_GET_INFO( ppc603e );
#define CPU_PPC603E CPU_GET_INFO_NAME( ppc603e )
CPU_GET_INFO( ppc603r );
#define CPU_PPC603R CPU_GET_INFO_NAME( ppc603r )
CPU_GET_INFO( ppc604 );
#define CPU_PPC604 CPU_GET_INFO_NAME( ppc604 )
CPU_GET_INFO( mpc8240 );
#define CPU_MPC8240 CPU_GET_INFO_NAME( mpc8240 )
CPU_GET_INFO( se3208 );
#define CPU_SE3208 CPU_GET_INFO_NAME( se3208 )
CPU_GET_INFO( mc68hc11 );
#define CPU_MC68HC11 CPU_GET_INFO_NAME( mc68hc11 )
CPU_GET_INFO( adsp21062 );
#define CPU_ADSP21062 CPU_GET_INFO_NAME( adsp21062 )
CPU_GET_INFO( dsp56k );
#define CPU_DSP56156 CPU_GET_INFO_NAME( dsp56k )
CPU_GET_INFO( rsp );
#define CPU_RSP CPU_GET_INFO_NAME( rsp )
CPU_GET_INFO( alpha8201 );
#define CPU_ALPHA8201 CPU_GET_INFO_NAME( alpha8201 )
CPU_GET_INFO( alpha8301 );
#define CPU_ALPHA8301 CPU_GET_INFO_NAME( alpha8301 )
CPU_GET_INFO( cdp1802 );
#define CPU_CDP1802 CPU_GET_INFO_NAME( cdp1802 )
CPU_GET_INFO( cop401 );
#define CPU_COP401 CPU_GET_INFO_NAME( cop401 )
CPU_GET_INFO( cop410 );
#define CPU_COP410 CPU_GET_INFO_NAME( cop410 )
CPU_GET_INFO( cop411 );
#define CPU_COP411 CPU_GET_INFO_NAME( cop411 )
CPU_GET_INFO( cop402 );
#define CPU_COP402 CPU_GET_INFO_NAME( cop402 )
CPU_GET_INFO( cop420 );
#define CPU_COP420 CPU_GET_INFO_NAME( cop420 )
CPU_GET_INFO( cop421 );
#define CPU_COP421 CPU_GET_INFO_NAME( cop421 )
CPU_GET_INFO( cop422 );
#define CPU_COP422 CPU_GET_INFO_NAME( cop422 )
CPU_GET_INFO( cop404 );
#define CPU_COP404 CPU_GET_INFO_NAME( cop404 )
CPU_GET_INFO( cop424 );
#define CPU_COP424 CPU_GET_INFO_NAME( cop424 )
CPU_GET_INFO( cop425 );
#define CPU_COP425 CPU_GET_INFO_NAME( cop425 )
CPU_GET_INFO( cop426 );
#define CPU_COP426 CPU_GET_INFO_NAME( cop426 )
CPU_GET_INFO( cop444 );
#define CPU_COP444 CPU_GET_INFO_NAME( cop444 )
CPU_GET_INFO( cop445 );
#define CPU_COP445 CPU_GET_INFO_NAME( cop445 )
CPU_GET_INFO( tmp90840 );
#define CPU_TMP90840 CPU_GET_INFO_NAME( tmp90840 )
CPU_GET_INFO( tmp90841 );
#define CPU_TMP90841 CPU_GET_INFO_NAME( tmp90841 )
CPU_GET_INFO( tmp91640 );
#define CPU_TMP91640 CPU_GET_INFO_NAME( tmp91640 )
CPU_GET_INFO( tmp91641 );
#define CPU_TMP91641 CPU_GET_INFO_NAME( tmp91641 )
CPU_GET_INFO( apexc );
#define CPU_APEXC CPU_GET_INFO_NAME( apexc )
CPU_GET_INFO( cp1610 );
#define CPU_CP1610 CPU_GET_INFO_NAME( cp1610 )
CPU_GET_INFO( f8 );
#define CPU_F8 CPU_GET_INFO_NAME( f8 )
CPU_GET_INFO( lh5801 );
#define CPU_LH5801 CPU_GET_INFO_NAME( lh5801 )
CPU_GET_INFO( pdp1 );
#define CPU_PDP1 CPU_GET_INFO_NAME( pdp1 )
CPU_GET_INFO( saturn );
#define CPU_SATURN CPU_GET_INFO_NAME( saturn )
CPU_GET_INFO( sc61860 );
#define CPU_SC61860 CPU_GET_INFO_NAME( sc61860 )
CPU_GET_INFO( tx0_64kw );
#define CPU_TX0_64KW CPU_GET_INFO_NAME( tx0_64kw )
CPU_GET_INFO( tx0_8kw );
#define CPU_TX0_8KW CPU_GET_INFO_NAME( tx0_8kw )
CPU_GET_INFO( lrR35902 );
#define CPU_LR35902 CPU_GET_INFO_NAME( lr35902 )
CPU_GET_INFO( tms7000 );
#define CPU_TMS7000 CPU_GET_INFO_NAME( tms7000 )
CPU_GET_INFO( tms7000_EXL );
#define CPU_TMS7000_EXL CPU_GET_INFO_NAME( tms7000_EXL )
CPU_GET_INFO( SM8500 );
#define CPU_sm8500 CPU_GET_INFO_NAME( sm8500 )
CPU_GET_INFO( v30mz );
#define CPU_V30MZ CPU_GET_INFO_NAME( v30mz )
CPU_GET_INFO( mb8841 );
#define CPU_MB8841 CPU_GET_INFO_NAME( mb8841 )
CPU_GET_INFO( mb8842 );
#define CPU_MB8842 CPU_GET_INFO_NAME( mb8842 )
CPU_GET_INFO( mb8843 );
#define CPU_MB8843 CPU_GET_INFO_NAME( mb8843 )
CPU_GET_INFO( mb8844 );
#define CPU_MB8844 CPU_GET_INFO_NAME( mb8844 )
CPU_GET_INFO( mb86233 );
#define CPU_MB86233 CPU_GET_INFO_NAME( mb86233 )
CPU_GET_INFO( ssp1601 );
#define CPU_SSP1601 CPU_GET_INFO_NAME( ssp1601 )
CPU_GET_INFO( minx );
#define CPU_MINX CPU_GET_INFO_NAME( minx )
CPU_GET_INFO( cxd8661r );
#define CPU_CXD8661R CPU_GET_INFO_NAME( cxd8661r )
/***************************************************************************
FUNCTION PROTOTYPES
***************************************************************************/
@ -674,21 +912,8 @@ char *cpuintrf_temp_str(void);
/* ----- live context control ----- */
/* find a CPU in the machine by searching */
int cpu_get_index_slow(const device_config *cpu);
/* ----- live CPU accessors ----- */
/* initialize a live CPU */
void cpu_init(const device_config *cpu, int index, int clock, cpu_irq_callback irqcallback);
/* free a live CPU */
void cpu_exit(const device_config *cpu);
/* return information about a live CPU */
INT64 cpu_get_info_int(const device_config *cpu, UINT32 state);
void *cpu_get_info_ptr(const device_config *cpu, UINT32 state);
@ -700,9 +925,6 @@ void cpu_set_info_int(const device_config *cpu, UINT32 state, INT64 data);
void cpu_set_info_ptr(const device_config *cpu, UINT32 state, void *data);
void cpu_set_info_fct(const device_config *cpu, UINT32 state, genf *data);
/* signal a reset for a given CPU */
void cpu_reset(const device_config *cpu);
/* return the PC, corrected to a byte offset and translated to physical space, on a given CPU */
offs_t cpu_get_physical_pc_byte(const device_config *cpu);
@ -716,9 +938,6 @@ void cpu_set_dasm_override(const device_config *cpu, cpu_disassemble_func dasm_o
/* ----- CPU type accessors ----- */
/* return a header template for a given CPU type */
const cpu_class_header *cputype_get_header_template(cpu_type cputype);
/* return information about a given CPU type */
INT64 cputype_get_info_int(cpu_type cputype, UINT32 state);
void *cputype_get_info_ptr(cpu_type cputype, UINT32 state);
@ -732,14 +951,15 @@ const char *cputype_get_info_string(cpu_type cputype, UINT32 state);
***************************************************************************/
/*-------------------------------------------------
cpu_get_index - return the index of the
specified CPU (deprecated soon)
cpu_get_class_header - return a pointer to
the class header
-------------------------------------------------*/
INLINE int cpu_get_index(const device_config *cpu)
INLINE cpu_class_header *cpu_get_class_header(const device_config *device)
{
cpu_class_header *classheader = cpu->classtoken;
return (classheader != NULL) ? classheader->index : cpu_get_index_slow(cpu);
if (device->token != NULL)
return (cpu_class_header *)((UINT8 *)device->token + device->tokenbytes) - 1;
return NULL;
}
@ -748,9 +968,9 @@ INLINE int cpu_get_index(const device_config *cpu)
the given CPU's debugger data
-------------------------------------------------*/
INLINE cpu_debug_data *cpu_get_debug_data(const device_config *cpu)
INLINE cpu_debug_data *cpu_get_debug_data(const device_config *device)
{
cpu_class_header *classheader = cpu->classtoken;
cpu_class_header *classheader = cpu_get_class_header(device);
return classheader->debug;
}
@ -760,10 +980,15 @@ INLINE cpu_debug_data *cpu_get_debug_data(const device_config *cpu)
the given CPU's address space
-------------------------------------------------*/
INLINE const address_space *cpu_get_address_space(const device_config *cpu, int spacenum)
INLINE const address_space *cpu_get_address_space(const device_config *device, int spacenum)
{
cpu_class_header *classheader = cpu->classtoken;
return classheader->space[spacenum];
/* it is faster to pull this from the class header, but only after we've started */
if (device->token != NULL)
{
cpu_class_header *classheader = cpu_get_class_header(device);
return classheader->space[spacenum];
}
return memory_find_address_space(device, spacenum);
}
@ -774,7 +999,7 @@ INLINE const address_space *cpu_get_address_space(const device_config *cpu, int
INLINE int cpu_execute(const device_config *device, int cycles)
{
cpu_class_header *classheader = device->classtoken;
cpu_class_header *classheader = cpu_get_class_header(device);
return (*classheader->execute)(device, cycles);
}

View File

@ -124,8 +124,9 @@ static void execute_hardreset(running_machine *machine, int ref, int params, con
void debug_command_init(running_machine *machine)
{
symbol_table *symtable = debug_cpu_get_global_symtable(machine);
int cpunum, itemnum;
const device_config *cpu;
const char *name;
int itemnum;
/* add a few simple global functions */
symtable_add_function(symtable, "min", NULL, 2, 2, execute_min);
@ -244,14 +245,13 @@ void debug_command_init(running_machine *machine)
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 */
for (cpunum = 0; cpunum < ARRAY_LENGTH(machine->cpu); cpunum++)
if (machine->cpu[cpunum] != NULL)
{
cpu_debug_init_func debug_init;
debug_init = (cpu_debug_init_func)cpu_get_info_fct(machine->cpu[cpunum], CPUINFO_PTR_DEBUG_INIT);
if (debug_init != NULL)
(*debug_init)(machine->cpu[cpunum]);
}
for (cpu = machine->cpu[0]; cpu != NULL; cpu = cpu->typenext)
{
cpu_debug_init_func debug_init;
debug_init = (cpu_debug_init_func)cpu_get_info_fct(cpu, CPUINFO_PTR_DEBUG_INIT);
if (debug_init != NULL)
(*debug_init)(cpu);
}
add_exit_callback(machine, debug_command_exit);
@ -268,12 +268,11 @@ void debug_command_init(running_machine *machine)
static void debug_command_exit(running_machine *machine)
{
int cpunum;
const device_config *cpu;
/* turn off all traces */
for (cpunum = 0; cpunum < ARRAY_LENGTH(machine->cpu); cpunum++)
if (machine->cpu[cpunum] != NULL)
debug_cpu_trace(machine->cpu[cpunum], NULL, 0, NULL);
for (cpu = machine->cpu[0]; cpu != NULL; cpu = cpu->typenext)
debug_cpu_trace(cpu, NULL, 0, NULL);
}
@ -854,8 +853,8 @@ static void execute_next(running_machine *machine, int ref, int params, const ch
static void execute_focus(running_machine *machine, int ref, int params, const char *param[])
{
const device_config *scancpu;
const device_config *cpu;
int cpunum;
/* validate params */
if (!debug_command_parameter_cpu(machine, param[0], &cpu))
@ -865,9 +864,9 @@ static void execute_focus(running_machine *machine, int ref, int params, const c
debug_cpu_ignore_cpu(cpu, 0);
/* then loop over CPUs and set the ignore flags on all other CPUs */
for (cpunum = 0; cpunum < ARRAY_LENGTH(machine->cpu); cpunum++)
if (machine->cpu[cpunum] != NULL && machine->cpu[cpunum] != cpu)
debug_cpu_ignore_cpu(machine->cpu[cpunum], 1);
for (scancpu = machine->cpu[0]; scancpu != NULL; scancpu = scancpu->typenext)
if (scancpu != cpu)
debug_cpu_ignore_cpu(scancpu, 1);
debug_console_printf(machine, "Now focused on CPU '%s'\n", cpu->tag);
}
@ -879,7 +878,8 @@ static void execute_focus(running_machine *machine, int ref, int params, const c
static void execute_ignore(running_machine *machine, int ref, int params, const char *param[])
{
const device_config *cpuwhich[MAX_COMMAND_PARAMS];
int cpunum, paramnum;
const device_config *cpu;
int paramnum;
char buffer[100];
int buflen = 0;
@ -887,20 +887,19 @@ static void execute_ignore(running_machine *machine, int ref, int params, const
if (params == 0)
{
/* loop over all CPUs */
for (cpunum = 0; cpunum < ARRAY_LENGTH(machine->cpu); cpunum++)
if (machine->cpu[cpunum] != NULL)
{
const cpu_debug_data *cpuinfo = cpu_get_debug_data(machine->cpu[cpunum]);
for (cpu = machine->cpu[0]; cpu != NULL; cpu = cpu->typenext)
{
const cpu_debug_data *cpuinfo = cpu_get_debug_data(cpu);
/* build up a comma-separated list */
if ((cpuinfo->flags & DEBUG_FLAG_OBSERVING) == 0)
{
if (buflen == 0)
buflen += sprintf(&buffer[buflen], "Currently ignoring CPU '%s'", machine->cpu[cpunum]->tag);
else
buflen += sprintf(&buffer[buflen], ", '%s'", machine->cpu[cpunum]->tag);
}
/* build up a comma-separated list */
if ((cpuinfo->flags & DEBUG_FLAG_OBSERVING) == 0)
{
if (buflen == 0)
buflen += sprintf(&buffer[buflen], "Currently ignoring CPU '%s'", cpu->tag);
else
buflen += sprintf(&buffer[buflen], ", '%s'", cpu->tag);
}
}
/* special message for none */
if (buflen == 0)
@ -920,11 +919,10 @@ static void execute_ignore(running_machine *machine, int ref, int params, const
for (paramnum = 0; paramnum < params; paramnum++)
{
/* make sure this isn't the last live CPU */
for (cpunum = 0; cpunum < ARRAY_LENGTH(machine->cpu); cpunum++)
if (machine->cpu[cpunum] != NULL && machine->cpu[cpunum] != cpuwhich[paramnum])
if ((cpu_get_debug_data(machine->cpu[cpunum])->flags & DEBUG_FLAG_OBSERVING) != 0)
break;
if (cpunum == ARRAY_LENGTH(machine->cpu))
for (cpu = machine->cpu[0]; cpu != NULL; cpu = cpu->typenext)
if (cpu != cpuwhich[paramnum] && (cpu_get_debug_data(cpu)->flags & DEBUG_FLAG_OBSERVING) != 0)
break;
if (cpu == NULL)
{
debug_console_printf(machine, "Can't ignore all CPUs!\n");
return;
@ -944,7 +942,8 @@ static void execute_ignore(running_machine *machine, int ref, int params, const
static void execute_observe(running_machine *machine, int ref, int params, const char *param[])
{
const device_config *cpuwhich[MAX_COMMAND_PARAMS];
int cpunum, paramnum;
const device_config *cpu;
int paramnum;
char buffer[100];
int buflen = 0;
@ -952,20 +951,19 @@ static void execute_observe(running_machine *machine, int ref, int params, const
if (params == 0)
{
/* loop over all CPUs */
for (cpunum = 0; cpunum < ARRAY_LENGTH(machine->cpu); cpunum++)
if (machine->cpu[cpunum] != NULL)
{
const cpu_debug_data *cpuinfo = cpu_get_debug_data(machine->cpu[cpunum]);
for (cpu = machine->cpu[0]; cpu != NULL; cpu = cpu->typenext)
{
const cpu_debug_data *cpuinfo = cpu_get_debug_data(cpu);
/* build up a comma-separated list */
if ((cpuinfo->flags & DEBUG_FLAG_OBSERVING) != 0)
{
if (buflen == 0)
buflen += sprintf(&buffer[buflen], "Currently observing CPU '%s'", machine->cpu[cpunum]->tag);
else
buflen += sprintf(&buffer[buflen], ", '%s'", machine->cpu[cpunum]->tag);
}
/* build up a comma-separated list */
if ((cpuinfo->flags & DEBUG_FLAG_OBSERVING) != 0)
{
if (buflen == 0)
buflen += sprintf(&buffer[buflen], "Currently observing CPU '%s'", cpu->tag);
else
buflen += sprintf(&buffer[buflen], ", '%s'", cpu->tag);
}
}
/* special message for none */
if (buflen == 0)
@ -1103,16 +1101,15 @@ static void execute_bpclear(running_machine *machine, int ref, int params, const
/* if 0 parameters, clear all */
if (params == 0)
{
int cpunum;
const device_config *cpu;
for (cpunum = 0; cpunum < ARRAY_LENGTH(machine->cpu); cpunum++)
if (machine->cpu[cpunum] != NULL)
{
const cpu_debug_data *cpuinfo = cpu_get_debug_data(machine->cpu[cpunum]);
debug_cpu_breakpoint *bp;
while ((bp = cpuinfo->bplist) != NULL)
debug_cpu_breakpoint_clear(machine, bp->index);
}
for (cpu = machine->cpu[0]; cpu != NULL; cpu = cpu->typenext)
{
const cpu_debug_data *cpuinfo = cpu_get_debug_data(cpu);
debug_cpu_breakpoint *bp;
while ((bp = cpuinfo->bplist) != NULL)
debug_cpu_breakpoint_clear(machine, bp->index);
}
debug_console_printf(machine, "Cleared all breakpoints\n");
}
@ -1142,16 +1139,15 @@ static void execute_bpdisenable(running_machine *machine, int ref, int params, c
/* if 0 parameters, clear all */
if (params == 0)
{
int cpunum;
const device_config *cpu;
for (cpunum = 0; cpunum < ARRAY_LENGTH(machine->cpu); cpunum++)
if (machine->cpu[cpunum] != NULL)
{
const cpu_debug_data *cpuinfo = cpu_get_debug_data(machine->cpu[cpunum]);
debug_cpu_breakpoint *bp;
for (bp = cpuinfo->bplist; bp != NULL; bp = bp->next)
debug_cpu_breakpoint_enable(machine, bp->index, ref);
}
for (cpu = machine->cpu[0]; cpu != NULL; cpu = cpu->typenext)
{
const cpu_debug_data *cpuinfo = cpu_get_debug_data(cpu);
debug_cpu_breakpoint *bp;
for (bp = cpuinfo->bplist; bp != NULL; bp = bp->next)
debug_cpu_breakpoint_enable(machine, bp->index, ref);
}
if (ref == 0)
debug_console_printf(machine, "Disabled all breakpoints\n");
else
@ -1179,35 +1175,35 @@ static void execute_bpdisenable(running_machine *machine, int ref, int params, c
static void execute_bplist(running_machine *machine, int ref, int params, const char *param[])
{
int cpunum, printed = 0;
const device_config *cpu;
int printed = 0;
char buffer[256];
/* loop over all CPUs */
for (cpunum = 0; cpunum < ARRAY_LENGTH(machine->cpu); cpunum++)
if (machine->cpu[cpunum] != NULL)
for (cpu = machine->cpu[0]; cpu != NULL; cpu = cpu->typenext)
{
const cpu_debug_data *cpuinfo = cpu_get_debug_data(cpu);
if (cpuinfo->bplist != NULL)
{
const cpu_debug_data *cpuinfo = cpu_get_debug_data(machine->cpu[cpunum]);
debug_cpu_breakpoint *bp;
if (cpuinfo->bplist != NULL)
debug_console_printf(machine, "CPU '%s' breakpoints:\n", cpu->tag);
/* loop over the breakpoints */
for (bp = cpuinfo->bplist; bp != NULL; bp = bp->next)
{
debug_cpu_breakpoint *bp;
debug_console_printf(machine, "CPU %d breakpoints:\n", cpunum);
/* loop over the breakpoints */
for (bp = cpuinfo->bplist; bp != NULL; bp = bp->next)
{
int buflen;
buflen = sprintf(buffer, "%c%4X @ %08X", bp->enabled ? ' ' : 'D', bp->index, bp->address);
if (bp->condition)
buflen += sprintf(&buffer[buflen], " if %s", expression_original_string(bp->condition));
if (bp->action)
buflen += sprintf(&buffer[buflen], " do %s", bp->action);
debug_console_printf(machine, "%s\n", buffer);
printed++;
}
int buflen;
buflen = sprintf(buffer, "%c%4X @ %08X", bp->enabled ? ' ' : 'D', bp->index, bp->address);
if (bp->condition)
buflen += sprintf(&buffer[buflen], " if %s", expression_original_string(bp->condition));
if (bp->action)
buflen += sprintf(&buffer[buflen], " do %s", bp->action);
debug_console_printf(machine, "%s\n", buffer);
printed++;
}
}
}
if (!printed)
debug_console_printf(machine, "No breakpoints currently installed\n");
@ -1279,21 +1275,20 @@ static void execute_wpclear(running_machine *machine, int ref, int params, const
/* if 0 parameters, clear all */
if (params == 0)
{
int cpunum;
const device_config *cpu;
for (cpunum = 0; cpunum < ARRAY_LENGTH(machine->cpu); cpunum++)
if (machine->cpu[cpunum] != NULL)
for (cpu = machine->cpu[0]; cpu != NULL; cpu = cpu->typenext)
{
const cpu_debug_data *cpuinfo = cpu_get_debug_data(cpu);
int spacenum;
for (spacenum = 0; spacenum < ADDRESS_SPACES; spacenum++)
{
const cpu_debug_data *cpuinfo = cpu_get_debug_data(machine->cpu[cpunum]);
int spacenum;
for (spacenum = 0; spacenum < ADDRESS_SPACES; spacenum++)
{
debug_cpu_watchpoint *wp;
while ((wp = cpuinfo->wplist[spacenum]) != NULL)
debug_cpu_watchpoint_clear(machine, wp->index);
}
debug_cpu_watchpoint *wp;
while ((wp = cpuinfo->wplist[spacenum]) != NULL)
debug_cpu_watchpoint_clear(machine, wp->index);
}
}
debug_console_printf(machine, "Cleared all watchpoints\n");
}
@ -1323,21 +1318,20 @@ static void execute_wpdisenable(running_machine *machine, int ref, int params, c
/* if 0 parameters, clear all */
if (params == 0)
{
int cpunum;
const device_config *cpu;
for (cpunum = 0; cpunum < ARRAY_LENGTH(machine->cpu); cpunum++)
if (machine->cpu[cpunum] != NULL)
for (cpu = machine->cpu[0]; cpu != NULL; cpu = cpu->typenext)
{
const cpu_debug_data *cpuinfo = cpu_get_debug_data(cpu);
int spacenum;
for (spacenum = 0; spacenum < ADDRESS_SPACES; spacenum++)
{
const cpu_debug_data *cpuinfo = cpu_get_debug_data(machine->cpu[cpunum]);
int spacenum;
for (spacenum = 0; spacenum < ADDRESS_SPACES; spacenum++)
{
debug_cpu_watchpoint *wp;
for (wp = cpuinfo->wplist[spacenum]; wp != NULL; wp = wp->next)
debug_cpu_watchpoint_enable(machine, wp->index, ref);
}
debug_cpu_watchpoint *wp;
for (wp = cpuinfo->wplist[spacenum]; wp != NULL; wp = wp->next)
debug_cpu_watchpoint_enable(machine, wp->index, ref);
}
}
if (ref == 0)
debug_console_printf(machine, "Disabled all watchpoints\n");
else
@ -1365,40 +1359,40 @@ static void execute_wpdisenable(running_machine *machine, int ref, int params, c
static void execute_wplist(running_machine *machine, int ref, int params, const char *param[])
{
int cpunum, printed = 0;
const device_config *cpu;
int printed = 0;
char buffer[256];
/* loop over all CPUs */
for (cpunum = 0; cpunum < ARRAY_LENGTH(machine->cpu); cpunum++)
if (machine->cpu[cpunum] != NULL)
{
const cpu_debug_data *cpuinfo = cpu_get_debug_data(machine->cpu[cpunum]);
int spacenum;
for (cpu = machine->cpu[0]; cpu != NULL; cpu = cpu->typenext)
{
const cpu_debug_data *cpuinfo = cpu_get_debug_data(cpu);
int spacenum;
for (spacenum = 0; spacenum < ADDRESS_SPACES; spacenum++)
if (cpuinfo->wplist[spacenum] != NULL)
for (spacenum = 0; spacenum < ADDRESS_SPACES; spacenum++)
if (cpuinfo->wplist[spacenum] != NULL)
{
static const char *const types[] = { "unkn ", "read ", "write", "r/w " };
const address_space *space = cpu_get_address_space(cpu, spacenum);
debug_cpu_watchpoint *wp;
debug_console_printf(machine, "CPU '%s' %s space watchpoints:\n", cpu->tag, address_space_names[spacenum]);
/* loop over the watchpoints */
for (wp = cpuinfo->wplist[spacenum]; wp != NULL; wp = wp->next)
{
static const char *const types[] = { "unkn ", "read ", "write", "r/w " };
const address_space *space = cpu_get_address_space(machine->cpu[cpunum], spacenum);
debug_cpu_watchpoint *wp;
debug_console_printf(machine, "CPU '%s' %s space watchpoints:\n", space->cpu->tag, address_space_names[spacenum]);
/* loop over the watchpoints */
for (wp = cpuinfo->wplist[spacenum]; wp != NULL; wp = wp->next)
{
int buflen;
buflen = sprintf(buffer, "%c%4X @ %08X-%08X %s", wp->enabled ? ' ' : 'D',
wp->index, memory_byte_to_address(space, wp->address), memory_byte_to_address_end(space, wp->address + wp->length) - 1, types[wp->type & 3]);
if (wp->condition)
buflen += sprintf(&buffer[buflen], " if %s", expression_original_string(wp->condition));
if (wp->action)
buflen += sprintf(&buffer[buflen], " do %s", wp->action);
debug_console_printf(machine, "%s\n", buffer);
printed++;
}
int buflen;
buflen = sprintf(buffer, "%c%4X @ %08X-%08X %s", wp->enabled ? ' ' : 'D',
wp->index, memory_byte_to_address(space, wp->address), memory_byte_to_address_end(space, wp->address + wp->length) - 1, types[wp->type & 3]);
if (wp->condition)
buflen += sprintf(&buffer[buflen], " if %s", expression_original_string(wp->condition));
if (wp->action)
buflen += sprintf(&buffer[buflen], " do %s", wp->action);
debug_console_printf(machine, "%s\n", buffer);
printed++;
}
}
}
}
if (!printed)
debug_console_printf(machine, "No watchpoints currently installed\n");
@ -1420,21 +1414,19 @@ static void execute_hotspot(running_machine *machine, int ref, int params, const
if (params == 0)
{
int cleared = FALSE;
int cpunum;
/* loop over CPUs and find live spots */
for (cpunum = 0; cpunum < ARRAY_LENGTH(machine->cpu); cpunum++)
if (machine->cpu[cpunum] != NULL)
{
const cpu_debug_data *cpuinfo = cpu_get_debug_data(machine->cpu[cpunum]);
for (cpu = machine->cpu[0]; cpu != NULL; cpu = cpu->typenext)
{
const cpu_debug_data *cpuinfo = cpu_get_debug_data(cpu);
if (cpuinfo->hotspots != NULL)
{
debug_cpu_hotspot_track(cpuinfo->device, 0, 0);
debug_console_printf(machine, "Cleared hotspot tracking on CPU '%s'\n", machine->cpu[cpunum]->tag);
cleared = TRUE;
}
if (cpuinfo->hotspots != NULL)
{
debug_cpu_hotspot_track(cpuinfo->device, 0, 0);
debug_console_printf(machine, "Cleared hotspot tracking on CPU '%s'\n", cpu->tag);
cleared = TRUE;
}
}
/* if we cleared, we're done */
if (cleared)

View File

@ -160,7 +160,8 @@ void debug_cpu_init(running_machine *machine)
{
const device_config *first_screen = video_screen_first(machine->config);
debugcpu_private *global;
int cpunum, regnum;
const device_config *cpu;
int regnum;
/* allocate and reset globals */
machine->debugcpu_data = global = auto_malloc(sizeof(*global));
@ -189,68 +190,66 @@ void debug_cpu_init(running_machine *machine)
}
/* loop over CPUs and build up their info */
for (cpunum = 0; cpunum < ARRAY_LENGTH(machine->cpu); cpunum++)
if (machine->cpu[cpunum] != NULL)
for (cpu = machine->cpu[0]; cpu != NULL; cpu = cpu->typenext)
{
cpu_class_header *classheader = cpu_get_class_header(cpu);
cpu_debug_data *info;
/* allocate some information */
info = auto_malloc(sizeof(*info));
memset(info, 0, sizeof(*info));
classheader->debug = info;
/* reset the PC data */
info->flags = DEBUG_FLAG_OBSERVING | DEBUG_FLAG_HISTORY;
info->device = cpu;
info->opwidth = cpu_get_min_opcode_bytes(info->device);
/* fetch the memory accessors */
info->read = (cpu_read_func)cpu_get_info_fct(info->device, CPUINFO_PTR_READ);
info->write = (cpu_write_func)cpu_get_info_fct(info->device, CPUINFO_PTR_WRITE);
info->readop = (cpu_readop_func)cpu_get_info_fct(info->device, CPUINFO_PTR_READOP);
/* allocate a symbol table */
info->symtable = symtable_alloc(global->symtable, (void *)cpu);
/* add a global symbol for the current instruction pointer */
symtable_add_register(info->symtable, "curpc", NULL, get_current_pc, 0);
symtable_add_register(info->symtable, "cycles", NULL, get_cycles, NULL);
if (classheader->space[ADDRESS_SPACE_PROGRAM] != NULL)
symtable_add_register(info->symtable, "logunmap", (void *)classheader->space[ADDRESS_SPACE_PROGRAM], get_logunmap, set_logunmap);
if (classheader->space[ADDRESS_SPACE_DATA] != NULL)
symtable_add_register(info->symtable, "logunmapd", (void *)classheader->space[ADDRESS_SPACE_DATA], get_logunmap, set_logunmap);
if (classheader->space[ADDRESS_SPACE_IO] != NULL)
symtable_add_register(info->symtable, "logunmapi", (void *)classheader->space[ADDRESS_SPACE_IO], get_logunmap, set_logunmap);
/* add all registers into it */
for (regnum = 0; regnum < MAX_REGS; regnum++)
{
const device_config *cpu = machine->cpu[cpunum];
cpu_class_header *classheader = cpu->classtoken;
cpu_debug_data *info;
const char *str = cpu_get_reg_string(info->device, regnum);
const char *colon;
char symname[256];
int charnum;
/* allocate some information */
info = auto_malloc(sizeof(*info));
memset(info, 0, sizeof(*info));
classheader->debug = info;
/* skip if we don't get a valid string, or one without a colon */
if (str == NULL)
continue;
if (str[0] == '~')
str++;
colon = strchr(str, ':');
if (colon == NULL)
continue;
/* reset the PC data */
info->flags = DEBUG_FLAG_OBSERVING | DEBUG_FLAG_HISTORY;
info->device = machine->cpu[cpunum];
info->opwidth = cpu_get_min_opcode_bytes(info->device);
/* strip all spaces from the name and convert to lowercase */
for (charnum = 0; charnum < sizeof(symname) - 1 && str < colon; str++)
if (!isspace(*str))
symname[charnum++] = tolower(*str);
symname[charnum] = 0;
/* fetch the memory accessors */
info->read = (cpu_read_func)cpu_get_info_fct(info->device, CPUINFO_PTR_READ);
info->write = (cpu_write_func)cpu_get_info_fct(info->device, CPUINFO_PTR_WRITE);
info->readop = (cpu_readop_func)cpu_get_info_fct(info->device, CPUINFO_PTR_READOP);
/* allocate a symbol table */
info->symtable = symtable_alloc(global->symtable, (void *)cpu);
/* add a global symbol for the current instruction pointer */
symtable_add_register(info->symtable, "curpc", NULL, get_current_pc, 0);
symtable_add_register(info->symtable, "cycles", NULL, get_cycles, NULL);
if (classheader->space[ADDRESS_SPACE_PROGRAM] != NULL)
symtable_add_register(info->symtable, "logunmap", (void *)classheader->space[ADDRESS_SPACE_PROGRAM], get_logunmap, set_logunmap);
if (classheader->space[ADDRESS_SPACE_DATA] != NULL)
symtable_add_register(info->symtable, "logunmapd", (void *)classheader->space[ADDRESS_SPACE_DATA], get_logunmap, set_logunmap);
if (classheader->space[ADDRESS_SPACE_IO] != NULL)
symtable_add_register(info->symtable, "logunmapi", (void *)classheader->space[ADDRESS_SPACE_IO], get_logunmap, set_logunmap);
/* add all registers into it */
for (regnum = 0; regnum < MAX_REGS; regnum++)
{
const char *str = cpu_get_reg_string(info->device, regnum);
const char *colon;
char symname[256];
int charnum;
/* skip if we don't get a valid string, or one without a colon */
if (str == NULL)
continue;
if (str[0] == '~')
str++;
colon = strchr(str, ':');
if (colon == NULL)
continue;
/* strip all spaces from the name and convert to lowercase */
for (charnum = 0; charnum < sizeof(symname) - 1 && str < colon; str++)
if (!isspace(*str))
symname[charnum++] = tolower(*str);
symname[charnum] = 0;
/* add the symbol to the table */
symtable_add_register(info->symtable, symname, (void *)(FPTR)regnum, get_cpu_reg, set_cpu_reg);
}
/* add the symbol to the table */
symtable_add_register(info->symtable, symname, (void *)(FPTR)regnum, get_cpu_reg, set_cpu_reg);
}
}
/* first CPU is visible by default */
global->visiblecpu = machine->cpu[0];
@ -271,18 +270,17 @@ void debug_cpu_init(running_machine *machine)
void debug_cpu_flush_traces(running_machine *machine)
{
int cpunum;
const device_config *cpu;
for (cpunum = 0; cpunum < ARRAY_LENGTH(machine->cpu); cpunum++)
if (machine->cpu[cpunum] != NULL)
{
cpu_debug_data *info = cpu_get_debug_data(machine->cpu[cpunum]);
for (cpu = machine->cpu[0]; cpu != NULL; cpu = cpu->typenext)
{
cpu_debug_data *info = cpu_get_debug_data(cpu);
/* this can be called on exit even when no debugging is enabled, so
make sure the info is valid before proceeding */
if (info != NULL && info->trace.file != NULL)
fflush(info->trace.file);
}
/* this can be called on exit even when no debugging is enabled, so
make sure the info is valid before proceeding */
if (info != NULL && info->trace.file != NULL)
fflush(info->trace.file);
}
}
@ -923,34 +921,33 @@ int debug_cpu_breakpoint_set(const device_config *device, offs_t address, parsed
int debug_cpu_breakpoint_clear(running_machine *machine, int bpnum)
{
debug_cpu_breakpoint *bp, *pbp;
int cpunum;
const device_config *cpu;
/* loop over CPUs and find the requested breakpoint */
for (cpunum = 0; cpunum < ARRAY_LENGTH(machine->cpu); cpunum++)
if (machine->cpu[cpunum] != NULL)
{
cpu_debug_data *info = cpu_get_debug_data(machine->cpu[cpunum]);
for (pbp = NULL, bp = info->bplist; bp != NULL; pbp = bp, bp = bp->next)
if (bp->index == bpnum)
{
/* unlink us from the list */
if (pbp == NULL)
info->bplist = bp->next;
else
pbp->next = bp->next;
for (cpu = machine->cpu[0]; cpu != NULL; cpu = cpu->typenext)
{
cpu_debug_data *info = cpu_get_debug_data(cpu);
for (pbp = NULL, bp = info->bplist; bp != NULL; pbp = bp, bp = bp->next)
if (bp->index == bpnum)
{
/* unlink us from the list */
if (pbp == NULL)
info->bplist = bp->next;
else
pbp->next = bp->next;
/* free the memory */
if (bp->condition != NULL)
expression_free(bp->condition);
if (bp->action != NULL)
free(bp->action);
free(bp);
/* free the memory */
if (bp->condition != NULL)
expression_free(bp->condition);
if (bp->action != NULL)
free(bp->action);
free(bp);
/* update the flags */
breakpoint_update_flags(info);
return TRUE;
}
}
/* update the flags */
breakpoint_update_flags(info);
return TRUE;
}
}
/* we didn't find it; return an error */
return FALSE;
@ -965,21 +962,20 @@ int debug_cpu_breakpoint_clear(running_machine *machine, int bpnum)
int debug_cpu_breakpoint_enable(running_machine *machine, int bpnum, int enable)
{
debug_cpu_breakpoint *bp;
int cpunum;
const device_config *cpu;
/* loop over CPUs and find the requested breakpoint */
for (cpunum = 0; cpunum < ARRAY_LENGTH(machine->cpu); cpunum++)
if (machine->cpu[cpunum] != NULL)
{
cpu_debug_data *info = cpu_get_debug_data(machine->cpu[cpunum]);
for (bp = info->bplist; bp != NULL; bp = bp->next)
if (bp->index == bpnum)
{
bp->enabled = (enable != 0);
breakpoint_update_flags(info);
return TRUE;
}
}
for (cpu = machine->cpu[0]; cpu != NULL; cpu = cpu->typenext)
{
cpu_debug_data *info = cpu_get_debug_data(cpu);
for (bp = info->bplist; bp != NULL; bp = bp->next)
if (bp->index == bpnum)
{
bp->enabled = (enable != 0);
breakpoint_update_flags(info);
return TRUE;
}
}
return FALSE;
}
@ -1033,34 +1029,34 @@ int debug_cpu_watchpoint_set(const address_space *space, int type, offs_t addres
int debug_cpu_watchpoint_clear(running_machine *machine, int wpnum)
{
debug_cpu_watchpoint *wp, *pwp;
int cpunum, spacenum;
const device_config *cpu;
int spacenum;
/* loop over CPUs and find the requested watchpoint */
for (cpunum = 0; cpunum < ARRAY_LENGTH(machine->cpu); cpunum++)
if (machine->cpu[cpunum] != NULL)
{
cpu_debug_data *info = cpu_get_debug_data(machine->cpu[cpunum]);
for (cpu = machine->cpu[0]; cpu != NULL; cpu = cpu->typenext)
{
cpu_debug_data *info = cpu_get_debug_data(cpu);
for (spacenum = 0; spacenum < ADDRESS_SPACES; spacenum++)
for (pwp = NULL, wp = info->wplist[spacenum]; wp != NULL; pwp = wp, wp = wp->next)
if (wp->index == wpnum)
{
/* unlink us from the list */
if (pwp == NULL)
info->wplist[spacenum] = wp->next;
else
pwp->next = wp->next;
for (spacenum = 0; spacenum < ADDRESS_SPACES; spacenum++)
for (pwp = NULL, wp = info->wplist[spacenum]; wp != NULL; pwp = wp, wp = wp->next)
if (wp->index == wpnum)
{
/* unlink us from the list */
if (pwp == NULL)
info->wplist[spacenum] = wp->next;
else
pwp->next = wp->next;
/* free the memory */
if (wp->condition != NULL)
expression_free(wp->condition);
if (wp->action != NULL)
free(wp->action);
free(wp);
/* free the memory */
if (wp->condition != NULL)
expression_free(wp->condition);
if (wp->action != NULL)
free(wp->action);
free(wp);
watchpoint_update_flags(cpu_get_address_space(machine->cpu[cpunum], spacenum));
return TRUE;
}
watchpoint_update_flags(cpu_get_address_space(cpu, spacenum));
return TRUE;
}
}
/* we didn't find it; return an error */
@ -1076,23 +1072,23 @@ int debug_cpu_watchpoint_clear(running_machine *machine, int wpnum)
int debug_cpu_watchpoint_enable(running_machine *machine, int wpnum, int enable)
{
debug_cpu_watchpoint *wp;
int cpunum, spacenum;
const device_config *cpu;
int spacenum;
/* loop over CPUs and address spaces and find the requested watchpoint */
for (cpunum = 0; cpunum < ARRAY_LENGTH(machine->cpu); cpunum++)
if (machine->cpu[cpunum] != NULL)
{
cpu_debug_data *info = cpu_get_debug_data(machine->cpu[cpunum]);
for (cpu = machine->cpu[0]; cpu != NULL; cpu = cpu->typenext)
{
cpu_debug_data *info = cpu_get_debug_data(cpu);
for (spacenum = 0; spacenum < ADDRESS_SPACES; spacenum++)
for (wp = info->wplist[spacenum]; wp != NULL; wp = wp->next)
if (wp->index == wpnum)
{
wp->enabled = (enable != 0);
watchpoint_update_flags(cpu_get_address_space(machine->cpu[cpunum], spacenum));
return TRUE;
}
}
for (spacenum = 0; spacenum < ADDRESS_SPACES; spacenum++)
for (wp = info->wplist[spacenum]; wp != NULL; wp = wp->next)
if (wp->index == wpnum)
{
wp->enabled = (enable != 0);
watchpoint_update_flags(cpu_get_address_space(cpu, spacenum));
return TRUE;
}
}
return FALSE;
}
@ -1770,36 +1766,36 @@ UINT64 debug_read_opcode(const address_space *space, offs_t address, int size, i
static void debug_cpu_exit(running_machine *machine)
{
debugcpu_private *global = machine->debugcpu_data;
int cpunum, spacenum;
const device_config *cpu;
int spacenum;
/* loop over all watchpoints and breakpoints to free their memory */
for (cpunum = 0; cpunum < ARRAY_LENGTH(machine->cpu); cpunum++)
if (machine->cpu[cpunum] != NULL)
for (cpu = machine->cpu[0]; cpu != NULL; cpu = cpu->typenext)
{
cpu_debug_data *info = cpu_get_debug_data(cpu);
/* close any tracefiles */
if (info->trace.file != NULL)
fclose(info->trace.file);
if (info->trace.action != NULL)
free(info->trace.action);
/* free the symbol table */
if (info->symtable != NULL)
symtable_free(info->symtable);
/* free all breakpoints */
while (info->bplist != NULL)
debug_cpu_breakpoint_clear(machine, info->bplist->index);
/* loop over all address spaces */
for (spacenum = 0; spacenum < ARRAY_LENGTH(info->wplist); spacenum++)
{
cpu_debug_data *info = cpu_get_debug_data(machine->cpu[cpunum]);
/* close any tracefiles */
if (info->trace.file != NULL)
fclose(info->trace.file);
if (info->trace.action != NULL)
free(info->trace.action);
/* free the symbol table */
if (info->symtable != NULL)
symtable_free(info->symtable);
/* free all breakpoints */
while (info->bplist != NULL)
debug_cpu_breakpoint_clear(machine, info->bplist->index);
/* loop over all address spaces */
for (spacenum = 0; spacenum < ARRAY_LENGTH(info->wplist); spacenum++)
{
/* free all watchpoints */
while (info->wplist[spacenum] != NULL)
debug_cpu_watchpoint_clear(machine, info->wplist[spacenum]->index);
}
/* free all watchpoints */
while (info->wplist[spacenum] != NULL)
debug_cpu_watchpoint_clear(machine, info->wplist[spacenum]->index);
}
}
/* free the global symbol table */
if (global != NULL && global->symtable != NULL)
@ -1826,12 +1822,11 @@ static void on_vblank(const device_config *device, void *param, int vblank_state
static void reset_transient_flags(running_machine *machine)
{
int cpunum;
const device_config *cpu;
/* loop over CPUs and reset the transient flags */
for (cpunum = 0; cpunum < ARRAY_LENGTH(machine->cpu); cpunum++)
if (machine->cpu[cpunum] != NULL)
cpu_get_debug_data(machine->cpu[cpunum])->flags &= ~DEBUG_FLAG_TRANSIENT;
for (cpu = machine->cpu[0]; cpu != NULL; cpu = cpu->typenext)
cpu_get_debug_data(cpu)->flags &= ~DEBUG_FLAG_TRANSIENT;
}

View File

@ -78,7 +78,7 @@ static const help_item static_help_list[] =
"\n"
" help [<topic>] -- get help on a particular topic\n"
" do <expression> -- evaluates the given expression\n"
" symlist [<cpunum>] -- lists registered symbols\n"
" symlist [<cpu>] -- lists registered symbols\n"
" softreset -- executes a soft reset\n"
" hardreset -- executes a hard reset\n"
" print <item>[,...] -- prints one or more <item>s to the console\n"
@ -95,16 +95,16 @@ static const help_item static_help_list[] =
"Memory Commands\n"
"Type help <command> for further details on each command\n"
"\n"
" dasm <filename>,<address>,<length>[,<opcodes>[,<cpunum>]] -- disassemble to the given file\n"
" dasm <filename>,<address>,<length>[,<opcodes>[,<cpu>]] -- disassemble to the given file\n"
" f[ind] <address>,<length>[,<data>[,...]] -- search program memory for data\n"
" f[ind]d <address>,<length>[,<data>[,...]] -- search data memory for data\n"
" f[ind]i <address>,<length>[,<data>[,...]] -- search I/O memory for data\n"
" dump <filename>,<address>,<length>[,<size>[,<ascii>[,<cpunum>]]] -- dump program memory as text\n"
" dumpd <filename>,<address>,<length>[,<size>[,<ascii>[,<cpunum>]]] -- dump data memory as text\n"
" dumpi <filename>,<address>,<length>[,<size>[,<ascii>[,<cpunum>]]] -- dump I/O memory as text\n"
" save <filename>,<address>,<length>[,<cpunum>] -- save binary program memory to the given file\n"
" saved <filename>,<address>,<length>[,<cpunum>] -- save binary data memory to the given file\n"
" savei <filename>,<address>,<length>[,<cpunum>] -- save binary I/O memory to the given file\n"
" dump <filename>,<address>,<length>[,<size>[,<ascii>[,<cpu>]]] -- dump program memory as text\n"
" dumpd <filename>,<address>,<length>[,<size>[,<ascii>[,<cpu>]]] -- dump data memory as text\n"
" dumpi <filename>,<address>,<length>[,<size>[,<ascii>[,<cpu>]]] -- dump I/O memory as text\n"
" save <filename>,<address>,<length>[,<cpu>] -- save binary program memory to the given file\n"
" saved <filename>,<address>,<length>[,<cpu>] -- save binary data memory to the given file\n"
" savei <filename>,<address>,<length>[,<cpu>] -- save binary I/O memory to the given file\n"
" map <address> -- map logical program address to physical address and bank\n"
" mapd <address> -- map logical data address to physical address and bank\n"
" mapi <address> -- map logical I/O address to physical address and bank\n"
@ -124,11 +124,11 @@ static const help_item static_help_list[] =
" gt[ime] <milliseconds> -- resumes execution until the given delay has elapsed\n"
" gv[blank] -- resumes execution, setting temp breakpoint on the next VBLANK (F8)\n"
" n[ext] -- executes until the next CPU switch (F6)\n"
" focus <cpunum> -- focuses debugger only on <cpunum>\n"
" ignore [<cpunum>[,<cpunum>[,...]]] -- stops debugging on <cpunum>\n"
" observe [<cpunum>[,<cpunum>[,...]]] -- resumes debugging on <cpunum>\n"
" trace {<filename>|OFF}[,<cpunum>[,<action>]] -- trace the given CPU to a file (defaults to active CPU)\n"
" traceover {<filename>|OFF}[,<cpunum>[,<action>]] -- trace the given CPU to a file, but skip subroutines (defaults to active CPU)\n"
" focus <cpu> -- focuses debugger only on <cpu>\n"
" ignore [<cpu>[,<cpu>[,...]]] -- stops debugging on <cpu>\n"
" observe [<cpu>[,<cpu>[,...]]] -- resumes debugging on <cpu>\n"
" trace {<filename>|OFF}[,<cpu>[,<action>]] -- trace the given CPU to a file (defaults to active CPU)\n"
" traceover {<filename>|OFF}[,<cpu>[,<action>]] -- trace the given CPU to a file, but skip subroutines (defaults to active CPU)\n"
" traceflush -- flushes all open trace files\n"
},
{
@ -156,7 +156,7 @@ static const help_item static_help_list[] =
" wpdisable [<wpnum>] -- disables a given watchpoint or all if no <wpnum> specified\n"
" wpenable [<wpnum>] -- enables a given watchpoint or all if no <wpnum> specified\n"
" wplist -- lists all the watchpoints\n"
" hotspot [<cpunum>,[<depth>[,<hits>]]] -- attempt to find hotspots\n"
" hotspot [<cpu>,[<depth>[,<hits>]]] -- attempt to find hotspots\n"
},
{
"expressions",
@ -219,10 +219,10 @@ static const help_item static_help_list[] =
{
"symlist",
"\n"
" symlist [<cpunum>]\n"
" symlist [<cpu>]\n"
"\n"
"Lists registered symbols. If <cpunum> is not specified, then symbols in the global symbol table are "
"displayed; otherwise, the symbols for <cpunum>'s specific CPU are displayed. Symbols are listed "
"Lists registered symbols. If <cpu> is not specified, then symbols in the global symbol table are "
"displayed; otherwise, the symbols for <cpu>'s specific CPU are displayed. Symbols are listed "
"alphabetically. Read-only symbols are flagged with an asterisk.\n"
"\n"
"Examples:\n"
@ -377,14 +377,14 @@ static const help_item static_help_list[] =
{
"dasm",
"\n"
" dasm <filename>,<address>,<length>[,<opcodes>[,<cpunum>]]\n"
" dasm <filename>,<address>,<length>[,<opcodes>[,<cpu>]]\n"
"\n"
"The dasm command disassembles program memory to the file specified in the <filename> parameter. "
"<address> indicates the address of the start of disassembly, and <length> indicates how much "
"memory to disassemble. The range <address> through <address>+<length>-1 inclusive will be "
"output to the file. By default, the raw opcode data is output with each line. The optional "
"<opcodes> parameter can be used to enable (1) or disable(0) this feature. Finally, you can "
"disassemble code from another CPU by specifying the <cpunum> parameter.\n"
"disassemble code from another CPU by specifying the <cpu> parameter.\n"
"\n"
"Examples:\n"
"\n"
@ -431,7 +431,7 @@ static const help_item static_help_list[] =
{
"dump",
"\n"
" dump[{d|i}] <filename>,<address>,<length>[,<size>[,<ascii>[,<cpunum>]]]\n"
" dump[{d|i}] <filename>,<address>,<length>[,<size>[,<ascii>[,<cpu>]]]\n"
"\n"
"The dump/dumpd/dumpi commands dump memory to the text file specified in the <filename> "
"parameter. 'dump' will dump program space memory, while 'dumpd' will dump data space memory "
@ -442,7 +442,7 @@ static const help_item static_help_list[] =
"<size> parameter, which can be used to group the data in 1, 2, 4 or 8-byte chunks. The optional "
"<ascii> parameter can be used to enable (1) or disable (0) the output of ASCII characters to the "
"right of each line; by default, this is enabled. Finally, you can dump memory from another CPU "
"by specifying the <cpunum> parameter.\n"
"by specifying the <cpu> parameter.\n"
"\n"
"Examples:\n"
"\n"
@ -457,14 +457,14 @@ static const help_item static_help_list[] =
{
"save",
"\n"
" save[{d|i}] <filename>,<address>,<length>[,<cpunum>]\n"
" save[{d|i}] <filename>,<address>,<length>[,<cpu>]\n"
"\n"
"The save/saved/savei commands save raw memory to the binary file specified in the <filename> "
"parameter. 'save' will save program space memory, while 'saved' will save data space memory "
"and 'savei' will save I/O space memory. <address> indicates the address of the start of saving, "
"and <length> indicates how much memory to save. The range <address> through <address>+<length>-1 "
"inclusive will be output to the file. You can also save memory from another CPU by specifying the "
"<cpunum> parameter.\n"
"<cpu> parameter.\n"
"\n"
"Examples:\n"
"\n"
@ -610,9 +610,9 @@ static const help_item static_help_list[] =
{
"focus",
"\n"
" focus <cpunum>\n"
" focus <cpu>\n"
"\n"
"Sets the debugger focus exclusively to the given <cpunum>. This is equivalent to specifying "
"Sets the debugger focus exclusively to the given <cpu>. This is equivalent to specifying "
"'ignore' on all other CPUs.\n"
"\n"
"Examples:\n"
@ -623,11 +623,11 @@ static const help_item static_help_list[] =
{
"ignore",
"\n"
" ignore [<cpunum>[,<cpunum>[,...]]]\n"
" ignore [<cpu>[,<cpu>[,...]]]\n"
"\n"
"Ignores the specified <cpunum> in the debugger. This means that you won't ever see execution "
"Ignores the specified <cpu> in the debugger. This means that you won't ever see execution "
"on that CPU, nor will you be able to set breakpoints on that CPU. To undo this change use "
"the 'observe' command. You can specify multiple <cpunum>s in a single command. Note also that "
"the 'observe' command. You can specify multiple <cpu>s in a single command. Note also that "
"you are not permitted to ignore all CPUs; at least one must be active at all times.\n"
"\n"
"Examples:\n"
@ -644,10 +644,10 @@ static const help_item static_help_list[] =
{
"observe",
"\n"
" observe [<cpunum>[,<cpunum>[,...]]]\n"
" observe [<cpu>[,<cpu>[,...]]]\n"
"\n"
"Re-enables interaction with the specified <cpunum> in the debugger. This command undoes the "
"effects of the 'ignore' command. You can specify multiple <cpunum>s in a single command.\n"
"Re-enables interaction with the specified <cpu> in the debugger. This command undoes the "
"effects of the 'ignore' command. You can specify multiple <cpu>s in a single command.\n"
"\n"
"Examples:\n"
"\n"
@ -663,9 +663,9 @@ static const help_item static_help_list[] =
{
"trace",
"\n"
" trace {<filename>|OFF}[,<cpunum>[,<action>]]\n"
" trace {<filename>|OFF}[,<cpu>[,<action>]]\n"
"\n"
"Starts or stops tracing of the execution of the specified <cpunum>. If <cpunum> is omitted, "
"Starts or stops tracing of the execution of the specified <cpu>. If <cpu> is omitted, "
"the currently active CPU is specified. When enabling tracing, specify the filename in the "
"<filename> parameter. To disable tracing, substitute the keyword 'off' for <filename>. If you "
"wish to log additional information on each trace, you can append an <action> parameter which "
@ -695,13 +695,13 @@ static const help_item static_help_list[] =
{
"traceover",
"\n"
" traceover {<filename>|OFF}[,<cpunum>[,<action>]]\n"
" traceover {<filename>|OFF}[,<cpu>[,<action>]]\n"
"\n"
"Starts or stops tracing of the execution of the specified <cpunum>. When tracing reaches "
"Starts or stops tracing of the execution of the specified <cpu>. When tracing reaches "
"a subroutine or call, tracing will skip over the subroutine. The same algorithm is used as is "
"used in the step over command. This means that traceover will not work properly when calls "
"are recusive or the return address is not immediately following the call instruction. If "
"<cpunum> is omitted, the currently active CPU is specified. When enabling tracing, specify the "
"<cpu> is omitted, the currently active CPU is specified. When enabling tracing, specify the "
"filename in the <filename> parameter. To disable tracing, substitute the keyword 'off' for "
"<filename>. If you wish to log additional information on each trace, you can append an <action> "
"parameter which is a command that is executed before each trace is logged. Generally, this is "
@ -929,10 +929,10 @@ static const help_item static_help_list[] =
{
"hotspot",
"\n"
" hotspot [<cpunum>,[<depth>[,<hits>]]]\n"
" hotspot [<cpu>,[<depth>[,<hits>]]]\n"
"\n"
"The hotspot command attempts to help locate hotspots in the code where speedup opportunities "
"might be present. <cpunum>, which defaults to the currently active CPU, specified which "
"might be present. <cpu>, which defaults to the currently active CPU, specified which "
"processor's memory to track. <depth>, which defaults to 64, controls the depth of the search "
"buffer. The search buffer tracks the last <depth> memory reads from unique PCs. The <hits> "
"parameter, which defaults to 250, specifies the minimum number of hits to report.\n"

View File

@ -1043,31 +1043,29 @@ static const registers_subview_item *registers_view_enumerate_subviews(running_m
astring *tempstring = astring_alloc();
registers_subview_item *head = NULL;
registers_subview_item **tailptr = &head;
const device_config *cpu;
int curindex = 0;
int cpunum;
/* iterate over CPUs with program address spaces */
for (cpunum = 0; cpunum < ARRAY_LENGTH(machine->cpu); cpunum++)
if (machine->cpu[cpunum] != NULL)
{
const device_config *device = machine->cpu[cpunum];
registers_subview_item *subview;
for (cpu = machine->cpu[0]; cpu != NULL; cpu = cpu->typenext)
{
registers_subview_item *subview;
/* determine the string and allocate a subview large enough */
astring_printf(tempstring, "CPU '%s' (%s)", device->tag, cpu_get_name(device));
subview = auto_malloc(sizeof(*subview) + astring_len(tempstring));
memset(subview, 0, sizeof(*subview));
/* determine the string and allocate a subview large enough */
astring_printf(tempstring, "CPU '%s' (%s)", cpu->tag, cpu_get_name(cpu));
subview = auto_malloc(sizeof(*subview) + astring_len(tempstring));
memset(subview, 0, sizeof(*subview));
/* populate the subview */
subview->next = NULL;
subview->index = curindex++;
subview->device = device;
strcpy(subview->name, astring_c(tempstring));
/* populate the subview */
subview->next = NULL;
subview->index = curindex++;
subview->device = cpu;
strcpy(subview->name, astring_c(tempstring));
/* add to the list */
*tailptr = subview;
tailptr = &subview->next;
}
/* add to the list */
*tailptr = subview;
tailptr = &subview->next;
}
/* free the temporary string */
astring_free(tempstring);
@ -1488,34 +1486,33 @@ static const disasm_subview_item *disasm_view_enumerate_subviews(running_machine
astring *tempstring = astring_alloc();
disasm_subview_item *head = NULL;
disasm_subview_item **tailptr = &head;
const device_config *cpu;
int curindex = 0;
int cpunum;
/* iterate over CPUs with program address spaces */
for (cpunum = 0; cpunum < ARRAY_LENGTH(machine->cpu); cpunum++)
if (machine->cpu[cpunum] != NULL)
for (cpu = machine->cpu[0]; cpu != NULL; cpu = cpu->typenext)
{
const address_space *space = cpu_get_address_space(cpu, ADDRESS_SPACE_PROGRAM);
if (space != NULL)
{
const address_space *space = cpu_get_address_space(machine->cpu[cpunum], ADDRESS_SPACE_PROGRAM);
if (space != NULL)
{
disasm_subview_item *subview;
disasm_subview_item *subview;
/* determine the string and allocate a subview large enough */
astring_printf(tempstring, "CPU '%s' (%s)", space->cpu->tag, cpu_get_name(space->cpu));
subview = auto_malloc(sizeof(*subview) + astring_len(tempstring));
memset(subview, 0, sizeof(*subview));
/* determine the string and allocate a subview large enough */
astring_printf(tempstring, "CPU '%s' (%s)", cpu->tag, cpu_get_name(cpu));
subview = auto_malloc(sizeof(*subview) + astring_len(tempstring));
memset(subview, 0, sizeof(*subview));
/* populate the subview */
subview->next = NULL;
subview->index = curindex++;
subview->space = space;
strcpy(subview->name, astring_c(tempstring));
/* populate the subview */
subview->next = NULL;
subview->index = curindex++;
subview->space = space;
strcpy(subview->name, astring_c(tempstring));
/* add to the list */
*tailptr = subview;
tailptr = &subview->next;
}
/* add to the list */
*tailptr = subview;
tailptr = &subview->next;
}
}
/* free the temporary string */
astring_free(tempstring);
@ -1532,7 +1529,7 @@ static int disasm_view_alloc(debug_view *view)
{
debug_view_disasm *dasmdata;
int total_comments = 0;
int cpunum;
const device_config *cpu;
/* fail if no available subviews */
if (view->machine->debugvw_data->disasm_subviews == NULL)
@ -1551,9 +1548,8 @@ static int disasm_view_alloc(debug_view *view)
debug_view_expression_alloc(&dasmdata->expression);
/* count the number of comments */
for (cpunum = 0; cpunum < ARRAY_LENGTH(view->machine->cpu); cpunum++)
if (view->machine->cpu[cpunum] != NULL)
total_comments += debug_comment_get_count(view->machine->cpu[cpunum]);
for (cpu = view->machine->cpu[0]; cpu != NULL; cpu = cpu->typenext)
total_comments += debug_comment_get_count(cpu);
/* initialize */
dasmdata->right_column = (total_comments > 0) ? DASM_RIGHTCOL_COMMENTS : DASM_RIGHTCOL_RAW;
@ -2406,39 +2402,39 @@ static const memory_subview_item *memory_view_enumerate_subviews(running_machine
astring *tempstring = astring_alloc();
memory_subview_item *head = NULL;
memory_subview_item **tailptr = &head;
int cpunum, spacenum;
const device_config *cpu;
int spacenum;
const char *rgntag;
int curindex = 0;
int itemnum;
/* first add all the CPUs' address spaces */
for (cpunum = 0; cpunum < ARRAY_LENGTH(machine->cpu); cpunum++)
if (machine->cpu[cpunum] != NULL)
for (spacenum = 0; spacenum < ADDRESS_SPACES; spacenum++)
for (cpu = machine->cpu[0]; cpu != NULL; cpu = cpu->typenext)
for (spacenum = 0; spacenum < ADDRESS_SPACES; spacenum++)
{
const address_space *space = cpu_get_address_space(cpu, spacenum);
if (space != NULL)
{
const address_space *space = cpu_get_address_space(machine->cpu[cpunum], spacenum);
if (space != NULL)
{
memory_subview_item *subview;
memory_subview_item *subview;
/* determine the string and allocate a subview large enough */
astring_printf(tempstring, "CPU '%s' (%s) %s memory", space->cpu->tag, cpu_get_name(space->cpu), space->name);
subview = auto_malloc(sizeof(*subview) + astring_len(tempstring));
memset(subview, 0, sizeof(*subview));
/* determine the string and allocate a subview large enough */
astring_printf(tempstring, "CPU '%s' (%s) %s memory", cpu->tag, cpu_get_name(cpu), space->name);
subview = auto_malloc(sizeof(*subview) + astring_len(tempstring));
memset(subview, 0, sizeof(*subview));
/* populate the subview */
subview->next = NULL;
subview->index = curindex++;
subview->space = space;
subview->endianness = space->endianness;
subview->prefsize = space->dbits / 8;
strcpy(subview->name, astring_c(tempstring));
/* populate the subview */
subview->next = NULL;
subview->index = curindex++;
subview->space = space;
subview->endianness = space->endianness;
subview->prefsize = space->dbits / 8;
strcpy(subview->name, astring_c(tempstring));
/* add to the list */
*tailptr = subview;
tailptr = &subview->next;
}
}
/* add to the list */
*tailptr = subview;
tailptr = &subview->next;
}
}
/* then add all the memory regions */
for (rgntag = memory_region_next(machine, NULL); rgntag != NULL; rgntag = memory_region_next(machine, rgntag))

View File

@ -49,8 +49,9 @@ extern running_machine *Machine;
*************************************/
#define MDRV_CPU_VBLANK_INT_HACK(_func, _rate) \
TOKEN_UINT32_PACK2(MCONFIG_TOKEN_CPU_VBLANK_INT_HACK, 8, _rate, 24), \
TOKEN_PTR(interrupt, _func),
MDRV_DEVICE_CONFIG_DATAPTR(cpu_config, vblank_interrupt, _func) \
MDRV_DEVICE_CONFIG_DATAPTR(cpu_config, vblank_interrupt_screen, NULL) \
MDRV_DEVICE_CONFIG_DATA32(cpu_config, vblank_interrupts_per_frame, _rate)

View File

@ -82,10 +82,9 @@ INLINE int device_matches_type(const device_config *device, device_type type)
device_config *device_list_add(device_config **listheadptr, device_type type, const char *tag)
{
device_config **devptr;
device_config *device;
device_config **devptr, **typedevptr;
device_config *device, *typedevice;
UINT32 configlen;
deviceinfo info;
assert(listheadptr != NULL);
assert(type != NULL);
@ -104,6 +103,7 @@ device_config *device_list_add(device_config **listheadptr, device_type type, co
/* populate all fields */
device->next = NULL;
device->typenext = NULL;
device->type = type;
device->class = devtype_get_info_int(type, DEVINFO_INT_CLASS);
device->static_config = NULL;
@ -120,25 +120,12 @@ device_config *device_list_add(device_config **listheadptr, device_type type, co
memset(device->inline_config, 0, configlen);
/* fetch function pointers to the core functions */
info.set_info = NULL;
(*type)(NULL, DEVINFO_FCT_SET_INFO, &info);
device->set_info = info.set_info;
device->set_info = (device_set_info_func)devtype_get_info_fct(type, DEVINFO_FCT_SET_INFO);
info.start = NULL;
(*type)(NULL, DEVINFO_FCT_START, &info);
device->start = info.start;
info.stop = NULL;
(*type)(NULL, DEVINFO_FCT_STOP, &info);
device->stop = info.stop;
info.reset = NULL;
(*type)(NULL, DEVINFO_FCT_RESET, &info);
device->reset = info.reset;
info.nvram = NULL;
(*type)(NULL, DEVINFO_FCT_NVRAM, &info);
device->nvram = info.nvram;
/* before adding us to the global list, add us to the end of the class list */
typedevice = (device_config *)device_list_first(*listheadptr, type);
for (typedevptr = &typedevice; *typedevptr != NULL; typedevptr = &(*typedevptr)->typenext) ;
*typedevptr = device;
/* link us to the end and return */
*devptr = device;
@ -153,8 +140,8 @@ device_config *device_list_add(device_config **listheadptr, device_type type, co
void device_list_remove(device_config **listheadptr, device_type type, const char *tag)
{
device_config **devptr;
device_config *device;
device_config **devptr, **typedevptr;
device_config *device, *typedevice;
assert(listheadptr != NULL);
assert(type != NULL);
@ -164,11 +151,17 @@ void device_list_remove(device_config **listheadptr, device_type type, const cha
for (devptr = listheadptr; *devptr != NULL; devptr = &(*devptr)->next)
if (type == (*devptr)->type && strcmp(tag, (*devptr)->tag) == 0)
break;
if (*devptr == NULL)
device = *devptr;
if (device == NULL)
fatalerror("Attempted to remove non-existant device: type=%s tag=%s\n", devtype_get_name(type), tag);
/* before removing us from the global list, remove us from the type list */
typedevice = (device_config *)device_list_first(*listheadptr, type);
for (typedevptr = &typedevice; *typedevptr != device; typedevptr = &(*typedevptr)->typenext) ;
assert(*typedevptr == device);
*typedevptr = device->typenext;
/* remove the device from the list */
device = *devptr;
*devptr = device->next;
/* free the device object */
@ -267,16 +260,8 @@ const device_config *device_list_first(const device_config *listhead, device_typ
const device_config *device_list_next(const device_config *prevdevice, device_type type)
{
const device_config *curdev;
assert(prevdevice != NULL);
/* scan forward starting with the item after the previous one */
for (curdev = prevdevice->next; curdev != NULL; curdev = curdev->next)
if (device_matches_type(curdev, type))
return curdev;
return NULL;
return (type == DEVICE_TYPE_WILDCARD) ? prevdevice->next : prevdevice->typenext;
}
@ -484,6 +469,23 @@ const device_config *device_list_class_find_by_index(const device_config *listhe
LIVE DEVICE MANAGEMENT
***************************************************************************/
/*-------------------------------------------------
device_list_attach_machine - "attach" a
running_machine to its list of devices
-------------------------------------------------*/
void device_list_attach_machine(running_machine *machine)
{
device_config *device;
assert(machine != NULL);
/* iterate over devices and assign the machine to them */
for (device = (device_config *)machine->config->devicelist; device != NULL; device = device->next)
device->machine = machine;
}
/*-------------------------------------------------
device_list_start - start the configured list
of devices for a machine
@ -504,23 +506,24 @@ void device_list_start(running_machine *machine)
/* iterate over devices and allocate memory for them */
for (device = (device_config *)machine->config->devicelist; device != NULL; device = device->next)
{
UINT32 tokenlen;
deviceinfo info = { 0 };
assert(!device->started);
assert(device->machine == machine);
assert(device->token == NULL);
assert(device->type != NULL);
assert(device->start != NULL);
devcount++;
/* get the size of the token data */
tokenlen = (UINT32)devtype_get_info_int(device->type, DEVINFO_INT_TOKEN_BYTES);
if (tokenlen == 0)
fatalerror("Device %s specifies a 0 token length!\n", devtype_get_name(device->type));
/* get the size of the token data; we do it directly because we can't call device_get_info_* with no token */
(*device->type)(device, DEVINFO_INT_TOKEN_BYTES, &info);
device->tokenbytes = (UINT32)info.i;
if (device->tokenbytes == 0)
fatalerror("Device %s specifies a 0 token length!\n", device_get_name(device));
/* allocate memory for the token */
device->token = malloc_or_die(tokenlen);
memset(device->token, 0, tokenlen);
device->token = malloc_or_die(device->tokenbytes);
memset(device->token, 0, device->tokenbytes);
/* fill in the remaining runtime fields */
device->machine = machine;
@ -537,7 +540,10 @@ void device_list_start(running_machine *machine)
/* iterate over devices and start them */
for (device = (device_config *)machine->config->devicelist; device != NULL; device = device->next)
{
if (!device->started && (*device->start)(device) == DEVICE_START_OK)
device_start_func start = (device_start_func)device_get_info_fct(device, DEVINFO_FCT_START);
assert(start != NULL);
if (!device->started && (*start)(device) == DEVICE_START_OK)
device->started = TRUE;
numstarted += device->started;
}
@ -563,12 +569,14 @@ static void device_list_stop(running_machine *machine)
/* iterate over devices and stop them */
for (device = (device_config *)machine->config->devicelist; device != NULL; device = device->next)
{
device_stop_func stop = (device_stop_func)device_get_info_fct(device, DEVINFO_FCT_STOP);
assert(device->token != NULL);
assert(device->type != NULL);
/* if we have a stop function, call it */
if (device->stop != NULL)
(*device->stop)(device);
if (stop != NULL)
(*stop)(device);
/* free allocated memory for the token */
if (device->token != NULL)
@ -576,6 +584,7 @@ static void device_list_stop(running_machine *machine)
/* reset all runtime fields */
device->token = NULL;
device->tokenbytes = 0;
device->machine = NULL;
device->region = NULL;
device->regionbytes = 0;
@ -607,28 +616,16 @@ static void device_list_reset(running_machine *machine)
void device_reset(const device_config *device)
{
device_reset_func reset;
assert(device != NULL);
assert(device->token != NULL);
assert(device->type != NULL);
/* if we have a reset function, call it */
if (device->reset != NULL)
(*device->reset)(device);
}
void devtag_reset(running_machine *machine, device_type type, const char *tag)
{
const device_config *device;
assert(machine != NULL);
assert(type != NULL);
assert(tag != NULL);
device = device_list_find_by_tag(machine->config->devicelist, type, tag);
if (device == NULL)
fatalerror("devtag_reset failed to find device: type=%s tag=%s\n", devtype_get_name(type), tag);
device_reset(device);
reset = (device_reset_func)device_get_info_fct(device, DEVINFO_FCT_RESET);
if (reset != NULL)
(*reset)(device);
}
@ -637,88 +634,6 @@ void devtag_reset(running_machine *machine, device_type type, const char *tag)
DEVICE INFORMATION GETTERS
***************************************************************************/
/*-------------------------------------------------
devtag_get_token - return the token associated
with an allocated device
-------------------------------------------------*/
void *devtag_get_token(running_machine *machine, device_type type, const char *tag)
{
const device_config *device;
assert(machine != NULL);
assert(type != NULL);
assert(tag != NULL);
device = device_list_find_by_tag(machine->config->devicelist, type, tag);
if (device == NULL)
fatalerror("devtag_get_token failed to find device: type=%s tag=%s\n", devtype_get_name(type), tag);
return device->token;
}
/*-------------------------------------------------
devtag_get_device - return the device associated
with a tag
-------------------------------------------------*/
const device_config *devtag_get_device(running_machine *machine, device_type type, const char *tag)
{
const device_config *device;
assert(machine != NULL);
assert(type != NULL);
assert(tag != NULL);
device = device_list_find_by_tag(machine->config->devicelist, type, tag);
if (device == NULL)
fatalerror("devtag_get_device failed to find device: type=%s tag=%s\n", devtype_get_name(type), tag);
return device;
}
/*-------------------------------------------------
devtag_get_static_config - return a pointer to
the static configuration for a device based on
type and tag
-------------------------------------------------*/
const void *devtag_get_static_config(running_machine *machine, device_type type, const char *tag)
{
const device_config *device;
assert(machine != NULL);
assert(type != NULL);
assert(tag != NULL);
device = device_list_find_by_tag(machine->config->devicelist, type, tag);
if (device == NULL)
fatalerror("devtag_get_static_config failed to find device: type=%s tag=%s\n", devtype_get_name(type), tag);
return device->static_config;
}
/*-------------------------------------------------
devtag_get_inline_config - return a pointer to
the inline configuration for a device based on
type and tag
-------------------------------------------------*/
const void *devtag_get_inline_config(running_machine *machine, device_type type, const char *tag)
{
const device_config *device;
assert(machine != NULL);
assert(type != NULL);
assert(tag != NULL);
device = device_list_find_by_tag(machine->config->devicelist, type, tag);
if (device == NULL)
fatalerror("devtag_get_inline_config failed to find device: type=%s tag=%s\n", devtype_get_name(type), tag);
return device->inline_config;
}
/*-------------------------------------------------
device_get_info_int - return an integer state
value from an allocated device
@ -740,22 +655,6 @@ INT64 device_get_info_int(const device_config *device, UINT32 state)
}
INT64 devtag_get_info_int(running_machine *machine, device_type type, const char *tag, UINT32 state)
{
const device_config *device;
assert(machine != NULL);
assert(type != NULL);
assert(tag != NULL);
assert(state >= DEVINFO_INT_FIRST && state <= DEVINFO_INT_LAST);
device = device_list_find_by_tag(machine->config->devicelist, type, tag);
if (device == NULL)
fatalerror("devtag_get_info_int failed to find device: type=%s tag=%s\n", devtype_get_name(type), tag);
return device_get_info_int(device, state);
}
/*-------------------------------------------------
device_get_info_ptr - return a pointer state
value from an allocated device
@ -776,22 +675,6 @@ void *device_get_info_ptr(const device_config *device, UINT32 state)
}
void *devtag_get_info_ptr(running_machine *machine, device_type type, const char *tag, UINT32 state)
{
const device_config *device;
assert(machine != NULL);
assert(type != NULL);
assert(tag != NULL);
assert(state >= DEVINFO_INT_FIRST && state <= DEVINFO_INT_LAST);
device = device_list_find_by_tag(machine->config->devicelist, type, tag);
if (device == NULL)
fatalerror("devtag_get_info_ptr failed to find device: type=%s tag=%s\n", devtype_get_name(type), tag);
return device_get_info_ptr(device, state);
}
/*-------------------------------------------------
device_get_info_fct - return a function
pointer state value from an allocated device
@ -812,22 +695,6 @@ genf *device_get_info_fct(const device_config *device, UINT32 state)
}
genf *devtag_get_info_fct(running_machine *machine, device_type type, const char *tag, UINT32 state)
{
const device_config *device;
assert(machine != NULL);
assert(type != NULL);
assert(tag != NULL);
assert(state >= DEVINFO_INT_FIRST && state <= DEVINFO_INT_LAST);
device = device_list_find_by_tag(machine->config->devicelist, type, tag);
if (device == NULL)
fatalerror("device_get_info_fct failed to find device: type=%s tag=%s\n", devtype_get_name(type), tag);
return device_get_info_fct(device, state);
}
/*-------------------------------------------------
device_get_info_string - return a string value
from an allocated device
@ -848,22 +715,6 @@ const char *device_get_info_string(const device_config *device, UINT32 state)
}
const char *devtag_get_info_string(running_machine *machine, device_type type, const char *tag, UINT32 state)
{
const device_config *device;
assert(machine != NULL);
assert(type != NULL);
assert(tag != NULL);
assert(state >= DEVINFO_INT_FIRST && state <= DEVINFO_INT_LAST);
device = device_list_find_by_tag(machine->config->devicelist, type, tag);
if (device == NULL)
fatalerror("device_get_info_string failed to find device: type=%s tag=%s\n", devtype_get_name(type), tag);
return device_get_info_string(device, state);
}
/***************************************************************************
DEVICE TYPE INFORMATION SETTERS
@ -889,6 +740,26 @@ INT64 devtype_get_info_int(device_type type, UINT32 state)
}
/*-------------------------------------------------
devtype_get_info_int - return a function
pointer from a device type (does not need to
be allocated)
-------------------------------------------------*/
genf *devtype_get_info_fct(device_type type, UINT32 state)
{
deviceinfo info;
assert(type != NULL);
assert(state >= DEVINFO_FCT_FIRST && state <= DEVINFO_FCT_LAST);
/* retrieve the value */
info.f = 0;
(*type)(NULL, state, &info);
return info.f;
}
/*-------------------------------------------------
devtype_get_info_string - return a string value
from a device type (does not need to be
@ -934,22 +805,6 @@ void device_set_info_int(const device_config *device, UINT32 state, INT64 data)
}
void devtag_set_info_int(running_machine *machine, device_type type, const char *tag, UINT32 state, INT64 data)
{
const device_config *device;
assert(machine != NULL);
assert(type != NULL);
assert(tag != NULL);
assert(state >= DEVINFO_INT_FIRST && state <= DEVINFO_INT_LAST);
device = device_list_find_by_tag(machine->config->devicelist, type, tag);
if (device == NULL)
fatalerror("devtag_set_info_int failed to find device: type=%s tag=%s\n", devtype_get_name(type), tag);
device_set_info_int(device, state, data);
}
/*-------------------------------------------------
device_set_info_ptr - set a pointer state
value for an allocated device
@ -970,22 +825,6 @@ void device_set_info_ptr(const device_config *device, UINT32 state, void *data)
}
void devtag_set_info_ptr(running_machine *machine, device_type type, const char *tag, UINT32 state, void *data)
{
const device_config *device;
assert(machine != NULL);
assert(type != NULL);
assert(tag != NULL);
assert(state >= DEVINFO_INT_FIRST && state <= DEVINFO_INT_LAST);
device = device_list_find_by_tag(machine->config->devicelist, type, tag);
if (device == NULL)
fatalerror("devtag_set_info_ptr failed to find device: type=%s tag=%s\n", devtype_get_name(type), tag);
device_set_info_ptr(device, state, data);
}
/*-------------------------------------------------
device_set_info_fct - set a function pointer
state value for an allocated device
@ -1004,19 +843,3 @@ void device_set_info_fct(const device_config *device, UINT32 state, genf *data)
info.f = data;
(*device->set_info)(device, state, &info);
}
void devtag_set_info_fct(running_machine *machine, device_type type, const char *tag, UINT32 state, genf *data)
{
const device_config *device;
assert(machine != NULL);
assert(type != NULL);
assert(tag != NULL);
assert(state >= DEVINFO_INT_FIRST && state <= DEVINFO_INT_LAST);
device = device_list_find_by_tag(machine->config->devicelist, type, tag);
if (device == NULL)
fatalerror("devtag_set_info_fct failed to find device: type=%s tag=%s\n", devtype_get_name(type), tag);
device_set_info_fct(device, state, data);
}

View File

@ -137,6 +137,45 @@ enum
#define DEVICE_VALIDITY_CHECK_CALL(name) DEVICE_VALIDITY_CHECK(name)(driver, device)
/* shorthand for accessing devices by machine/type/tag */
#define devtag_get_device(mach,type,tag) device_list_find_by_tag((mach)->config->devicelist, type, tag)
#define devtag_reset(mach,type,tag) device_reset(devtag_get_device(mach, type, tag))
#define devtag_get_info_int(mach,type,tag,state) device_get_info_int(devtag_get_device(mach, type, tag), state)
#define devtag_get_info_ptr(mach,type,tag,state) device_get_info_ptr(devtag_get_device(mach, type, tag), state)
#define devtag_get_info_fct(mach,type,tag,state) device_get_info_fct(devtag_get_device(mach, type, tag), state)
#define devtag_get_info_string(mach,type,tag,state) device_get_info_string(devtag_get_device(mach, type, tag), state)
#define devtag_set_info_int(mach,type,tag,state,data) device_set_info_int(devtag_get_device(mach, type, tag), state, data)
#define devtag_set_info_ptr(mach,type,tag,state,data) device_set_info_ptr(devtag_get_device(mach, type, tag), state, data)
#define devtag_set_info_fct(mach,type,tag,state,data) device_set_info_fct(devtag_get_device(mach, type, tag), state, data)
/* shorthand for getting standard data about device types */
#define devtype_get_name(type) devtype_get_info_string(type, DEVINFO_STR_NAME)
#define devtype_get_family(type) devtype_get_info_string(type, DEVINFO_STR_FAMILY)
#define devtype_get_version(type) devtype_get_info_string(type, DEVINFO_STR_VERSION)
#define devtype_get_source_file(type) devtype_get_info_string(type, DEVINFO_STR_SOURCE_FILE)
#define devtype_get_credits(type) devtype_get_info_string(type, DEVINFO_STR_CREDITS)
/* shorthand for getting standard data about devices */
#define device_get_name(dev) device_get_info_string(dev, DEVINFO_STR_NAME)
#define device_get_family(dev) device_get_info_string(dev, DEVINFO_STR_FAMILY)
#define device_get_version(dev) device_get_info_string(dev, DEVINFO_STR_VERSION)
#define device_get_source_file(dev) device_get_info_string(dev, DEVINFO_STR_SOURCE_FILE)
#define device_get_credits(dev) device_get_info_string(dev, DEVINFO_STR_CREDITS)
/* shorthand for getting standard data about devices by machine/type/tag */
#define devtag_get_name(mach,type,tag) devtag_get_info_string(mach, type, tag, DEVINFO_STR_NAME)
#define devtag_get_family(mach,type,tag) devtag_get_info_string(mach, type, tag, DEVINFO_STR_FAMILY)
#define devtag_get_version(mach,type,tag) devtag_get_info_string(mach, type, tag, DEVINFO_STR_VERSION)
#define devtag_get_source_file(mach,type,tag) devtag_get_info_string(mach, type, tag, DEVINFO_STR_SOURCE_FILE)
#define devtag_get_credits(mach,type,tag) devtag_get_info_string(mach, type, tag, DEVINFO_STR_CREDITS)
/***************************************************************************
TYPE DEFINITIONS
@ -184,20 +223,17 @@ union _deviceinfo
struct _device_config
{
device_config * next; /* next device */
device_config * typenext; /* next device of the same type */
device_type type; /* device type */
device_class class; /* device class */
device_set_info_func set_info; /* quick pointer to set_info callback */
device_start_func start; /* quick pointer to start callback */
device_stop_func stop; /* quick pointer to stop callback */
device_reset_func reset; /* quick pointer to reset callback */
device_nvram_func nvram; /* quick pointer to nvram callback */
const void * static_config; /* static device configuration */
void * inline_config; /* inline device configuration */
/* these fields are only valid if the device is live */
UINT8 started; /* TRUE if the start function has succeeded */
void * token; /* token if device is live */
void * classtoken; /* class token if device is live */
UINT32 tokenbytes; /* size of the token data allocated */
running_machine * machine; /* machine if device is live */
UINT8 * region; /* pointer to region with the device's tag, or NULL */
UINT32 regionbytes; /* size of the region, in bytes */
@ -274,44 +310,30 @@ const device_config *device_list_class_find_by_index(const device_config *listhe
/* ----- live device management ----- */
/* "attach" a running_machine to its list of devices */
void device_list_attach_machine(running_machine *machine);
/* start the configured list of devices for a machine */
void device_list_start(running_machine *machine);
/* reset a device based on an allocated device_config */
void device_reset(const device_config *device);
void devtag_reset(running_machine *machine, device_type type, const char *tag);
/* ----- device information getters ----- */
/* return the device associated with a tag */
const device_config *devtag_get_device(running_machine *machine, device_type type, const char *tag);
/* return the token associated with an allocated device */
void *devtag_get_token(running_machine *machine, device_type type, const char *tag);
/* return a pointer to the static configuration for a device based on type and tag */
const void *devtag_get_static_config(running_machine *machine, device_type type, const char *tag);
/* return a pointer to the inline configuration for a device based on type and tag */
const void *devtag_get_inline_config(running_machine *machine, device_type type, const char *tag);
/* return an integer state value from an allocated device */
INT64 device_get_info_int(const device_config *device, UINT32 state);
INT64 devtag_get_info_int(running_machine *machine, device_type type, const char *tag, UINT32 state);
/* return a pointer state value from an allocated device */
void *device_get_info_ptr(const device_config *device, UINT32 state);
void *devtag_get_info_ptr(running_machine *machine, device_type type, const char *tag, UINT32 state);
/* return a function pointer state value from an allocated device */
genf *device_get_info_fct(const device_config *device, UINT32 state);
genf *devtag_get_info_fct(running_machine *machine, device_type type, const char *tag, UINT32 state);
/* return a string value from an allocated device */
const char *device_get_info_string(const device_config *device, UINT32 state);
const char *devtag_get_info_string(running_machine *machine, device_type type, const char *tag, UINT32 state);
@ -320,6 +342,9 @@ const char *devtag_get_info_string(running_machine *machine, device_type type, c
/* return an integer value from a device type (does not need to be allocated) */
INT64 devtype_get_info_int(device_type type, UINT32 state);
/* return a function pointer from a device type (does not need to be allocated) */
genf *devtype_get_info_fct(device_type type, UINT32 state);
/* return a string value from a device type (does not need to be allocated) */
const char *devtype_get_info_string(device_type type, UINT32 state);
@ -329,35 +354,12 @@ const char *devtype_get_info_string(device_type type, UINT32 state);
/* set an integer state value for an allocated device */
void device_set_info_int(const device_config *device, UINT32 state, INT64 data);
void devtag_set_info_int(running_machine *machine, device_type type, const char *tag, UINT32 state, INT64 data);
/* set a pointer state value for an allocated device */
void device_set_info_ptr(const device_config *device, UINT32 state, void *data);
void devtag_set_info_ptr(running_machine *machine, device_type type, const char *tag, UINT32 state, void *data);
/* set a function pointer state value for an allocated device */
void device_set_info_fct(const device_config *device, UINT32 state, genf *data);
void devtag_set_info_fct(running_machine *machine, device_type type, const char *tag, UINT32 state, genf *data);
/***************************************************************************
INLINE FUNCTIONS
***************************************************************************/
/* return common strings based on device instances */
INLINE const char *device_get_name(const device_config *device) { return device_get_info_string(device, DEVINFO_STR_NAME); }
INLINE const char *device_get_family(const device_config *device) { return device_get_info_string(device, DEVINFO_STR_FAMILY); }
INLINE const char *device_get_version(const device_config *device) { return device_get_info_string(device, DEVINFO_STR_VERSION); }
INLINE const char *device_get_source_file(const device_config *device) { return device_get_info_string(device, DEVINFO_STR_SOURCE_FILE); }
INLINE const char *device_get_credits(const device_config *device) { return device_get_info_string(device, DEVINFO_STR_CREDITS); }
/* return common strings based on device types */
INLINE const char *devtype_get_name(device_type devtype) { return devtype_get_info_string(devtype, DEVINFO_STR_NAME); }
INLINE const char *devtype_get_family(device_type devtype) { return devtype_get_info_string(devtype, DEVINFO_STR_FAMILY); }
INLINE const char *devtype_get_version(device_type devtype) { return devtype_get_info_string(devtype, DEVINFO_STR_VERSION); }
INLINE const char *devtype_get_source_file(device_type devtype) { return devtype_get_info_string(devtype, DEVINFO_STR_SOURCE_FILE); }
INLINE const char *devtype_get_credits(device_type devtype) { return devtype_get_info_string(devtype, DEVINFO_STR_CREDITS); }
#endif /* __DEVINTRF_H__ */

View File

@ -569,19 +569,19 @@ static void print_game_sample(FILE *out, const game_driver *game, const machine_
static void print_game_chips(FILE *out, const game_driver *game, const machine_config *config)
{
const device_config *device;
int chipnum;
/* iterate over CPUs */
for (chipnum = 0; chipnum < ARRAY_LENGTH(config->cpu); chipnum++)
if (config->cpu[chipnum].type != CPU_DUMMY)
{
fprintf(out, "\t\t<chip");
fprintf(out, " type=\"cpu\"");
fprintf(out, " tag=\"%s\"", xml_normalize_string(config->cpu[chipnum].tag));
fprintf(out, " name=\"%s\"", xml_normalize_string(cputype_get_name(config->cpu[chipnum].type)));
fprintf(out, " clock=\"%d\"", config->cpu[chipnum].clock);
fprintf(out, "/>\n");
}
for (device = cpu_first(config); device != NULL; device = cpu_next(device))
{
fprintf(out, "\t\t<chip");
fprintf(out, " type=\"cpu\"");
fprintf(out, " tag=\"%s\"", xml_normalize_string(device->tag));
fprintf(out, " name=\"%s\"", xml_normalize_string(device_get_name(device)));
fprintf(out, " clock=\"%d\"", ((const cpu_config *)device->inline_config)->clock);
fprintf(out, "/>\n");
}
/* iterate over sound chips */
for (chipnum = 0; chipnum < ARRAY_LENGTH(config->sound); chipnum++)

View File

@ -174,9 +174,9 @@ static void dma8237_update_status(const device_config *device)
}
/* set the halt line */
if (dma8237->intf && dma8237->intf->cpunum >= 0)
if (dma8237->intf && dma8237->intf->cputag != NULL)
{
cpu_set_input_line(device->machine->cpu[dma8237->intf->cpunum], INPUT_LINE_HALT,
cputag_set_input_line(device->machine, dma8237->intf->cputag, INPUT_LINE_HALT,
pending_transfer ? ASSERT_LINE : CLEAR_LINE);
}

View File

@ -24,7 +24,7 @@ typedef void (*dma8237_out_eop_func)(const device_config *device, int state);
struct dma8237_interface
{
/* CPU to halt when DMA is active */
int cpunum;
const char *cputag;
/* speed of DMA accesses (per byte) */
double bus_speed;

View File

@ -218,9 +218,9 @@ static void dma8257_update_status(const device_config *device)
}
/* set the halt line */
if (dma8257->intf && dma8257->intf->cpunum >= 0)
if (dma8257->intf && dma8257->intf->cputag != NULL)
{
cpu_set_input_line(device->machine->cpu[dma8257->intf->cpunum], INPUT_LINE_HALT,
cputag_set_input_line(device->machine, dma8257->intf->cputag, INPUT_LINE_HALT,
pending_transfer ? ASSERT_LINE : CLEAR_LINE);
}

View File

@ -22,7 +22,7 @@ typedef struct _dma8257_interface dma8257_interface;
struct _dma8257_interface
{
/* CPU to halt when DMA is active */
int cpunum;
const char *cputag;
/* clock */
int clockhz;

View File

@ -272,7 +272,7 @@ mame_file *nvram_fopen(running_machine *machine, UINT32 openflags)
void nvram_load(running_machine *machine)
{
mame_file *nvram_file = NULL;
device_config *device;
const device_config *device;
if (machine->config->nvram_handler != NULL)
{
@ -280,23 +280,19 @@ void nvram_load(running_machine *machine)
(*machine->config->nvram_handler)(machine, nvram_file, 0);
}
for (device = (device_config *)machine->config->devicelist; device != NULL; device = device->next)
for (device = machine->config->devicelist; device != NULL; device = device->next)
{
if (device->nvram != NULL)
device_nvram_func nvram = (device_nvram_func)device_get_info_fct(device, DEVINFO_FCT_NVRAM);
if (nvram != NULL)
{
if (nvram_file == NULL)
{
nvram_file = nvram_fopen(machine, OPEN_FLAG_READ);
}
(*device->nvram)(device, nvram_file, 0);
(*nvram)(device, nvram_file, 0);
}
}
if (nvram_file != NULL)
{
mame_fclose(nvram_file);
}
}
@ -307,7 +303,7 @@ void nvram_load(running_machine *machine)
void nvram_save(running_machine *machine)
{
mame_file *nvram_file = NULL;
device_config *device;
const device_config *device;
if (machine->config->nvram_handler != NULL)
{
@ -315,23 +311,19 @@ void nvram_save(running_machine *machine)
(*machine->config->nvram_handler)(machine, nvram_file, 1);
}
for (device = (device_config *)machine->config->devicelist; device != NULL; device = device->next)
for (device = machine->config->devicelist; device != NULL; device = device->next)
{
if (device->nvram != NULL)
device_nvram_func nvram = (device_nvram_func)device_get_info_fct(device, DEVINFO_FCT_NVRAM);
if (nvram != NULL)
{
if (nvram_file == NULL)
{
nvram_file = nvram_fopen(machine, OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS);
}
(*device->nvram)(device, nvram_file, 1);
(*nvram)(device, nvram_file, 1);
}
}
if (nvram_file != NULL)
{
mame_fclose(nvram_file);
}
}
@ -579,14 +571,14 @@ static void interrupt_reset(running_machine *machine)
static TIMER_CALLBACK( clear_all_lines )
{
int cpunum = param;
int inputcount = cpu_get_input_lines(machine->cpu[cpunum]);
const device_config *device = ptr;
int inputcount = cpu_get_input_lines(device);
int line;
/* clear NMI and all inputs */
cpu_set_input_line(machine->cpu[cpunum], INPUT_LINE_NMI, CLEAR_LINE);
cpu_set_input_line(device, INPUT_LINE_NMI, CLEAR_LINE);
for (line = 0; line < inputcount; line++)
cpu_set_input_line(machine->cpu[cpunum], line, CLEAR_LINE);
cpu_set_input_line(device, line, CLEAR_LINE);
}
@ -637,16 +629,18 @@ void generic_pulse_irq_line_and_vector(const device_config *device, int irqline,
disable value for global interrupts
-------------------------------------------------*/
void cpu_interrupt_enable(int cpunum, int enabled)
void cpu_interrupt_enable(const device_config *device, int enabled)
{
assert_always(cpunum >= 0 && cpunum < ARRAY_LENGTH(Machine->cpu) && Machine->cpu[cpunum] != NULL, "cpu_interrupt_enable() called for invalid cpu num!");
int cpunum = cpu_get_index(device);
assert_always(device != NULL, "cpu_interrupt_enable() called for invalid cpu!");
/* set the new state */
interrupt_enable[cpunum] = enabled;
/* make sure there are no queued interrupts */
if (enabled == 0)
timer_call_after_resynch(Machine, NULL, cpunum, clear_all_lines);
timer_call_after_resynch(device->machine, (void *)device, 0, clear_all_lines);
}
@ -657,7 +651,7 @@ void cpu_interrupt_enable(int cpunum, int enabled)
WRITE8_HANDLER( interrupt_enable_w )
{
cpu_interrupt_enable(cpu_get_index(space->cpu), data);
cpu_interrupt_enable(space->cpu, data);
}

View File

@ -121,7 +121,7 @@ void set_led_status(int num, int value);
void generic_pulse_irq_line(const device_config *device, int irqline);
void generic_pulse_irq_line_and_vector(const device_config *device, int irqline, int vector);
void cpu_interrupt_enable(int cpu, int enabled);
void cpu_interrupt_enable(const device_config *device, int enabled);
READ8_HANDLER( interrupt_enable_r );
WRITE8_HANDLER( interrupt_enable_w );

View File

@ -256,10 +256,10 @@ static void z80dma_update_status(const device_config *device)
}
/* set the halt line */
if (z80dma->intf && z80dma->intf->cpunum >= 0)
if (z80dma->intf && z80dma->intf->cputag != NULL)
{
//FIXME: Synchronization is done by BUSREQ!
cpu_set_input_line(device->machine->cpu[z80dma->intf->cpunum], INPUT_LINE_HALT,
cputag_set_input_line(device->machine, z80dma->intf->cputag, INPUT_LINE_HALT,
pending_transfer ? ASSERT_LINE : CLEAR_LINE);
}
}

View File

@ -13,7 +13,7 @@ typedef struct _z80dma_interface z80dma_interface;
struct _z80dma_interface
{
/* CPU to halt when DMA is active */
int cpunum;
const char *cputag;
/* clock */
int clockhz;

View File

@ -216,7 +216,6 @@ extern int mame_validitychecks(const game_driver *driver);
static int parse_ini_file(core_options *options, const char *name);
static running_machine *create_machine(const game_driver *driver);
static void prepare_machine(running_machine *machine);
static void destroy_machine(running_machine *machine);
static void init_machine(running_machine *machine);
static TIMER_CALLBACK( soft_reset );
@ -241,11 +240,10 @@ static void logfile_callback(running_machine *machine, const char *buffer);
INLINE void eat_all_cpu_cycles(running_machine *machine)
{
int cpunum;
const device_config *cpu;
for (cpunum = 0; cpunum < ARRAY_LENGTH(machine->cpu); cpunum++)
if (machine->cpu[cpunum] != NULL)
cpu_eat_cycles(machine->cpu[cpunum], 1000000000);
for (cpu = machine->cpu[0]; cpu != NULL; cpu = cpu->typenext)
cpu_eat_cycles(cpu, 1000000000);
}
@ -301,7 +299,6 @@ int mame_execute(core_options *options)
/* create the machine structure and driver */
machine = create_machine(driver);
prepare_machine(machine);
mame = machine->mame_data;
/* start in the "pre-init phase" */
@ -1404,18 +1401,28 @@ static running_machine *create_machine(const game_driver *driver)
machine->basename = mame_strdup(driver->name);
machine->config = machine_config_alloc(driver->machine_config);
/* temporary: create fake CPU devices */
for (cpunum = 0; cpunum < ARRAY_LENGTH(machine->cpu); cpunum++)
if (machine->config->cpu[cpunum].type != CPU_DUMMY)
machine->cpu[cpunum] = cpuexec_create_cpu_device(&machine->config->cpu[cpunum]);
/* allocate the driver data */
if (machine->config->driver_data_size != 0)
{
machine->driver_data = malloc(machine->config->driver_data_size);
if (machine->driver_data == NULL)
goto error;
memset(machine->driver_data, 0, machine->config->driver_data_size);
}
/* find devices */
machine->cpu[0] = 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);
/* attach this machine to tall the devices in the configuration */
device_list_attach_machine(machine);
/* fetch core options */
machine->sample_rate = options_get_int(mame_options(), OPTION_SAMPLERATE);
machine->debug_flags = options_get_bool(mame_options(), OPTION_DEBUG) ? (DEBUG_FLAG_ENABLED | DEBUG_FLAG_CALL_HOOK) : 0;
return machine;
error:
@ -1431,58 +1438,14 @@ error:
}
/*-------------------------------------------------
prepare_machine - reset the state of the
machine object
-------------------------------------------------*/
static void prepare_machine(running_machine *machine)
{
/* reset most portions of the machine */
/* graphics layout */
memset(machine->gfx, 0, sizeof(machine->gfx));
/* palette-related information */
machine->pens = NULL;
machine->shadow_table = NULL;
/* audio-related information */
machine->sample_rate = options_get_int(mame_options(), OPTION_SAMPLERATE);
/* input-related information */
machine->portconfig = NULL;
/* debugger-related information */
machine->debug_flags = options_get_bool(mame_options(), OPTION_DEBUG) ? (DEBUG_FLAG_ENABLED | DEBUG_FLAG_CALL_HOOK) : 0;
/* reset the global MAME data and clear the other privates */
memset(machine->mame_data, 0, sizeof(*machine->mame_data));
machine->palette_data = NULL;
machine->streams_data = NULL;
/* reset the driver data */
if (machine->config->driver_data_size != 0)
memset(machine->driver_data, 0, machine->config->driver_data_size);
}
/*-------------------------------------------------
destroy_machine - free the machine data
-------------------------------------------------*/
static void destroy_machine(running_machine *machine)
{
int cpunum;
assert(machine == Machine);
/* temporary: free the fake CPU devices */
for (cpunum = 0; cpunum < ARRAY_LENGTH(machine->cpu); cpunum++)
if (machine->cpu[cpunum] != NULL)
free((void *)machine->cpu[cpunum]);
if (machine->driver_data != NULL)
free(machine->driver_data);
if (machine->config != NULL)

View File

@ -58,16 +58,13 @@ machine_config *machine_config_alloc(const machine_config_token *tokens)
void machine_config_free(machine_config *config)
{
int cpunum, soundnum;
int soundnum;
/* release the device list */
while (config->devicelist != NULL)
device_list_remove(&config->devicelist, config->devicelist->type, config->devicelist->tag);
/* release the strings */
for (cpunum = 0; cpunum < ARRAY_LENGTH(config->cputag); cpunum++)
if (config->cputag[cpunum] != NULL)
astring_free(config->cputag[cpunum]);
for (soundnum = 0; soundnum < ARRAY_LENGTH(config->soundtag); soundnum++)
if (config->soundtag[soundnum] != NULL)
astring_free(config->soundtag[soundnum]);
@ -77,75 +74,6 @@ void machine_config_free(machine_config *config)
}
/*-------------------------------------------------
cpu_add - add a CPU during machine driver
expansion
-------------------------------------------------*/
static cpu_config *cpu_add(machine_config *machine, const char *tag, cpu_type type, int cpuclock)
{
int cpunum;
for (cpunum = 0; cpunum < MAX_CPU; cpunum++)
if (machine->cpu[cpunum].type == CPU_DUMMY)
{
if (machine->cputag[cpunum] == NULL)
machine->cputag[cpunum] = astring_alloc();
astring_cpyc(machine->cputag[cpunum], tag);
machine->cpu[cpunum].tag = astring_c(machine->cputag[cpunum]);
machine->cpu[cpunum].type = type;
machine->cpu[cpunum].clock = cpuclock;
return &machine->cpu[cpunum];
}
fatalerror("Out of CPU's!\n");
return NULL;
}
/*-------------------------------------------------
cpu_find - find a tagged CPU during machine
driver expansion
-------------------------------------------------*/
static cpu_config *cpu_find(machine_config *machine, const char *tag)
{
int cpunum;
for (cpunum = 0; cpunum < MAX_CPU; cpunum++)
if (machine->cpu[cpunum].tag && strcmp(machine->cpu[cpunum].tag, tag) == 0)
return &machine->cpu[cpunum];
fatalerror("Can't find CPU '%s'!\n", tag);
return NULL;
}
/*-------------------------------------------------
cpu_remove - remove a tagged CPU during
machine driver expansion
-------------------------------------------------*/
static void cpu_remove(machine_config *machine, const char *tag)
{
int cpunum;
for (cpunum = 0; cpunum < MAX_CPU; cpunum++)
if (machine->cpu[cpunum].tag && strcmp(machine->cpu[cpunum].tag, tag) == 0)
{
if (machine->cputag[cpunum] != NULL)
astring_free(machine->cputag[cpunum]);
memmove(&machine->cpu[cpunum], &machine->cpu[cpunum + 1], sizeof(machine->cpu[0]) * (MAX_CPU - cpunum - 1));
memmove(&machine->cputag[cpunum], &machine->cputag[cpunum + 1], sizeof(machine->cputag[0]) * (MAX_CPU - cpunum - 1));
memset(&machine->cpu[MAX_CPU - 1], 0, sizeof(machine->cpu[0]));
memset(&machine->cputag[MAX_CPU - 1], 0, sizeof(machine->cputag[0]));
return;
}
fatalerror("Can't find CPU '%s'!\n", tag);
}
/*-------------------------------------------------
sound_add - add a sound system during
machine driver expansion
@ -228,7 +156,6 @@ static void machine_config_detokenize(machine_config *config, const machine_conf
astring *tempstring = astring_alloc();
device_config *device = NULL;
sound_config *sound = NULL;
cpu_config *cpu = NULL;
/* loop over tokens until we hit the end */
while (entrytype != MCONFIG_TOKEN_END)
@ -331,90 +258,6 @@ static void machine_config_detokenize(machine_config *config, const machine_conf
break;
/* add/modify/remove/replace CPUs */
case MCONFIG_TOKEN_CPU_ADD:
TOKEN_UNGET_UINT32(tokens);
TOKEN_GET_UINT64_UNPACK3(tokens, entrytype, 8, type, 24, clock, 32);
tag = TOKEN_GET_STRING(tokens);
cpu = cpu_add(config, device_build_tag(tempstring, tagprefix, tag), type, clock);
break;
case MCONFIG_TOKEN_CPU_MODIFY:
tag = TOKEN_GET_STRING(tokens);
cpu = cpu_find(config, device_build_tag(tempstring, tagprefix, tag));
break;
case MCONFIG_TOKEN_CPU_REMOVE:
tag = TOKEN_GET_STRING(tokens);
cpu_remove(config, device_build_tag(tempstring, tagprefix, tag));
cpu = NULL;
break;
case MCONFIG_TOKEN_CPU_REPLACE:
TOKEN_UNGET_UINT32(tokens);
TOKEN_GET_UINT64_UNPACK3(tokens, entrytype, 8, type, 24, clock, 32);
tag = TOKEN_GET_STRING(tokens);
cpu = cpu_find(config, device_build_tag(tempstring, tagprefix, tag));
if (cpu == NULL)
fatalerror("Unable to find CPU: tag=%s\n", astring_c(tempstring));
cpu->type = type;
cpu->clock = clock;
break;
/* CPU parameters */
case MCONFIG_TOKEN_cpu_get_flags:
assert(cpu != NULL);
TOKEN_UNGET_UINT32(tokens);
TOKEN_GET_UINT32_UNPACK2(tokens, entrytype, 8, cpu->flags, 24);
break;
case MCONFIG_TOKEN_CPU_CONFIG:
assert(cpu != NULL);
cpu->reset_param = TOKEN_GET_PTR(tokens, voidptr);
break;
case MCONFIG_TOKEN_CPU_PROGRAM_MAP:
assert(cpu != NULL);
cpu->address_map[ADDRESS_SPACE_PROGRAM][0] = TOKEN_GET_PTR(tokens, addrmap);
cpu->address_map[ADDRESS_SPACE_PROGRAM][1] = TOKEN_GET_PTR(tokens, addrmap);
break;
case MCONFIG_TOKEN_CPU_DATA_MAP:
assert(cpu != NULL);
cpu->address_map[ADDRESS_SPACE_DATA][0] = TOKEN_GET_PTR(tokens, addrmap);
cpu->address_map[ADDRESS_SPACE_DATA][1] = TOKEN_GET_PTR(tokens, addrmap);
break;
case MCONFIG_TOKEN_CPU_IO_MAP:
assert(cpu != NULL);
cpu->address_map[ADDRESS_SPACE_IO][0] = TOKEN_GET_PTR(tokens, addrmap);
cpu->address_map[ADDRESS_SPACE_IO][1] = TOKEN_GET_PTR(tokens, addrmap);
break;
case MCONFIG_TOKEN_CPU_VBLANK_INT:
assert(cpu != NULL);
TOKEN_UNGET_UINT32(tokens);
TOKEN_GET_UINT32_UNPACK1(tokens, entrytype, 8);
cpu->vblank_interrupt_screen = TOKEN_GET_STRING(tokens);
cpu->vblank_interrupt = TOKEN_GET_PTR(tokens, interrupt);
cpu->vblank_interrupts_per_frame = 1;
break;
case MCONFIG_TOKEN_CPU_VBLANK_INT_HACK:
assert(cpu != NULL);
TOKEN_UNGET_UINT32(tokens);
TOKEN_GET_UINT32_UNPACK2(tokens, entrytype, 8, cpu->vblank_interrupts_per_frame, 24);
cpu->vblank_interrupt = TOKEN_GET_PTR(tokens, interrupt);
break;
case MCONFIG_TOKEN_CPU_PERIODIC_INT:
assert(cpu != NULL);
TOKEN_UNGET_UINT32(tokens);
TOKEN_GET_UINT32_UNPACK2(tokens, entrytype, 8, data32, 24);
cpu->timed_interrupt_period = HZ_TO_ATTOSECONDS(data32);
cpu->timed_interrupt = TOKEN_GET_PTR(tokens, interrupt);
break;
/* core parameters */
case MCONFIG_TOKEN_DRIVER_DATA:
TOKEN_UNGET_UINT32(tokens);

View File

@ -43,19 +43,6 @@ enum
MCONFIG_TOKEN_DEVICE_CONFIG_DATAFP32,
MCONFIG_TOKEN_DEVICE_CONFIG_DATAFP64,
MCONFIG_TOKEN_CPU_ADD,
MCONFIG_TOKEN_CPU_MODIFY,
MCONFIG_TOKEN_CPU_REMOVE,
MCONFIG_TOKEN_CPU_REPLACE,
MCONFIG_TOKEN_cpu_get_flags,
MCONFIG_TOKEN_CPU_CONFIG,
MCONFIG_TOKEN_CPU_PROGRAM_MAP,
MCONFIG_TOKEN_CPU_DATA_MAP,
MCONFIG_TOKEN_CPU_IO_MAP,
MCONFIG_TOKEN_CPU_VBLANK_INT,
MCONFIG_TOKEN_CPU_VBLANK_INT_HACK,
MCONFIG_TOKEN_CPU_PERIODIC_INT,
MCONFIG_TOKEN_DRIVER_DATA,
MCONFIG_TOKEN_INTERLEAVE,
MCONFIG_TOKEN_WATCHDOG_VBLANK,
@ -124,8 +111,6 @@ struct _machine_config
{
UINT32 driver_data_size; /* amount of memory needed for driver_data */
cpu_config cpu[MAX_CPU]; /* array of CPUs in the system */
astring * cputag[MAX_CPU]; /* allocated strings for each CPU tag */
UINT32 cpu_slices_per_frame; /* number of times to interleave execution per frame */
INT32 watchdog_vblank_count; /* number of VBLANKs until the watchdog kills us */
attotime watchdog_time; /* length of time until the watchdog kills us */
@ -171,7 +156,6 @@ union _machine_config_token
const gfx_decode_entry *gfxdecode;
const addrmap_token *addrmap;
device_type devtype;
void (*interrupt)(const device_config *device);
driver_init_func driver_init;
nvram_handler_func nvram_handler;
memcard_handler_func memcard_handler;
@ -278,57 +262,6 @@ union _machine_config_token
#endif
/* add/modify/remove/replace CPUs */
#define MDRV_CPU_ADD(_tag, _type, _clock) \
TOKEN_UINT64_PACK3(MCONFIG_TOKEN_CPU_ADD, 8, CPU_##_type, 24, _clock, 32), \
TOKEN_STRING(_tag),
#define MDRV_CPU_MODIFY(_tag) \
TOKEN_UINT32_PACK1(MCONFIG_TOKEN_CPU_MODIFY, 8), \
TOKEN_STRING(_tag),
#define MDRV_CPU_REMOVE(_tag) \
TOKEN_UINT32_PACK1(MCONFIG_TOKEN_CPU_REMOVE, 8), \
TOKEN_STRING(_tag),
#define MDRV_CPU_REPLACE(_tag, _type, _clock) \
TOKEN_UINT64_PACK3(MCONFIG_TOKEN_CPU_REPLACE, 8, CPU_##_type, 24, _clock, 32), \
TOKEN_STRING(_tag),
/* CPU parameters */
#define MDRV_CPU_FLAGS(_flags) \
TOKEN_UINT32_PACK2(MCONFIG_TOKEN_cpu_get_flags, 8, _flags, 24),
#define MDRV_CPU_CONFIG(_config) \
TOKEN_UINT32_PACK1(MCONFIG_TOKEN_CPU_CONFIG, 8), \
TOKEN_PTR(voidptr, &(_config)),
#define MDRV_CPU_PROGRAM_MAP(_map1, _map2) \
TOKEN_UINT32_PACK1(MCONFIG_TOKEN_CPU_PROGRAM_MAP, 8), \
TOKEN_PTR(voidptr, ADDRESS_MAP_NAME(_map1)), \
TOKEN_PTR(voidptr, ADDRESS_MAP_NAME(_map2)), \
#define MDRV_CPU_DATA_MAP(_map1, _map2) \
TOKEN_UINT32_PACK1(MCONFIG_TOKEN_CPU_DATA_MAP, 8), \
TOKEN_PTR(voidptr, ADDRESS_MAP_NAME(_map1)), \
TOKEN_PTR(voidptr, ADDRESS_MAP_NAME(_map2)), \
#define MDRV_CPU_IO_MAP(_map1, _map2) \
TOKEN_UINT32_PACK1(MCONFIG_TOKEN_CPU_IO_MAP, 8), \
TOKEN_PTR(voidptr, ADDRESS_MAP_NAME(_map1)), \
TOKEN_PTR(voidptr, ADDRESS_MAP_NAME(_map2)), \
#define MDRV_CPU_VBLANK_INT(_tag, _func) \
TOKEN_UINT32_PACK1(MCONFIG_TOKEN_CPU_VBLANK_INT, 8), \
TOKEN_STRING(_tag), \
TOKEN_PTR(interrupt, _func),
#define MDRV_CPU_PERIODIC_INT(_func, _rate) \
TOKEN_UINT32_PACK2(MCONFIG_TOKEN_CPU_PERIODIC_INT, 8, _rate, 24), \
TOKEN_PTR(interrupt, _func),
/* core parameters */
#define MDRV_DRIVER_DATA(_struct) \
TOKEN_UINT32_PACK2(MCONFIG_TOKEN_DRIVER_DATA, 8, sizeof(_struct), 24),

View File

@ -750,25 +750,25 @@ const address_space *memory_find_address_space(const device_config *cpu, int spa
address map for a CPU's address space
-------------------------------------------------*/
address_map *address_map_alloc(const machine_config *config, const game_driver *driver, int cpunum, int spacenum)
address_map *address_map_alloc(const device_config *device, const game_driver *driver, int spacenum)
{
const char *cputag = config->cpu[cpunum].tag;
int cputype = config->cpu[cpunum].type;
const addrmap_token *internal_map = (const addrmap_token *)cputype_get_info_ptr(cputype, CPUINFO_PTR_INTERNAL_MEMORY_MAP + spacenum);
const cpu_config *cpuconfig = device->inline_config;
const addrmap_token *internal_map;
address_map *map;
map = malloc_or_die(sizeof(*map));
memset(map, 0, sizeof(*map));
/* append the internal CPU map (first so it takes priority) */
internal_map = (const addrmap_token *)cputype_get_info_ptr(cpuconfig->type, CPUINFO_PTR_INTERNAL_MEMORY_MAP + spacenum);
if (internal_map != NULL)
map_detokenize(map, driver, cputag, internal_map);
map_detokenize(map, driver, device->tag, internal_map);
/* construct the standard map */
if (config->cpu[cpunum].address_map[spacenum][0] != NULL)
map_detokenize(map, driver, cputag, config->cpu[cpunum].address_map[spacenum][0]);
if (config->cpu[cpunum].address_map[spacenum][1] != NULL)
map_detokenize(map, driver, cputag, config->cpu[cpunum].address_map[spacenum][1]);
if (cpuconfig->address_map[spacenum] != NULL)
map_detokenize(map, driver, device->tag, cpuconfig->address_map[spacenum]);
if (cpuconfig->address_map2[spacenum] != NULL)
map_detokenize(map, driver, device->tag, cpuconfig->address_map2[spacenum]);
return map;
}
@ -1328,7 +1328,7 @@ UINT64 *_memory_install_device_handler64(const address_space *space, const devic
int memory_address_physical(const address_space *space, int intention, offs_t *address)
{
cpu_class_header *classheader = space->cpu->classtoken;
cpu_class_header *classheader = cpu_get_class_header(space->cpu);
if (classheader->translate != NULL)
return (*classheader->translate)(space->cpu, space->spacenum, intention, address);
else
@ -1474,115 +1474,109 @@ void memory_dump(running_machine *machine, FILE *file)
static void memory_init_spaces(running_machine *machine)
{
const machine_config *config = machine->config;
memory_private *memdata = machine->memory_data;
address_space **nextptr = (address_space **)&memdata->spacelist;
int cpunum, spacenum;
const device_config *device;
int spacenum;
/* create a global watchpoint-filled table */
memdata->wptable = auto_malloc(1 << LEVEL1_BITS);
memset(memdata->wptable, STATIC_WATCHPOINT, 1 << LEVEL1_BITS);
/* loop over CPUs */
for (cpunum = 0; cpunum < ARRAY_LENGTH(machine->cpu); cpunum++)
if (machine->cpu[cpunum] != NULL)
{
cpu_type cputype = config->cpu[cpunum].type;
for (device = machine->cpu[0]; device != NULL; device = device->typenext)
for (spacenum = 0; spacenum < ADDRESS_SPACES; spacenum++)
if (cpu_get_addrbus_width(device, spacenum) > 0)
{
address_space *space = malloc_or_die(sizeof(*space));
int logbits = cpu_get_logaddr_width(device, spacenum);
int ashift = cpu_get_addrbus_shift(device, spacenum);
int abits = cpu_get_addrbus_width(device, spacenum);
int dbits = cpu_get_databus_width(device, spacenum);
int endianness = cpu_get_endianness(device);
int accessorindex = (dbits == 8) ? 0 : (dbits == 16) ? 1 : (dbits == 32) ? 2 : 3;
int entrynum;
/* initialize each address space with an actual address bus */
for (spacenum = 0; spacenum < ADDRESS_SPACES; spacenum++)
if (cputype_get_addrbus_width(cputype, spacenum) > 0)
/* if logbits is 0, revert to abits */
if (logbits == 0)
logbits = abits;
/* determine the address and data bits */
memset(space, 0, sizeof(*space));
space->machine = machine;
space->cpu = device;
space->name = address_space_names[spacenum];
space->accessors = memory_accessors[accessorindex][(endianness == ENDIANNESS_LITTLE) ? 0 : 1];
space->addrmask = 0xffffffffUL >> (32 - abits);
space->bytemask = (ashift < 0) ? ((space->addrmask << -ashift) | ((1 << -ashift) - 1)) : (space->addrmask >> ashift);
space->logaddrmask = 0xffffffffUL >> (32 - logbits);
space->logbytemask = (ashift < 0) ? ((space->logaddrmask << -ashift) | ((1 << -ashift) - 1)) : (space->logaddrmask >> ashift);
space->spacenum = spacenum;
space->endianness = endianness;
space->ashift = ashift;
space->pageshift = cpu_get_page_shift(device, spacenum);
space->abits = abits;
space->dbits = dbits;
space->addrchars = (abits + 3) / 4;
space->logaddrchars = (logbits + 3) / 4;
space->log_unmap = TRUE;
/* allocate subtable information; we malloc this manually because it will be realloc'ed */
space->read.subtable = auto_malloc(sizeof(*space->read.subtable) * SUBTABLE_COUNT);
memset(space->read.subtable, 0, sizeof(*space->read.subtable) * SUBTABLE_COUNT);
space->write.subtable = auto_malloc(sizeof(*space->write.subtable) * SUBTABLE_COUNT);
memset(space->write.subtable, 0, sizeof(*space->write.subtable) * SUBTABLE_COUNT);
/* allocate the handler table */
space->read.handlers[0] = auto_malloc(sizeof(*space->read.handlers[0]) * ARRAY_LENGTH(space->read.handlers));
memset(space->read.handlers[0], 0, sizeof(*space->read.handlers[0]) * ARRAY_LENGTH(space->read.handlers));
space->write.handlers[0] = auto_malloc(sizeof(*space->write.handlers[0]) * ARRAY_LENGTH(space->write.handlers));
memset(space->write.handlers[0], 0, sizeof(*space->write.handlers[0]) * ARRAY_LENGTH(space->write.handlers));
for (entrynum = 1; entrynum < ARRAY_LENGTH(space->read.handlers); entrynum++)
{
address_space *space = malloc_or_die(sizeof(*space));
int logbits = cputype_get_logaddr_width(cputype, spacenum);
int ashift = cputype_get_addrbus_shift(cputype, spacenum);
int abits = cputype_get_addrbus_width(cputype, spacenum);
int dbits = cputype_get_databus_width(cputype, spacenum);
int endianness = cputype_get_endianness(cputype);
int accessorindex = (dbits == 8) ? 0 : (dbits == 16) ? 1 : (dbits == 32) ? 2 : 3;
int entrynum;
/* if logbits is 0, revert to abits */
if (logbits == 0)
logbits = abits;
/* determine the address and data bits */
memset(space, 0, sizeof(*space));
space->machine = machine;
space->cpu = machine->cpu[cpunum];
space->name = address_space_names[spacenum];
space->accessors = memory_accessors[accessorindex][(endianness == ENDIANNESS_LITTLE) ? 0 : 1];
space->addrmask = 0xffffffffUL >> (32 - abits);
space->bytemask = (ashift < 0) ? ((space->addrmask << -ashift) | ((1 << -ashift) - 1)) : (space->addrmask >> ashift);
space->logaddrmask = 0xffffffffUL >> (32 - logbits);
space->logbytemask = (ashift < 0) ? ((space->logaddrmask << -ashift) | ((1 << -ashift) - 1)) : (space->logaddrmask >> ashift);
space->spacenum = spacenum;
space->endianness = endianness;
space->ashift = ashift;
space->pageshift = cputype_get_page_shift(cputype, spacenum);
space->abits = abits;
space->dbits = dbits;
space->addrchars = (abits + 3) / 4;
space->logaddrchars = (logbits + 3) / 4;
space->log_unmap = TRUE;
/* allocate subtable information; we malloc this manually because it will be realloc'ed */
space->read.subtable = auto_malloc(sizeof(*space->read.subtable) * SUBTABLE_COUNT);
memset(space->read.subtable, 0, sizeof(*space->read.subtable) * SUBTABLE_COUNT);
space->write.subtable = auto_malloc(sizeof(*space->write.subtable) * SUBTABLE_COUNT);
memset(space->write.subtable, 0, sizeof(*space->write.subtable) * SUBTABLE_COUNT);
/* allocate the handler table */
space->read.handlers[0] = auto_malloc(sizeof(*space->read.handlers[0]) * ARRAY_LENGTH(space->read.handlers));
memset(space->read.handlers[0], 0, sizeof(*space->read.handlers[0]) * ARRAY_LENGTH(space->read.handlers));
space->write.handlers[0] = auto_malloc(sizeof(*space->write.handlers[0]) * ARRAY_LENGTH(space->write.handlers));
memset(space->write.handlers[0], 0, sizeof(*space->write.handlers[0]) * ARRAY_LENGTH(space->write.handlers));
for (entrynum = 1; entrynum < ARRAY_LENGTH(space->read.handlers); entrynum++)
{
space->read.handlers[entrynum] = space->read.handlers[0] + entrynum;
space->write.handlers[entrynum] = space->write.handlers[0] + entrynum;
}
/* init the static handlers */
for (entrynum = 0; entrynum < ENTRY_COUNT; entrynum++)
{
space->read.handlers[entrynum]->handler.generic = get_static_handler(space->dbits, 0, entrynum);
space->read.handlers[entrynum]->object = space;
space->write.handlers[entrynum]->handler.generic = get_static_handler(space->dbits, 1, entrynum);
space->write.handlers[entrynum]->object = space;
}
/* make sure we fix up the mask for the unmap and watchpoint handlers */
space->read.handlers[STATIC_UNMAP]->bytemask = ~0;
space->write.handlers[STATIC_UNMAP]->bytemask = ~0;
space->read.handlers[STATIC_WATCHPOINT]->bytemask = ~0;
space->write.handlers[STATIC_WATCHPOINT]->bytemask = ~0;
/* allocate memory; these aren't auto-malloc'ed as we need to expand them */
space->read.table = malloc_or_die(1 << LEVEL1_BITS);
space->write.table = malloc_or_die(1 << LEVEL1_BITS);
/* initialize everything to unmapped */
memset(space->read.table, STATIC_UNMAP, 1 << LEVEL1_BITS);
memset(space->write.table, STATIC_UNMAP, 1 << LEVEL1_BITS);
/* initialize the lookups */
space->readlookup = space->read.table;
space->writelookup = space->write.table;
/* set the direct access information base */
space->direct.raw = space->direct.decrypted = NULL;
space->direct.mask = space->bytemask;
space->direct.min = 1;
space->direct.max = 0;
space->direct.entry = STATIC_UNMAP;
space->directupdate = NULL;
/* link us in */
*nextptr = space;
nextptr = (address_space **)&space->next;
space->read.handlers[entrynum] = space->read.handlers[0] + entrynum;
space->write.handlers[entrynum] = space->write.handlers[0] + entrynum;
}
}
/* init the static handlers */
for (entrynum = 0; entrynum < ENTRY_COUNT; entrynum++)
{
space->read.handlers[entrynum]->handler.generic = get_static_handler(space->dbits, 0, entrynum);
space->read.handlers[entrynum]->object = space;
space->write.handlers[entrynum]->handler.generic = get_static_handler(space->dbits, 1, entrynum);
space->write.handlers[entrynum]->object = space;
}
/* make sure we fix up the mask for the unmap and watchpoint handlers */
space->read.handlers[STATIC_UNMAP]->bytemask = ~0;
space->write.handlers[STATIC_UNMAP]->bytemask = ~0;
space->read.handlers[STATIC_WATCHPOINT]->bytemask = ~0;
space->write.handlers[STATIC_WATCHPOINT]->bytemask = ~0;
/* allocate memory; these aren't auto-malloc'ed as we need to expand them */
space->read.table = malloc_or_die(1 << LEVEL1_BITS);
space->write.table = malloc_or_die(1 << LEVEL1_BITS);
/* initialize everything to unmapped */
memset(space->read.table, STATIC_UNMAP, 1 << LEVEL1_BITS);
memset(space->write.table, STATIC_UNMAP, 1 << LEVEL1_BITS);
/* initialize the lookups */
space->readlookup = space->read.table;
space->writelookup = space->write.table;
/* set the direct access information base */
space->direct.raw = space->direct.decrypted = NULL;
space->direct.mask = space->bytemask;
space->direct.min = 1;
space->direct.max = 0;
space->direct.entry = STATIC_UNMAP;
space->directupdate = NULL;
/* link us in */
*nextptr = space;
nextptr = (address_space **)&space->next;
}
}
@ -1607,7 +1601,7 @@ static void memory_init_preflight(running_machine *machine)
int entrynum;
/* allocate the address map */
space->map = address_map_alloc(machine->config, machine->gamedrv, cpu_get_index(space->cpu), space->spacenum);
space->map = address_map_alloc(space->cpu, machine->gamedrv, space->spacenum);
/* extract global parameters specified by the map */
space->unmap = (space->map->unmapval == 0) ? 0 : ~0;

View File

@ -861,7 +861,7 @@ const address_space *memory_find_address_space(const device_config *cpu, int spa
/* ----- address maps ----- */
/* build and allocate an address map for a CPU's address space */
address_map *address_map_alloc(const machine_config *drv, const game_driver *driver, int cpunum, int spacenum);
address_map *address_map_alloc(const device_config *device, const game_driver *driver, int spacenum);
/* release allocated memory for an address map */
void address_map_free(address_map *map);

View File

@ -1173,19 +1173,18 @@ static UINT32 normalize_flags_for_cpu(running_machine *machine, UINT32 startflag
const device_config *device = cputag_get_cpu(machine, rgntag);
if (device != NULL)
{
int cputype = ((const cpu_config *)device->inline_config)->type;
int buswidth;
/* set the endianness */
startflags &= ~ROMREGION_ENDIANMASK;
if (cputype_get_endianness(cputype) == ENDIANNESS_LITTLE)
if (cpu_get_endianness(device) == ENDIANNESS_LITTLE)
startflags |= ROMREGION_LE;
else
startflags |= ROMREGION_BE;
/* set the width */
startflags &= ~ROMREGION_WIDTHMASK;
buswidth = cputype_get_databus_width(cputype, ADDRESS_SPACE_PROGRAM);
buswidth = cpu_get_databus_width(device, ADDRESS_SPACE_PROGRAM);
if (buswidth <= 8)
startflags |= ROMREGION_8BIT;
else if (buswidth <= 16)

View File

@ -575,7 +575,7 @@ void sndintrf_init(running_machine *machine)
static DEVICE_GET_INFO( sndclass )
{
sndintrf_data *snddata = device->classtoken;
sndintrf_data *snddata = device->inline_config;
(*snddata->intf.get_info)(device, state, (sndinfo *)info);
}
@ -592,7 +592,9 @@ int sndintrf_init_sound(running_machine *machine, int sndnum, const char *tag, s
info->device->static_config = config;
info->device->region = memory_region(info->device->machine, info->device->tag);
info->device->regionbytes = memory_region_length(info->device->machine, info->device->tag);
info->device->classtoken = info;
/* hack: stash the info pointer in the inline_config */
info->device->inline_config = info;
/* fill in the type and interface */
info->intf = snd_type_header[sndtype];

View File

@ -48,6 +48,7 @@
#include "cpuexec.h"
#include "streams.h"
#include "nes_apu.h"
#include "driver.h"
#include "cpu/m6502/m6502.h"
#include "nes_defs.h"

View File

@ -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)

View File

@ -714,51 +714,18 @@ static int validate_cpu(int drivnum, const machine_config *config, const input_p
{
const game_driver *driver = drivers[drivnum];
cpu_validity_check_func cpu_validity_check;
const device_config *device;
int error = FALSE;
int cpunum;
/* loop over all the CPUs */
for (cpunum = 0; cpunum < MAX_CPU; cpunum++)
for (device = cpu_first(config); device != NULL; device = cpu_next(device))
{
const cpu_config *cpu = &config->cpu[cpunum];
int spacenum, checknum;
/* skip empty entries */
if (cpu->type == CPU_DUMMY)
continue;
/* check for valid tag */
if (cpu->tag == NULL)
{
mame_printf_error("%s: %s has NULL CPU tag\n", driver->source_file, driver->name);
error = TRUE;
}
/* check for duplicate tags */
else
{
for (checknum = 0; checknum < cpunum; checknum++)
if (config->cpu[checknum].tag != NULL && strcmp(cpu->tag, config->cpu[checknum].tag) == 0)
{
mame_printf_error("%s: %s has multiple CPUs tagged as '%s'\n", driver->source_file, driver->name, cpu->tag);
error = TRUE;
}
}
/* validate the CPU tag */
error |= validate_tag(driver, "CPU", cpu->tag);
/* checks to see if this driver is using a dummy CPU */
if (cpu->type == CPU_DUMMY)
{
mame_printf_error("%s: %s uses non-present CPU\n", driver->source_file, driver->name);
error = TRUE;
continue;
}
const cpu_config *cpuconfig = device->inline_config;
int spacenum;
/* check the CPU for incompleteness */
if (cputype_get_info_fct(cpu->type, CPUINFO_PTR_RESET) == NULL ||
cputype_get_info_fct(cpu->type, CPUINFO_PTR_EXECUTE) == NULL)
if (cpu_get_info_fct(device, CPUINFO_PTR_RESET) == NULL ||
cpu_get_info_fct(device, CPUINFO_PTR_EXECUTE) == NULL)
{
mame_printf_error("%s: %s uses an incomplete CPU\n", driver->source_file, driver->name);
error = TRUE;
@ -766,33 +733,30 @@ static int validate_cpu(int drivnum, const machine_config *config, const input_p
}
/* check for CPU-specific validity check */
cpu_validity_check = (cpu_validity_check_func) cputype_get_info_fct(cpu->type, CPUINFO_PTR_VALIDITY_CHECK);
if (cpu_validity_check != NULL)
{
if ((*cpu_validity_check)(driver, config->cpu[cpunum].reset_param))
error = TRUE;
}
cpu_validity_check = (cpu_validity_check_func) cpu_get_info_fct(device, CPUINFO_PTR_VALIDITY_CHECK);
if (cpu_validity_check != NULL && (*cpu_validity_check)(driver, device->static_config))
error = TRUE;
/* loop over all address spaces */
for (spacenum = 0; spacenum < ADDRESS_SPACES; spacenum++)
{
#define SPACE_SHIFT(a) ((addr_shift < 0) ? ((a) << -addr_shift) : ((a) >> addr_shift))
#define SPACE_SHIFT_END(a) ((addr_shift < 0) ? (((a) << -addr_shift) | ((1 << -addr_shift) - 1)) : ((a) >> addr_shift))
int databus_width = cputype_get_databus_width(cpu->type, spacenum);
int addr_shift = cputype_get_addrbus_shift(cpu->type, spacenum);
int databus_width = cpu_get_databus_width(device, spacenum);
int addr_shift = cpu_get_addrbus_shift(device, spacenum);
int alignunit = databus_width/8;
address_map_entry *entry;
address_map *map;
/* check to see that the same map is not used twice */
if (cpu->address_map[spacenum][0] != NULL && cpu->address_map[spacenum][0] == cpu->address_map[spacenum][1])
if (cpuconfig->address_map[spacenum] != NULL && cpuconfig->address_map[spacenum] == cpuconfig->address_map2[spacenum])
{
mame_printf_error("%s: %s uses identical memory maps for CPU #%d spacenum %d\n", driver->source_file, driver->name, cpunum, spacenum);
mame_printf_error("%s: %s uses identical memory maps for CPU '%s' spacenum %d\n", driver->source_file, driver->name, device->tag, spacenum);
error = TRUE;
}
/* construct the maps */
map = address_map_alloc(config, driver, cpunum, spacenum);
map = address_map_alloc(device, driver, spacenum);
/* if this is an empty map, just skip it */
if (map->entrylist == NULL)
@ -804,12 +768,12 @@ static int validate_cpu(int drivnum, const machine_config *config, const input_p
/* validate the global map parameters */
if (map->spacenum != spacenum)
{
mame_printf_error("%s: %s CPU #%d space %d has address space %d handlers!\n", driver->source_file, driver->name, cpunum, spacenum, map->spacenum);
mame_printf_error("%s: %s CPU '%s' space %d has address space %d handlers!\n", driver->source_file, driver->name, device->tag, spacenum, map->spacenum);
error = TRUE;
}
if (map->databits != databus_width)
{
mame_printf_error("%s: %s cpu #%d uses wrong memory handlers for %s space! (width = %d, memory = %08x)\n", driver->source_file, driver->name, cpunum, address_space_names[spacenum], databus_width, map->databits);
mame_printf_error("%s: %s cpu '%s' uses wrong memory handlers for %s space! (width = %d, memory = %08x)\n", driver->source_file, driver->name, device->tag, address_space_names[spacenum], databus_width, map->databits);
error = TRUE;
}
@ -836,7 +800,7 @@ static int validate_cpu(int drivnum, const machine_config *config, const input_p
/* if this is a program space, auto-assign implicit ROM entries */
if ((FPTR)entry->read.generic == STATIC_ROM && entry->region == NULL)
{
entry->region = config->cpu[cpunum].tag;
entry->region = device->tag;
entry->rgnoffs = entry->addrstart;
}
@ -851,7 +815,7 @@ static int validate_cpu(int drivnum, const machine_config *config, const input_p
/* stop if we hit an empty */
if (rgninfo->entries[rgnnum].tag == NULL)
{
mame_printf_error("%s: %s CPU %d space %d memory map entry %X-%X references non-existant region \"%s\"\n", driver->source_file, driver->name, cpunum, spacenum, entry->addrstart, entry->addrend, entry->region);
mame_printf_error("%s: %s CPU '%s' %s space memory map entry %X-%X references non-existant region \"%s\"\n", driver->source_file, driver->name, device->tag, address_space_names[spacenum], entry->addrstart, entry->addrend, entry->region);
error = TRUE;
break;
}
@ -862,7 +826,7 @@ static int validate_cpu(int drivnum, const machine_config *config, const input_p
offs_t length = rgninfo->entries[rgnnum].length;
if (entry->rgnoffs + (byteend - bytestart + 1) > length)
{
mame_printf_error("%s: %s CPU %d space %d memory map entry %X-%X extends beyond region \"%s\" size (%X)\n", driver->source_file, driver->name, cpunum, spacenum, entry->addrstart, entry->addrend, entry->region, length);
mame_printf_error("%s: %s CPU '%s' %s space memory map entry %X-%X extends beyond region \"%s\" size (%X)\n", driver->source_file, driver->name, device->tag, address_space_names[spacenum], entry->addrstart, entry->addrend, entry->region, length);
error = TRUE;
}
break;
@ -873,19 +837,19 @@ static int validate_cpu(int drivnum, const machine_config *config, const input_p
/* make sure all devices exist */
if (entry->read_devtype != NULL && device_list_find_by_tag(config->devicelist, entry->read_devtype, entry->read_devtag) == NULL)
{
mame_printf_error("%s: %s CPU %d space %d memory map entry references nonexistant device type %s, tag %s\n", driver->source_file, driver->name, cpunum, spacenum, devtype_get_name(entry->read_devtype), entry->read_devtag);
mame_printf_error("%s: %s CPU '%s' %s space memory map entry references nonexistant device type %s, tag %s\n", driver->source_file, driver->name, device->tag, address_space_names[spacenum], devtype_get_name(entry->read_devtype), entry->read_devtag);
error = TRUE;
}
if (entry->write_devtype != NULL && device_list_find_by_tag(config->devicelist, entry->write_devtype, entry->write_devtag) == NULL)
{
mame_printf_error("%s: %s CPU %d space %d memory map entry references nonexistant device type %s, tag %s\n", driver->source_file, driver->name, cpunum, spacenum, devtype_get_name(entry->write_devtype), entry->write_devtag);
mame_printf_error("%s: %s CPU '%s' %s space memory map entry references nonexistant device type %s, tag %s\n", driver->source_file, driver->name, device->tag, address_space_names[spacenum], devtype_get_name(entry->write_devtype), entry->write_devtag);
error = TRUE;
}
/* make sure ports exist */
if (entry->read_porttag != NULL && input_port_by_tag(portlist, entry->read_porttag) == NULL)
{
mame_printf_error("%s: %s CPU %d space %d memory map entry references nonexistant port tag %s\n", driver->source_file, driver->name, cpunum, spacenum, entry->read_porttag);
mame_printf_error("%s: %s CPU '%s' %s space memory map entry references nonexistant port tag %s\n", driver->source_file, driver->name, device->tag, address_space_names[spacenum], entry->read_porttag);
error = TRUE;
}
}
@ -894,46 +858,43 @@ static int validate_cpu(int drivnum, const machine_config *config, const input_p
address_map_free(map);
/* validate the interrupts */
if (cpu->vblank_interrupt != NULL)
if (cpuconfig->vblank_interrupt != NULL)
{
if (video_screen_count(config) == 0)
{
mame_printf_error("%s: %s cpu #%d has a VBLANK interrupt, but the driver is screenless !\n", driver->source_file, driver->name, cpunum);
mame_printf_error("%s: %s cpu '%s' has a VBLANK interrupt, but the driver is screenless !\n", driver->source_file, driver->name, device->tag);
error = TRUE;
}
else if (cpu->vblank_interrupts_per_frame == 0)
else if (cpuconfig->vblank_interrupt_screen != NULL && cpuconfig->vblank_interrupts_per_frame != 0)
{
mame_printf_error("%s: %s cpu #%d has a VBLANK interrupt handler with 0 interrupts!\n", driver->source_file, driver->name, cpunum);
mame_printf_error("%s: %s cpu '%s' has a new VBLANK interrupt handler with >1 interrupts!\n", driver->source_file, driver->name, device->tag);
error = TRUE;
}
else if (cpu->vblank_interrupts_per_frame == 1)
else if (cpuconfig->vblank_interrupt_screen != NULL && device_list_find_by_tag(config->devicelist, VIDEO_SCREEN, cpuconfig->vblank_interrupt_screen) == NULL)
{
if (cpu->vblank_interrupt_screen == NULL)
{
mame_printf_error("%s: %s cpu #%d has a valid VBLANK interrupt handler with no screen tag supplied!\n", driver->source_file, driver->name, cpunum);
error = TRUE;
}
else if (device_list_index(config->devicelist, VIDEO_SCREEN, cpu->vblank_interrupt_screen) == -1)
{
mame_printf_error("%s: %s cpu #%d VBLANK interrupt with a non-existant screen tag (%s)!\n", driver->source_file, driver->name, cpunum, cpu->vblank_interrupt_screen);
error = TRUE;
}
mame_printf_error("%s: %s cpu '%s' VBLANK interrupt with a non-existant screen tag (%s)!\n", driver->source_file, driver->name, device->tag, cpuconfig->vblank_interrupt_screen);
error = TRUE;
}
else if (cpuconfig->vblank_interrupt_screen == NULL && cpuconfig->vblank_interrupts_per_frame == 0)
{
mame_printf_error("%s: %s cpu '%s' has a VBLANK interrupt handler with 0 interrupts!\n", driver->source_file, driver->name, device->tag);
error = TRUE;
}
}
else if (cpu->vblank_interrupts_per_frame != 0)
else if (cpuconfig->vblank_interrupts_per_frame != 0)
{
mame_printf_error("%s: %s cpu #%d has no VBLANK interrupt handler but a non-0 interrupt count is given!\n", driver->source_file, driver->name, cpunum);
mame_printf_error("%s: %s cpu '%s' has no VBLANK interrupt handler but a non-0 interrupt count is given!\n", driver->source_file, driver->name, device->tag);
error = TRUE;
}
if ((cpu->timed_interrupt != NULL) && (cpu->timed_interrupt_period == 0))
if (cpuconfig->timed_interrupt != NULL && cpuconfig->timed_interrupt_period == 0)
{
mame_printf_error("%s: %s cpu #%d has a timer interrupt handler with 0 period!\n", driver->source_file, driver->name, cpunum);
mame_printf_error("%s: %s cpu '%s' has a timer interrupt handler with 0 period!\n", driver->source_file, driver->name, device->tag);
error = TRUE;
}
else if ((cpu->timed_interrupt == NULL) && (cpu->timed_interrupt_period != 0))
else if (cpuconfig->timed_interrupt == NULL && cpuconfig->timed_interrupt_period != 0)
{
mame_printf_error("%s: %s cpu #%d has a no timer interrupt handler but has a non-0 period given!\n", driver->source_file, driver->name, cpunum);
mame_printf_error("%s: %s cpu '%s' has a no timer interrupt handler but has a non-0 period given!\n", driver->source_file, driver->name, device->tag);
error = TRUE;
}
}

View File

@ -326,9 +326,6 @@ void video_init(running_machine *machine)
global.frameskip_level = options_get_int(mame_options(), OPTION_FRAMESKIP);
global.seconds_to_run = options_get_int(mame_options(), OPTION_SECONDS_TO_RUN);
/* set the first screen device as the primary - this will set NULL if screenless */
machine->primary_screen = video_screen_first(machine->config);
/* create spriteram buffers if necessary */
if (machine->config->video_attributes & VIDEO_BUFFERS_SPRITERAM)
init_buffered_spriteram(machine);
@ -1110,7 +1107,7 @@ attotime video_screen_get_frame_period(const device_config *screen)
/* a lot of modules want to the period of the primary screen, so
if we are screenless, return something reasonable so that we don't fall over */
if (screen == NULL || video_screen_count(screen->machine->config) == 0)
if (screen == NULL || !screen->started || video_screen_count(screen->machine->config) == 0)
{
ret = DEFAULT_FRAME_PERIOD;
}

View File

@ -264,7 +264,7 @@ static SOUND_START( mario )
#endif
state->eabank = 0;
if (audiocpu != NULL && ((const cpu_class_header *)audiocpu->classtoken)->cputype != CPU_Z80)
if (audiocpu != NULL && cpu_get_type(audiocpu) != CPU_Z80)
{
state->eabank = 1;
memory_install_read8_handler(cpu_get_address_space(audiocpu, ADDRESS_SPACE_PROGRAM), 0x000, 0x7ff, 0, 0, SMH_BANK1);

View File

@ -79,7 +79,7 @@ void namcoc7x_sound_write16(UINT16 command, UINT32 offset)
void namcoc7x_on_driver_init(running_machine *machine)
{
UINT8 *pROM = (UINT8 *)memory_region(machine, "c7x");
int cpunum;
const device_config *cpu;
// clear the two 16-bits magic values at the start of the rom
// (prevents external init routines from getting called - they assume a
@ -87,9 +87,9 @@ void namcoc7x_on_driver_init(running_machine *machine)
memset(pROM, 0, 4);
// install speedup cheat
for (cpunum = 0; cpunum < MAX_CPU; cpunum++)
if (machine->config->cpu[cpunum].type == CPU_M37702)
memory_install_readwrite16_handler(cpu_get_address_space(machine->cpu[cpunum], ADDRESS_SPACE_PROGRAM), 0x82, 0x83, 0, 0, speedup_r, speedup_w);
for (cpu = machine->cpu[0]; cpu != NULL; cpu = cpu->typenext)
if (cpu_get_type(cpu) == CPU_M37702)
memory_install_readwrite16_handler(cpu_get_address_space(cpu, ADDRESS_SPACE_PROGRAM), 0x82, 0x83, 0, 0, speedup_r, speedup_w);
}
void namcoc7x_set_host_ram(UINT32 *hostram)

View File

@ -65,7 +65,7 @@ static WRITE8_HANDLER( irqack_w )
{
int bit = data & 1;
cpu_interrupt_enable(0, bit);
cpu_interrupt_enable(space->machine->cpu[0], bit);
if (!bit)
cpu_set_input_line(space->machine->cpu[0], 0, CLEAR_LINE );

View File

@ -955,7 +955,7 @@ static void init_g1_common(running_machine *machine, offs_t slapstic_base, int s
state_save_register_postload(machine, pitfighb_state_postload, NULL);
}
else if (slapstic != 0)
atarigen_slapstic_init(machine, 0, slapstic_base, 0, slapstic);
atarigen_slapstic_init(machine->cpu[0], slapstic_base, 0, slapstic);
atarijsa_init(machine, "IN0", 0x4000);
atarig1_pitfight = is_pitfight;

View File

@ -2146,7 +2146,7 @@ ROM_END
static DRIVER_INIT( marble )
{
atarigen_eeprom_default = NULL;
atarigen_slapstic_init(machine, 0, 0x080000, 0, 103);
atarigen_slapstic_init(machine->cpu[0], 0x080000, 0, 103);
joystick_type = 0; /* none */
trackball_type = 1; /* rotated */
@ -2156,7 +2156,7 @@ static DRIVER_INIT( marble )
static DRIVER_INIT( peterpak )
{
atarigen_eeprom_default = NULL;
atarigen_slapstic_init(machine, 0, 0x080000, 0, 107);
atarigen_slapstic_init(machine->cpu[0], 0x080000, 0, 107);
joystick_type = 1; /* digital */
trackball_type = 0; /* none */
@ -2166,7 +2166,7 @@ static DRIVER_INIT( peterpak )
static DRIVER_INIT( indytemp )
{
atarigen_eeprom_default = NULL;
atarigen_slapstic_init(machine, 0, 0x080000, 0, 105);
atarigen_slapstic_init(machine->cpu[0], 0x080000, 0, 105);
joystick_type = 1; /* digital */
trackball_type = 0; /* none */
@ -2176,7 +2176,7 @@ static DRIVER_INIT( indytemp )
static DRIVER_INIT( roadrunn )
{
atarigen_eeprom_default = NULL;
atarigen_slapstic_init(machine, 0, 0x080000, 0, 108);
atarigen_slapstic_init(machine->cpu[0], 0x080000, 0, 108);
joystick_type = 2; /* analog */
trackball_type = 0; /* none */
@ -2186,7 +2186,7 @@ static DRIVER_INIT( roadrunn )
static DRIVER_INIT( roadb109 )
{
atarigen_eeprom_default = NULL;
atarigen_slapstic_init(machine, 0, 0x080000, 0, 109);
atarigen_slapstic_init(machine->cpu[0], 0x080000, 0, 109);
joystick_type = 3; /* pedal */
trackball_type = 2; /* steering wheel */
@ -2196,7 +2196,7 @@ static DRIVER_INIT( roadb109 )
static DRIVER_INIT( roadb110 )
{
atarigen_eeprom_default = NULL;
atarigen_slapstic_init(machine, 0, 0x080000, 0, 110);
atarigen_slapstic_init(machine->cpu[0], 0x080000, 0, 110);
joystick_type = 3; /* pedal */
trackball_type = 2; /* steering wheel */

View File

@ -72,16 +72,16 @@ VIDEO_UPDATE( brkthru );
static WRITE8_HANDLER( brkthru_1803_w )
{
/* bit 0 = NMI enable */
cpu_interrupt_enable(0, ~data & 1);
cpu_interrupt_enable(space->machine->cpu[0], ~data & 1);
/* bit 1 = ? maybe IRQ acknowledge */
}
static WRITE8_HANDLER( darwin_0803_w )
{
/* bit 0 = NMI enable */
/*cpu_interrupt_enable(1, ~data & 1);*/
/*cpu_interrupt_enable(space->machine->cpu[1], ~data & 1);*/
logerror("0803 %02X\n",data);
cpu_interrupt_enable(0, data & 1);
cpu_interrupt_enable(space->machine->cpu[0], data & 1);
/* bit 1 = ? maybe IRQ acknowledge */
}

View File

@ -247,7 +247,7 @@ static WRITE8_HANDLER(toprollr_rombank_w)
static TIMER_CALLBACK( disable_interrupts )
{
cpu_interrupt_enable(0,0);
cpu_interrupt_enable(machine->cpu[0],0);
}

View File

@ -128,7 +128,7 @@ static WRITE8_HANDLER( irq_enable_w )
{
int bit = data & 1;
cpu_interrupt_enable(0,bit);
cpu_interrupt_enable(space->machine->cpu[0],bit);
if (!bit)
cpu_set_input_line(space->machine->cpu[0], 0, CLEAR_LINE);
}

View File

@ -1504,7 +1504,7 @@ ROM_END
static void cojag_common_init(running_machine *machine, UINT16 gpu_jump_offs, UINT16 spin_pc)
{
/* copy over the ROM */
cojag_is_r3000 = (machine->config->cpu[0].type == CPU_R3041BE);
cojag_is_r3000 = (cpu_get_type(machine->cpu[0]) == CPU_R3041BE);
/* install synchronization hooks for GPU */
if (cojag_is_r3000)

View File

@ -159,7 +159,7 @@ static READ8_HANDLER( pc3259_r )
static WRITE8_HANDLER( port_sound_w )
{
/* D0 - interrupt enable - also goes to PC3259 as /HTCTRL */
cpu_interrupt_enable(0, (data & 0x01) ? TRUE : FALSE);
cpu_interrupt_enable(space->machine->cpu[0], (data & 0x01) ? TRUE : FALSE);
crbaloon_set_clear_collision_address((data & 0x01) ? TRUE : FALSE);
/* D1 - SOUND STOP */

View File

@ -971,14 +971,14 @@ static const UINT16 default_eeprom[] =
static DRIVER_INIT( cyberbal )
{
atarigen_eeprom_default = default_eeprom;
atarigen_slapstic_init(machine, 0, 0x018000, 0, 0);
atarigen_slapstic_init(machine->cpu[0], 0x018000, 0, 0);
}
static DRIVER_INIT( cyberbt )
{
atarigen_eeprom_default = default_eeprom;
atarigen_slapstic_init(machine, 0, 0x018000, 0, 116);
atarigen_slapstic_init(machine->cpu[0], 0x018000, 0, 116);
}

View File

@ -262,7 +262,7 @@ GFXDECODE_END
static void irqhandler(running_machine *machine, int linestate)
{
/* system 16c doesn't have the sound CPU */
if (machine->config->cpu[1].type != CPU_DUMMY)
if (machine->cpu[1] != NULL)
cpu_set_input_line(machine->cpu[1],0,linestate);
}

View File

@ -338,7 +338,7 @@ static WRITE8_DEVICE_HANDLER( p8257_ctl_w );
static const z80dma_interface dk3_dma =
{
0,
"main",
CLOCK_1H,
dk_dma_read_byte,
@ -349,7 +349,7 @@ static const z80dma_interface dk3_dma =
static const dma8257_interface dk_dma =
{
0,
"main",
CLOCK_1H,
dk_dma_read_byte,
@ -362,7 +362,7 @@ static const dma8257_interface dk_dma =
static const dma8257_interface hb_dma =
{
0,
"main",
CLOCK_1H,
hb_dma_read_byte,

View File

@ -19,7 +19,7 @@ static UINT8 sound_nmi_enabled;
static TIMER_CALLBACK( interrupt_disable )
{
//interrupt_enable = 0;
cpu_interrupt_enable(0,0);
cpu_interrupt_enable(machine->cpu[0],0);
}
MACHINE_RESET( espial )

View File

@ -613,7 +613,7 @@ static WRITE8_HANDLER(dma_page_select_w)
static const struct dma8237_interface dma8237_1_config =
{
0,
"main",
1.0e-6, // 1us
pc_dma_read_byte,

View File

@ -741,19 +741,19 @@ static WRITE8_HANDLER( bosco_latch_w )
switch (offset)
{
case 0x00: /* IRQ1 */
cpu_interrupt_enable(0,bit);
cpu_interrupt_enable(space->machine->cpu[0],bit);
if (!bit)
cpu_set_input_line(space->machine->cpu[0], 0, CLEAR_LINE);
break;
case 0x01: /* IRQ2 */
cpu_interrupt_enable(1,bit);
cpu_interrupt_enable(space->machine->cpu[1],bit);
if (!bit)
cpu_set_input_line(space->machine->cpu[1], 0, CLEAR_LINE);
break;
case 0x02: /* NMION */
cpu_interrupt_enable(2,!bit);
cpu_interrupt_enable(space->machine->cpu[2],!bit);
break;
case 0x03: /* RESET */

View File

@ -441,7 +441,7 @@ static DMA8237_MEM_WRITE( pc_dma_write_byte )
static const struct dma8237_interface dma8237_1_config =
{
0,
"main",
1.0e-6, // 1us
pc_dma_read_byte,
@ -455,7 +455,7 @@ static const struct dma8237_interface dma8237_1_config =
static const struct dma8237_interface dma8237_2_config =
{
0,
"main",
1.0e-6, // 1us
NULL,

View File

@ -255,7 +255,7 @@ static WRITE8_HANDLER( gaplus_snd_sharedram_w )
static WRITE8_HANDLER( gaplus_irq_1_ctrl_w )
{
int bit = !BIT(offset,11);
cpu_interrupt_enable(0,bit);
cpu_interrupt_enable(space->machine->cpu[0],bit);
if (!bit)
cpu_set_input_line(space->machine->cpu[0], 0, CLEAR_LINE);
}
@ -263,7 +263,7 @@ static WRITE8_HANDLER( gaplus_irq_1_ctrl_w )
static WRITE8_HANDLER( gaplus_irq_3_ctrl_w )
{
int bit = !BIT(offset,13);
cpu_interrupt_enable(2,bit);
cpu_interrupt_enable(space->machine->cpu[2],bit);
if (!bit)
cpu_set_input_line(space->machine->cpu[2], 0, CLEAR_LINE);
}
@ -271,7 +271,7 @@ static WRITE8_HANDLER( gaplus_irq_3_ctrl_w )
static WRITE8_HANDLER( gaplus_irq_2_ctrl_w )
{
int bit = offset & 1;
cpu_interrupt_enable(1,bit);
cpu_interrupt_enable(space->machine->cpu[1],bit);
if (!bit)
cpu_set_input_line(space->machine->cpu[1], 0, CLEAR_LINE);
}
@ -295,7 +295,7 @@ logerror("%04x: freset %d\n",cpu_get_pc(space->cpu),bit);
static MACHINE_RESET( gaplus )
{
/* on reset, VINTON is reset, while the other flags don't seem to be affected */
cpu_interrupt_enable(1,0);
cpu_interrupt_enable(machine->cpu[1],0);
cpu_set_input_line(machine->cpu[1], 0, CLEAR_LINE);
}

View File

@ -1628,7 +1628,7 @@ static void gauntlet_common_init(running_machine *machine, int slapstic, int vin
{
UINT8 *rom = memory_region(machine, "main");
atarigen_eeprom_default = NULL;
atarigen_slapstic_init(machine, 0, 0x038000, 0, slapstic);
atarigen_slapstic_init(machine->cpu[0], 0x038000, 0, slapstic);
/* swap the top and bottom halves of the main CPU ROM images */
atarigen_swap_mem(rom + 0x000000, rom + 0x008000, 0x8000);

View File

@ -148,7 +148,7 @@ MACHINE_START( genesis )
MACHINE_RESET( genesis )
{
/* C2 doesn't have a Z80, so we can't just assume */
if (machine->config->cpu[1].type == CPU_Z80)
if (machine->cpu[1] != NULL && cpu_get_type(machine->cpu[1]) == CPU_Z80)
{
/* the following ensures that the Z80 begins without running away from 0 */
/* 0x76 is just a forced 'halt' as soon as the CPU is initially run */

View File

@ -3461,10 +3461,10 @@ static void init_ds3(running_machine *machine)
memory_install_write16_handler(cpu_get_address_space(hdcpu_main, ADDRESS_SPACE_PROGRAM), 0x823800, 0x823fff, 0, 0, hd68k_ds3_control_w);
/* if we have a sound DSP, boot it */
if (hdcpu_sound != NULL && ((const cpu_class_header *)hdcpu_sound->classtoken)->cputype == CPU_ADSP2105)
if (hdcpu_sound != NULL && cpu_get_type(hdcpu_sound) == CPU_ADSP2105)
adsp2105_load_boot_data((UINT8 *)(hdcpu_sound->region + 0x10000), (UINT32 *)hdcpu_sound->region);
if (hdcpu_sounddsp != NULL && ((const cpu_class_header *)hdcpu_sounddsp->classtoken)->cputype == CPU_ADSP2105)
if (hdcpu_sounddsp != NULL && cpu_get_type(hdcpu_sounddsp) == CPU_ADSP2105)
adsp2105_load_boot_data((UINT8 *)(hdcpu_sounddsp->region + 0x10000), (UINT32 *)hdcpu_sounddsp->region);
/*

View File

@ -589,13 +589,15 @@ static const via6522_interface via_interface =
void itech8_update_interrupts(running_machine *machine, int periodic, int tms34061, int blitter)
{
cpu_type main_cpu_type = cpu_get_type(machine->cpu[0]);
/* update the states */
if (periodic != -1) periodic_int = periodic;
if (tms34061 != -1) tms34061_int = tms34061;
if (blitter != -1) blitter_int = blitter;
/* handle the 6809 case */
if (machine->config->cpu[0].type == CPU_M6809 || machine->config->cpu[0].type == CPU_HD6309)
if (main_cpu_type == CPU_M6809 || main_cpu_type == CPU_HD6309)
{
/* just modify lines that have changed */
if (periodic != -1) cpu_set_input_line(machine->cpu[0], INPUT_LINE_NMI, periodic ? ASSERT_LINE : CLEAR_LINE);
@ -673,8 +675,10 @@ static MACHINE_START( sstrike )
static MACHINE_RESET( itech8 )
{
cpu_type main_cpu_type = cpu_get_type(machine->cpu[0]);
/* make sure bank 0 is selected */
if (machine->config->cpu[0].type == CPU_M6809 || machine->config->cpu[0].type == CPU_HD6309)
if (main_cpu_type == CPU_M6809 || main_cpu_type == CPU_HD6309)
{
memory_set_bankptr(machine, 1, &memory_region(machine, "main")[0x4000]);
cpu_reset(machine->cpu[0]);

View File

@ -40,7 +40,7 @@ MACHINE_RESET( kyugo )
{
const address_space *space = cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM);
// must start with interrupts and sub CPU disabled
cpu_interrupt_enable(0, 0);
cpu_interrupt_enable(machine->cpu[0], 0);
kyugo_sub_cpu_control_w(space, 0, 0);
}

View File

@ -702,13 +702,13 @@ static WRITE8_HANDLER( superpac_latch_w )
switch (offset & 0x0e)
{
case 0x00: /* INT ON 2 */
cpu_interrupt_enable(1,bit);
cpu_interrupt_enable(space->machine->cpu[1],bit);
if (!bit)
cpu_set_input_line(space->machine->cpu[1], 0, CLEAR_LINE);
break;
case 0x02: /* INT ON */
cpu_interrupt_enable(0,bit);
cpu_interrupt_enable(space->machine->cpu[0],bit);
if (!bit)
cpu_set_input_line(space->machine->cpu[0], 0, CLEAR_LINE);
break;
@ -744,19 +744,19 @@ static WRITE8_HANDLER( phozon_latch_w )
switch (offset & 0x0e)
{
case 0x00:
cpu_interrupt_enable(1,bit);
cpu_interrupt_enable(space->machine->cpu[1],bit);
if (!bit)
cpu_set_input_line(space->machine->cpu[1], 0, CLEAR_LINE);
break;
case 0x02:
cpu_interrupt_enable(0,bit);
cpu_interrupt_enable(space->machine->cpu[0],bit);
if (!bit)
cpu_set_input_line(space->machine->cpu[0], 0, CLEAR_LINE);
break;
case 0x04:
cpu_interrupt_enable(2,bit);
cpu_interrupt_enable(space->machine->cpu[2],bit);
if (!bit)
cpu_set_input_line(space->machine->cpu[2], 0, CLEAR_LINE);
break;
@ -790,13 +790,13 @@ static WRITE8_HANDLER( mappy_latch_w )
switch (offset & 0x0e)
{
case 0x00: /* INT ON 2 */
cpu_interrupt_enable(1,bit);
cpu_interrupt_enable(space->machine->cpu[1],bit);
if (!bit)
cpu_set_input_line(space->machine->cpu[1], 0, CLEAR_LINE);
break;
case 0x02: /* INT ON */
cpu_interrupt_enable(0,bit);
cpu_interrupt_enable(space->machine->cpu[0],bit);
if (!bit)
cpu_set_input_line(space->machine->cpu[0], 0, CLEAR_LINE);
break;

View File

@ -105,7 +105,7 @@ static WRITE8_DEVICE_HANDLER(mario_dma_write_byte);
static const z80dma_interface mario_dma =
{
0,
"main",
Z80_CLOCK,
mario_dma_read_byte,

View File

@ -792,7 +792,7 @@ static DMA8237_MEM_WRITE( pc_dma_write_byte )
static const struct dma8237_interface dma8237_1_config =
{
0,
"main",
1.0e-6, // 1us
pc_dma_read_byte,
@ -806,7 +806,7 @@ static const struct dma8237_interface dma8237_1_config =
static const struct dma8237_interface dma8237_2_config =
{
0,
"main",
1.0e-6, // 1us
NULL,

View File

@ -68,7 +68,7 @@ static READ8_HANDLER( nbmj8991_sound_r )
static MACHINE_RESET( nbmj8991 )
{
if (machine->config->cpu[1].type == CPU_Z80)
if (cpu_get_type(machine->cpu[1]) == CPU_Z80)
{
memory_configure_bank(machine, 1, 0, 4, memory_region(machine, "audio") + 0x8000, 0x8000);
memory_set_bank(machine, 1, 0);

View File

@ -232,7 +232,7 @@ static WRITE8_HANDLER( pacland_led_w )
static WRITE8_HANDLER( pacland_irq_1_ctrl_w )
{
int bit = !BIT(offset,11);
cpu_interrupt_enable(0,bit);
cpu_interrupt_enable(space->machine->cpu[0],bit);
if (!bit)
cpu_set_input_line(space->machine->cpu[0], 0, CLEAR_LINE);
}
@ -240,7 +240,7 @@ static WRITE8_HANDLER( pacland_irq_1_ctrl_w )
static WRITE8_HANDLER( pacland_irq_2_ctrl_w )
{
int bit = !BIT(offset,13);
cpu_interrupt_enable(1,bit);
cpu_interrupt_enable(space->machine->cpu[1],bit);
if (!bit)
cpu_set_input_line(space->machine->cpu[1], 0, CLEAR_LINE);
}

View File

@ -286,7 +286,7 @@ static WRITE8_HANDLER( polepos_latch_w )
switch (offset)
{
case 0x00: /* IRQON */
cpu_interrupt_enable(0,bit);
cpu_interrupt_enable(space->machine->cpu[0],bit);
if (!bit)
cpu_set_input_line(space->machine->cpu[0], 0, CLEAR_LINE);
break;
@ -330,7 +330,7 @@ static WRITE16_HANDLER( polepos_z8002_nvi_enable_w )
{
data &= 1;
cpu_interrupt_enable(cpu_get_index(space->cpu),data);
cpu_interrupt_enable(space->cpu,data);
if (!data)
cpu_set_input_line(space->cpu, 0, CLEAR_LINE);
}

View File

@ -240,7 +240,7 @@ static WRITE8_HANDLER( rallyx_latch_w )
break;
case 0x01: /* INT ON */
cpu_interrupt_enable(0,bit);
cpu_interrupt_enable(space->machine->cpu[0],bit);
if (!bit)
cpu_set_input_line(space->machine->cpu[0], 0, CLEAR_LINE);
break;
@ -284,7 +284,7 @@ static WRITE8_HANDLER( locomotn_latch_w )
break;
case 0x01: /* INTST */
cpu_interrupt_enable(0,bit);
cpu_interrupt_enable(space->machine->cpu[0],bit);
break;
case 0x02: /* MUT */

View File

@ -528,7 +528,7 @@ static DRIVER_INIT( rampart )
atarigen_eeprom_default = compressed_default_eeprom;
memcpy(&rom[0x140000], &rom[0x40000], 0x8000);
atarigen_slapstic_init(machine, 0, 0x140000, 0x438000, 118);
atarigen_slapstic_init(machine->cpu[0], 0x140000, 0x438000, 118);
}

View File

@ -74,7 +74,7 @@ static WRITE8_HANDLER( irq0_ack_w )
{
int bit = data & 1;
cpu_interrupt_enable(0,bit);
cpu_interrupt_enable(space->machine->cpu[0],bit);
if (!bit)
cpu_set_input_line(space->machine->cpu[0], 0, CLEAR_LINE);
}
@ -83,7 +83,7 @@ static WRITE8_HANDLER( irq1_ack_w )
{
int bit = data & 1;
cpu_interrupt_enable(1,bit);
cpu_interrupt_enable(space->machine->cpu[1],bit);
if (!bit)
cpu_set_input_line(space->machine->cpu[1], 0, CLEAR_LINE);
}

View File

@ -202,7 +202,7 @@ static MACHINE_RESET( system18 )
fd1094_machine_init(machine->cpu[0]);
/* if we are running with a real live 8751, we need to boost the interleave at startup */
if (machine->config->cpu[2].type == CPU_I8751)
if (machine->cpu[2] != NULL && cpu_get_type(machine->cpu[2]) == CPU_I8751)
timer_call_after_resynch(machine, NULL, 0, boost_interleave);
}

View File

@ -1737,7 +1737,7 @@ static MACHINE_RESET( spi )
static MACHINE_DRIVER_START( spi )
/* basic machine hardware */
MDRV_CPU_ADD("main",I386, 50000000/2) /* Intel 386DX, 25MHz */
MDRV_CPU_ADD("main", I386, 50000000/2) /* Intel 386DX, 25MHz */
MDRV_CPU_PROGRAM_MAP(spi_map, 0)
MDRV_CPU_VBLANK_INT("main", spi_interrupt)

View File

@ -98,7 +98,7 @@ static WRITE8_HANDLER( friskyt_portB_w )
{
//logerror("PC %04x: 8910 port B = %02x\n",cpu_get_pc(space->cpu),data);
/* bit 0 is IRQ enable */
cpu_interrupt_enable(0,data & 1);
cpu_interrupt_enable(space->machine->cpu[0],data & 1);
/* bit 1 flips screen */

View File

@ -90,7 +90,7 @@ static WRITE8_HANDLER( skykid_bankswitch_w )
static WRITE8_HANDLER( skykid_irq_1_ctrl_w )
{
int bit = !BIT(offset,11);
cpu_interrupt_enable(0,bit);
cpu_interrupt_enable(space->machine->cpu[0],bit);
if (!bit)
cpu_set_input_line(space->machine->cpu[0], 0, CLEAR_LINE);
}
@ -98,7 +98,7 @@ static WRITE8_HANDLER( skykid_irq_1_ctrl_w )
static WRITE8_HANDLER( skykid_irq_2_ctrl_w )
{
int bit = !BIT(offset,13);
cpu_interrupt_enable(1,bit);
cpu_interrupt_enable(space->machine->cpu[1],bit);
if (!bit)
cpu_set_input_line(space->machine->cpu[1], 0, CLEAR_LINE);
}

View File

@ -386,7 +386,7 @@ static DMA8237_MEM_WRITE( pc_dma_write_byte )
static const struct dma8237_interface dma8237_1_config =
{
0,
"main",
1.0e-6, // 1us
pc_dma_read_byte,
@ -400,7 +400,7 @@ static const struct dma8237_interface dma8237_1_config =
static const struct dma8237_interface dma8237_2_config =
{
0,
"main",
1.0e-6, // 1us
NULL,

View File

@ -154,30 +154,30 @@ static WRITE16_HANDLER( toypop_m68000_sharedram_w )
static READ8_HANDLER( toypop_main_interrupt_enable_r )
{
cpu_interrupt_enable(0,1);
cpu_interrupt_enable(space->machine->cpu[0],1);
return 0;
}
static WRITE8_HANDLER( toypop_main_interrupt_enable_w )
{
cpu_interrupt_enable(0,1);
cpu_interrupt_enable(space->machine->cpu[0],1);
cpu_set_input_line(space->machine->cpu[0], 0, CLEAR_LINE);
}
static WRITE8_HANDLER( toypop_main_interrupt_disable_w )
{
cpu_interrupt_enable(0,0);
cpu_interrupt_enable(space->machine->cpu[0],0);
}
static WRITE8_HANDLER( toypop_sound_interrupt_enable_acknowledge_w )
{
cpu_interrupt_enable(1,1);
cpu_interrupt_enable(space->machine->cpu[1],1);
cpu_set_input_line(space->machine->cpu[1], 0, CLEAR_LINE);
}
static WRITE8_HANDLER( toypop_sound_interrupt_disable_w )
{
cpu_interrupt_enable(1,0);
cpu_interrupt_enable(space->machine->cpu[1],0);
}
static INTERRUPT_GEN( toypop_main_interrupt )
@ -212,9 +212,9 @@ static WRITE8_HANDLER( toypop_m68000_assert_w )
static TIMER_CALLBACK( disable_interrupts )
{
cpu_interrupt_enable(0,0);
cpu_interrupt_enable(machine->cpu[0],0);
cpu_set_input_line(machine->cpu[0], 0, CLEAR_LINE);
cpu_interrupt_enable(1,0);
cpu_interrupt_enable(machine->cpu[1],0);
cpu_set_input_line(machine->cpu[1], 0, CLEAR_LINE);
interrupt_enable_68k = 0;
}

View File

@ -288,7 +288,7 @@ static WRITE8_HANDLER( warpwarp_out3_w )
break;
case 6:
warpwarp_ball_on = data & 1;
cpu_interrupt_enable(0,data & 1);
cpu_interrupt_enable(space->machine->cpu[0],data & 1);
if (~data & 1)
cpu_set_input_line(space->machine->cpu[0], 0, CLEAR_LINE);
break;

View File

@ -383,7 +383,7 @@ ROM_END
static DRIVER_INIT( xybots )
{
atarigen_eeprom_default = NULL;
atarigen_slapstic_init(machine, 0, 0x008000, 0, 107);
atarigen_slapstic_init(machine->cpu[0], 0x008000, 0, 107);
atarijsa_init(machine, "FFE200", 0x0100);
}

View File

@ -535,7 +535,7 @@ static DIRECT_UPDATE_HANDLER( atarigen_slapstic_setdirect )
slapstic and sets the chip number.
---------------------------------------------------------------*/
void atarigen_slapstic_init(running_machine *machine, int cpunum, offs_t base, offs_t mirror, int chipnum)
void atarigen_slapstic_init(const device_config *device, offs_t base, offs_t mirror, int chipnum)
{
/* reset in case we have no state */
atarigen_slapstic_num = chipnum;
@ -545,10 +545,10 @@ void atarigen_slapstic_init(running_machine *machine, int cpunum, offs_t base, o
if (chipnum != 0)
{
/* initialize the slapstic */
slapstic_init(machine, chipnum);
slapstic_init(device->machine, chipnum);
/* install the memory handlers */
atarigen_slapstic = memory_install_readwrite16_handler(cpu_get_address_space(machine->cpu[cpunum], ADDRESS_SPACE_PROGRAM), base, base + 0x7fff, 0, mirror, atarigen_slapstic_r, atarigen_slapstic_w);
atarigen_slapstic = memory_install_readwrite16_handler(cpu_get_address_space(device, ADDRESS_SPACE_PROGRAM), base, base + 0x7fff, 0, mirror, atarigen_slapstic_r, atarigen_slapstic_w);
/* allocate memory for a copy of bank 0 */
atarigen_slapstic_bank0 = auto_malloc(0x2000);
@ -560,7 +560,7 @@ void atarigen_slapstic_init(running_machine *machine, int cpunum, offs_t base, o
/* install an opcode base handler if we are a 68000 or variant */
atarigen_slapstic_base = base;
atarigen_slapstic_mirror = mirror;
memory_set_direct_update_handler(cpu_get_address_space(machine->cpu[cpunum], ADDRESS_SPACE_PROGRAM), atarigen_slapstic_setdirect);
memory_set_direct_update_handler(cpu_get_address_space(device, ADDRESS_SPACE_PROGRAM), atarigen_slapstic_setdirect);
}
}

View File

@ -134,7 +134,7 @@ NVRAM_HANDLER( atarigen );
SLAPSTIC HANDLING
---------------------------------------------------------------*/
void atarigen_slapstic_init(running_machine *machine, int cpunum, offs_t base, offs_t mirror, int chipnum);
void atarigen_slapstic_init(const device_config *device, offs_t base, offs_t mirror, int chipnum);
void atarigen_slapstic_reset(void);
WRITE16_HANDLER( atarigen_slapstic_w );

View File

@ -27,7 +27,7 @@ WRITE8_HANDLER( bublbobl_bankswitch_w )
cpu_set_input_line(space->machine->cpu[1], INPUT_LINE_RESET, (data & 0x10) ? CLEAR_LINE : ASSERT_LINE);
/* bit 5 resets mcu */
if (space->machine->config->cpu[3].type != CPU_DUMMY) // only if we have a MCU
if (space->machine->cpu[3] != NULL) // only if we have a MCU
cpu_set_input_line(space->machine->cpu[3], INPUT_LINE_RESET, (data & 0x20) ? CLEAR_LINE : ASSERT_LINE);
/* bit 6 enables display */

View File

@ -409,7 +409,7 @@ MACHINE_RESET( leland )
memory_set_bankptr(machine, 3, &slave_base[0x10000]);
/* if we have an I80186 CPU, reset it */
if (machine->config->cpu[2].type == CPU_I80186)
if (cpu_get_type(machine->cpu[2]) == CPU_I80186)
leland_80186_sound_init();
}

View File

@ -23,7 +23,7 @@ bit 0 = ? (unused?)
WRITE8_HANDLER( mexico86_f008_w )
{
cpu_set_input_line(space->machine->cpu[1], INPUT_LINE_RESET, (data & 4) ? CLEAR_LINE : ASSERT_LINE);
if (space->machine->config->cpu[2].type != CPU_DUMMY)
if (space->machine->cpu[2] != NULL)
{
// mexico 86, knight boy
cpu_set_input_line(space->machine->cpu[2], INPUT_LINE_RESET, (data & 2) ? CLEAR_LINE : ASSERT_LINE);

View File

@ -681,8 +681,8 @@ static WRITE8_HANDLER( unknown_w )
/* Main bankswitching routine */
static void set_bank(running_machine *machine, int banknum, const bankhandler *handler)
{
const address_space *space = cpu_get_address_space(machine->cpu[(banknum >> 3) & 1], ADDRESS_SPACE_PROGRAM);
int bankstart = (banknum & 7) * 0x2000;
int cpunum = (banknum >> 3) & 1;
/* for BANK handlers , memory direct and OP-code base */
if (handler->bank_pointer)
@ -692,12 +692,12 @@ static void set_bank(running_machine *machine, int banknum, const bankhandler *h
if (!handler->bank_handler_r)
{
if (namcos1_active_bank[banknum].bank_handler_r)
memory_install_read8_handler(cpu_get_address_space(machine->cpu[cpunum], ADDRESS_SPACE_PROGRAM), bankstart, bankstart + 0x1fff, 0, 0, ram_bank_handler_r[banknum]);
memory_install_read8_handler(space, bankstart, bankstart + 0x1fff, 0, 0, ram_bank_handler_r[banknum]);
}
else
{
if (!namcos1_active_bank[banknum].bank_handler_r)
memory_install_read8_handler(cpu_get_address_space(machine->cpu[cpunum], ADDRESS_SPACE_PROGRAM), bankstart, bankstart + 0x1fff, 0, 0, io_bank_handler_r[banknum]);
memory_install_read8_handler(space, bankstart, bankstart + 0x1fff, 0, 0, io_bank_handler_r[banknum]);
}
/* write handlers (except for the 0xe000-0xffff range) */
@ -706,12 +706,12 @@ static void set_bank(running_machine *machine, int banknum, const bankhandler *h
if (!handler->bank_handler_w)
{
if (namcos1_active_bank[banknum].bank_handler_w)
memory_install_write8_handler(cpu_get_address_space(machine->cpu[cpunum], ADDRESS_SPACE_PROGRAM), bankstart, bankstart + 0x1fff, 0, 0, ram_bank_handler_w[banknum]);
memory_install_write8_handler(space, bankstart, bankstart + 0x1fff, 0, 0, ram_bank_handler_w[banknum]);
}
else
{
if (!namcos1_active_bank[banknum].bank_handler_r)
memory_install_write8_handler(cpu_get_address_space(machine->cpu[cpunum], ADDRESS_SPACE_PROGRAM), bankstart, bankstart + 0x1fff, 0, 0, io_bank_handler_w[banknum]);
memory_install_write8_handler(space, bankstart, bankstart + 0x1fff, 0, 0, io_bank_handler_w[banknum]);
}
}

View File

@ -325,7 +325,7 @@ static void update_memory_mapping(running_machine *machine, struct memory_mapper
if (LOG_MEMORY_MAP) mame_printf_debug("----\nRemapping:\n");
/* first reset everything back to the beginning */
memory_install_readwrite16_handler(cpu_get_address_space(machine->cpu[cpu_get_index(chip->cpu)], ADDRESS_SPACE_PROGRAM), 0x000000, 0xffffff, 0, 0, segaic16_memory_mapper_lsb_r, segaic16_memory_mapper_lsb_w);
memory_install_readwrite16_handler(cpu_get_address_space(chip->cpu, ADDRESS_SPACE_PROGRAM), 0x000000, 0xffffff, 0, 0, segaic16_memory_mapper_lsb_r, segaic16_memory_mapper_lsb_w);
/* loop over the regions */
for (rgnum = 0; chip->map[rgnum].regbase != 0; rgnum++)

View File

@ -806,6 +806,8 @@ static FILE *slapsticlog;
void slapstic_init(running_machine *machine, int chip)
{
cpu_type cputype = cpu_get_type(machine->cpu[0]);
/* only a small number of chips are known to exist */
if (chip < 101 || chip > 118)
return;
@ -819,8 +821,7 @@ void slapstic_init(running_machine *machine, int chip)
slapstic_reset();
/* see if we're 68k or 6502/6809 based */
access_68k = (machine->config->cpu[0].type == CPU_M68000 ||
machine->config->cpu[0].type == CPU_M68010);
access_68k = (cputype == CPU_M68000 || cputype == CPU_M68010);
/* save state */
state_save_register_item(machine, "slapstic", NULL, 0, state);

View File

@ -53,8 +53,8 @@ MACHINE_RESET( taitosj )
zaccept = 1;
zready = 0;
busreq = 0;
if (machine->config->cpu[2].type != CPU_DUMMY)
cpu_set_input_line(machine->cpu[2],0,CLEAR_LINE);
if (machine->cpu[2] != NULL)
cpu_set_input_line(machine->cpu[2],0,CLEAR_LINE);
spacecr_prot_value = 0;
}

View File

@ -713,7 +713,7 @@ WRITE8_HANDLER( tnzs_bankswitch1_w )
/* bit 2 resets the mcu */
if (data & 0x04)
{
if (space->machine->config->cpu[2].type == CPU_I8742)
if (space->machine->cpu[2] != NULL && cpu_get_type(space->machine->cpu[2]) == CPU_I8742)
cpu_set_input_line(space->machine->cpu[2], INPUT_LINE_RESET, PULSE_LINE);
}
/* Coin count and lockout is handled by the i8742 */

View File

@ -232,7 +232,7 @@ WRITE16_HANDLER( toaplan1_reset_sound )
logerror("PC:%04x Resetting Sound CPU and Sound chip (%08x)\n",cpu_get_previouspc(space->cpu),data);
if (space->machine->config->sound[0].type == SOUND_YM3812)
sndti_reset(SOUND_YM3812, 0);
if (space->machine->config->cpu[1].type == CPU_Z80)
if (space->machine->cpu[1] != NULL && cpu_get_type(space->machine->cpu[1]) == CPU_Z80)
cpu_set_input_line(space->machine->cpu[1], INPUT_LINE_RESET, PULSE_LINE);
}
}

View File

@ -577,9 +577,8 @@ INLINE void taitoic_drawscanline(
/* Note: various assumptions are made in these routines, typically that
only CPU#0 is of interest. If in doubt, check the routine. */
static int has_write_handler(running_machine *machine, int cpunum, write16_space_func handler)
static int has_write_handler(const device_config *cpu, write16_space_func handler)
{
const device_config *cpu = machine->cpu[cpunum];
if (cpu != NULL)
{
const address_space *space = cpu_get_address_space(cpu, ADDRESS_SPACE_PROGRAM);
@ -596,11 +595,11 @@ static int has_write_handler(running_machine *machine, int cpunum, write16_space
int TC0100SCN_count(running_machine *machine)
{
int mask = (has_write_handler(machine, 0, TC0100SCN_word_0_w) ||
has_write_handler(machine, 0, TC0100SCN_dual_screen_w) ||
has_write_handler(machine, 0, TC0100SCN_triple_screen_w)) ? 1 : 0;
mask |= has_write_handler(machine, 0, TC0100SCN_word_1_w) << 1;
mask |= has_write_handler(machine, 0, TC0100SCN_word_2_w) << 2;
int mask = (has_write_handler(machine->cpu[0], TC0100SCN_word_0_w) ||
has_write_handler(machine->cpu[0], TC0100SCN_dual_screen_w) ||
has_write_handler(machine->cpu[0], TC0100SCN_triple_screen_w)) ? 1 : 0;
mask |= has_write_handler(machine->cpu[0], TC0100SCN_word_1_w) << 1;
mask |= has_write_handler(machine->cpu[0], TC0100SCN_word_2_w) << 2;
/* Catch illegal configurations */
/* TODO: we should give an appropriate warning */
@ -611,45 +610,45 @@ int TC0100SCN_count(running_machine *machine)
int TC0110PCR_mask(running_machine *machine)
{
int mask = (has_write_handler(machine, 0, TC0110PCR_word_w) ||
has_write_handler(machine, 0, TC0110PCR_step1_word_w) ||
has_write_handler(machine, 0, TC0110PCR_step1_rbswap_word_w) ||
has_write_handler(machine, 0, TC0110PCR_step1_4bpg_word_w)) ? 1 : 0;
mask |= has_write_handler(machine, 0, TC0110PCR_step1_word_1_w) << 1;
mask |= has_write_handler(machine, 0, TC0110PCR_step1_word_2_w) << 2;
int mask = (has_write_handler(machine->cpu[0], TC0110PCR_word_w) ||
has_write_handler(machine->cpu[0], TC0110PCR_step1_word_w) ||
has_write_handler(machine->cpu[0], TC0110PCR_step1_rbswap_word_w) ||
has_write_handler(machine->cpu[0], TC0110PCR_step1_4bpg_word_w)) ? 1 : 0;
mask |= has_write_handler(machine->cpu[0], TC0110PCR_step1_word_1_w) << 1;
mask |= has_write_handler(machine->cpu[0], TC0110PCR_step1_word_2_w) << 2;
return mask;
}
int has_TC0150ROD(running_machine *machine)
{
return has_write_handler(machine, 0, TC0150ROD_word_w) ||
has_write_handler(machine, 1, TC0150ROD_word_w) ||
has_write_handler(machine, 2, TC0150ROD_word_w);
return has_write_handler(machine->cpu[0], TC0150ROD_word_w) ||
has_write_handler(machine->cpu[1], TC0150ROD_word_w) ||
has_write_handler(machine->cpu[2], TC0150ROD_word_w);
}
int has_TC0280GRD(running_machine *machine)
{
return has_write_handler(machine, 0, TC0280GRD_word_w);
return has_write_handler(machine->cpu[0], TC0280GRD_word_w);
}
int has_TC0360PRI(running_machine *machine)
{
return has_write_handler(machine, 0, TC0360PRI_halfword_w) ||
has_write_handler(machine, 0, TC0360PRI_halfword_swap_w);
return has_write_handler(machine->cpu[0], TC0360PRI_halfword_w) ||
has_write_handler(machine->cpu[0], TC0360PRI_halfword_swap_w);
}
int has_TC0430GRW(running_machine *machine)
{
return has_write_handler(machine, 0, TC0430GRW_word_w);
return has_write_handler(machine->cpu[0], TC0430GRW_word_w);
}
int has_TC0480SCP(running_machine *machine)
{
return has_write_handler(machine, 0, TC0480SCP_word_w);
return has_write_handler(machine->cpu[0], TC0480SCP_word_w);
}