diff options
author | 2010-07-03 00:12:44 +0000 | |
---|---|---|
committer | 2010-07-03 00:12:44 +0000 | |
commit | c70c5fee5a6094c5a1fbd6b25568e57b1d3a8216 (patch) | |
tree | eb0db95e2757f00a708dd4bfbf3ed4af41d943b6 | |
parent | 46e30c4f68c5c92b597d6b3ae9e9037d5e04efe9 (diff) |
Created CPU-specific device types for all CPUs, using new macros
DECLARE_LEGACY_CPU_DEVICE and DEFINE_LEGACY_CPU_DEVICE. Changed CPUs
to be their own device types, rather than all of type CPU with a
special internal subtype. Note that as part of this process I removed
the CPU_ prefix from the ALL-CAPS device name, so CPU_Z80 is just
plain old Z80 now. This required changing a couple of names like
8080 to I8080 so that there was an alphabetic first character.
Added memory interfaces to the list of fast-access interfaces. To do
this properly I had to add a separate method to devices which is
called immediately after construction, when it is possible to perform
dynamic_casts on fully-constructed objects. (This is just internal,
no changes necessary to the devices themselves.)
Some additional notes:
* SH2 and SH4 had typedefs that conflicted with their CPU_-less names
so I bulk renamed to structures to sh2_state and sh4_state; RB, feel
free to choose alternate names if you don't like 'em
* SCSP was caught doing something to the 3rd indexed CPU. Since several
systems that use SCSP don't even have 3 CPUs, I had no idea what
this was supposed to do, so I changed to it reference "audiocpu"
assuming that stv was the assumed target. This is really gross and
should be a configuration parameter, not a hard-coded assumption.
273 files changed, 1644 insertions, 1674 deletions
@@ -694,9 +694,9 @@ $(sort $(OBJDIRS)): ifndef EXECUTABLE_DEFINED # always recompile the version string -$(VERSIONOBJ): $(DRVLIBS) $(LIBOSD) $(LIBEMU) $(LIBCPU) $(LIBSOUND) $(LIBUTIL) $(EXPAT) $(ZLIB) $(SOFTFLOAT) $(LIBOCORE) $(RESFILE) +$(VERSIONOBJ): $(DRVLIBS) $(LIBOSD) $(LIBCPU) $(LIBEMU) $(LIBSOUND) $(LIBUTIL) $(EXPAT) $(ZLIB) $(SOFTFLOAT) $(LIBOCORE) $(RESFILE) -$(EMULATOR): $(VERSIONOBJ) $(DRVLIBS) $(LIBOSD) $(LIBEMU) $(LIBCPU) $(LIBDASM) $(LIBSOUND) $(LIBUTIL) $(EXPAT) $(SOFTFLOAT) $(ZLIB) $(LIBOCORE) $(RESFILE) +$(EMULATOR): $(VERSIONOBJ) $(DRVLIBS) $(LIBOSD) $(LIBCPU) $(LIBEMU) $(LIBDASM) $(LIBSOUND) $(LIBUTIL) $(EXPAT) $(SOFTFLOAT) $(ZLIB) $(LIBOCORE) $(RESFILE) @echo Linking $@... $(LD) $(LDFLAGS) $(LDFLAGSEMULATOR) $^ $(LIBS) -o $@ ifeq ($(TARGETOS),win32) diff --git a/src/emu/cpu/adsp2100/adsp2100.c b/src/emu/cpu/adsp2100/adsp2100.c index 73c04e6870b..628ba02cdae 100644 --- a/src/emu/cpu/adsp2100/adsp2100.c +++ b/src/emu/cpu/adsp2100/adsp2100.c @@ -301,13 +301,12 @@ static void check_irqs(adsp2100_state *adsp); INLINE adsp2100_state *get_safe_token(running_device *device) { assert(device != NULL); - assert(device->type() == CPU); - assert(cpu_get_type(device) == CPU_ADSP2100 || - cpu_get_type(device) == CPU_ADSP2101 || - cpu_get_type(device) == CPU_ADSP2104 || - cpu_get_type(device) == CPU_ADSP2105 || - cpu_get_type(device) == CPU_ADSP2115 || - cpu_get_type(device) == CPU_ADSP2181); + assert(device->type() == ADSP2100 || + device->type() == ADSP2101 || + device->type() == ADSP2104 || + device->type() == ADSP2105 || + device->type() == ADSP2115 || + device->type() == ADSP2181); return (adsp2100_state *)downcast<legacy_cpu_device *>(device)->token(); } @@ -2199,3 +2198,10 @@ UINT16 adsp2181_idma_data_r(running_device *device) return result; } + +DEFINE_LEGACY_CPU_DEVICE(ADSP2100, adsp2100); +DEFINE_LEGACY_CPU_DEVICE(ADSP2101, adsp2101); +DEFINE_LEGACY_CPU_DEVICE(ADSP2104, adsp2104); +DEFINE_LEGACY_CPU_DEVICE(ADSP2105, adsp2105); +DEFINE_LEGACY_CPU_DEVICE(ADSP2115, adsp2115); +DEFINE_LEGACY_CPU_DEVICE(ADSP2181, adsp2181); diff --git a/src/emu/cpu/adsp2100/adsp2100.h b/src/emu/cpu/adsp2100/adsp2100.h index f78fd2ca62b..8da1d82cd3b 100644 --- a/src/emu/cpu/adsp2100/adsp2100.h +++ b/src/emu/cpu/adsp2100/adsp2100.h @@ -16,6 +16,13 @@ TYPE DEFINITIONS ***************************************************************************/ +DECLARE_LEGACY_CPU_DEVICE(ADSP2100, adsp2100); +DECLARE_LEGACY_CPU_DEVICE(ADSP2101, adsp2101); +DECLARE_LEGACY_CPU_DEVICE(ADSP2104, adsp2104); +DECLARE_LEGACY_CPU_DEVICE(ADSP2105, adsp2105); +DECLARE_LEGACY_CPU_DEVICE(ADSP2115, adsp2115); +DECLARE_LEGACY_CPU_DEVICE(ADSP2181, adsp2181); + /* transmit and receive data callbacks types */ typedef INT32 (*adsp21xx_rx_func)(cpu_device &device, int port); typedef void (*adsp21xx_tx_func)(cpu_device &device, int port, INT32 data); @@ -69,9 +76,6 @@ enum #define ADSP2100_IRQ2 2 /* IRQ2 */ #define ADSP2100_IRQ3 3 /* IRQ3 */ -CPU_GET_INFO( adsp2100 ); -#define CPU_ADSP2100 CPU_GET_INFO_NAME( adsp2100 ) - /************************************************************************** * ADSP2101 section @@ -86,9 +90,6 @@ CPU_GET_INFO( adsp2100 ); #define ADSP2101_SPORT0_TX 4 /* SPORT0 transmit IRQ */ #define ADSP2101_TIMER 5 /* internal timer IRQ */ -CPU_GET_INFO( adsp2101 ); -#define CPU_ADSP2101 CPU_GET_INFO_NAME( adsp2101 ) - /************************************************************************** * ADSP2104 section @@ -103,9 +104,6 @@ CPU_GET_INFO( adsp2101 ); #define ADSP2104_SPORT0_TX 4 /* SPORT0 transmit IRQ */ #define ADSP2104_TIMER 5 /* internal timer IRQ */ -CPU_GET_INFO( adsp2104 ); -#define CPU_ADSP2104 CPU_GET_INFO_NAME( adsp2104 ) - void adsp2104_load_boot_data(UINT8 *srcdata, UINT32 *dstdata); @@ -120,9 +118,6 @@ void adsp2104_load_boot_data(UINT8 *srcdata, UINT32 *dstdata); #define ADSP2105_IRQ2 2 /* IRQ2 */ #define ADSP2105_TIMER 5 /* internal timer IRQ */ -CPU_GET_INFO( adsp2105 ); -#define CPU_ADSP2105 CPU_GET_INFO_NAME( adsp2105 ) - void adsp2105_load_boot_data(UINT8 *srcdata, UINT32 *dstdata); @@ -139,9 +134,6 @@ void adsp2105_load_boot_data(UINT8 *srcdata, UINT32 *dstdata); #define ADSP2115_SPORT0_TX 4 /* SPORT0 transmit IRQ */ #define ADSP2115_TIMER 5 /* internal timer IRQ */ -CPU_GET_INFO( adsp2115 ); -#define CPU_ADSP2115 CPU_GET_INFO_NAME( adsp2115 ) - void adsp2115_load_boot_data(UINT8 *srcdata, UINT32 *dstdata); @@ -161,9 +153,6 @@ void adsp2115_load_boot_data(UINT8 *srcdata, UINT32 *dstdata); #define ADSP2181_IRQL1 7 /* IRQL1 */ #define ADSP2181_IRQL2 8 /* IRQL2 */ -CPU_GET_INFO( adsp2181 ); -#define CPU_ADSP2181 CPU_GET_INFO_NAME( adsp2181 ) - void adsp2181_load_boot_data(UINT8 *srcdata, UINT32 *dstdata); void adsp2181_idma_addr_w(running_device *device, UINT16 data); UINT16 adsp2181_idma_addr_r(running_device *device); diff --git a/src/emu/cpu/alph8201/alph8201.c b/src/emu/cpu/alph8201/alph8201.c index 104ac854660..078d939674e 100644 --- a/src/emu/cpu/alph8201/alph8201.c +++ b/src/emu/cpu/alph8201/alph8201.c @@ -227,9 +227,8 @@ typedef struct { INLINE alpha8201_state *get_safe_token(running_device *device) { assert(device != NULL); - assert(device->type() == CPU); - assert(cpu_get_type(device) == CPU_ALPHA8201 || - cpu_get_type(device) == CPU_ALPHA8301); + assert(device->type() == ALPHA8201 || + device->type() == ALPHA8301); return (alpha8201_state *)downcast<legacy_cpu_device *>(device)->token(); } @@ -994,3 +993,6 @@ CPU_GET_INFO( alpha8301 ) CPU_GET_INFO_CALL(alpha8xxx); } } + +DEFINE_LEGACY_CPU_DEVICE(ALPHA8201, alpha8201); +DEFINE_LEGACY_CPU_DEVICE(ALPHA8301, alpha8301); diff --git a/src/emu/cpu/alph8201/alph8201.h b/src/emu/cpu/alph8201/alph8201.h index 1e0359c147e..449e584fe67 100644 --- a/src/emu/cpu/alph8201/alph8201.h +++ b/src/emu/cpu/alph8201/alph8201.h @@ -35,11 +35,8 @@ enum ALPHA8201_R4,ALPHA8201_R5,ALPHA8201_R6,ALPHA8201_R7 }; -extern CPU_GET_INFO( alpha8201 ); -extern CPU_GET_INFO( alpha8301 ); - -#define CPU_ALPHA8201 CPU_GET_INFO_NAME( alpha8201 ) -#define CPU_ALPHA8301 CPU_GET_INFO_NAME( alpha8301 ) +DECLARE_LEGACY_CPU_DEVICE(ALPHA8201, alpha8201); +DECLARE_LEGACY_CPU_DEVICE(ALPHA8301, alpha8301); CPU_DISASSEMBLE( alpha8201 ); diff --git a/src/emu/cpu/am29000/am29000.c b/src/emu/cpu/am29000/am29000.c index c63f672fb10..68072195351 100644 --- a/src/emu/cpu/am29000/am29000.c +++ b/src/emu/cpu/am29000/am29000.c @@ -144,8 +144,7 @@ typedef struct _am29000_state INLINE am29000_state *get_safe_token(running_device *device) { assert(device != NULL); - assert(device->type() == CPU); - assert(cpu_get_type(device) == CPU_AM29000); + assert(device->type() == AM29000); return (am29000_state *)downcast<legacy_cpu_device *>(device)->token(); } @@ -1209,3 +1208,5 @@ CPU_GET_INFO( am29000 ) } } + +DEFINE_LEGACY_CPU_DEVICE(AM29000, am29000); diff --git a/src/emu/cpu/am29000/am29000.h b/src/emu/cpu/am29000/am29000.h index 9b39d9e7845..69e82382fed 100644 --- a/src/emu/cpu/am29000/am29000.h +++ b/src/emu/cpu/am29000/am29000.h @@ -433,7 +433,6 @@ enum PUBLIC FUNCTIONS ***************************************************************************/ -extern CPU_GET_INFO( am29000 ); -#define CPU_AM29000 CPU_GET_INFO_NAME( am29000 ) +DECLARE_LEGACY_CPU_DEVICE(AM29000, am29000); #endif /* __AM29000_H__ */ diff --git a/src/emu/cpu/apexc/apexc.c b/src/emu/cpu/apexc/apexc.c index bcc8f92810b..86efb77d773 100644 --- a/src/emu/cpu/apexc/apexc.c +++ b/src/emu/cpu/apexc/apexc.c @@ -371,8 +371,7 @@ struct _apexc_state INLINE apexc_state *get_safe_token(running_device *device) { assert(device != NULL); - assert(device->type() == CPU); - assert(cpu_get_type(device) == CPU_APEXC); + assert(device->type() == APEXC); return (apexc_state *)downcast<legacy_cpu_device *>(device)->token(); } @@ -951,3 +950,5 @@ CPU_GET_INFO( apexc ) case CPUINFO_STR_REGISTER + APEXC_STATE: sprintf(info->s, "CPU state:%01X", cpustate->running ? TRUE : FALSE); break; } } + +DEFINE_LEGACY_CPU_DEVICE(APEXC, apexc); diff --git a/src/emu/cpu/apexc/apexc.h b/src/emu/cpu/apexc/apexc.h index 8cd9f30819d..553b1d87cf0 100644 --- a/src/emu/cpu/apexc/apexc.h +++ b/src/emu/cpu/apexc/apexc.h @@ -19,8 +19,7 @@ enum APEXC_PC /* doesn't actually exist; is there for the disassembler */ }; -CPU_GET_INFO( apexc ); -#define CPU_APEXC CPU_GET_INFO_NAME( apexc ) +DECLARE_LEGACY_CPU_DEVICE(APEXC, apexc); CPU_DISASSEMBLE( apexc ); diff --git a/src/emu/cpu/arm/arm.c b/src/emu/cpu/arm/arm.c index eb3370a8648..3ab053756d4 100644 --- a/src/emu/cpu/arm/arm.c +++ b/src/emu/cpu/arm/arm.c @@ -253,8 +253,7 @@ static void arm_check_irq_state(ARM_REGS* cpustate); INLINE ARM_REGS *get_safe_token(running_device *device) { assert(device != NULL); - assert(device->type() == CPU); - assert(cpu_get_type(device) == CPU_ARM); + assert(device->type() == ARM); return (ARM_REGS *)downcast<legacy_cpu_device *>(device)->token(); } @@ -1567,3 +1566,5 @@ CPU_GET_INFO( arm ) case CPUINFO_STR_REGISTER + ARM32_SR14: sprintf( info->s, "SR14:%08x", cpustate->sArmRegister[eR14_SVC] ); break; } } + +DEFINE_LEGACY_CPU_DEVICE(ARM, arm); diff --git a/src/emu/cpu/arm/arm.h b/src/emu/cpu/arm/arm.h index 8b83df0469b..7732e5a105d 100644 --- a/src/emu/cpu/arm/arm.h +++ b/src/emu/cpu/arm/arm.h @@ -14,8 +14,7 @@ * PUBLIC FUNCTIONS ***************************************************************************************************/ -extern CPU_GET_INFO( arm ); -#define CPU_ARM CPU_GET_INFO_NAME( arm ) +DECLARE_LEGACY_CPU_DEVICE(ARM, arm); enum { diff --git a/src/emu/cpu/arm7/arm7.c b/src/emu/cpu/arm7/arm7.c index 854a9af0465..b06dd4dbaee 100644 --- a/src/emu/cpu/arm7/arm7.c +++ b/src/emu/cpu/arm7/arm7.c @@ -71,8 +71,7 @@ void arm7_dt_w_callback(arm_state *cpustate, UINT32 insn, UINT32 *prn, void (*wr INLINE arm_state *get_safe_token(running_device *device) { assert(device != NULL); - assert(device->type() == CPU); - assert(cpu_get_type(device) == CPU_ARM7 || cpu_get_type(device) == CPU_ARM9 || cpu_get_type(device) == CPU_PXA255); + assert(device->type() == ARM7 || device->type() == ARM9 || device->type() == PXA255); return (arm_state *)downcast<legacy_cpu_device *>(device)->token(); } @@ -837,3 +836,7 @@ void arm7_dt_w_callback(arm_state *cpustate, UINT32 insn, UINT32 *prn, void (*wr { } +DEFINE_LEGACY_CPU_DEVICE(ARM7, arm7); +DEFINE_LEGACY_CPU_DEVICE(ARM9, arm9); +DEFINE_LEGACY_CPU_DEVICE(PXA255, pxa255); +DEFINE_LEGACY_CPU_DEVICE(SA1110, sa1110); diff --git a/src/emu/cpu/arm7/arm7.h b/src/emu/cpu/arm7/arm7.h index 7e3b93b4fde..637d43431f7 100644 --- a/src/emu/cpu/arm7/arm7.h +++ b/src/emu/cpu/arm7/arm7.h @@ -37,16 +37,10 @@ /**************************************************************************************************** * PUBLIC FUNCTIONS ***************************************************************************************************/ -extern CPU_GET_INFO( arm7 ); -#define CPU_ARM7 CPU_GET_INFO_NAME( arm7 ) -extern CPU_GET_INFO( arm9 ); -#define CPU_ARM9 CPU_GET_INFO_NAME( arm9 ) - -extern CPU_GET_INFO( pxa255 ); -#define CPU_PXA255 CPU_GET_INFO_NAME( pxa255 ) - -extern CPU_GET_INFO( sa1110 ); -#define CPU_SA1110 CPU_GET_INFO_NAME( sa1110 ) +DECLARE_LEGACY_CPU_DEVICE(ARM7, arm7); +DECLARE_LEGACY_CPU_DEVICE(ARM9, arm9); +DECLARE_LEGACY_CPU_DEVICE(PXA255, pxa255); +DECLARE_LEGACY_CPU_DEVICE(SA1110, sa1110); #endif /* __ARM7_H__ */ diff --git a/src/emu/cpu/asap/asap.c b/src/emu/cpu/asap/asap.c index 8ccc95cf86e..30dc0c4ab43 100644 --- a/src/emu/cpu/asap/asap.c +++ b/src/emu/cpu/asap/asap.c @@ -271,8 +271,7 @@ static void (*const conditiontable[16])(asap_state *) = INLINE asap_state *get_safe_token(running_device *device) { assert(device != NULL); - assert(device->type() == CPU); - assert(cpu_get_type(device) == CPU_ASAP); + assert(device->type() == ASAP); return (asap_state *)downcast<legacy_cpu_device *>(device)->token(); } @@ -1848,3 +1847,5 @@ CPU_GET_INFO( asap ) case CPUINFO_STR_REGISTER + ASAP_R31: sprintf(info->s, "R31:%08X", asap->src2val[REGBASE + 31]); break; } } + +DEFINE_LEGACY_CPU_DEVICE(ASAP, asap); diff --git a/src/emu/cpu/asap/asap.h b/src/emu/cpu/asap/asap.h index c261b7108a6..1458aae5bda 100644 --- a/src/emu/cpu/asap/asap.h +++ b/src/emu/cpu/asap/asap.h @@ -37,7 +37,6 @@ enum PUBLIC FUNCTIONS ***************************************************************************/ -extern CPU_GET_INFO( asap ); -#define CPU_ASAP CPU_GET_INFO_NAME( asap ) +DECLARE_LEGACY_CPU_DEVICE(ASAP, asap); #endif /* __ASAP_H__ */ diff --git a/src/emu/cpu/avr8/avr8.c b/src/emu/cpu/avr8/avr8.c index f9ed105e1e3..abe18022c09 100644 --- a/src/emu/cpu/avr8/avr8.c +++ b/src/emu/cpu/avr8/avr8.c @@ -78,8 +78,7 @@ enum INLINE avr8_state *get_safe_token(running_device *device) { assert(device != NULL); - assert(device->type() == CPU); - assert(cpu_get_type(device) == CPU_AVR8); + assert(device->type() == AVR8); return (avr8_state *)downcast<legacy_cpu_device *>(device)->token(); } @@ -1157,3 +1156,5 @@ CPU_GET_INFO( avr8 ) case CPUINFO_STR_REGISTER + AVR8_SP: sprintf(info->s, "SP: %04x", SPREG ); break; } } + +DEFINE_LEGACY_CPU_DEVICE(AVR8, avr8); diff --git a/src/emu/cpu/avr8/avr8.h b/src/emu/cpu/avr8/avr8.h index 48bf10aa9a4..167aeb70ff4 100644 --- a/src/emu/cpu/avr8/avr8.h +++ b/src/emu/cpu/avr8/avr8.h @@ -83,8 +83,7 @@ enum AVR8_INT_SPM_RDY, }; -CPU_GET_INFO( avr8 ); -#define CPU_AVR8 CPU_GET_INFO_NAME( avr8 ) +DECLARE_LEGACY_CPU_DEVICE(AVR8, avr8); CPU_DISASSEMBLE( avr8 ); diff --git a/src/emu/cpu/ccpu/ccpu.c b/src/emu/cpu/ccpu/ccpu.c index d79fb77aef2..a3576bf9180 100644 --- a/src/emu/cpu/ccpu/ccpu.c +++ b/src/emu/cpu/ccpu/ccpu.c @@ -53,8 +53,7 @@ struct _ccpu_state INLINE ccpu_state *get_safe_token(running_device *device) { assert(device != NULL); - assert(device->type() == CPU); - assert(cpu_get_type(device) == CPU_CCPU); + assert(device->type() == CCPU); return (ccpu_state *)downcast<legacy_cpu_device *>(device)->token(); } @@ -825,3 +824,5 @@ CPU_GET_INFO( ccpu ) case CPUINFO_STR_REGISTER + CCPU_T: sprintf(info->s, "T:%03X", cpustate->T); break; } } + +DEFINE_LEGACY_CPU_DEVICE(CCPU, ccpu); diff --git a/src/emu/cpu/ccpu/ccpu.h b/src/emu/cpu/ccpu/ccpu.h index 9ac96a48784..c59b45529cd 100644 --- a/src/emu/cpu/ccpu/ccpu.h +++ b/src/emu/cpu/ccpu/ccpu.h @@ -54,8 +54,7 @@ struct _ccpu_config PUBLIC FUNCTIONS ***************************************************************************/ -CPU_GET_INFO( ccpu ); -#define CPU_CCPU CPU_GET_INFO_NAME( ccpu ) +DECLARE_LEGACY_CPU_DEVICE(CCPU, ccpu); void ccpu_wdt_timer_trigger(running_device *device); diff --git a/src/emu/cpu/cdp1802/cdp1802.c b/src/emu/cpu/cdp1802/cdp1802.c index e6c8c1f0a3e..2cdfc52932d 100644 --- a/src/emu/cpu/cdp1802/cdp1802.c +++ b/src/emu/cpu/cdp1802/cdp1802.c @@ -70,8 +70,7 @@ struct _cdp1802_state INLINE cdp1802_state *get_safe_token(running_device *device) { assert(device != NULL); - assert(device->type() == CPU); - assert(cpu_get_type(device) == CPU_CDP1802); + assert(device->type() == CDP1802); return (cdp1802_state *)downcast<legacy_cpu_device *>(device)->token(); } @@ -1105,3 +1104,5 @@ CPU_GET_INFO( cdp1802 ) case DEVINFO_STR_CREDITS: strcpy(info->s, "Copyright Nicola Salmoria and the MAME Team"); break; } } + +DEFINE_LEGACY_CPU_DEVICE(CDP1802, cdp1802); diff --git a/src/emu/cpu/cdp1802/cdp1802.h b/src/emu/cpu/cdp1802/cdp1802.h index c4a18d6bae8..74b25b19287 100644 --- a/src/emu/cpu/cdp1802/cdp1802.h +++ b/src/emu/cpu/cdp1802/cdp1802.h @@ -92,8 +92,7 @@ struct _cdp1802_interface }; #define CDP1802_INTERFACE(name) const cdp1802_interface (name) = -extern CPU_GET_INFO( cdp1802 ); -#define CPU_CDP1802 CPU_GET_INFO_NAME( cdp1802 ) +DECLARE_LEGACY_CPU_DEVICE(CDP1802, cdp1802); extern CPU_DISASSEMBLE( cdp1802 ); diff --git a/src/emu/cpu/cop400/cop400.c b/src/emu/cpu/cop400/cop400.c index 68dc8fe1ebd..71078a2d98d 100644 --- a/src/emu/cpu/cop400/cop400.c +++ b/src/emu/cpu/cop400/cop400.c @@ -202,20 +202,19 @@ struct _cop400_opcode_map { INLINE cop400_state *get_safe_token(running_device *device) { assert(device != NULL); - assert(device->type() == CPU); - assert(cpu_get_type(device) == CPU_COP401 || - cpu_get_type(device) == CPU_COP410 || - cpu_get_type(device) == CPU_COP411 || - cpu_get_type(device) == CPU_COP402 || - cpu_get_type(device) == CPU_COP420 || - cpu_get_type(device) == CPU_COP421 || - cpu_get_type(device) == CPU_COP422 || - cpu_get_type(device) == CPU_COP404 || - cpu_get_type(device) == CPU_COP424 || - cpu_get_type(device) == CPU_COP425 || - cpu_get_type(device) == CPU_COP426 || - cpu_get_type(device) == CPU_COP444 || - cpu_get_type(device) == CPU_COP445); + assert(device->type() == COP401 || + device->type() == COP410 || + device->type() == COP411 || + device->type() == COP402 || + device->type() == COP420 || + device->type() == COP421 || + device->type() == COP422 || + device->type() == COP404 || + device->type() == COP424 || + device->type() == COP425 || + device->type() == COP426 || + device->type() == COP444 || + device->type() == COP445); return (cop400_state *)downcast<legacy_cpu_device *>(device)->token(); } @@ -1685,3 +1684,22 @@ CPU_GET_INFO( cop404 ) default: CPU_GET_INFO_CALL(cop444); break; } } + +/* COP410 family */ +DEFINE_LEGACY_CPU_DEVICE(COP401, cop401); +DEFINE_LEGACY_CPU_DEVICE(COP410, cop410); +DEFINE_LEGACY_CPU_DEVICE(COP411, cop411); + +/* COP420 family */ +DEFINE_LEGACY_CPU_DEVICE(COP402, cop402); +DEFINE_LEGACY_CPU_DEVICE(COP420, cop420); +DEFINE_LEGACY_CPU_DEVICE(COP421, cop421); +DEFINE_LEGACY_CPU_DEVICE(COP422, cop422); + +/* COP444 family */ +DEFINE_LEGACY_CPU_DEVICE(COP404, cop404); +DEFINE_LEGACY_CPU_DEVICE(COP424, cop424); +DEFINE_LEGACY_CPU_DEVICE(COP425, cop425); +DEFINE_LEGACY_CPU_DEVICE(COP426, cop426); +DEFINE_LEGACY_CPU_DEVICE(COP444, cop444); +DEFINE_LEGACY_CPU_DEVICE(COP445, cop445); diff --git a/src/emu/cpu/cop400/cop400.h b/src/emu/cpu/cop400/cop400.h index b1fd37b1331..ad859e1296f 100644 --- a/src/emu/cpu/cop400/cop400.h +++ b/src/emu/cpu/cop400/cop400.h @@ -133,23 +133,23 @@ struct _cop400_interface ***************************************************************************/ /* COP410 family */ -extern CPU_GET_INFO( cop401 ); -extern CPU_GET_INFO( cop410 ); -extern CPU_GET_INFO( cop411 ); +DECLARE_LEGACY_CPU_DEVICE(COP401, cop401); +DECLARE_LEGACY_CPU_DEVICE(COP410, cop410); +DECLARE_LEGACY_CPU_DEVICE(COP411, cop411); /* COP420 family */ -extern CPU_GET_INFO( cop402 ); -extern CPU_GET_INFO( cop420 ); -extern CPU_GET_INFO( cop421 ); -extern CPU_GET_INFO( cop422 ); +DECLARE_LEGACY_CPU_DEVICE(COP402, cop402); +DECLARE_LEGACY_CPU_DEVICE(COP420, cop420); +DECLARE_LEGACY_CPU_DEVICE(COP421, cop421); +DECLARE_LEGACY_CPU_DEVICE(COP422, cop422); /* COP444 family */ -extern CPU_GET_INFO( cop404 ); -extern CPU_GET_INFO( cop424 ); -extern CPU_GET_INFO( cop425 ); -extern CPU_GET_INFO( cop426 ); -extern CPU_GET_INFO( cop444 ); -extern CPU_GET_INFO( cop445 ); +DECLARE_LEGACY_CPU_DEVICE(COP404, cop404); +DECLARE_LEGACY_CPU_DEVICE(COP424, cop424); +DECLARE_LEGACY_CPU_DEVICE(COP425, cop425); +DECLARE_LEGACY_CPU_DEVICE(COP426, cop426); +DECLARE_LEGACY_CPU_DEVICE(COP444, cop444); +DECLARE_LEGACY_CPU_DEVICE(COP445, cop445); /* disassemblers */ extern CPU_DISASSEMBLE( cop410 ); diff --git a/src/emu/cpu/cp1610/cp1610.c b/src/emu/cpu/cp1610/cp1610.c index beca0530d9a..1d3d14fc8fc 100644 --- a/src/emu/cpu/cp1610/cp1610.c +++ b/src/emu/cpu/cp1610/cp1610.c @@ -54,8 +54,7 @@ struct _cp1610_state INLINE cp1610_state *get_safe_token(running_device *device) { assert(device != NULL); - assert(device->type() == CPU); - assert(cpu_get_type(device) == CPU_CP1610); + assert(device->type() == CP1610); return (cp1610_state *)downcast<legacy_cpu_device *>(device)->token(); } @@ -3535,4 +3534,4 @@ CPU_GET_INFO( cp1610 ) return; } - +DEFINE_LEGACY_CPU_DEVICE(CP1610, cp1610); diff --git a/src/emu/cpu/cp1610/cp1610.h b/src/emu/cpu/cp1610/cp1610.h index fc8d5eccda6..47246109cc8 100644 --- a/src/emu/cpu/cp1610/cp1610.h +++ b/src/emu/cpu/cp1610/cp1610.h @@ -34,8 +34,7 @@ enum #define CP1610_INT_INTR INPUT_LINE_NMI /* Non-Maskable */ -CPU_GET_INFO( cp1610 ); -#define CPU_CP1610 CPU_GET_INFO_NAME( cp1610 ) +DECLARE_LEGACY_CPU_DEVICE(CP1610, cp1610); CPU_DISASSEMBLE( cp1610 ); diff --git a/src/emu/cpu/cubeqcpu/cubeqcpu.c b/src/emu/cpu/cubeqcpu/cubeqcpu.c index a1827f6d702..a1afafdf2dd 100644 --- a/src/emu/cpu/cubeqcpu/cubeqcpu.c +++ b/src/emu/cpu/cubeqcpu/cubeqcpu.c @@ -196,24 +196,21 @@ typedef struct INLINE cquestsnd_state *get_safe_token_snd(running_device *device) { assert(device != NULL); - assert(device->type() == CPU); - assert(cpu_get_type(device) == CPU_CQUESTSND); + assert(device->type() == CQUESTSND); return (cquestsnd_state *)downcast<legacy_cpu_device *>(device)->token(); } INLINE cquestrot_state *get_safe_token_rot(running_device *device) { assert(device != NULL); - assert(device->type() == CPU); - assert(cpu_get_type(device) == CPU_CQUESTROT); + assert(device->type() == CQUESTROT); return (cquestrot_state *)downcast<legacy_cpu_device *>(device)->token(); } INLINE cquestlin_state *get_safe_token_lin(running_device *device) { assert(device != NULL); - assert(device->type() == CPU); - assert(cpu_get_type(device) == CPU_CQUESTLIN); + assert(device->type() == CQUESTLIN); return (cquestlin_state *)downcast<legacy_cpu_device *>(device)->token(); } @@ -1897,3 +1894,7 @@ CPU_GET_INFO( cquestlin ) case CPUINFO_STR_REGISTER + CQUESTLIN_ZLATCH: sprintf(info->s, "ZLATCH: %04X", cpustate->zlatch); break; } } + +DEFINE_LEGACY_CPU_DEVICE(CQUESTSND, cquestsnd); +DEFINE_LEGACY_CPU_DEVICE(CQUESTROT, cquestrot); +DEFINE_LEGACY_CPU_DEVICE(CQUESTLIN, cquestlin); diff --git a/src/emu/cpu/cubeqcpu/cubeqcpu.h b/src/emu/cpu/cubeqcpu/cubeqcpu.h index 328d2f7a665..b3352786b88 100644 --- a/src/emu/cpu/cubeqcpu/cubeqcpu.h +++ b/src/emu/cpu/cubeqcpu/cubeqcpu.h @@ -154,12 +154,8 @@ void cubeqcpu_clear_stack(running_device *device); UINT8 cubeqcpu_get_ptr_ram_val(running_device *device, int i); UINT32* cubeqcpu_get_stack_ram(running_device *device); -CPU_GET_INFO( cquestsnd ); -CPU_GET_INFO( cquestrot ); -CPU_GET_INFO( cquestlin ); - -#define CPU_CQUESTSND CPU_GET_INFO_NAME( cquestsnd ) -#define CPU_CQUESTROT CPU_GET_INFO_NAME( cquestrot ) -#define CPU_CQUESTLIN CPU_GET_INFO_NAME( cquestlin ) +DECLARE_LEGACY_CPU_DEVICE(CQUESTSND, cquestsnd); +DECLARE_LEGACY_CPU_DEVICE(CQUESTROT, cquestrot); +DECLARE_LEGACY_CPU_DEVICE(CQUESTLIN, cquestlin); #endif /* _CUBEQCPU_H */ diff --git a/src/emu/cpu/dsp32/dsp32.c b/src/emu/cpu/dsp32/dsp32.c index 0d39d587654..9a643844da4 100644 --- a/src/emu/cpu/dsp32/dsp32.c +++ b/src/emu/cpu/dsp32/dsp32.c @@ -205,8 +205,7 @@ static CPU_RESET( dsp32c ); INLINE dsp32_state *get_safe_token(running_device *device) { assert(device != NULL); - assert(device->type() == CPU); - assert(cpu_get_type(device) == CPU_DSP32C); + assert(device->type() == DSP32C); return (dsp32_state *)downcast<legacy_cpu_device *>(device)->token(); } @@ -931,3 +930,5 @@ CPU_GET_INFO( dsp32c ) case CPUINFO_STR_REGISTER + DSP32_IOC: sprintf(info->s, "IOC:%05X", cpustate->IOC); break; } } + +DEFINE_LEGACY_CPU_DEVICE(DSP32C, dsp32c); diff --git a/src/emu/cpu/dsp32/dsp32.h b/src/emu/cpu/dsp32/dsp32.h index b3f324123ab..421f9ed44fc 100644 --- a/src/emu/cpu/dsp32/dsp32.h +++ b/src/emu/cpu/dsp32/dsp32.h @@ -76,8 +76,7 @@ struct _dsp32_config PUBLIC FUNCTIONS ***************************************************************************/ -extern CPU_GET_INFO( dsp32c ); -#define CPU_DSP32C CPU_GET_INFO_NAME( dsp32c ) +DECLARE_LEGACY_CPU_DEVICE(DSP32C, dsp32c); extern void dsp32c_pio_w(running_device *device, int reg, int data); extern int dsp32c_pio_r(running_device *device, int reg); diff --git a/src/emu/cpu/dsp56k/dsp56def.h b/src/emu/cpu/dsp56k/dsp56def.h index 342eedcca0f..7bc38d31bc9 100644 --- a/src/emu/cpu/dsp56k/dsp56def.h +++ b/src/emu/cpu/dsp56k/dsp56def.h @@ -415,7 +415,6 @@ static void PCD_set(dsp56k_core* cpustate, UINT16 value); INLINE dsp56k_core *get_safe_token(running_device *device) { assert(device != NULL); - assert(device->type() == CPU); - assert(cpu_get_type(device) == CPU_DSP56156); + assert(device->type() == DSP56156); return (dsp56k_core *)downcast<legacy_cpu_device *>(device)->token(); } diff --git a/src/emu/cpu/dsp56k/dsp56k.c b/src/emu/cpu/dsp56k/dsp56k.c index d5b6eb7e30f..9e498a74558 100644 --- a/src/emu/cpu/dsp56k/dsp56k.c +++ b/src/emu/cpu/dsp56k/dsp56k.c @@ -620,3 +620,5 @@ CPU_GET_INFO( dsp56k ) case CPUINFO_STR_REGISTER + DSP56K_ST15: sprintf(info->s, "ST15: %08x", ST15); break; } } + +DEFINE_LEGACY_CPU_DEVICE(DSP56156, dsp56k); diff --git a/src/emu/cpu/dsp56k/dsp56k.h b/src/emu/cpu/dsp56k/dsp56k.h index 320ab5e3c29..e1629d8f814 100644 --- a/src/emu/cpu/dsp56k/dsp56k.h +++ b/src/emu/cpu/dsp56k/dsp56k.h @@ -64,8 +64,7 @@ enum #define DSP56K_IRQ_RESET 3 /* Is this needed? */ // Needed for MAME -extern CPU_GET_INFO( dsp56k ); -#define CPU_DSP56156 CPU_GET_INFO_NAME( dsp56k ) +DECLARE_LEGACY_CPU_DEVICE(DSP56156, dsp56k); /*************************************************************************** diff --git a/src/emu/cpu/e132xs/e132xs.c b/src/emu/cpu/e132xs/e132xs.c index b81b88fb747..6fc51c6df70 100644 --- a/src/emu/cpu/e132xs/e132xs.c +++ b/src/emu/cpu/e132xs/e132xs.c @@ -416,21 +416,20 @@ ADDRESS_MAP_END INLINE hyperstone_state *get_safe_token(running_device *device) { assert(device != NULL); - assert(device->type() == CPU); - assert(cpu_get_type(device) == CPU_E116T || - cpu_get_type(device) == CPU_E116XT || - cpu_get_type(device) == CPU_E116XS || - cpu_get_type(device) == CPU_E116XSR || - cpu_get_type(device) == CPU_E132N || - cpu_get_type(device) == CPU_E132T || - cpu_get_type(device) == CPU_E132XN || - cpu_get_type(device) == CPU_E132XT || - cpu_get_type(device) == CPU_E132XS || - cpu_get_type(device) == CPU_E132XSR || - cpu_get_type(device) == CPU_GMS30C2116 || - cpu_get_type(device) == CPU_GMS30C2132 || - cpu_get_type(device) == CPU_GMS30C2216 || - cpu_get_type(device) == CPU_GMS30C2232); + assert(device->type() == E116T || + device->type() == E116XT || + device->type() == E116XS || + device->type() == E116XSR || + device->type() == E132N || + device->type() == E132T || + device->type() == E132XN || + device->type() == E132XT || + device->type() == E132XS || + device->type() == E132XSR || + device->type() == GMS30C2116 || + device->type() == GMS30C2132 || + device->type() == GMS30C2216 || + device->type() == GMS30C2232); return (hyperstone_state *)downcast<legacy_cpu_device *>(device)->token(); } @@ -5430,3 +5429,18 @@ CPU_GET_INFO( gms30c2232 ) CPU_GET_INFO_CALL(hyperstone); } } + +DEFINE_LEGACY_CPU_DEVICE(E116T, e116t); +DEFINE_LEGACY_CPU_DEVICE(E116XT, e116xt); +DEFINE_LEGACY_CPU_DEVICE(E116XS, e116xs); +DEFINE_LEGACY_CPU_DEVICE(E116XSR, e116xsr); +DEFINE_LEGACY_CPU_DEVICE(E132N, e132n); +DEFINE_LEGACY_CPU_DEVICE(E132T, e132t); +DEFINE_LEGACY_CPU_DEVICE(E132XN, e132xn); +DEFINE_LEGACY_CPU_DEVICE(E132XT, e132xt); +DEFINE_LEGACY_CPU_DEVICE(E132XS, e132xs); +DEFINE_LEGACY_CPU_DEVICE(E132XSR, e132xsr); +DEFINE_LEGACY_CPU_DEVICE(GMS30C2116, gms30c2116); +DEFINE_LEGACY_CPU_DEVICE(GMS30C2132, gms30c2132); +DEFINE_LEGACY_CPU_DEVICE(GMS30C2216, gms30c2216); +DEFINE_LEGACY_CPU_DEVICE(GMS30C2232, gms30c2232); diff --git a/src/emu/cpu/e132xs/e132xs.h b/src/emu/cpu/e132xs/e132xs.h index f564675fdf6..b3f91f8ad36 100644 --- a/src/emu/cpu/e132xs/e132xs.h +++ b/src/emu/cpu/e132xs/e132xs.h @@ -22,47 +22,21 @@ /* Functions */ -CPU_GET_INFO( e116t ); -#define CPU_E116T CPU_GET_INFO_NAME( e116t ) +DECLARE_LEGACY_CPU_DEVICE(E116T, e116t); +DECLARE_LEGACY_CPU_DEVICE(E116XT, e116xt); +DECLARE_LEGACY_CPU_DEVICE(E116XS, e116xs); +DECLARE_LEGACY_CPU_DEVICE(E116XSR, e116xsr); +DECLARE_LEGACY_CPU_DEVICE(E132N, e132n); +DECLARE_LEGACY_CPU_DEVICE(E132T, e132t); +DECLARE_LEGACY_CPU_DEVICE(E132XN, e132xn); +DECLARE_LEGACY_CPU_DEVICE(E132XT, e132xt); +DECLARE_LEGACY_CPU_DEVICE(E132XS, e132xs); +DECLARE_LEGACY_CPU_DEVICE(E132XSR, e132xsr); +DECLARE_LEGACY_CPU_DEVICE(GMS30C2116, gms30c2116); +DECLARE_LEGACY_CPU_DEVICE(GMS30C2132, gms30c2132); +DECLARE_LEGACY_CPU_DEVICE(GMS30C2216, gms30c2216); +DECLARE_LEGACY_CPU_DEVICE(GMS30C2232, gms30c2232); -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 ) extern unsigned dasm_hyperstone(char *buffer, unsigned pc, const UINT8 *oprom, unsigned h_flag, int private_fp); diff --git a/src/emu/cpu/esrip/esrip.c b/src/emu/cpu/esrip/esrip.c index 1f8079af78b..7ff64cc8e01 100644 --- a/src/emu/cpu/esrip/esrip.c +++ b/src/emu/cpu/esrip/esrip.c @@ -123,8 +123,7 @@ typedef struct INLINE esrip_state *get_safe_token(running_device *device) { assert(device != NULL); - assert(device->type() == CPU); - assert(cpu_get_type(device) == CPU_ESRIP); + assert(device->type() == ESRIP); return (esrip_state *)downcast<legacy_cpu_device *>(device)->token(); } @@ -1995,3 +1994,5 @@ CPU_GET_INFO( esrip ) case CPUINFO_STR_REGISTER + ESRIP_IADDR: sprintf(info->s, "IADR: %04X", cpustate->iaddr_latch); break; } } + +DEFINE_LEGACY_CPU_DEVICE(ESRIP, esrip); diff --git a/src/emu/cpu/esrip/esrip.h b/src/emu/cpu/esrip/esrip.h index b3d16adf9c0..fd6b7569fd3 100644 --- a/src/emu/cpu/esrip/esrip.h +++ b/src/emu/cpu/esrip/esrip.h @@ -94,9 +94,7 @@ struct _esrip_config_ PUBLIC FUNCTIONS ***************************************************************************/ -CPU_GET_INFO( esrip ); - -#define CPU_ESRIP CPU_GET_INFO_NAME( esrip ) +DECLARE_LEGACY_CPU_DEVICE(ESRIP, esrip); extern UINT8 get_rip_status(running_device *cpu); diff --git a/src/emu/cpu/f8/f8.c b/src/emu/cpu/f8/f8.c index 86f3be933a9..941999ac143 100644 --- a/src/emu/cpu/f8/f8.c +++ b/src/emu/cpu/f8/f8.c @@ -64,8 +64,7 @@ struct _f8_Regs INLINE f8_Regs *get_safe_token(running_device *device) { assert(device != NULL); - assert(device->type() == CPU); - assert(cpu_get_type(device) == CPU_F8); + assert(device->type() == F8); return (f8_Regs *)downcast<legacy_cpu_device *>(device)->token(); } @@ -2230,8 +2229,4 @@ CPU_GET_INFO( f8 ) return; } - - - - - +DEFINE_LEGACY_CPU_DEVICE(F8, f8); diff --git a/src/emu/cpu/f8/f8.h b/src/emu/cpu/f8/f8.h index 22f62b16660..e75d7b8fc3c 100644 --- a/src/emu/cpu/f8/f8.h +++ b/src/emu/cpu/f8/f8.h @@ -46,8 +46,7 @@ enum #define F8_INT_NONE 0 #define F8_INT_INTR 1 -CPU_GET_INFO( f8 ); -#define CPU_F8 CPU_GET_INFO_NAME( f8 ) +DECLARE_LEGACY_CPU_DEVICE(F8, f8); #ifdef __cplusplus } diff --git a/src/emu/cpu/g65816/g65816.c b/src/emu/cpu/g65816/g65816.c index 0b3ed96c9fb..f762741b046 100644 --- a/src/emu/cpu/g65816/g65816.c +++ b/src/emu/cpu/g65816/g65816.c @@ -98,8 +98,7 @@ TODO general: INLINE g65816i_cpu_struct *get_safe_token(running_device *device) { assert(device != NULL); - assert(device->type() == CPU); - assert(cpu_get_type(device) == CPU_G65816 || cpu_get_type(device) == CPU_5A22); + assert(device->type() == G65816 || device->type() == _5A22); return (g65816i_cpu_struct *)downcast<legacy_cpu_device *>(device)->token(); } @@ -538,7 +537,7 @@ static CPU_INIT( 5a22 ) } -CPU_GET_INFO( 5a22 ) +CPU_GET_INFO( _5a22 ) { switch (state) { @@ -552,6 +551,9 @@ CPU_GET_INFO( 5a22 ) } } +DEFINE_LEGACY_CPU_DEVICE(G65816, g65816); +DEFINE_LEGACY_CPU_DEVICE(_5A22, _5a22); + /* ======================================================================== */ /* ============================== END OF FILE ============================= */ /* ======================================================================== */ diff --git a/src/emu/cpu/g65816/g65816.h b/src/emu/cpu/g65816/g65816.h index 11e09c9ebcd..831bdafad66 100644 --- a/src/emu/cpu/g65816/g65816.h +++ b/src/emu/cpu/g65816/g65816.h @@ -57,10 +57,8 @@ enum }; /* Main interface function */ -CPU_GET_INFO( g65816 ); -#define CPU_G65816 CPU_GET_INFO_NAME( g65816 ) -CPU_GET_INFO( 5a22 ); -#define CPU_5A22 CPU_GET_INFO_NAME( 5a22 ) +DECLARE_LEGACY_CPU_DEVICE(G65816, g65816); +DECLARE_LEGACY_CPU_DEVICE(_5A22, _5a22); #define CPU_TYPE_G65816 0 #define CPU_TYPE_5A22 1 diff --git a/src/emu/cpu/h6280/h6280.c b/src/emu/cpu/h6280/h6280.c index 60e154a61fd..5575fe151a4 100644 --- a/src/emu/cpu/h6280/h6280.c +++ b/src/emu/cpu/h6280/h6280.c @@ -120,8 +120,7 @@ static void set_irq_line(h6280_Regs* cpustate, int irqline, int state); INLINE h6280_Regs *get_safe_token(running_device *device) { assert(device != NULL); - assert(device->type() == CPU); - assert(cpu_get_type(device) == CPU_H6280); + assert(device->type() == H6280); return (h6280_Regs *)downcast<legacy_cpu_device *>(device)->token(); } @@ -530,3 +529,5 @@ CPU_GET_INFO( h6280 ) case CPUINFO_STR_REGISTER + H6280_M8: sprintf(info->s, "M8:%02X", cpustate->mmr[7]); break; } } + +DEFINE_LEGACY_CPU_DEVICE(H6280, h6280); diff --git a/src/emu/cpu/h6280/h6280.h b/src/emu/cpu/h6280/h6280.h index 991e19354fd..da4c5f7e2ce 100644 --- a/src/emu/cpu/h6280/h6280.h +++ b/src/emu/cpu/h6280/h6280.h @@ -72,9 +72,7 @@ typedef struct } h6280_Regs; - -CPU_GET_INFO( h6280 ); -#define CPU_H6280 CPU_GET_INFO_NAME( h6280 ) +DECLARE_LEGACY_CPU_DEVICE(H6280, h6280); READ8_HANDLER( h6280_irq_status_r ); WRITE8_HANDLER( h6280_irq_status_w ); diff --git a/src/emu/cpu/h83002/h8.h b/src/emu/cpu/h83002/h8.h index d867ca62676..307ac86f33a 100644 --- a/src/emu/cpu/h83002/h8.h +++ b/src/emu/cpu/h83002/h8.h @@ -85,15 +85,10 @@ enum H8_SERIAL_1, }; -CPU_GET_INFO( h8_3002 ); -CPU_GET_INFO( h8_3007 ); -CPU_GET_INFO( h8_3044 ); -CPU_GET_INFO( h8_3334 ); - -#define CPU_H83002 CPU_GET_INFO_NAME( h8_3002 ) -#define CPU_H83007 CPU_GET_INFO_NAME( h8_3007 ) -#define CPU_H83044 CPU_GET_INFO_NAME( h8_3044 ) -#define CPU_H83334 CPU_GET_INFO_NAME( h8_3334 ) +DECLARE_LEGACY_CPU_DEVICE(H83002, h8_3002); +DECLARE_LEGACY_CPU_DEVICE(H83007, h8_3007); +DECLARE_LEGACY_CPU_DEVICE(H83044, h8_3044); +DECLARE_LEGACY_CPU_DEVICE(H83334, h8_3334); #endif /* __H83002_H__ */ diff --git a/src/emu/cpu/h83002/h8_16.c b/src/emu/cpu/h83002/h8_16.c index a959c52398f..838bb3e16bf 100644 --- a/src/emu/cpu/h83002/h8_16.c +++ b/src/emu/cpu/h83002/h8_16.c @@ -666,3 +666,7 @@ CPU_GET_INFO( h8_3007 ) CPU_GET_INFO_CALL(h8_3002); } } + +DEFINE_LEGACY_CPU_DEVICE(H83002, h8_3002); +DEFINE_LEGACY_CPU_DEVICE(H83007, h8_3007); +DEFINE_LEGACY_CPU_DEVICE(H83044, h8_3044); diff --git a/src/emu/cpu/h83002/h8_8.c b/src/emu/cpu/h83002/h8_8.c index 5a9e82f0066..0dd5d6ef9f0 100644 --- a/src/emu/cpu/h83002/h8_8.c +++ b/src/emu/cpu/h83002/h8_8.c @@ -824,3 +824,4 @@ CPU_GET_INFO( h8_3334 ) } } +DEFINE_LEGACY_CPU_DEVICE(H83334, h8_3334); diff --git a/src/emu/cpu/h83002/h8priv.h b/src/emu/cpu/h83002/h8priv.h index e7fd0ab5d0d..8208c653aa6 100644 --- a/src/emu/cpu/h83002/h8priv.h +++ b/src/emu/cpu/h83002/h8priv.h @@ -50,11 +50,10 @@ extern h83xx_state h8; INLINE h83xx_state *get_safe_token(running_device *device) { assert(device != NULL); - assert(device->type() == CPU); - assert(cpu_get_type(device) == CPU_H83002 || - cpu_get_type(device) == CPU_H83007 || - cpu_get_type(device) == CPU_H83044 || - cpu_get_type(device) == CPU_H83334); + assert(device->type() == H83002 || + device->type() == H83007 || + device->type() == H83044 || + device->type() == H83334); return (h83xx_state *)downcast<legacy_cpu_device *>(device)->token(); } diff --git a/src/emu/cpu/hd6309/hd6309.c b/src/emu/cpu/hd6309/hd6309.c index 79cc6f070f6..8ad722d8147 100644 --- a/src/emu/cpu/hd6309/hd6309.c +++ b/src/emu/cpu/hd6309/hd6309.c @@ -154,8 +154,7 @@ struct _m68_state_t INLINE m68_state_t *get_safe_token(running_device *device) { assert(device != NULL); - assert(device->type() == CPU); - assert(cpu_get_type(device) == CPU_HD6309); + assert(device->type() == HD6309); return (m68_state_t *)downcast<legacy_cpu_device *>(device)->token(); } @@ -1353,3 +1352,5 @@ CPU_GET_INFO( hd6309 ) case CPUINFO_STR_REGISTER + HD6309_DP: sprintf(info->s, "DP:%02X", m68_state->dp.b.h); break; } } + +DEFINE_LEGACY_CPU_DEVICE(HD6309, hd6309); diff --git a/src/emu/cpu/hd6309/hd6309.h b/src/emu/cpu/hd6309/hd6309.h index 91898fd6ab0..8fceaaccdae 100644 --- a/src/emu/cpu/hd6309/hd6309.h +++ b/src/emu/cpu/hd6309/hd6309.h @@ -17,8 +17,7 @@ enum /* PUBLIC FUNCTIONS */ -CPU_GET_INFO( hd6309 ); -#define CPU_HD6309 CPU_GET_INFO_NAME( hd6309 ) +DECLARE_LEGACY_CPU_DEVICE(HD6309, hd6309); CPU_DISASSEMBLE( hd6309 ); diff --git a/src/emu/cpu/i386/i386.c b/src/emu/cpu/i386/i386.c index d706b6e6784..faf98c461d7 100644 --- a/src/emu/cpu/i386/i386.c +++ b/src/emu/cpu/i386/i386.c @@ -1456,3 +1456,8 @@ CPU_GET_INFO( mediagx ) default: CPU_GET_INFO_CALL(i386); break; } } + +DEFINE_LEGACY_CPU_DEVICE(I386, i386); +DEFINE_LEGACY_CPU_DEVICE(I486, i486); +DEFINE_LEGACY_CPU_DEVICE(PENTIUM, pentium); +DEFINE_LEGACY_CPU_DEVICE(MEDIAGX, mediagx); diff --git a/src/emu/cpu/i386/i386.h b/src/emu/cpu/i386/i386.h index 548441b0e3b..31a21250e9b 100644 --- a/src/emu/cpu/i386/i386.h +++ b/src/emu/cpu/i386/i386.h @@ -9,15 +9,10 @@ // mingw has this defined for 32-bit compiles
#undef i386
-CPU_GET_INFO( i386 );
-CPU_GET_INFO( i486 );
-CPU_GET_INFO( pentium );
-CPU_GET_INFO( mediagx );
-
-#define CPU_I386 CPU_GET_INFO_NAME( i386 )
-#define CPU_I486 CPU_GET_INFO_NAME( i486 )
-#define CPU_PENTIUM CPU_GET_INFO_NAME( pentium )
-#define CPU_MEDIAGX CPU_GET_INFO_NAME( mediagx )
+DECLARE_LEGACY_CPU_DEVICE(I386, i386);
+DECLARE_LEGACY_CPU_DEVICE(I486, i486);
+DECLARE_LEGACY_CPU_DEVICE(PENTIUM, pentium);
+DECLARE_LEGACY_CPU_DEVICE(MEDIAGX, mediagx);
diff --git a/src/emu/cpu/i386/i386priv.h b/src/emu/cpu/i386/i386priv.h index 421661889cd..0ed6749d51a 100644 --- a/src/emu/cpu/i386/i386priv.h +++ b/src/emu/cpu/i386/i386priv.h @@ -260,11 +260,10 @@ struct _i386_state INLINE i386_state *get_safe_token(running_device *device) { assert(device != NULL); - assert(device->type() == CPU); - assert(cpu_get_type(device) == CPU_I386 || - cpu_get_type(device) == CPU_I486 || - cpu_get_type(device) == CPU_PENTIUM || - cpu_get_type(device) == CPU_MEDIAGX); + assert(device->type() == I386 || + device->type() == I486 || + device->type() == PENTIUM || + device->type() == MEDIAGX); return (i386_state *)downcast<legacy_cpu_device *>(device)->token(); } diff --git a/src/emu/cpu/i4004/i4004.c b/src/emu/cpu/i4004/i4004.c index 81595372e27..e49e23816bb 100644 --- a/src/emu/cpu/i4004/i4004.c +++ b/src/emu/cpu/i4004/i4004.c @@ -54,8 +54,7 @@ struct _i4004_state INLINE i4004_state *get_safe_token(running_device *device) { assert(device != NULL); - assert(device->type() == CPU); - assert(cpu_get_type(device) == CPU_I4004); + assert(device->type() == I4004); return (i4004_state *)downcast<legacy_cpu_device *>(device)->token(); } @@ -617,3 +616,5 @@ CPU_GET_INFO( i4004 ) case DEVINFO_STR_CREDITS: strcpy(info->s, "Copyright Miodrag Milanovic"); break; } } + +DEFINE_LEGACY_CPU_DEVICE(I4004, i4004); diff --git a/src/emu/cpu/i4004/i4004.h b/src/emu/cpu/i4004/i4004.h index de76710d4ed..4d0fedea8ac 100644 --- a/src/emu/cpu/i4004/i4004.h +++ b/src/emu/cpu/i4004/i4004.h @@ -26,8 +26,7 @@ enum FUNCTION PROTOTYPES ***************************************************************************/ -CPU_GET_INFO( i4004 ); -#define CPU_I4004 CPU_GET_INFO_NAME( i4004 ) +DECLARE_LEGACY_CPU_DEVICE(I4004, i4004); CPU_DISASSEMBLE( i4004 ); diff --git a/src/emu/cpu/i8008/i8008.c b/src/emu/cpu/i8008/i8008.c index a63c089029a..9d82168c958 100644 --- a/src/emu/cpu/i8008/i8008.c +++ b/src/emu/cpu/i8008/i8008.c @@ -57,8 +57,7 @@ struct _i8008_state INLINE i8008_state *get_safe_token(running_device *device) { assert(device != NULL); - assert(device->type() == CPU); - assert(cpu_get_type(device) == CPU_I8008); + assert(device->type() == I8008); return (i8008_state *)downcast<legacy_cpu_device *>(device)->token(); } @@ -720,3 +719,5 @@ CPU_GET_INFO( i8008 ) case DEVINFO_STR_CREDITS: strcpy(info->s, "Copyright Miodrag Milanovic"); break; } } + +DEFINE_LEGACY_CPU_DEVICE(I8008, i8008); diff --git a/src/emu/cpu/i8008/i8008.h b/src/emu/cpu/i8008/i8008.h index 78f06d2b71b..5d15fdb6139 100644 --- a/src/emu/cpu/i8008/i8008.h +++ b/src/emu/cpu/i8008/i8008.h @@ -25,8 +25,7 @@ enum FUNCTION PROTOTYPES ***************************************************************************/ -CPU_GET_INFO( i8008 ); -#define CPU_I8008 CPU_GET_INFO_NAME( i8008 ) +DECLARE_LEGACY_CPU_DEVICE(I8008, i8008); CPU_DISASSEMBLE( i8008 ); #endif diff --git a/src/emu/cpu/i8085/i8085.c b/src/emu/cpu/i8085/i8085.c index 2ac29a184a5..ce8494f9fbf 100644 --- a/src/emu/cpu/i8085/i8085.c +++ b/src/emu/cpu/i8085/i8085.c @@ -275,9 +275,8 @@ static void execute_one(i8085_state *cpustate, int opcode); INLINE i8085_state *get_safe_token(running_device *device) { assert(device != NULL); - assert(device->type() == CPU); - assert(cpu_get_type(device) == CPU_8080 || - cpu_get_type(device) == CPU_8085A); + assert(device->type() == I8080 || + device->type() == I8085A); return (i8085_state *)downcast<legacy_cpu_device *>(device)->token(); } @@ -1290,3 +1289,7 @@ CPU_GET_INFO( i8080a ) default: CPU_GET_INFO_CALL(i8085); break; } } + +DEFINE_LEGACY_CPU_DEVICE(I8080, i8080); +DEFINE_LEGACY_CPU_DEVICE(I8080A, i8080a); +DEFINE_LEGACY_CPU_DEVICE(I8085A, i8085); diff --git a/src/emu/cpu/i8085/i8085.h b/src/emu/cpu/i8085/i8085.h index 0c18f6a67e6..6c1dadc9448 100644 --- a/src/emu/cpu/i8085/i8085.h +++ b/src/emu/cpu/i8085/i8085.h @@ -50,14 +50,9 @@ struct _i8085_config FUNCTION PROTOTYPES ***************************************************************************/ -CPU_GET_INFO( i8080 ); -#define CPU_8080 CPU_GET_INFO_NAME( i8080 ) - -CPU_GET_INFO( i8080a ); -#define CPU_8080A CPU_GET_INFO_NAME( i8080a ) - -CPU_GET_INFO( i8085 ); -#define CPU_8085A CPU_GET_INFO_NAME( i8085 ) +DECLARE_LEGACY_CPU_DEVICE(I8080, i8080); +DECLARE_LEGACY_CPU_DEVICE(I8080A, i8080a); +DECLARE_LEGACY_CPU_DEVICE(I8085A, i8085); CPU_DISASSEMBLE( i8085 ); diff --git a/src/emu/cpu/i86/i286.c b/src/emu/cpu/i86/i286.c index 77fd00b66fc..02ea3a75ad7 100644 --- a/src/emu/cpu/i86/i286.c +++ b/src/emu/cpu/i86/i286.c @@ -84,8 +84,7 @@ struct _i80286_state INLINE i80286_state *get_safe_token(running_device *device) { assert(device != NULL); - assert(device->type() == CPU); - assert(cpu_get_type(device) == CPU_I80286); + assert(device->type() == I80286); return (i80286_state *)downcast<legacy_cpu_device *>(device)->token(); } @@ -516,3 +515,6 @@ CPU_GET_INFO( i80286 ) case CPUINFO_STR_REGISTER + I80286_IDTR_LIMIT: sprintf(info->s, "%04X", cpustate->idtr.limit); break; } } + +#undef I80286 +DEFINE_LEGACY_CPU_DEVICE(I80286, i80286); diff --git a/src/emu/cpu/i86/i286.h b/src/emu/cpu/i86/i286.h index 8e087b40842..2ec52cdb080 100644 --- a/src/emu/cpu/i86/i286.h +++ b/src/emu/cpu/i86/i286.h @@ -43,7 +43,6 @@ enum }; /* Public functions */ -CPU_GET_INFO( i80286 ); -#define CPU_I80286 CPU_GET_INFO_NAME( i80286 ) +DECLARE_LEGACY_CPU_DEVICE(I80286, i80286); #endif /* __I286INTF_H__ */ diff --git a/src/emu/cpu/i86/i86.c b/src/emu/cpu/i86/i86.c index 103fdba4d11..24973817d48 100644 --- a/src/emu/cpu/i86/i86.c +++ b/src/emu/cpu/i86/i86.c @@ -73,11 +73,10 @@ struct _i8086_state INLINE i8086_state *get_safe_token(running_device *device) { assert(device != NULL); - assert(device->type() == CPU); - assert(cpu_get_type(device) == CPU_I8086 || - cpu_get_type(device) == CPU_I8088 || - cpu_get_type(device) == CPU_I80186 || - cpu_get_type(device) == CPU_I80188); + assert(device->type() == I8086 || + device->type() == I8088 || + device->type() == I80186 || + device->type() == I80188); return (i8086_state *)downcast<legacy_cpu_device *>(device)->token(); } @@ -644,3 +643,8 @@ CPU_GET_INFO( i80188 ) default: CPU_GET_INFO_CALL(i8086); break; } } + +DEFINE_LEGACY_CPU_DEVICE(I8086, i8086); +DEFINE_LEGACY_CPU_DEVICE(I8088, i8088); +DEFINE_LEGACY_CPU_DEVICE(I80186, i80186); +DEFINE_LEGACY_CPU_DEVICE(I80188, i80188); diff --git a/src/emu/cpu/i86/i86.h b/src/emu/cpu/i86/i86.h index 358cc3723f5..17ac64ffc6e 100644 --- a/src/emu/cpu/i86/i86.h +++ b/src/emu/cpu/i86/i86.h @@ -39,16 +39,9 @@ enum };
/* Public functions */
-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 )
+DECLARE_LEGACY_CPU_DEVICE(I8086, i8086);
+DECLARE_LEGACY_CPU_DEVICE(I8088, i8088);
+DECLARE_LEGACY_CPU_DEVICE(I80186, i80186);
+DECLARE_LEGACY_CPU_DEVICE(I80188, i80188);
#endif /* __I86INTF_H__ */
diff --git a/src/emu/cpu/i860/i860.c b/src/emu/cpu/i860/i860.c index ee765d46444..2c10a36216d 100644 --- a/src/emu/cpu/i860/i860.c +++ b/src/emu/cpu/i860/i860.c @@ -380,3 +380,5 @@ CPU_GET_INFO( i860 ) case CPUINFO_STR_REGISTER + I860_F31: CPU_GET_INFO_STR_F(31); break; } } + +DEFINE_LEGACY_CPU_DEVICE(I860, i860); diff --git a/src/emu/cpu/i860/i860.h b/src/emu/cpu/i860/i860.h index f3c8a3a1aca..1625a5970c3 100644 --- a/src/emu/cpu/i860/i860.h +++ b/src/emu/cpu/i860/i860.h @@ -47,8 +47,7 @@ enum }; /* Needed for MAME */ -CPU_GET_INFO( i860 ); -#define CPU_I860 CPU_GET_INFO_NAME( i860 ) +DECLARE_LEGACY_CPU_DEVICE(I860, i860); /*************************************************************************** @@ -179,8 +178,7 @@ typedef struct { INLINE i860_state_t *get_safe_token(running_device *device) { assert(device != NULL); - assert(device->type() == CPU); - assert(cpu_get_type(device) == CPU_I860); + assert(device->type() == I860); return (i860_state_t *)downcast<legacy_cpu_device *>(device)->token(); } diff --git a/src/emu/cpu/i960/i960.c b/src/emu/cpu/i960/i960.c index 4280121ab3e..8f921f1f897 100644 --- a/src/emu/cpu/i960/i960.c +++ b/src/emu/cpu/i960/i960.c @@ -43,8 +43,7 @@ struct _i960_state_t { INLINE i960_state_t *get_safe_token(running_device *device) { assert(device != NULL); - assert(device->type() == CPU); - assert(cpu_get_type(device) == CPU_I960); + assert(device->type() == I960); return (i960_state_t *)downcast<legacy_cpu_device *>(device)->token(); } @@ -2227,3 +2226,5 @@ void i960_stall(running_device *device) i960_state_t *i960 = get_safe_token(device); i960->IP = i960->PIP; } + +DEFINE_LEGACY_CPU_DEVICE(I960, i960); diff --git a/src/emu/cpu/i960/i960.h b/src/emu/cpu/i960/i960.h index a975d1c5a2b..d299b968560 100644 --- a/src/emu/cpu/i960/i960.h +++ b/src/emu/cpu/i960/i960.h @@ -60,8 +60,7 @@ enum I960_IRQ3 = 3 }; -CPU_GET_INFO( i960 ); -#define CPU_I960 CPU_GET_INFO_NAME( i960 ) +DECLARE_LEGACY_CPU_DEVICE(I960, i960); void i960_noburst(running_device *device); void i960_stall(running_device *device); diff --git a/src/emu/cpu/jaguar/jaguar.c b/src/emu/cpu/jaguar/jaguar.c index c7444ee4f51..d2e0afbbfca 100644 --- a/src/emu/cpu/jaguar/jaguar.c +++ b/src/emu/cpu/jaguar/jaguar.c @@ -251,9 +251,8 @@ static void (*const dsp_op_table[64])(jaguar_state *jaguar, UINT16 op) = INLINE jaguar_state *get_safe_token(running_device *device) { assert(device != NULL); - assert(device->type() == CPU); - assert(cpu_get_type(device) == CPU_JAGUARGPU || - cpu_get_type(device) == CPU_JAGUARDSP); + assert(device->type() == JAGUARGPU || + device->type() == JAGUARDSP); return (jaguar_state *)downcast<legacy_cpu_device *>(device)->token(); } @@ -1663,3 +1662,6 @@ CPU_GET_INFO( jaguardsp ) default: CPU_GET_INFO_CALL(jaguargpu); break; } } + +DEFINE_LEGACY_CPU_DEVICE(JAGUARGPU, jaguargpu); +DEFINE_LEGACY_CPU_DEVICE(JAGUARDSP, jaguardsp); diff --git a/src/emu/cpu/jaguar/jaguar.h b/src/emu/cpu/jaguar/jaguar.h index dfe6057237e..ef01031dce0 100644 --- a/src/emu/cpu/jaguar/jaguar.h +++ b/src/emu/cpu/jaguar/jaguar.h @@ -99,13 +99,11 @@ struct _jaguar_cpu_config PUBLIC FUNCTIONS ***************************************************************************/ -extern CPU_GET_INFO( jaguargpu ); -#define CPU_JAGUARGPU CPU_GET_INFO_NAME( jaguargpu ) +DECLARE_LEGACY_CPU_DEVICE(JAGUARGPU, jaguargpu); extern void jaguargpu_ctrl_w(running_device *device, offs_t offset, UINT32 data, UINT32 mem_mask); extern UINT32 jaguargpu_ctrl_r(running_device *device, offs_t offset); -extern CPU_GET_INFO( jaguardsp ); -#define CPU_JAGUARDSP CPU_GET_INFO_NAME( jaguardsp ) +DECLARE_LEGACY_CPU_DEVICE(JAGUARDSP, jaguardsp); extern void jaguardsp_ctrl_w(running_device *device, offs_t offset, UINT32 data, UINT32 mem_mask); extern UINT32 jaguardsp_ctrl_r(running_device *device, offs_t offset); diff --git a/src/emu/cpu/konami/konami.c b/src/emu/cpu/konami/konami.c index 32355634445..43412a73422 100644 --- a/src/emu/cpu/konami/konami.c +++ b/src/emu/cpu/konami/konami.c @@ -69,8 +69,7 @@ struct _konami_state INLINE konami_state *get_safe_token(running_device *device) { assert(device != NULL); - assert(device->type() == CPU); - assert(cpu_get_type(device) == CPU_KONAMI); + assert(device->type() == KONAMI); return (konami_state *)downcast<legacy_cpu_device *>(device)->token(); } @@ -627,3 +626,5 @@ CPU_GET_INFO( konami ) case CPUINFO_STR_REGISTER + KONAMI_DP: sprintf(info->s, "DP:%02X", cpustate->dp.b.h); break; } } + +DEFINE_LEGACY_CPU_DEVICE(KONAMI, konami); diff --git a/src/emu/cpu/konami/konami.h b/src/emu/cpu/konami/konami.h index 27049084c9e..c3b771103f8 100644 --- a/src/emu/cpu/konami/konami.h +++ b/src/emu/cpu/konami/konami.h @@ -20,8 +20,7 @@ enum #define KONAMI_FIRQ_LINE 1 /* FIRQ line number */ /* PUBLIC FUNCTIONS */ -CPU_GET_INFO( konami ); -#define CPU_KONAMI CPU_GET_INFO_NAME( konami ) +DECLARE_LEGACY_CPU_DEVICE(KONAMI, konami); CPU_DISASSEMBLE( konami ); diff --git a/src/emu/cpu/lh5801/lh5801.c b/src/emu/cpu/lh5801/lh5801.c index 8eddb9505e6..c30b60e336c 100644 --- a/src/emu/cpu/lh5801/lh5801.c +++ b/src/emu/cpu/lh5801/lh5801.c @@ -71,8 +71,7 @@ struct _lh5810_state INLINE lh5801_state *get_safe_token(running_device *device) { assert(device != NULL); - assert(device->type() == CPU); - assert(cpu_get_type(device) == CPU_LH5801); + assert(device->type() == LH5801); return (lh5801_state *)downcast<legacy_cpu_device *>(device)->token(); } @@ -268,3 +267,5 @@ CPU_GET_INFO( lh5801 ) case CPUINFO_STR_REGISTER + LH5801_DP: sprintf(info->s, "DP:%04X", cpustate->dp); break; } } + +DEFINE_LEGACY_CPU_DEVICE(LH5801, lh5801); diff --git a/src/emu/cpu/lh5801/lh5801.h b/src/emu/cpu/lh5801/lh5801.h index b869422c7dc..e5075b12189 100644 --- a/src/emu/cpu/lh5801/lh5801.h +++ b/src/emu/cpu/lh5801/lh5801.h @@ -76,8 +76,7 @@ struct _lh5801_cpu_core #define LH5801_INT_NONE 0 #define LH5801_IRQ 1 -CPU_GET_INFO( lh5801 ); -#define CPU_LH5801 CPU_GET_INFO_NAME( lh5801 ) +DECLARE_LEGACY_CPU_DEVICE(LH5801, lh5801); extern CPU_DISASSEMBLE( lh5801 ); #endif /* __LH5801_H__ */ diff --git a/src/emu/cpu/lr35902/lr35902.c b/src/emu/cpu/lr35902/lr35902.c index f87e2f1c44b..69efd30d14f 100644 --- a/src/emu/cpu/lr35902/lr35902.c +++ b/src/emu/cpu/lr35902/lr35902.c @@ -116,8 +116,7 @@ union _lr35902_state { INLINE lr35902_state *get_safe_token(running_device *device) { assert(device != NULL); - assert(device->type() == CPU); - assert(cpu_get_type(device) == CPU_LR35902); + assert(device->type() == LR35902); return (lr35902_state *)downcast<legacy_cpu_device *>(device)->token(); } @@ -491,3 +490,5 @@ CPU_GET_INFO( lr35902 ) case CPUINFO_STR_REGISTER + LR35902_IF: sprintf(info->s, "IF:%02X", cpustate->w.IF); break; } } + +DEFINE_LEGACY_CPU_DEVICE(LR35902, lr35902); diff --git a/src/emu/cpu/lr35902/lr35902.h b/src/emu/cpu/lr35902/lr35902.h index 412bbc7b6dd..cf092327b46 100644 --- a/src/emu/cpu/lr35902/lr35902.h +++ b/src/emu/cpu/lr35902/lr35902.h @@ -29,8 +29,7 @@ enum /****************************************************************************/ /* Return register contents */ /****************************************************************************/ -extern CPU_GET_INFO( lr35902 ); -#define CPU_LR35902 CPU_GET_INFO_NAME( lr35902 ) +DECLARE_LEGACY_CPU_DEVICE(LR35902, lr35902); extern CPU_DISASSEMBLE( lr35902 ); diff --git a/src/emu/cpu/m37710/m37710.c b/src/emu/cpu/m37710/m37710.c index 9ad5a8b4a35..580f8563ddd 100644 --- a/src/emu/cpu/m37710/m37710.c +++ b/src/emu/cpu/m37710/m37710.c @@ -1132,6 +1132,9 @@ CPU_GET_INFO( m37702 ) CPU_GET_INFO_CALL(m37710); } +DEFINE_LEGACY_CPU_DEVICE(M37710, m37710); +DEFINE_LEGACY_CPU_DEVICE(M37702, m37702); + /* ======================================================================== */ /* ============================== END OF FILE ============================= */ /* ======================================================================== */ diff --git a/src/emu/cpu/m37710/m37710.h b/src/emu/cpu/m37710/m37710.h index 3b1d0183da4..a9a159d77cb 100644 --- a/src/emu/cpu/m37710/m37710.h +++ b/src/emu/cpu/m37710/m37710.h @@ -85,11 +85,8 @@ enum M37710_SER0_XMIT, M37710_SER1_REC, M37710_SER1_XMIT }; -CPU_GET_INFO( m37710 ); -CPU_GET_INFO( m37702 ); - -#define CPU_M37710 CPU_GET_INFO_NAME( m37710 ) -#define CPU_M37702 CPU_GET_INFO_NAME( m37702 ) +DECLARE_LEGACY_CPU_DEVICE(M37710, m37710); +DECLARE_LEGACY_CPU_DEVICE(M37702, m37702); /* ======================================================================== */ /* ============================== END OF FILE ============================= */ diff --git a/src/emu/cpu/m37710/m37710cm.h b/src/emu/cpu/m37710/m37710cm.h index 5f2deabf3a3..5fedde511b0 100644 --- a/src/emu/cpu/m37710/m37710cm.h +++ b/src/emu/cpu/m37710/m37710cm.h @@ -130,9 +130,8 @@ struct _m37710i_cpu_struct INLINE m37710i_cpu_struct *get_safe_token(running_device *device) { assert(device != NULL); - assert(device->type() == CPU); - assert(cpu_get_type(device) == CPU_M37710 || - cpu_get_type(device) == CPU_M37702); + assert(device->type() == M37710 || + device->type() == M37702); return (m37710i_cpu_struct *)downcast<legacy_cpu_device *>(device)->token(); } diff --git a/src/emu/cpu/m6502/m4510.c b/src/emu/cpu/m6502/m4510.c index 1b3c682ded2..e3d7bfca3d4 100644 --- a/src/emu/cpu/m6502/m4510.c +++ b/src/emu/cpu/m6502/m4510.c @@ -159,8 +159,7 @@ struct _m4510_Regs { INLINE m4510_Regs *get_safe_token(running_device *device) { assert(device != NULL); - assert(device->type() == CPU); - assert(cpu_get_type(device) == CPU_M4510); + assert(device->type() == M4510); return (m4510_Regs *)downcast<legacy_cpu_device *>(device)->token(); } @@ -553,3 +552,5 @@ CPU_GET_INFO( m4510 ) } } +#undef M4510 +DEFINE_LEGACY_CPU_DEVICE(M4510, m4510); diff --git a/src/emu/cpu/m6502/m4510.h b/src/emu/cpu/m6502/m4510.h index 321ed647b00..e896a9bf5b3 100644 --- a/src/emu/cpu/m6502/m4510.h +++ b/src/emu/cpu/m6502/m4510.h @@ -39,8 +39,7 @@ enum #define M4510_IRQ_LINE M6502_IRQ_LINE -CPU_GET_INFO( m4510 ); -#define CPU_M4510 CPU_GET_INFO_NAME( m4510 ) +DECLARE_LEGACY_CPU_DEVICE(M4510, m4510); extern CPU_DISASSEMBLE( m4510 ); diff --git a/src/emu/cpu/m6502/m6502.c b/src/emu/cpu/m6502/m6502.c index 163a4212d1f..b007c21a5b8 100644 --- a/src/emu/cpu/m6502/m6502.c +++ b/src/emu/cpu/m6502/m6502.c @@ -87,16 +87,15 @@ struct _m6502_Regs INLINE m6502_Regs *get_safe_token(running_device *device) { assert(device != NULL); - assert(device->type() == CPU); - assert(cpu_get_type(device) == CPU_M6502 || - cpu_get_type(device) == CPU_M6510 || - cpu_get_type(device) == CPU_M6510T || - cpu_get_type(device) == CPU_M7501 || - cpu_get_type(device) == CPU_M8502 || - cpu_get_type(device) == CPU_N2A03 || - cpu_get_type(device) == CPU_M65C02 || - cpu_get_type(device) == CPU_M65SC02 || - cpu_get_type(device) == CPU_DECO16); + assert(device->type() == M6502 || + device->type() == M6510 || + device->type() == M6510T || + device->type() == M7501 || + device->type() == M8502 || + device->type() == N2A03 || + device->type() == M65C02 || + device->type() == M65SC02 || + device->type() == DECO16); return (m6502_Regs *)downcast<legacy_cpu_device *>(device)->token(); } @@ -967,3 +966,13 @@ CPU_GET_INFO( deco16 ) default: CPU_GET_INFO_CALL(m6502); break; } } + +DEFINE_LEGACY_CPU_DEVICE(M6502, m6502); +DEFINE_LEGACY_CPU_DEVICE(M6510, m6510); +DEFINE_LEGACY_CPU_DEVICE(M6510T, m6510t); +DEFINE_LEGACY_CPU_DEVICE(M7501, m7501); +DEFINE_LEGACY_CPU_DEVICE(M8502, m8502); +DEFINE_LEGACY_CPU_DEVICE(N2A03, n2a03); +DEFINE_LEGACY_CPU_DEVICE(M65C02, m65c02); +DEFINE_LEGACY_CPU_DEVICE(M65SC02, m65sc02); +DEFINE_LEGACY_CPU_DEVICE(DECO16, deco16); diff --git a/src/emu/cpu/m6502/m6502.h b/src/emu/cpu/m6502/m6502.h index 1506c871322..3afa02361ef 100644 --- a/src/emu/cpu/m6502/m6502.h +++ b/src/emu/cpu/m6502/m6502.h @@ -65,8 +65,7 @@ struct _m6502_interface m6510_port_write_func port_write_func; }; -extern CPU_GET_INFO( m6502 ); -#define CPU_M6502 CPU_GET_INFO_NAME( m6502 ) +DECLARE_LEGACY_CPU_DEVICE(M6502, m6502); extern CPU_DISASSEMBLE( m6502 ); @@ -86,8 +85,7 @@ extern CPU_DISASSEMBLE( m6502 ); #define M6510_IRQ_LINE M6502_IRQ_LINE -extern CPU_GET_INFO( m6510 ); -#define CPU_M6510 CPU_GET_INFO_NAME( m6510 ) +DECLARE_LEGACY_CPU_DEVICE(M6510, m6510); extern CPU_DISASSEMBLE( m6510 ); @@ -106,8 +104,7 @@ UINT8 m6510_get_port(legacy_cpu_device *device); #define M6510T_IRQ_LINE M6502_IRQ_LINE -extern CPU_GET_INFO( m6510t ); -#define CPU_M6510T CPU_GET_INFO_NAME( m6510t ) +DECLARE_LEGACY_CPU_DEVICE(M6510T, m6510t); #define M7501_A M6502_A @@ -123,8 +120,7 @@ extern CPU_GET_INFO( m6510t ); #define M7501_IRQ_LINE M6502_IRQ_LINE -extern CPU_GET_INFO( m7501 ); -#define CPU_M7501 CPU_GET_INFO_NAME( m7501 ) +DECLARE_LEGACY_CPU_DEVICE(M7501, m7501); #define M8502_A M6502_A #define M8502_X M6502_X @@ -139,8 +135,7 @@ extern CPU_GET_INFO( m7501 ); #define M8502_IRQ_LINE M6502_IRQ_LINE -extern CPU_GET_INFO( m8502 ); -#define CPU_M8502 CPU_GET_INFO_NAME( m8502 ) +DECLARE_LEGACY_CPU_DEVICE(M8502, m8502); /**************************************************************************** @@ -159,8 +154,7 @@ extern CPU_GET_INFO( m8502 ); #define N2A03_IRQ_LINE M6502_IRQ_LINE -extern CPU_GET_INFO( n2a03 ); -#define CPU_N2A03 CPU_GET_INFO_NAME( n2a03 ) +DECLARE_LEGACY_CPU_DEVICE(N2A03, n2a03); #define N2A03_DEFAULTCLOCK (21477272.724 / 12) @@ -187,8 +181,7 @@ extern void n2a03_irq(running_device *device); #define M65C02_IRQ_LINE M6502_IRQ_LINE -extern CPU_GET_INFO( m65c02 ); -#define CPU_M65C02 CPU_GET_INFO_NAME( m65c02 ) +DECLARE_LEGACY_CPU_DEVICE(M65C02, m65c02); extern CPU_DISASSEMBLE( m65c02 ); @@ -209,8 +202,7 @@ extern CPU_DISASSEMBLE( m65c02 ); #define M65SC02_IRQ_LINE M6502_IRQ_LINE -extern CPU_GET_INFO( m65sc02 ); -#define CPU_M65SC02 CPU_GET_INFO_NAME( m65sc02 ) +DECLARE_LEGACY_CPU_DEVICE(M65SC02, m65sc02); extern CPU_DISASSEMBLE( m65sc02 ); @@ -230,8 +222,7 @@ extern CPU_DISASSEMBLE( m65sc02 ); #define DECO16_IRQ_LINE M6502_IRQ_LINE -extern CPU_GET_INFO( deco16 ); -#define CPU_DECO16 CPU_GET_INFO_NAME( deco16 ) +DECLARE_LEGACY_CPU_DEVICE(DECO16, deco16); extern CPU_DISASSEMBLE( deco16 ); diff --git a/src/emu/cpu/m6502/m6509.c b/src/emu/cpu/m6502/m6509.c index 460d06a75a0..f0d023217a9 100644 --- a/src/emu/cpu/m6502/m6509.c +++ b/src/emu/cpu/m6502/m6509.c @@ -90,8 +90,7 @@ struct _m6509_Regs { INLINE m6509_Regs *get_safe_token(running_device *device) { assert(device != NULL); - assert(device->type() == CPU); - assert(cpu_get_type(device) == CPU_M6509); + assert(device->type() == M6509); return (m6509_Regs *)downcast<legacy_cpu_device *>(device)->token(); } @@ -414,3 +413,4 @@ CPU_GET_INFO( m6509 ) } } +DEFINE_LEGACY_CPU_DEVICE(M6509, m6509); diff --git a/src/emu/cpu/m6502/m6509.h b/src/emu/cpu/m6502/m6509.h index f0b305441e0..2043d3317cc 100644 --- a/src/emu/cpu/m6502/m6509.h +++ b/src/emu/cpu/m6502/m6509.h @@ -39,7 +39,6 @@ enum positiv edge sets overflow flag */ #define M6509_SET_OVERFLOW 3 -CPU_GET_INFO( m6509 ); -#define CPU_M6509 CPU_GET_INFO_NAME( m6509 ) +DECLARE_LEGACY_CPU_DEVICE(M6509, m6509); #endif /* __M6509_H__ */ diff --git a/src/emu/cpu/m6502/m65ce02.c b/src/emu/cpu/m6502/m65ce02.c index 8ef4020b301..c4d9667e6c1 100644 --- a/src/emu/cpu/m6502/m65ce02.c +++ b/src/emu/cpu/m6502/m65ce02.c @@ -84,8 +84,7 @@ struct _m65ce02_Regs { INLINE m65ce02_Regs *get_safe_token(running_device *device) { assert(device != NULL); - assert(device->type() == CPU); - assert(cpu_get_type(device) == CPU_M65CE02); + assert(device->type() == M65CE02); return (m65ce02_Regs *)downcast<legacy_cpu_device *>(device)->token(); } @@ -360,3 +359,5 @@ CPU_GET_INFO( m65ce02 ) case CPUINFO_STR_REGISTER + M65CE02_ZP: sprintf(info->s, "ZP:%03X", cpustate->zp.w.l); break; } } + +DEFINE_LEGACY_CPU_DEVICE(M65CE02, m65ce02); diff --git a/src/emu/cpu/m6502/m65ce02.h b/src/emu/cpu/m6502/m65ce02.h index be79c482277..2a556f560ff 100644 --- a/src/emu/cpu/m6502/m65ce02.h +++ b/src/emu/cpu/m6502/m65ce02.h @@ -35,8 +35,7 @@ enum #define M65CE02_IRQ_LINE M6502_IRQ_LINE -CPU_GET_INFO( m65ce02 ); -#define CPU_M65CE02 CPU_GET_INFO_NAME( m65ce02 ) +DECLARE_LEGACY_CPU_DEVICE(M65CE02, m65ce02); extern CPU_DISASSEMBLE( m65ce02 ); diff --git a/src/emu/cpu/m6800/m6800.c b/src/emu/cpu/m6800/m6800.c index 3a5743fe157..4da2e7a7d74 100644 --- a/src/emu/cpu/m6800/m6800.c +++ b/src/emu/cpu/m6800/m6800.c @@ -156,14 +156,13 @@ struct _m6800_state INLINE m6800_state *get_safe_token(running_device *device) { assert(device != NULL); - assert(device->type() == CPU); - assert(cpu_get_type(device) == CPU_M6800 || - cpu_get_type(device) == CPU_M6801 || - cpu_get_type(device) == CPU_M6802 || - cpu_get_type(device) == CPU_M6803 || - cpu_get_type(device) == CPU_M6808 || - cpu_get_type(device) == CPU_HD63701 || - cpu_get_type(device) == CPU_NSC8105); + assert(device->type() == M6800 || + device->type() == M6801 || + device->type() == M6802 || + device->type() == M6803 || + device->type() == M6808 || + device->type() == HD63701 || + device->type() == NSC8105); return (m6800_state *)downcast<legacy_cpu_device *>(device)->token(); } @@ -2888,3 +2887,11 @@ CPU_GET_INFO( nsc8105 ) default: CPU_GET_INFO_CALL(m6800); break; } } + +DEFINE_LEGACY_CPU_DEVICE(M6800, m6800); +DEFINE_LEGACY_CPU_DEVICE(M6801, m6801); +DEFINE_LEGACY_CPU_DEVICE(M6802, m6802); +DEFINE_LEGACY_CPU_DEVICE(M6803, m6803); +DEFINE_LEGACY_CPU_DEVICE(M6808, m6808); +DEFINE_LEGACY_CPU_DEVICE(HD63701, hd63701); +DEFINE_LEGACY_CPU_DEVICE(NSC8105, nsc8105); diff --git a/src/emu/cpu/m6800/m6800.h b/src/emu/cpu/m6800/m6800.h index 2a03a1889d1..96201243c79 100644 --- a/src/emu/cpu/m6800/m6800.h +++ b/src/emu/cpu/m6800/m6800.h @@ -42,23 +42,13 @@ enum M6803_PORT4 }; -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 ) +DECLARE_LEGACY_CPU_DEVICE(M6800, m6800); +DECLARE_LEGACY_CPU_DEVICE(M6801, m6801); +DECLARE_LEGACY_CPU_DEVICE(M6802, m6802); +DECLARE_LEGACY_CPU_DEVICE(M6803, m6803); +DECLARE_LEGACY_CPU_DEVICE(M6808, m6808); +DECLARE_LEGACY_CPU_DEVICE(HD63701, hd63701); +DECLARE_LEGACY_CPU_DEVICE(NSC8105, nsc8105); /* FIMXE: these should be replaced to use m6803 ones */ #define HD63701_DDR1 M6803_DDR1 @@ -75,10 +65,6 @@ READ8_HANDLER( hd63701_internal_registers_r ); WRITE8_HANDLER( hd63701_internal_registers_w ); -CPU_GET_INFO( nsc8105 ); -#define CPU_NSC8105 CPU_GET_INFO_NAME( nsc8105 ) - - CPU_DISASSEMBLE( m6800 ); CPU_DISASSEMBLE( m6801 ); CPU_DISASSEMBLE( m6802 ); @@ -106,8 +92,6 @@ CPU_DISASSEMBLE( nsc8105 ); #define M6801_WAI M6800_WAI #define M6801_IRQ_LINE M6800_IRQ_LINE -extern CPU_GET_INFO( m6801 ); - /**************************************************************************** * For now make the 6802 using the m6800 variables and functions ****************************************************************************/ @@ -124,8 +108,6 @@ extern CPU_GET_INFO( m6801 ); #define M6802_WAI M6800_WAI #define M6802_IRQ_LINE M6800_IRQ_LINE -extern CPU_GET_INFO( m6802 ); - /**************************************************************************** * For now make the 6803 using the m6800 variables and functions ****************************************************************************/ @@ -143,8 +125,6 @@ extern CPU_GET_INFO( m6802 ); #define M6803_IRQ_LINE M6800_IRQ_LINE #define M6803_TIN_LINE M6800_TIN_LINE -extern CPU_GET_INFO( m6803 ); - /* By default, on a port write port bits which are not set as output in the DDR */ /* are set to the value returned by a read from the same port. If you need to */ /* know the DDR for e.g. port 1, do m6803_internal_registers_r(M6801_DDR1) */ @@ -175,8 +155,6 @@ extern CPU_GET_INFO( m6803 ); #define M6808_WAI M6800_WAI #define M6808_IRQ_LINE M6800_IRQ_LINE -extern CPU_GET_INFO( m6808 ); - /**************************************************************************** * For now make the HD63701 using the m6800 variables and functions ****************************************************************************/ @@ -195,8 +173,6 @@ extern CPU_GET_INFO( m6808 ); #define HD63701_IRQ_LINE M6800_IRQ_LINE #define HD63701_TIN_LINE M6800_TIN_LINE -extern CPU_GET_INFO( hd63701 ); - #define HD63701_DDR1 M6803_DDR1 #define HD63701_DDR2 M6803_DDR2 #define HD63701_DDR3 M6803_DDR3 @@ -228,8 +204,6 @@ WRITE8_HANDLER( hd63701_internal_registers_w ); #define NSC8105_IRQ_LINE M6800_IRQ_LINE #define NSC8105_TIN_LINE M6800_TIN_LINE -extern CPU_GET_INFO( nsc8105 ); - #endif #endif /* __M6800_H__ */ diff --git a/src/emu/cpu/m68000/m68000.h b/src/emu/cpu/m68000/m68000.h index eb5aece8132..b1dbc70f507 100644 --- a/src/emu/cpu/m68000/m68000.h +++ b/src/emu/cpu/m68000/m68000.h @@ -73,33 +73,19 @@ typedef void (*m68k_rte_func)(running_device *device); typedef int (*m68k_tas_func)(running_device *device); -CPU_GET_INFO( m68000 ); -CPU_GET_INFO( m68008 ); -CPU_GET_INFO( m68010 ); -CPU_GET_INFO( m68ec020 ); -CPU_GET_INFO( m68020 ); -CPU_GET_INFO( m68020pmmu ); -CPU_GET_INFO( m68ec030 ); -CPU_GET_INFO( m68030 ); -CPU_GET_INFO( m68ec040 ); -CPU_GET_INFO( m68lc040 ); -CPU_GET_INFO( m68040 ); - -CPU_GET_INFO( scc68070 ); - -#define CPU_M68000 CPU_GET_INFO_NAME( m68000 ) -#define CPU_M68008 CPU_GET_INFO_NAME( m68008 ) -#define CPU_M68010 CPU_GET_INFO_NAME( m68010 ) -#define CPU_M68EC020 CPU_GET_INFO_NAME( m68ec020 ) -#define CPU_M68020 CPU_GET_INFO_NAME( m68020 ) -#define CPU_M68020_68851 CPU_GET_INFO_NAME( m68020pmmu ) -#define CPU_M68EC030 CPU_GET_INFO_NAME( m68ec030 ) -#define CPU_M68030 CPU_GET_INFO_NAME( m68030 ) -#define CPU_M68EC040 CPU_GET_INFO_NAME( m68ec040 ) -#define CPU_M68LC040 CPU_GET_INFO_NAME( m68lc040 ) -#define CPU_M68040 CPU_GET_INFO_NAME( m68040 ) - -#define CPU_SCC68070 CPU_GET_INFO_NAME( scc68070 ) +DECLARE_LEGACY_CPU_DEVICE(M68000, m68000); +DECLARE_LEGACY_CPU_DEVICE(M68008, m68008); +DECLARE_LEGACY_CPU_DEVICE(M68010, m68010); +DECLARE_LEGACY_CPU_DEVICE(M68EC020, m68ec020); +DECLARE_LEGACY_CPU_DEVICE(M68020, m68020); +DECLARE_LEGACY_CPU_DEVICE(M68020PMMU, m68020pmmu); +DECLARE_LEGACY_CPU_DEVICE(M68EC030, m68ec030); +DECLARE_LEGACY_CPU_DEVICE(M68030, m68030); +DECLARE_LEGACY_CPU_DEVICE(M68EC040, m68ec040); +DECLARE_LEGACY_CPU_DEVICE(M68LC040, m68lc040); +DECLARE_LEGACY_CPU_DEVICE(M68040, m68040); +DECLARE_LEGACY_CPU_DEVICE(SCC68070, scc68070); + void m68k_set_encrypted_opcode_range(running_device *device, offs_t start, offs_t end); diff --git a/src/emu/cpu/m68000/m68kcpu.c b/src/emu/cpu/m68000/m68kcpu.c index 247c5646d8e..96185b4f092 100644 --- a/src/emu/cpu/m68000/m68kcpu.c +++ b/src/emu/cpu/m68000/m68kcpu.c @@ -496,18 +496,17 @@ const UINT8 m68ki_ea_idx_cycle_table[64] = INLINE m68ki_cpu_core *get_safe_token(running_device *device) { assert(device != NULL); - assert(device->type() == CPU); - assert(cpu_get_type(device) == CPU_M68000 || - cpu_get_type(device) == CPU_M68008 || - cpu_get_type(device) == CPU_M68010 || - cpu_get_type(device) == CPU_M68EC020 || - cpu_get_type(device) == CPU_M68020 || - cpu_get_type(device) == CPU_M68020_68851 || - cpu_get_type(device) == CPU_M68EC030 || - cpu_get_type(device) == CPU_M68030 || - cpu_get_type(device) == CPU_M68EC040 || - cpu_get_type(device) == CPU_M68040 || - cpu_get_type(device) == CPU_SCC68070); + assert(device->type() == M68000 || + device->type() == M68008 || + device->type() == M68010 || + device->type() == M68EC020 || + device->type() == M68020 || + device->type() == M68020PMMU || + device->type() == M68EC030 || + device->type() == M68030 || + device->type() == M68EC040 || + device->type() == M68040 || + device->type() == SCC68070); return (m68ki_cpu_core *)downcast<legacy_cpu_device *>(device)->token(); } @@ -1813,3 +1812,16 @@ CPU_GET_INFO( scc68070 ) } } +DEFINE_LEGACY_CPU_DEVICE(M68000, m68000); +DEFINE_LEGACY_CPU_DEVICE(M68008, m68008); +DEFINE_LEGACY_CPU_DEVICE(M68010, m68010); +DEFINE_LEGACY_CPU_DEVICE(M68EC020, m68ec020); +DEFINE_LEGACY_CPU_DEVICE(M68020, m68020); +DEFINE_LEGACY_CPU_DEVICE(M68020PMMU, m68020pmmu); +DEFINE_LEGACY_CPU_DEVICE(M68EC030, m68ec030); +DEFINE_LEGACY_CPU_DEVICE(M68030, m68030); +DEFINE_LEGACY_CPU_DEVICE(M68EC040, m68ec040); +DEFINE_LEGACY_CPU_DEVICE(M68LC040, m68lc040); +DEFINE_LEGACY_CPU_DEVICE(M68040, m68040); +DEFINE_LEGACY_CPU_DEVICE(SCC68070, scc68070); + diff --git a/src/emu/cpu/m6805/m6805.c b/src/emu/cpu/m6805/m6805.c index d567a0aa758..7b356f6013a 100644 --- a/src/emu/cpu/m6805/m6805.c +++ b/src/emu/cpu/m6805/m6805.c @@ -70,10 +70,9 @@ typedef struct INLINE m6805_Regs *get_safe_token(running_device *device) { assert(device != NULL); - assert(device->type() == CPU); - assert(cpu_get_type(device) == CPU_M6805 || - cpu_get_type(device) == CPU_M68705 || - cpu_get_type(device) == CPU_HD63705); + assert(device->type() == M6805 || + device->type() == M68705 || + device->type() == HD63705); return (m6805_Regs *)downcast<legacy_cpu_device *>(device)->token(); } @@ -1075,3 +1074,7 @@ CPU_GET_INFO( hd63705 ) default: CPU_GET_INFO_CALL(m6805); break; } } + +DEFINE_LEGACY_CPU_DEVICE(M6805, m6805); +DEFINE_LEGACY_CPU_DEVICE(M68705, m68705); +DEFINE_LEGACY_CPU_DEVICE(HD63705, hd63705); diff --git a/src/emu/cpu/m6805/m6805.h b/src/emu/cpu/m6805/m6805.h index 2e84c35dae9..13a45348d52 100644 --- a/src/emu/cpu/m6805/m6805.h +++ b/src/emu/cpu/m6805/m6805.h @@ -10,8 +10,7 @@ enum { M6805_PC=1, M6805_S, M6805_CC, M6805_A, M6805_X, M6805_IRQ_STATE }; #define M6805_IRQ_LINE 0 -extern CPU_GET_INFO( m6805 ); -#define CPU_M6805 CPU_GET_INFO_NAME( m6805 ) +DECLARE_LEGACY_CPU_DEVICE(M6805, m6805); /**************************************************************************** * 68705 section @@ -27,8 +26,7 @@ extern CPU_GET_INFO( m6805 ); #define M68705_IRQ_LINE M6805_IRQ_LINE #define M68705_INT_TIMER 0x01 -extern CPU_GET_INFO( m68705 ); -#define CPU_M68705 CPU_GET_INFO_NAME( m68705 ) +DECLARE_LEGACY_CPU_DEVICE(M68705, m68705); /**************************************************************************** * HD63705 section @@ -55,8 +53,7 @@ extern CPU_GET_INFO( m68705 ); #define HD63705_INT_ADCONV 0x07 #define HD63705_INT_NMI 0x08 -extern CPU_GET_INFO( hd63705 ); -#define CPU_HD63705 CPU_GET_INFO_NAME( hd63705 ) +DECLARE_LEGACY_CPU_DEVICE(HD63705, hd63705); CPU_DISASSEMBLE( m6805 ); diff --git a/src/emu/cpu/m6809/m6809.c b/src/emu/cpu/m6809/m6809.c index 3f7c23e1f34..9e64437b562 100644 --- a/src/emu/cpu/m6809/m6809.c +++ b/src/emu/cpu/m6809/m6809.c @@ -114,9 +114,8 @@ struct _m68_state_t INLINE m68_state_t *get_safe_token(running_device *device) { assert(device != NULL); - assert(device->type() == CPU); - assert(cpu_get_type(device) == CPU_M6809 || - cpu_get_type(device) == CPU_M6809E); + assert(device->type() == M6809 || + device->type() == M6809E); return (m68_state_t *)downcast<legacy_cpu_device *>(device)->token(); } @@ -1203,3 +1202,6 @@ CPU_GET_INFO( m6809e ) default: CPU_GET_INFO_CALL(m6809); break; } } + +DEFINE_LEGACY_CPU_DEVICE(M6809, m6809); +DEFINE_LEGACY_CPU_DEVICE(M6809E, m6809e); diff --git a/src/emu/cpu/m6809/m6809.h b/src/emu/cpu/m6809/m6809.h index 1553647e0ad..1b1381322f8 100644 --- a/src/emu/cpu/m6809/m6809.h +++ b/src/emu/cpu/m6809/m6809.h @@ -15,12 +15,10 @@ enum #define M6809_IRQ_LINE 0 /* IRQ line number */ #define M6809_FIRQ_LINE 1 /* FIRQ line number */ -CPU_GET_INFO( m6809 ); -#define CPU_M6809 CPU_GET_INFO_NAME( m6809 ) +DECLARE_LEGACY_CPU_DEVICE(M6809, m6809); +DECLARE_LEGACY_CPU_DEVICE(M6809E, m6809e); /* M6809e has LIC line to indicate opcode/data fetch */ -CPU_GET_INFO( m6809e ); -#define CPU_M6809E CPU_GET_INFO_NAME( m6809e ) CPU_DISASSEMBLE( m6809 ); diff --git a/src/emu/cpu/mb86233/mb86233.c b/src/emu/cpu/mb86233/mb86233.c index 6cbc166ee8c..9f7328cef42 100644 --- a/src/emu/cpu/mb86233/mb86233.c +++ b/src/emu/cpu/mb86233/mb86233.c @@ -68,8 +68,7 @@ struct _mb86233_state INLINE mb86233_state *get_safe_token(running_device *device) { assert(device != NULL); - assert(device->type() == CPU); - assert(cpu_get_type(device) == CPU_MB86233); + assert(device->type() == MB86233); return (mb86233_state *)downcast<legacy_cpu_device *>(device)->token(); } @@ -1711,3 +1710,5 @@ CPU_GET_INFO( mb86233 ) case CPUINFO_STR_REGISTER + MB86233_R15: sprintf(info->s, "R15:%08X", GETGPR(15)); break; } } + +DEFINE_LEGACY_CPU_DEVICE(MB86233, mb86233); diff --git a/src/emu/cpu/mb86233/mb86233.h b/src/emu/cpu/mb86233/mb86233.h index bb008fa4e47..5b7924b822f 100644 --- a/src/emu/cpu/mb86233/mb86233.h +++ b/src/emu/cpu/mb86233/mb86233.h @@ -53,7 +53,6 @@ struct _mb86233_cpu_core const char *tablergn; }; -extern CPU_GET_INFO( mb86233 ); -#define CPU_MB86233 CPU_GET_INFO_NAME( mb86233 ) +DECLARE_LEGACY_CPU_DEVICE(MB86233, mb86233); #endif /* __MB86233_H__ */ diff --git a/src/emu/cpu/mb88xx/mb88xx.c b/src/emu/cpu/mb88xx/mb88xx.c index dd70bd7f6bf..59f1ef960c3 100644 --- a/src/emu/cpu/mb88xx/mb88xx.c +++ b/src/emu/cpu/mb88xx/mb88xx.c @@ -84,12 +84,11 @@ struct _mb88_state INLINE mb88_state *get_safe_token(running_device *device) { assert(device != NULL); - assert(device->type() == CPU); - assert(cpu_get_type(device) == CPU_MB88 || - cpu_get_type(device) == CPU_MB8841 || - cpu_get_type(device) == CPU_MB8842 || - cpu_get_type(device) == CPU_MB8843 || - cpu_get_type(device) == CPU_MB8844); + assert(device->type() == MB88 || + device->type() == MB8841 || + device->type() == MB8842 || + device->type() == MB8843 || + device->type() == MB8844); return (mb88_state *)downcast<legacy_cpu_device *>(device)->token(); } @@ -1100,3 +1099,9 @@ CPU_GET_INFO( mb8844 ) default: CPU_GET_INFO_CALL(mb88); break; } } + +DEFINE_LEGACY_CPU_DEVICE(MB88, mb88); +DEFINE_LEGACY_CPU_DEVICE(MB8841, mb8841); +DEFINE_LEGACY_CPU_DEVICE(MB8842, mb8842); +DEFINE_LEGACY_CPU_DEVICE(MB8843, mb8843); +DEFINE_LEGACY_CPU_DEVICE(MB8844, mb8844); diff --git a/src/emu/cpu/mb88xx/mb88xx.h b/src/emu/cpu/mb88xx/mb88xx.h index 10041634ed9..4391d669d25 100644 --- a/src/emu/cpu/mb88xx/mb88xx.h +++ b/src/emu/cpu/mb88xx/mb88xx.h @@ -64,17 +64,11 @@ struct _mb88_cpu_core PUBLIC FUNCTIONS ***************************************************************************/ -CPU_GET_INFO( mb88 ); -CPU_GET_INFO( mb8841 ); -CPU_GET_INFO( mb8842 ); -CPU_GET_INFO( mb8843 ); -CPU_GET_INFO( mb8844 ); - -#define CPU_MB88 CPU_GET_INFO_NAME( mb88 ) -#define CPU_MB8841 CPU_GET_INFO_NAME( mb8841 ) -#define CPU_MB8842 CPU_GET_INFO_NAME( mb8842 ) -#define CPU_MB8843 CPU_GET_INFO_NAME( mb8843 ) -#define CPU_MB8844 CPU_GET_INFO_NAME( mb8844 ) +DECLARE_LEGACY_CPU_DEVICE(MB88, mb88); +DECLARE_LEGACY_CPU_DEVICE(MB8841, mb8841); +DECLARE_LEGACY_CPU_DEVICE(MB8842, mb8842); +DECLARE_LEGACY_CPU_DEVICE(MB8843, mb8843); +DECLARE_LEGACY_CPU_DEVICE(MB8844, mb8844); CPU_DISASSEMBLE( mb88 ); diff --git a/src/emu/cpu/mc68hc11/mc68hc11.c b/src/emu/cpu/mc68hc11/mc68hc11.c index 8efff6c9766..6b8407e5eb3 100644 --- a/src/emu/cpu/mc68hc11/mc68hc11.c +++ b/src/emu/cpu/mc68hc11/mc68hc11.c @@ -81,8 +81,7 @@ struct _hc11_state INLINE hc11_state *get_safe_token(running_device *device) { assert(device != NULL); - assert(device->type() == CPU); - assert(cpu_get_type(device) == CPU_MC68HC11); + assert(device->type() == MC68HC11); return (hc11_state *)downcast<legacy_cpu_device *>(device)->token(); } @@ -608,3 +607,5 @@ CPU_GET_INFO( mc68hc11 ) case CPUINFO_STR_REGISTER + HC11_IY: sprintf(info->s, "IY: %04X", cpustate->iy); break; } } + +DEFINE_LEGACY_CPU_DEVICE(MC68HC11, mc68hc11); diff --git a/src/emu/cpu/mc68hc11/mc68hc11.h b/src/emu/cpu/mc68hc11/mc68hc11.h index 0e5ff6901ce..6c20c812295 100644 --- a/src/emu/cpu/mc68hc11/mc68hc11.h +++ b/src/emu/cpu/mc68hc11/mc68hc11.h @@ -6,8 +6,7 @@ CPU_DISASSEMBLE( hc11 ); -CPU_GET_INFO( mc68hc11 ); -#define CPU_MC68HC11 CPU_GET_INFO_NAME( mc68hc11 ) +DECLARE_LEGACY_CPU_DEVICE(MC68HC11, mc68hc11); #define MC68HC11_IO_PORTA 0x00 diff --git a/src/emu/cpu/mcs48/mcs48.c b/src/emu/cpu/mcs48/mcs48.c index 9aa50c377a4..94f5e98816c 100644 --- a/src/emu/cpu/mcs48/mcs48.c +++ b/src/emu/cpu/mcs48/mcs48.c @@ -220,24 +220,23 @@ static int check_irqs(mcs48_state *cpustate); INLINE mcs48_state *get_safe_token(running_device *device) { assert(device != NULL); - assert(device->type() == CPU); - assert(cpu_get_type(device) == CPU_I8035 || - cpu_get_type(device) == CPU_I8048 || - cpu_get_type(device) == CPU_I8648 || - cpu_get_type(device) == CPU_I8748 || - cpu_get_type(device) == CPU_I8039 || - cpu_get_type(device) == CPU_I8049 || - cpu_get_type(device) == CPU_I8749 || - cpu_get_type(device) == CPU_I8040 || - cpu_get_type(device) == CPU_I8050 || - cpu_get_type(device) == CPU_I8041 || - cpu_get_type(device) == CPU_I8741 || - cpu_get_type(device) == CPU_I8042 || - cpu_get_type(device) == CPU_I8242 || - cpu_get_type(device) == CPU_I8742 || - cpu_get_type(device) == CPU_MB8884 || - cpu_get_type(device) == CPU_N7751 || - cpu_get_type(device) == CPU_M58715); + assert(device->type() == I8035 || + device->type() == I8048 || + device->type() == I8648 || + device->type() == I8748 || + device->type() == I8039 || + device->type() == I8049 || + device->type() == I8749 || + device->type() == I8040 || + device->type() == I8050 || + device->type() == I8041 || + device->type() == I8741 || + device->type() == I8042 || + device->type() == I8242 || + device->type() == I8742 || + device->type() == MB8884 || + device->type() == N7751 || + device->type() == M58715); return (mcs48_state *)downcast<legacy_cpu_device *>(device)->token(); } @@ -1516,3 +1515,28 @@ CPU_GET_INFO( i8742 ) { mcs48_generic_get_info(devconfig, device, state, info, CPU_GET_INFO( mb8884 ) { mcs48_generic_get_info(devconfig, device, state, info, MCS48_FEATURE, 0, 64, "MB8884"); } CPU_GET_INFO( n7751 ) { mcs48_generic_get_info(devconfig, device, state, info, MCS48_FEATURE, 1024, 64, "N7751"); } CPU_GET_INFO( m58715 ) { mcs48_generic_get_info(devconfig, device, state, info, MCS48_FEATURE, 2048, 128, "M58715"); } + +/* Official Intel MCS-48 parts */ +DEFINE_LEGACY_CPU_DEVICE(I8021, i8021); /* 1k internal ROM, 64 bytes internal RAM */ +DEFINE_LEGACY_CPU_DEVICE(I8022, i8022); /* 2k internal ROM, 128 bytes internal RAM */ +DEFINE_LEGACY_CPU_DEVICE(I8035, i8035); /* external ROM, 64 bytes internal RAM */ +DEFINE_LEGACY_CPU_DEVICE(I8048, i8048); /* 1k internal ROM, 64 bytes internal RAM */ +DEFINE_LEGACY_CPU_DEVICE(I8648, i8648); /* 1k internal OTP ROM, 64 bytes internal RAM */ +DEFINE_LEGACY_CPU_DEVICE(I8748, i8748); /* 1k internal EEPROM, 64 bytes internal RAM */ +DEFINE_LEGACY_CPU_DEVICE(I8039, i8039); /* external ROM, 128 bytes internal RAM */ +DEFINE_LEGACY_CPU_DEVICE(I8049, i8049); /* 2k internal ROM, 128 bytes internal RAM */ +DEFINE_LEGACY_CPU_DEVICE(I8749, i8749); /* 2k internal EEPROM, 128 bytes internal RAM */ +DEFINE_LEGACY_CPU_DEVICE(I8040, i8040); /* external ROM, 256 bytes internal RAM */ +DEFINE_LEGACY_CPU_DEVICE(I8050, i8050); /* 4k internal ROM, 256 bytes internal RAM */ + +/* Official Intel UPI-41 parts */ +DEFINE_LEGACY_CPU_DEVICE(I8041, i8041); /* 1k internal ROM, 128 bytes internal RAM */ +DEFINE_LEGACY_CPU_DEVICE(I8741, i8741); /* 1k internal EEPROM, 128 bytes internal RAM */ +DEFINE_LEGACY_CPU_DEVICE(I8042, i8042); /* 2k internal ROM, 256 bytes internal RAM */ +DEFINE_LEGACY_CPU_DEVICE(I8242, i8242); /* 2k internal ROM, 256 bytes internal RAM */ +DEFINE_LEGACY_CPU_DEVICE(I8742, i8742); /* 2k internal EEPROM, 256 bytes internal RAM */ + +/* Clones */ +DEFINE_LEGACY_CPU_DEVICE(MB8884, mb8884); /* 8035 clone */ +DEFINE_LEGACY_CPU_DEVICE(N7751, n7751); /* 8048 clone */ +DEFINE_LEGACY_CPU_DEVICE(M58715, m58715); /* 8049 clone */ diff --git a/src/emu/cpu/mcs48/mcs48.h b/src/emu/cpu/mcs48/mcs48.h index 6d27bd55ccd..5e6b2d73f6d 100644 --- a/src/emu/cpu/mcs48/mcs48.h +++ b/src/emu/cpu/mcs48/mcs48.h @@ -87,59 +87,36 @@ enum MACROS ***************************************************************************/ -#define CPU_I8021 CPU_GET_INFO_NAME( i8021 ) -#define CPU_I8022 CPU_GET_INFO_NAME( i8022 ) -#define CPU_I8035 CPU_GET_INFO_NAME( i8035 ) -#define CPU_I8048 CPU_GET_INFO_NAME( i8048 ) -#define CPU_I8648 CPU_GET_INFO_NAME( i8648 ) -#define CPU_I8748 CPU_GET_INFO_NAME( i8748 ) -#define CPU_I8039 CPU_GET_INFO_NAME( i8039 ) -#define CPU_I8049 CPU_GET_INFO_NAME( i8049 ) -#define CPU_I8749 CPU_GET_INFO_NAME( i8749 ) -#define CPU_I8040 CPU_GET_INFO_NAME( i8040 ) -#define CPU_I8050 CPU_GET_INFO_NAME( i8050 ) - -#define CPU_I8041 CPU_GET_INFO_NAME( i8041 ) -#define CPU_I8741 CPU_GET_INFO_NAME( i8741 ) -#define CPU_I8042 CPU_GET_INFO_NAME( i8042 ) -#define CPU_I8242 CPU_GET_INFO_NAME( i8242 ) -#define CPU_I8742 CPU_GET_INFO_NAME( i8742 ) - -#define CPU_MB8884 CPU_GET_INFO_NAME( mb8884 ) -#define CPU_N7751 CPU_GET_INFO_NAME( n7751 ) -#define CPU_M58715 CPU_GET_INFO_NAME( m58715 ) - - - -/*************************************************************************** - FUNCTION PROTOTYPES -***************************************************************************/ - /* Official Intel MCS-48 parts */ -CPU_GET_INFO( i8021 ); /* 1k internal ROM, 64 bytes internal RAM */ -CPU_GET_INFO( i8022 ); /* 2k internal ROM, 128 bytes internal RAM */ -CPU_GET_INFO( i8035 ); /* external ROM, 64 bytes internal RAM */ -CPU_GET_INFO( i8048 ); /* 1k internal ROM, 64 bytes internal RAM */ -CPU_GET_INFO( i8648 ); /* 1k internal OTP ROM, 64 bytes internal RAM */ -CPU_GET_INFO( i8748 ); /* 1k internal EEPROM, 64 bytes internal RAM */ -CPU_GET_INFO( i8039 ); /* external ROM, 128 bytes internal RAM */ -CPU_GET_INFO( i8049 ); /* 2k internal ROM, 128 bytes internal RAM */ -CPU_GET_INFO( i8749 ); /* 2k internal EEPROM, 128 bytes internal RAM */ -CPU_GET_INFO( i8040 ); /* external ROM, 256 bytes internal RAM */ -CPU_GET_INFO( i8050 ); /* 4k internal ROM, 256 bytes internal RAM */ +DECLARE_LEGACY_CPU_DEVICE(I8021, i8021); /* 1k internal ROM, 64 bytes internal RAM */ +DECLARE_LEGACY_CPU_DEVICE(I8022, i8022); /* 2k internal ROM, 128 bytes internal RAM */ +DECLARE_LEGACY_CPU_DEVICE(I8035, i8035); /* external ROM, 64 bytes internal RAM */ +DECLARE_LEGACY_CPU_DEVICE(I8048, i8048); /* 1k internal ROM, 64 bytes internal RAM */ +DECLARE_LEGACY_CPU_DEVICE(I8648, i8648); /* 1k internal OTP ROM, 64 bytes internal RAM */ +DECLARE_LEGACY_CPU_DEVICE(I8748, i8748); /* 1k internal EEPROM, 64 bytes internal RAM */ +DECLARE_LEGACY_CPU_DEVICE(I8039, i8039); /* external ROM, 128 bytes internal RAM */ +DECLARE_LEGACY_CPU_DEVICE(I8049, i8049); /* 2k internal ROM, 128 bytes internal RAM */ +DECLARE_LEGACY_CPU_DEVICE(I8749, i8749); /* 2k internal EEPROM, 128 bytes internal RAM */ +DECLARE_LEGACY_CPU_DEVICE(I8040, i8040); /* external ROM, 256 bytes internal RAM */ +DECLARE_LEGACY_CPU_DEVICE(I8050, i8050); /* 4k internal ROM, 256 bytes internal RAM */ /* Official Intel UPI-41 parts */ -CPU_GET_INFO( i8041 ); /* 1k internal ROM, 128 bytes internal RAM */ -CPU_GET_INFO( i8741 ); /* 1k internal EEPROM, 128 bytes internal RAM */ -CPU_GET_INFO( i8042 ); /* 2k internal ROM, 256 bytes internal RAM */ -CPU_GET_INFO( i8242 ); /* 2k internal ROM, 256 bytes internal RAM */ -CPU_GET_INFO( i8742 ); /* 2k internal EEPROM, 256 bytes internal RAM */ +DECLARE_LEGACY_CPU_DEVICE(I8041, i8041); /* 1k internal ROM, 128 bytes internal RAM */ +DECLARE_LEGACY_CPU_DEVICE(I8741, i8741); /* 1k internal EEPROM, 128 bytes internal RAM */ +DECLARE_LEGACY_CPU_DEVICE(I8042, i8042); /* 2k internal ROM, 256 bytes internal RAM */ +DECLARE_LEGACY_CPU_DEVICE(I8242, i8242); /* 2k internal ROM, 256 bytes internal RAM */ +DECLARE_LEGACY_CPU_DEVICE(I8742, i8742); /* 2k internal EEPROM, 256 bytes internal RAM */ /* Clones */ -CPU_GET_INFO( mb8884 ); /* 8035 clone */ -CPU_GET_INFO( n7751 ); /* 8048 clone */ -CPU_GET_INFO( m58715 ); /* 8049 clone */ +DECLARE_LEGACY_CPU_DEVICE(MB8884, mb8884); /* 8035 clone */ +DECLARE_LEGACY_CPU_DEVICE(N7751, n7751); /* 8048 clone */ +DECLARE_LEGACY_CPU_DEVICE(M58715, m58715); /* 8049 clone */ + + +/*************************************************************************** + FUNCTION PROTOTYPES +***************************************************************************/ /* functions for talking to the input/output buffers on the UPI41-class chips */ UINT8 upi41_master_r(running_device *device, UINT8 a0); diff --git a/src/emu/cpu/mcs51/mcs51.c b/src/emu/cpu/mcs51/mcs51.c index 609d8e9aeb1..97b14180669 100644 --- a/src/emu/cpu/mcs51/mcs51.c +++ b/src/emu/cpu/mcs51/mcs51.c @@ -651,21 +651,20 @@ INLINE void serial_transmit(mcs51_state_t *mcs51_state, UINT8 data); INLINE mcs51_state_t *get_safe_token(running_device *device) { assert(device != NULL); - assert(device->type() == CPU); - assert(cpu_get_type(device) == CPU_I8031 || - cpu_get_type(device) == CPU_I8032 || - cpu_get_type(device) == CPU_I8051 || - cpu_get_type(device) == CPU_I8751 || - cpu_get_type(device) == CPU_I8052 || - cpu_get_type(device) == CPU_I8752 || - cpu_get_type(device) == CPU_I80C31 || - cpu_get_type(device) == CPU_I80C32 || - cpu_get_type(device) == CPU_I80C51 || - cpu_get_type(device) == CPU_I80C52 || - cpu_get_type(device) == CPU_I87C51 || - cpu_get_type(device) == CPU_I87C52 || - cpu_get_type(device) == CPU_AT89C4051 || - cpu_get_type(device) == CPU_DS5002FP); + assert(device->type() == I8031 || + device->type() == I8032 || + device->type() == I8051 || + device->type() == I8751 || + device->type() == I8052 || + device->type() == I8752 || + device->type() == I80C31 || + device->type() == I80C32 || + device->type() == I80C51 || + device->type() == I80C52 || + device->type() == I87C51 || + device->type() == I87C52 || + device->type() == AT89C4051 || + device->type() == DS5002FP); return (mcs51_state_t *)downcast<legacy_cpu_device *>(device)->token(); } @@ -2750,3 +2749,18 @@ CPU_GET_INFO( ds5002fp ) default: CPU_GET_INFO_CALL(i8051); break; } } + +DEFINE_LEGACY_CPU_DEVICE(I8031, i8031); +DEFINE_LEGACY_CPU_DEVICE(I8032, i8032); +DEFINE_LEGACY_CPU_DEVICE(I8051, i8051); +DEFINE_LEGACY_CPU_DEVICE(I8751, i8751); +DEFINE_LEGACY_CPU_DEVICE(I8052, i8052); +DEFINE_LEGACY_CPU_DEVICE(I8752, i8752); +DEFINE_LEGACY_CPU_DEVICE(I80C31, i80c31); +DEFINE_LEGACY_CPU_DEVICE(I80C51, i80c51); +DEFINE_LEGACY_CPU_DEVICE(I87C51, i87c51); +DEFINE_LEGACY_CPU_DEVICE(I80C32, i80c32); +DEFINE_LEGACY_CPU_DEVICE(I80C52, i80c52); +DEFINE_LEGACY_CPU_DEVICE(I87C52, i87c52); +DEFINE_LEGACY_CPU_DEVICE(AT89C4051, at89c4051); +DEFINE_LEGACY_CPU_DEVICE(DS5002FP, ds5002fp); diff --git a/src/emu/cpu/mcs51/mcs51.h b/src/emu/cpu/mcs51/mcs51.h index 4674ebe8938..3c2c51e55f3 100644 --- a/src/emu/cpu/mcs51/mcs51.h +++ b/src/emu/cpu/mcs51/mcs51.h @@ -96,47 +96,30 @@ extern void i8051_set_serial_tx_callback(running_device *device, mcs51_serial_tx extern void i8051_set_serial_rx_callback(running_device *device, mcs51_serial_rx_func rx_func); /* variants with no internal rom and 128 byte internal memory */ -CPU_GET_INFO( i8031 ); -#define CPU_I8031 CPU_GET_INFO_NAME( i8031 ) +DECLARE_LEGACY_CPU_DEVICE(I8031, i8031); /* variants with no internal rom and 256 byte internal memory */ -CPU_GET_INFO( i8032 ); -#define CPU_I8032 CPU_GET_INFO_NAME( i8032 ) +DECLARE_LEGACY_CPU_DEVICE(I8032, i8032); /* variants 4k internal rom and 128 byte internal memory */ -CPU_GET_INFO( i8051 ); -CPU_GET_INFO( i8751 ); - -#define CPU_I8051 CPU_GET_INFO_NAME( i8051 ) -#define CPU_I8751 CPU_GET_INFO_NAME( i8751 ) +DECLARE_LEGACY_CPU_DEVICE(I8051, i8051); +DECLARE_LEGACY_CPU_DEVICE(I8751, i8751); /* variants 8k internal rom and 256 byte internal memory and more registers */ -CPU_GET_INFO( i8052 ); -CPU_GET_INFO( i8752 ); - -#define CPU_I8052 CPU_GET_INFO_NAME( i8052 ) -#define CPU_I8752 CPU_GET_INFO_NAME( i8752 ) +DECLARE_LEGACY_CPU_DEVICE(I8052, i8052); +DECLARE_LEGACY_CPU_DEVICE(I8752, i8752); /* cmos variants */ -CPU_GET_INFO( i80c31 ); -CPU_GET_INFO( i80c51 ); -CPU_GET_INFO( i87c51 ); - -#define CPU_I80C31 CPU_GET_INFO_NAME( i80c31 ) -#define CPU_I80C32 CPU_GET_INFO_NAME( i80c32 ) -#define CPU_I80C51 CPU_GET_INFO_NAME( i80c51 ) - -CPU_GET_INFO( i80c32 ); -CPU_GET_INFO( i80c52 ); -CPU_GET_INFO( i87c52 ); +DECLARE_LEGACY_CPU_DEVICE(I80C31, i80c31); +DECLARE_LEGACY_CPU_DEVICE(I80C51, i80c51); +DECLARE_LEGACY_CPU_DEVICE(I87C51, i87c51); -#define CPU_I80C52 CPU_GET_INFO_NAME( i80c52 ) -#define CPU_I87C51 CPU_GET_INFO_NAME( i87c51 ) -#define CPU_I87C52 CPU_GET_INFO_NAME( i87c52 ) +DECLARE_LEGACY_CPU_DEVICE(I80C32, i80c32); +DECLARE_LEGACY_CPU_DEVICE(I80C52, i80c52); +DECLARE_LEGACY_CPU_DEVICE(I87C52, i87c52); /* 4k internal perom and 128 internal ram and 2 analog comparators */ -CPU_GET_INFO( at89c4051 ); -#define CPU_AT89C4051 CPU_GET_INFO_NAME( at89c4051 ) +DECLARE_LEGACY_CPU_DEVICE(AT89C4051, at89c4051); /* * The DS5002FP has 2 16 bits data address buses (the byte-wide bus and the expanded bus). The exact memory position accessed depends on the @@ -154,8 +137,7 @@ CPU_GET_INFO( at89c4051 ); * Internal ram 128k and security features */ -CPU_GET_INFO( ds5002fp ); -#define CPU_DS5002FP CPU_GET_INFO_NAME( ds5002fp ) +DECLARE_LEGACY_CPU_DEVICE(DS5002FP, ds5002fp); /**************************************************************************** diff --git a/src/emu/cpu/minx/minx.c b/src/emu/cpu/minx/minx.c index 1e839441278..3b89bcbabb4 100644 --- a/src/emu/cpu/minx/minx.c +++ b/src/emu/cpu/minx/minx.c @@ -96,8 +96,7 @@ typedef struct { INLINE minx_state *get_safe_token(running_device *device) { assert(device != NULL); - assert(device->type() == CPU); - assert(cpu_get_type(device) == CPU_MINX); + assert(device->type() == MINX); return (minx_state *)downcast<legacy_cpu_device *>(device)->token(); } @@ -395,3 +394,4 @@ CPU_GET_INFO( minx ) } } +DEFINE_LEGACY_CPU_DEVICE(MINX, minx); diff --git a/src/emu/cpu/minx/minx.h b/src/emu/cpu/minx/minx.h index 27e7aba31ed..5604c8cb055 100644 --- a/src/emu/cpu/minx/minx.h +++ b/src/emu/cpu/minx/minx.h @@ -11,8 +11,7 @@ enum MINX_XI, MINX_YI, }; -CPU_GET_INFO( minx ); -#define CPU_MINX CPU_GET_INFO_NAME( minx ) +DECLARE_LEGACY_CPU_DEVICE(MINX, minx); extern CPU_DISASSEMBLE( minx ); diff --git a/src/emu/cpu/mips/mips3.c b/src/emu/cpu/mips/mips3.c index e811f77d62d..88b2ad34eea 100644 --- a/src/emu/cpu/mips/mips3.c +++ b/src/emu/cpu/mips/mips3.c @@ -2463,3 +2463,26 @@ CPU_GET_INFO( rm7000le ) default: CPU_GET_INFO_CALL(mips3); break; } } + +DEFINE_LEGACY_CPU_DEVICE(VR4300BE, vr4300be); +DEFINE_LEGACY_CPU_DEVICE(VR4300LE, vr4300le); +DEFINE_LEGACY_CPU_DEVICE(VR4310BE, vr4310be); +DEFINE_LEGACY_CPU_DEVICE(VR4310LE, vr4310le); + +DEFINE_LEGACY_CPU_DEVICE(R4600BE, r4600be); +DEFINE_LEGACY_CPU_DEVICE(R4600LE, r4600le); + +DEFINE_LEGACY_CPU_DEVICE(R4650BE, r4650be); +DEFINE_LEGACY_CPU_DEVICE(R4650LE, r4650le); + +DEFINE_LEGACY_CPU_DEVICE(R4700BE, r4700be); +DEFINE_LEGACY_CPU_DEVICE(R4700LE, r4700le); + +DEFINE_LEGACY_CPU_DEVICE(R5000BE, r5000be); +DEFINE_LEGACY_CPU_DEVICE(R5000LE, r5000le); + +DEFINE_LEGACY_CPU_DEVICE(QED5271BE, qed5271be); +DEFINE_LEGACY_CPU_DEVICE(QED5271LE, qed5271le); + +DEFINE_LEGACY_CPU_DEVICE(RM7000BE, rm7000be); +DEFINE_LEGACY_CPU_DEVICE(RM7000LE, rm7000le); diff --git a/src/emu/cpu/mips/mips3.h b/src/emu/cpu/mips/mips3.h index 0e7e1cfc618..3fc198ee855 100644 --- a/src/emu/cpu/mips/mips3.h +++ b/src/emu/cpu/mips/mips3.h @@ -228,44 +228,28 @@ void mips3drc_set_options(running_device *device, UINT32 options); void mips3drc_add_fastram(running_device *device, offs_t start, offs_t end, UINT8 readonly, void *base); void mips3drc_add_hotspot(running_device *device, offs_t pc, UINT32 opcode, UINT32 cycles); -CPU_GET_INFO( vr4300be ); -CPU_GET_INFO( vr4300le ); -#define CPU_VR4300BE CPU_GET_INFO_NAME( vr4300be ) -#define CPU_VR4300LE CPU_GET_INFO_NAME( vr4300le ) -CPU_GET_INFO( vr4310be ); -CPU_GET_INFO( vr4310le ); -#define CPU_VR4310BE CPU_GET_INFO_NAME( vr4310be ) -#define CPU_VR4310LE CPU_GET_INFO_NAME( vr4310le ) - -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 ) +DECLARE_LEGACY_CPU_DEVICE(VR4300BE, vr4300be); +DECLARE_LEGACY_CPU_DEVICE(VR4300LE, vr4300le); +DECLARE_LEGACY_CPU_DEVICE(VR4310BE, vr4310be); +DECLARE_LEGACY_CPU_DEVICE(VR4310LE, vr4310le); + +DECLARE_LEGACY_CPU_DEVICE(R4600BE, r4600be); +DECLARE_LEGACY_CPU_DEVICE(R4600LE, r4600le); + +DECLARE_LEGACY_CPU_DEVICE(R4650BE, r4650be); +DECLARE_LEGACY_CPU_DEVICE(R4650LE, r4650le); + +DECLARE_LEGACY_CPU_DEVICE(R4700BE, r4700be); +DECLARE_LEGACY_CPU_DEVICE(R4700LE, r4700le); + +DECLARE_LEGACY_CPU_DEVICE(R5000BE, r5000be); +DECLARE_LEGACY_CPU_DEVICE(R5000LE, r5000le); + +DECLARE_LEGACY_CPU_DEVICE(QED5271BE, qed5271be); +DECLARE_LEGACY_CPU_DEVICE(QED5271LE, qed5271le); + +DECLARE_LEGACY_CPU_DEVICE(RM7000BE, rm7000be); +DECLARE_LEGACY_CPU_DEVICE(RM7000LE, rm7000le); diff --git a/src/emu/cpu/mips/mips3drc.c b/src/emu/cpu/mips/mips3drc.c index 057520ac8e5..5ef5404dd68 100644 --- a/src/emu/cpu/mips/mips3drc.c +++ b/src/emu/cpu/mips/mips3drc.c @@ -276,23 +276,22 @@ static const UINT8 fpmode_source[4] = INLINE mips3_state *get_safe_token(running_device *device) { assert(device != NULL); - assert(device->type() == CPU); - assert(cpu_get_type(device) == CPU_VR4300BE || - cpu_get_type(device) == CPU_VR4300LE || - cpu_get_type(device) == CPU_VR4310BE || - cpu_get_type(device) == CPU_VR4310LE || - cpu_get_type(device) == CPU_R4600BE || - cpu_get_type(device) == CPU_R4600LE || - cpu_get_type(device) == CPU_R4650BE || - cpu_get_type(device) == CPU_R4650LE || - cpu_get_type(device) == CPU_R4700BE || - cpu_get_type(device) == CPU_R4700LE || - cpu_get_type(device) == CPU_R5000BE || - cpu_get_type(device) == CPU_R5000LE || - cpu_get_type(device) == CPU_QED5271BE || - cpu_get_type(device) == CPU_QED5271LE || - cpu_get_type(device) == CPU_RM7000BE || - cpu_get_type(device) == CPU_RM7000LE); + assert(device->type() == VR4300BE || + device->type() == VR4300LE || + device->type() == VR4310BE || + device->type() == VR4310LE || + device->type() == R4600BE || + device->type() == R4600LE || + device->type() == R4650BE || + device->type() == R4650LE || + device->type() == R4700BE || + device->type() == R4700LE || + device->type() == R5000BE || + device->type() == R5000LE || + device->type() == QED5271BE || + device->type() == QED5271LE || + device->type() == RM7000BE || + device->type() == RM7000LE); return *(mips3_state **)downcast<legacy_cpu_device *>(device)->token(); } @@ -4065,3 +4064,26 @@ CPU_GET_INFO( rm7000le ) default: CPU_GET_INFO_CALL(mips3); break; } } + +DEFINE_LEGACY_CPU_DEVICE(VR4300BE, vr4300be); +DEFINE_LEGACY_CPU_DEVICE(VR4300LE, vr4300le); +DEFINE_LEGACY_CPU_DEVICE(VR4310BE, vr4310be); +DEFINE_LEGACY_CPU_DEVICE(VR4310LE, vr4310le); + +DEFINE_LEGACY_CPU_DEVICE(R4600BE, r4600be); +DEFINE_LEGACY_CPU_DEVICE(R4600LE, r4600le); + +DEFINE_LEGACY_CPU_DEVICE(R4650BE, r4650be); +DEFINE_LEGACY_CPU_DEVICE(R4650LE, r4650le); + +DEFINE_LEGACY_CPU_DEVICE(R4700BE, r4700be); +DEFINE_LEGACY_CPU_DEVICE(R4700LE, r4700le); + +DEFINE_LEGACY_CPU_DEVICE(R5000BE, r5000be); +DEFINE_LEGACY_CPU_DEVICE(R5000LE, r5000le); + +DEFINE_LEGACY_CPU_DEVICE(QED5271BE, qed5271be); +DEFINE_LEGACY_CPU_DEVICE(QED5271LE, qed5271le); + +DEFINE_LEGACY_CPU_DEVICE(RM7000BE, rm7000be); +DEFINE_LEGACY_CPU_DEVICE(RM7000LE, rm7000le); diff --git a/src/emu/cpu/mips/psx.c b/src/emu/cpu/mips/psx.c index 0b96e52f0b1..61277581c14 100644 --- a/src/emu/cpu/mips/psx.c +++ b/src/emu/cpu/mips/psx.c @@ -196,9 +196,8 @@ struct _psxcpu_state INLINE psxcpu_state *get_safe_token(running_device *device) { assert(device != NULL); - assert(device->type() == CPU); - assert(cpu_get_type(device) == CPU_PSXCPU || - cpu_get_type(device) == CPU_CXD8661R); + assert(device->type() == PSXCPU || + device->type() == CXD8661R); return (psxcpu_state *)downcast<legacy_cpu_device *>(device)->token(); } @@ -6426,3 +6425,6 @@ CPU_GET_INFO( cxd8661r ) } } + +DEFINE_LEGACY_CPU_DEVICE(PSXCPU, psxcpu); +DEFINE_LEGACY_CPU_DEVICE(CXD8661R, cxd8661r); diff --git a/src/emu/cpu/mips/psx.h b/src/emu/cpu/mips/psx.h index 0683719653a..75250dabdc3 100644 --- a/src/emu/cpu/mips/psx.h +++ b/src/emu/cpu/mips/psx.h @@ -214,10 +214,7 @@ struct _DasmPSXCPU_state extern unsigned DasmPSXCPU( DasmPSXCPU_state *state, char *buffer, UINT32 pc, const UINT8 *opram ); -CPU_GET_INFO( psxcpu ); -#define CPU_PSXCPU CPU_GET_INFO_NAME( psxcpu ) - -CPU_GET_INFO( cxd8661r ); -#define CPU_CXD8661R CPU_GET_INFO_NAME( cxd8661r ) +DECLARE_LEGACY_CPU_DEVICE(PSXCPU, psxcpu); +DECLARE_LEGACY_CPU_DEVICE(CXD8661R, cxd8661r); #endif /* __PSX_H__ */ diff --git a/src/emu/cpu/mips/r3000.c b/src/emu/cpu/mips/r3000.c index 2e18b3f2d7e..3a7a94d858f 100644 --- a/src/emu/cpu/mips/r3000.c +++ b/src/emu/cpu/mips/r3000.c @@ -165,11 +165,10 @@ struct _r3000_state INLINE r3000_state *get_safe_token(running_device *device) { assert(device != NULL); - assert(device->type() == CPU); - assert(cpu_get_type(device) == CPU_R3000BE || - cpu_get_type(device) == CPU_R3000LE || - cpu_get_type(device) == CPU_R3041BE || - cpu_get_type(device) == CPU_R3041LE); + assert(device->type() == R3000BE || + device->type() == R3000LE || + device->type() == R3041BE || + device->type() == R3041LE); return (r3000_state *)downcast<legacy_cpu_device *>(device)->token(); } @@ -1369,3 +1368,9 @@ CPU_GET_INFO( r3041le ) default: CPU_GET_INFO_CALL(r3000); break; } } + +DEFINE_LEGACY_CPU_DEVICE(R3000BE, r3000be); +DEFINE_LEGACY_CPU_DEVICE(R3000LE, r3000le); + +DEFINE_LEGACY_CPU_DEVICE(R3041BE, r3041be); +DEFINE_LEGACY_CPU_DEVICE(R3041LE, r3041le); diff --git a/src/emu/cpu/mips/r3000.h b/src/emu/cpu/mips/r3000.h index f6a287ca58f..d2c6789fbb3 100644 --- a/src/emu/cpu/mips/r3000.h +++ b/src/emu/cpu/mips/r3000.h @@ -59,16 +59,10 @@ struct _r3000_cpu_core PUBLIC FUNCTIONS ***************************************************************************/ -extern CPU_GET_INFO( r3000be ); -extern CPU_GET_INFO( r3000le ); +DECLARE_LEGACY_CPU_DEVICE(R3000BE, r3000be); +DECLARE_LEGACY_CPU_DEVICE(R3000LE, r3000le); -#define CPU_R3000BE CPU_GET_INFO_NAME( r3000be ) -#define CPU_R3000LE CPU_GET_INFO_NAME( r3000le ) - -extern CPU_GET_INFO( r3041be ); -extern CPU_GET_INFO( r3041le ); - -#define CPU_R3041BE CPU_GET_INFO_NAME( r3041be ) -#define CPU_R3041LE CPU_GET_INFO_NAME( r3041le ) +DECLARE_LEGACY_CPU_DEVICE(R3041BE, r3041be); +DECLARE_LEGACY_CPU_DEVICE(R3041LE, r3041le); #endif /* __R3000_H__ */ diff --git a/src/emu/cpu/mn10200/mn10200.c b/src/emu/cpu/mn10200/mn10200.c index 5d43be1adac..f0f856fd3ee 100644 --- a/src/emu/cpu/mn10200/mn10200.c +++ b/src/emu/cpu/mn10200/mn10200.c @@ -149,8 +149,7 @@ INLINE void mn102_change_pc(mn102_info *mn102, UINT32 pc) INLINE mn102_info *get_safe_token(running_device *device) { assert(device != NULL); - assert(device->type() == CPU); - assert(cpu_get_type(device) == CPU_MN10200); + assert(device->type() == MN10200); return (mn102_info *)downcast<legacy_cpu_device *>(device)->token(); } @@ -2437,3 +2436,5 @@ CPU_GET_INFO( mn10200 ) case CPUINFO_STR_REGISTER + MN10200_IAGR: sprintf(info->s, "IAGR: %02x", cpustate->iagr); break; } } + +DEFINE_LEGACY_CPU_DEVICE(MN10200, mn10200); diff --git a/src/emu/cpu/mn10200/mn10200.h b/src/emu/cpu/mn10200/mn10200.h index b4cd11d857b..4aa45352fda 100644 --- a/src/emu/cpu/mn10200/mn10200.h +++ b/src/emu/cpu/mn10200/mn10200.h @@ -45,8 +45,7 @@ enum MN10200_IRQ3 }; -CPU_GET_INFO( mn10200 ); -#define CPU_MN10200 CPU_GET_INFO_NAME( mn10200 ) +DECLARE_LEGACY_CPU_DEVICE(MN10200, mn10200); CPU_DISASSEMBLE( mn10200 ); diff --git a/src/emu/cpu/nec/nec.c b/src/emu/cpu/nec/nec.c index d6a090616e8..7ce59c8657f 100644 --- a/src/emu/cpu/nec/nec.c +++ b/src/emu/cpu/nec/nec.c @@ -184,12 +184,11 @@ struct _nec_state_t INLINE nec_state_t *get_safe_token(running_device *device) { assert(device != NULL); - assert(device->type() == CPU); - assert(cpu_get_type(device) == CPU_V20 || - cpu_get_type(device) == CPU_V25 || - cpu_get_type(device) == CPU_V30 || - cpu_get_type(device) == CPU_V33 || - cpu_get_type(device) == CPU_V35); + assert(device->type() == V20 || + device->type() == V25 || + device->type() == V30 || + device->type() == V33 || + device->type() == V35); return (nec_state_t *)downcast<legacy_cpu_device *>(device)->token(); } @@ -1219,7 +1218,7 @@ static CPU_INIT( v20 ) nec_init(device, irqcallback, 0); configure_memory_8bit(nec_state); - nec_state->chip_type=V20; + nec_state->chip_type=V20_TYPE; nec_state->prefetch_size = 4; /* 3 words */ nec_state->prefetch_cycles = 4; /* four cycles per byte */ } @@ -1230,7 +1229,7 @@ static CPU_INIT( v30 ) nec_init(device, irqcallback, 1); configure_memory_16bit(nec_state); - nec_state->chip_type=V30; + nec_state->chip_type=V30_TYPE; nec_state->prefetch_size = 6; /* 3 words */ nec_state->prefetch_cycles = 2; /* two cycles per byte / four per word */ @@ -1241,7 +1240,7 @@ static CPU_INIT( v33 ) nec_state_t *nec_state = get_safe_token(device); nec_init(device, irqcallback, 2); - nec_state->chip_type=V33; + nec_state->chip_type=V33_TYPE; nec_state->prefetch_size = 6; /* FIXME: Need information about prefetch size and cycles for V33. * complete guess below, nbbatman will not work @@ -1529,3 +1528,9 @@ CPU_GET_INFO( v35 ) default: CPU_GET_INFO_CALL(nec); break; } } + +DEFINE_LEGACY_CPU_DEVICE(V20, v20); +DEFINE_LEGACY_CPU_DEVICE(V25, v25); +DEFINE_LEGACY_CPU_DEVICE(V30, v30); +DEFINE_LEGACY_CPU_DEVICE(V33, v33); +DEFINE_LEGACY_CPU_DEVICE(V35, v35); diff --git a/src/emu/cpu/nec/nec.h b/src/emu/cpu/nec/nec.h index a63709d81e3..93070d1b5d4 100644 --- a/src/emu/cpu/nec/nec.h +++ b/src/emu/cpu/nec/nec.h @@ -20,16 +20,10 @@ enum };
/* Public functions */
-extern CPU_GET_INFO( v20 );
-extern CPU_GET_INFO( v25 );
-extern CPU_GET_INFO( v30 );
-extern CPU_GET_INFO( v33 );
-extern CPU_GET_INFO( v35 );
-
-#define CPU_V20 CPU_GET_INFO_NAME( v20 )
-#define CPU_V25 CPU_GET_INFO_NAME( v25 )
-#define CPU_V30 CPU_GET_INFO_NAME( v30 )
-#define CPU_V33 CPU_GET_INFO_NAME( v33 )
-#define CPU_V35 CPU_GET_INFO_NAME( v35 )
+DECLARE_LEGACY_CPU_DEVICE(V20, v20);
+DECLARE_LEGACY_CPU_DEVICE(V25, v25);
+DECLARE_LEGACY_CPU_DEVICE(V30, v30);
+DECLARE_LEGACY_CPU_DEVICE(V33, v33);
+DECLARE_LEGACY_CPU_DEVICE(V35, v35);
#endif
diff --git a/src/emu/cpu/nec/necpriv.h b/src/emu/cpu/nec/necpriv.h index 7dfcbb1ea3b..fe2da05fb90 100644 --- a/src/emu/cpu/nec/necpriv.h +++ b/src/emu/cpu/nec/necpriv.h @@ -5,9 +5,9 @@ typedef enum { AW, CW, DW, BW, SP, BP, IX, IY } WREGS; #define NEC_NMI_INT_VECTOR 2 /* Cpu types, steps of 8 to help the cycle count calculation */ -#define V33 0 -#define V30 8 -#define V20 16 +#define V33_TYPE 0 +#define V30_TYPE 8 +#define V20_TYPE 16 #ifndef FALSE #define FALSE 0 diff --git a/src/emu/cpu/pdp1/pdp1.c b/src/emu/cpu/pdp1/pdp1.c index aba3900c068..7200d42456a 100644 --- a/src/emu/cpu/pdp1/pdp1.c +++ b/src/emu/cpu/pdp1/pdp1.c @@ -425,8 +425,7 @@ struct _pdp1_state INLINE pdp1_state *get_safe_token(running_device *device) { assert(device != NULL); - assert(device->type() == CPU); - assert(cpu_get_type(device) == CPU_PDP1); + assert(device->type() == PDP1); return (pdp1_state *)downcast<legacy_cpu_device *>(device)->token(); } @@ -1887,3 +1886,5 @@ static void pulse_start_clear(pdp1_state *cpustate) if (cpustate->io_sc_callback) (*cpustate->io_sc_callback)(cpustate->device); } + +DEFINE_LEGACY_CPU_DEVICE(PDP1, pdp1); diff --git a/src/emu/cpu/pdp1/pdp1.h b/src/emu/cpu/pdp1/pdp1.h index 9660dc953ac..458fb5c236f 100644 --- a/src/emu/cpu/pdp1/pdp1.h +++ b/src/emu/cpu/pdp1/pdp1.h @@ -48,8 +48,7 @@ struct _pdp1_reset_param_t #define IOT_NO_COMPLETION_PULSE -1 /* PUBLIC FUNCTIONS */ -CPU_GET_INFO( pdp1 ); -#define CPU_PDP1 CPU_GET_INFO_NAME( pdp1 ) +DECLARE_LEGACY_CPU_DEVICE(PDP1, pdp1); #define AND 001 #define IOR 002 diff --git a/src/emu/cpu/pdp1/tx0.c b/src/emu/cpu/pdp1/tx0.c index fa0abe16c4a..e880abceba3 100644 --- a/src/emu/cpu/pdp1/tx0.c +++ b/src/emu/cpu/pdp1/tx0.c @@ -71,9 +71,8 @@ struct _tx0_state INLINE tx0_state *get_safe_token(running_device *device) { assert(device != NULL); - assert(device->type() == CPU); - assert(cpu_get_type(device) == CPU_TX0_64KW || - cpu_get_type(device) == CPU_TX0_8KW); + assert(device->type() == TX0_64KW || + device->type() == TX0_8KW); return (tx0_state *)downcast<legacy_cpu_device *>(device)->token(); } @@ -1299,3 +1298,6 @@ static void pulse_reset(running_device *device) if (cpustate->iface->io_reset_callback) (*cpustate->iface->io_reset_callback)(device); } + +DEFINE_LEGACY_CPU_DEVICE(TX0_64KW, tx0_64kw); +DEFINE_LEGACY_CPU_DEVICE(TX0_8KW, tx0_8kw); diff --git a/src/emu/cpu/pdp1/tx0.h b/src/emu/cpu/pdp1/tx0.h index 5e2f7a42f15..71875c3f8c6 100644 --- a/src/emu/cpu/pdp1/tx0.h +++ b/src/emu/cpu/pdp1/tx0.h @@ -43,11 +43,8 @@ struct _tx0_reset_param_t }; /* PUBLIC FUNCTIONS */ -CPU_GET_INFO( tx0_64kw ); -CPU_GET_INFO( tx0_8kw ); - -#define CPU_TX0_64KW CPU_GET_INFO_NAME( tx0_64kw ) -#define CPU_TX0_8KW CPU_GET_INFO_NAME( tx0_8kw ) +DECLARE_LEGACY_CPU_DEVICE(TX0_64KW, tx0_64kw); +DECLARE_LEGACY_CPU_DEVICE(TX0_8KW, tx0_8kw); CPU_DISASSEMBLE( tx0_64kw ); CPU_DISASSEMBLE( tx0_8kw ); diff --git a/src/emu/cpu/pic16c5x/pic16c5x.c b/src/emu/cpu/pic16c5x/pic16c5x.c index 493b101c6eb..9f21b9fdad2 100644 --- a/src/emu/cpu/pic16c5x/pic16c5x.c +++ b/src/emu/cpu/pic16c5x/pic16c5x.c @@ -106,12 +106,11 @@ struct _pic16c5x_state INLINE pic16c5x_state *get_safe_token(running_device *device) { assert(device != NULL); - assert(device->type() == CPU); - assert(cpu_get_type(device) == CPU_PIC16C54 || - cpu_get_type(device) == CPU_PIC16C55 || - cpu_get_type(device) == CPU_PIC16C56 || - cpu_get_type(device) == CPU_PIC16C57 || - cpu_get_type(device) == CPU_PIC16C58); + assert(device->type() == PIC16C54 || + device->type() == PIC16C55 || + device->type() == PIC16C56 || + device->type() == PIC16C57 || + device->type() == PIC16C58); return (pic16c5x_state *)downcast<legacy_cpu_device *>(device)->token(); } @@ -1384,3 +1383,9 @@ CPU_GET_INFO( pic16c58 ) default: CPU_GET_INFO_CALL(pic16c5x); break; } } + +DEFINE_LEGACY_CPU_DEVICE(PIC16C54, pic16c54); +DEFINE_LEGACY_CPU_DEVICE(PIC16C55, pic16c55); +DEFINE_LEGACY_CPU_DEVICE(PIC16C56, pic16c56); +DEFINE_LEGACY_CPU_DEVICE(PIC16C57, pic16c57); +DEFINE_LEGACY_CPU_DEVICE(PIC16C58, pic16c58); diff --git a/src/emu/cpu/pic16c5x/pic16c5x.h b/src/emu/cpu/pic16c5x/pic16c5x.h index 08eb44e419a..68224cb4a33 100644 --- a/src/emu/cpu/pic16c5x/pic16c5x.h +++ b/src/emu/cpu/pic16c5x/pic16c5x.h @@ -47,24 +47,11 @@ void pic16c5x_set_config(running_device *cpu, int data); -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 ) +DECLARE_LEGACY_CPU_DEVICE(PIC16C54, pic16c54); +DECLARE_LEGACY_CPU_DEVICE(PIC16C55, pic16c55); +DECLARE_LEGACY_CPU_DEVICE(PIC16C56, pic16c56); +DECLARE_LEGACY_CPU_DEVICE(PIC16C57, pic16c57); +DECLARE_LEGACY_CPU_DEVICE(PIC16C58, pic16c58); CPU_DISASSEMBLE( pic16c5x ); diff --git a/src/emu/cpu/pic16c62x/pic16c62x.c b/src/emu/cpu/pic16c62x/pic16c62x.c index c433a1fd59d..5cc4d749586 100644 --- a/src/emu/cpu/pic16c62x/pic16c62x.c +++ b/src/emu/cpu/pic16c62x/pic16c62x.c @@ -96,14 +96,13 @@ struct _pic16c62x_state INLINE pic16c62x_state *get_safe_token(running_device *device) { assert(device != NULL); - assert(device->type() == CPU); - assert(cpu_get_type(device) == CPU_PIC16C620 || - cpu_get_type(device) == CPU_PIC16C620A || -// cpu_get_type(device) == CPU_PIC16CR620A || - cpu_get_type(device) == CPU_PIC16C621 || - cpu_get_type(device) == CPU_PIC16C621A || - cpu_get_type(device) == CPU_PIC16C622 || - cpu_get_type(device) == CPU_PIC16C622A); + assert(device->type() == PIC16C620 || + device->type() == PIC16C620A || +// device->type() == PIC16CR620A || + device->type() == PIC16C621 || + device->type() == PIC16C621A || + device->type() == PIC16C622 || + device->type() == PIC16C622A); return (pic16c62x_state *)downcast<legacy_cpu_device *>(device)->token(); } @@ -1601,3 +1600,12 @@ CPU_GET_INFO( pic16c622a ) } } + +DEFINE_LEGACY_CPU_DEVICE(PIC16C620, pic16c620); +DEFINE_LEGACY_CPU_DEVICE(PIC16C620A, pic16c620a); +//DEFINE_LEGACY_CPU_DEVICE(PIC16CR620A, pic16cr620a); +DEFINE_LEGACY_CPU_DEVICE(PIC16C621, pic16c621); +DEFINE_LEGACY_CPU_DEVICE(PIC16C621A, pic16c621a); +DEFINE_LEGACY_CPU_DEVICE(PIC16C622, pic16c622); +DEFINE_LEGACY_CPU_DEVICE(PIC16C622A, pic16c622a); + diff --git a/src/emu/cpu/pic16c62x/pic16c62x.h b/src/emu/cpu/pic16c62x/pic16c62x.h index a361a942e69..97d54303ea3 100644 --- a/src/emu/cpu/pic16c62x/pic16c62x.h +++ b/src/emu/cpu/pic16c62x/pic16c62x.h @@ -50,31 +50,13 @@ void pic16c62x_set_config(running_device *cpu, int data); -CPU_GET_INFO( pic16c620 ); -#define CPU_PIC16C620 CPU_GET_INFO_NAME( pic16c620 ) - - -CPU_GET_INFO( pic16c620a ); -#define CPU_PIC16C620A CPU_GET_INFO_NAME( pic16c620a ) - - -//CPU_GET_INFO( pic16cr620a ); -//#define CPU_PIC16CR620A CPU_GET_INFO_NAME( pic16cr620a ) - - -CPU_GET_INFO( pic16c621 ); -#define CPU_PIC16C621 CPU_GET_INFO_NAME( pic16c621 ) - - -CPU_GET_INFO( pic16c621a ); -#define CPU_PIC16C621A CPU_GET_INFO_NAME( pic16c621a ) - -CPU_GET_INFO( pic16c622 ); -#define CPU_PIC16C622 CPU_GET_INFO_NAME( pic16c622 ) - - -CPU_GET_INFO( pic16c622a ); -#define CPU_PIC16C622A CPU_GET_INFO_NAME( pic16c622a ) +DECLARE_LEGACY_CPU_DEVICE(PIC16C620, pic16c620); +DECLARE_LEGACY_CPU_DEVICE(PIC16C620A, pic16c620a); +//DECLARE_LEGACY_CPU_DEVICE(PIC16CR620A, pic16cr620a); +DECLARE_LEGACY_CPU_DEVICE(PIC16C621, pic16c621); +DECLARE_LEGACY_CPU_DEVICE(PIC16C621A, pic16c621a); +DECLARE_LEGACY_CPU_DEVICE(PIC16C622, pic16c622); +DECLARE_LEGACY_CPU_DEVICE(PIC16C622A, pic16c622a); CPU_DISASSEMBLE( pic16c62x ); diff --git a/src/emu/cpu/powerpc/ppc.c b/src/emu/cpu/powerpc/ppc.c index fc09e1e3c30..6f251107dcc 100644 --- a/src/emu/cpu/powerpc/ppc.c +++ b/src/emu/cpu/powerpc/ppc.c @@ -2094,3 +2094,15 @@ CPU_GET_INFO( ppc604 ) default: CPU_GET_INFO_CALL(ppc); break; } } + +DEFINE_LEGACY_CPU_DEVICE(PPC403GA, ppc403ga); +DEFINE_LEGACY_CPU_DEVICE(PPC403GCX, ppc403gcx); + +DEFINE_LEGACY_CPU_DEVICE(PPC601, ppc601); +DEFINE_LEGACY_CPU_DEVICE(PPC602, ppc602); +DEFINE_LEGACY_CPU_DEVICE(PPC603, ppc603); +DEFINE_LEGACY_CPU_DEVICE(PPC603E, ppc603e); +DEFINE_LEGACY_CPU_DEVICE(PPC603R, ppc603r); +DEFINE_LEGACY_CPU_DEVICE(PPC604, ppc604); +DEFINE_LEGACY_CPU_DEVICE(MPC8240, mpc8240); + diff --git a/src/emu/cpu/powerpc/ppc.h b/src/emu/cpu/powerpc/ppc.h index 34b485f4213..c9f6489b3db 100644 --- a/src/emu/cpu/powerpc/ppc.h +++ b/src/emu/cpu/powerpc/ppc.h @@ -167,32 +167,16 @@ void ppc4xx_spu_set_tx_handler(running_device *device, ppc4xx_spu_tx_handler han void ppc4xx_spu_receive_byte(running_device *device, UINT8 byteval); -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 ) +DECLARE_LEGACY_CPU_DEVICE(PPC403GA, ppc403ga); +DECLARE_LEGACY_CPU_DEVICE(PPC403GCX, ppc403gcx); + +DECLARE_LEGACY_CPU_DEVICE(PPC601, ppc601); +DECLARE_LEGACY_CPU_DEVICE(PPC602, ppc602); +DECLARE_LEGACY_CPU_DEVICE(PPC603, ppc603); +DECLARE_LEGACY_CPU_DEVICE(PPC603E, ppc603e); +DECLARE_LEGACY_CPU_DEVICE(PPC603R, ppc603r); +DECLARE_LEGACY_CPU_DEVICE(PPC604, ppc604); +DECLARE_LEGACY_CPU_DEVICE(MPC8240, mpc8240); #endif /* __PPC_H__ */ diff --git a/src/emu/cpu/powerpc/ppcdrc.c b/src/emu/cpu/powerpc/ppcdrc.c index db89255bb23..5daeac700ce 100644 --- a/src/emu/cpu/powerpc/ppcdrc.c +++ b/src/emu/cpu/powerpc/ppcdrc.c @@ -438,16 +438,15 @@ static const UINT8 fcmp_cr_table_source[32] = INLINE powerpc_state *get_safe_token(running_device *device) { assert(device != NULL); - assert(device->type() == CPU); - assert(cpu_get_type(device) == CPU_PPC403GA || - cpu_get_type(device) == CPU_PPC403GCX || - cpu_get_type(device) == CPU_PPC601 || - cpu_get_type(device) == CPU_PPC602 || - cpu_get_type(device) == CPU_PPC603 || - cpu_get_type(device) == CPU_PPC603E || - cpu_get_type(device) == CPU_PPC603R || - cpu_get_type(device) == CPU_PPC604 || - cpu_get_type(device) == CPU_MPC8240); + assert(device->type() == PPC403GA || + device->type() == PPC403GCX || + device->type() == PPC601 || + device->type() == PPC602 || + device->type() == PPC603 || + device->type() == PPC603E || + device->type() == PPC603R || + device->type() == PPC604 || + device->type() == MPC8240); return *(powerpc_state **)downcast<legacy_cpu_device *>(device)->token(); } @@ -4621,3 +4620,14 @@ CPU_GET_INFO( mpc8240 ) default: CPU_GET_INFO_CALL(ppcdrc); break; } } + +DEFINE_LEGACY_CPU_DEVICE(PPC403GA, ppc403ga); +DEFINE_LEGACY_CPU_DEVICE(PPC403GCX, ppc403gcx); + +DEFINE_LEGACY_CPU_DEVICE(PPC601, ppc601); +DEFINE_LEGACY_CPU_DEVICE(PPC602, ppc602); +DEFINE_LEGACY_CPU_DEVICE(PPC603, ppc603); +DEFINE_LEGACY_CPU_DEVICE(PPC603E, ppc603e); +DEFINE_LEGACY_CPU_DEVICE(PPC603R, ppc603r); +DEFINE_LEGACY_CPU_DEVICE(PPC604, ppc604); +DEFINE_LEGACY_CPU_DEVICE(MPC8240, mpc8240); diff --git a/src/emu/cpu/rsp/rsp.c b/src/emu/cpu/rsp/rsp.c index 50cf86a3934..a082027c85c 100644 --- a/src/emu/cpu/rsp/rsp.c +++ b/src/emu/cpu/rsp/rsp.c @@ -30,8 +30,7 @@ extern offs_t rsp_dasm_one(char *buffer, offs_t pc, UINT32 op); INLINE rsp_state *get_safe_token(running_device *device) { assert(device != NULL); - assert(device->type() == CPU); - assert(cpu_get_type(device) == CPU_RSP); + assert(device->type() == RSP); return (rsp_state *)downcast<legacy_cpu_device *>(device)->token(); } @@ -2989,3 +2988,5 @@ CPU_GET_INFO( rsp ) case CPUINFO_STR_REGISTER + RSP_STEPCNT: sprintf(info->s, "STEP: %d", rsp->step_count); break; } } + +DEFINE_LEGACY_CPU_DEVICE(RSP, rsp); diff --git a/src/emu/cpu/rsp/rsp.h b/src/emu/cpu/rsp/rsp.h index bddfd64fc4d..480e47e931e 100644 --- a/src/emu/cpu/rsp/rsp.h +++ b/src/emu/cpu/rsp/rsp.h @@ -216,8 +216,7 @@ struct _rsp_state rspimp_state* impstate; }; -CPU_GET_INFO( rsp ); -#define CPU_RSP CPU_GET_INFO_NAME( rsp ) +DECLARE_LEGACY_CPU_DEVICE(RSP, rsp); extern offs_t rsp_dasm_one(char *buffer, offs_t pc, UINT32 op); diff --git a/src/emu/cpu/rsp/rspdrc.c b/src/emu/cpu/rsp/rspdrc.c index 692691b6108..963a57c2635 100644 --- a/src/emu/cpu/rsp/rspdrc.c +++ b/src/emu/cpu/rsp/rspdrc.c @@ -351,8 +351,7 @@ static void log_add_disasm_comment(rsp_state *rsp, drcuml_block *block, UINT32 p INLINE rsp_state *get_safe_token(running_device *device) { assert(device != NULL); - assert(device->type() == CPU); - assert(cpu_get_type(device) == CPU_RSP); + assert(device->type() == RSP); return *(rsp_state **)downcast<legacy_cpu_device *>(device)->token(); } @@ -8718,3 +8717,5 @@ CPU_GET_INFO( rsp ) case CPUINFO_STR_REGISTER + RSP_STEPCNT: sprintf(info->s, "STEP: %d", rsp->step_count); break; } } + +DEFINE_LEGACY_CPU_DEVICE(RSP, rsp); diff --git a/src/emu/cpu/s2650/s2650.c b/src/emu/cpu/s2650/s2650.c index 774f66a4c9e..f5a119b4b66 100644 --- a/src/emu/cpu/s2650/s2650.c +++ b/src/emu/cpu/s2650/s2650.c @@ -50,8 +50,7 @@ struct _s2650_regs { INLINE s2650_regs *get_safe_token(running_device *device) { assert(device != NULL); - assert(device->type() == CPU); - assert(cpu_get_type(device) == CPU_S2650); + assert(device->type() == S2650); return (s2650_regs *)downcast<legacy_cpu_device *>(device)->token(); } @@ -1641,3 +1640,5 @@ CPU_GET_INFO( s2650 ) case CPUINFO_STR_REGISTER + S2650_FO: sprintf(info->s, "FO:%X", (s2650c->psu & FO) ? 1 : 0); break; } } + +DEFINE_LEGACY_CPU_DEVICE(S2650, s2650); diff --git a/src/emu/cpu/s2650/s2650.h b/src/emu/cpu/s2650/s2650.h index 61c591ba92a..8fa34426fff 100644 --- a/src/emu/cpu/s2650/s2650.h +++ b/src/emu/cpu/s2650/s2650.h @@ -21,8 +21,7 @@ enum S2650_FO_PORT = 0x0103 /* Fake FO Line */ }; -extern CPU_GET_INFO( s2650 ); -#define CPU_S2650 CPU_GET_INFO_NAME( s2650 ) +DECLARE_LEGACY_CPU_DEVICE(S2650, s2650); extern CPU_DISASSEMBLE( s2650 ); diff --git a/src/emu/cpu/saturn/saturn.c b/src/emu/cpu/saturn/saturn.c index e9a46376762..8d442e018ae 100644 --- a/src/emu/cpu/saturn/saturn.c +++ b/src/emu/cpu/saturn/saturn.c @@ -90,8 +90,7 @@ struct _saturn_state INLINE saturn_state *get_safe_token(running_device *device) { assert(device != NULL); - assert(device->type() == CPU); - assert(cpu_get_type(device) == CPU_SATURN); + assert(device->type() == SATURN); return (saturn_state *)downcast<legacy_cpu_device *>(device)->token(); } @@ -407,3 +406,5 @@ CPU_GET_INFO( saturn ) case CPUINFO_STR_REGISTER + SATURN_SLEEPING: sprintf(info->s, "sleep:%c", cpustate->sleeping?'S':'.'); break; } } + +DEFINE_LEGACY_CPU_DEVICE(SATURN, saturn); diff --git a/src/emu/cpu/saturn/saturn.h b/src/emu/cpu/saturn/saturn.h index 3ad3bc1fe2a..02a4207252a 100644 --- a/src/emu/cpu/saturn/saturn.h +++ b/src/emu/cpu/saturn/saturn.h @@ -87,7 +87,6 @@ enum CPU_DISASSEMBLE( saturn ); -CPU_GET_INFO( saturn ); -#define CPU_SATURN CPU_GET_INFO_NAME( saturn ) +DECLARE_LEGACY_CPU_DEVICE(SATURN, saturn); #endif /* __SATURN_H__ */ diff --git a/src/emu/cpu/sc61860/sc61860.c b/src/emu/cpu/sc61860/sc61860.c index 098678b1611..40aad0faffe 100644 --- a/src/emu/cpu/sc61860/sc61860.c +++ b/src/emu/cpu/sc61860/sc61860.c @@ -63,8 +63,7 @@ struct _sc61860_state INLINE sc61860_state *get_safe_token(running_device *device) { assert(device != NULL); - assert(device->type() == CPU); - assert(cpu_get_type(device) == CPU_SC61860); + assert(device->type() == SC61860); return (sc61860_state *)downcast<legacy_cpu_device *>(device)->token(); } @@ -245,3 +244,5 @@ CPU_GET_INFO( sc61860 ) case CPUINFO_STR_REGISTER + SC61860_ZERO: sprintf(info->s, "Zero: %d", cpustate->zero);break; } } + +DEFINE_LEGACY_CPU_DEVICE(SC61860, sc61860); diff --git a/src/emu/cpu/sc61860/sc61860.h b/src/emu/cpu/sc61860/sc61860.h index cc8dc6b9bbd..e834873744d 100644 --- a/src/emu/cpu/sc61860/sc61860.h +++ b/src/emu/cpu/sc61860/sc61860.h @@ -55,7 +55,6 @@ CPU_DISASSEMBLE( sc61860 ); /* this is though for power on/off of the sharps */ UINT8 *sc61860_internal_ram(running_device *device); -CPU_GET_INFO( sc61860 ); -#define CPU_SC61860 CPU_GET_INFO_NAME( sc61860 ) +DECLARE_LEGACY_CPU_DEVICE(SC61860, sc61860); #endif /* __SC61860_H__ */ diff --git a/src/emu/cpu/scmp/scmp.c b/src/emu/cpu/scmp/scmp.c index e88300cc8a6..bfbd9d3c55f 100644 --- a/src/emu/cpu/scmp/scmp.c +++ b/src/emu/cpu/scmp/scmp.c @@ -56,8 +56,7 @@ struct _scmp_state INLINE scmp_state *get_safe_token(running_device *device) { assert(device != NULL); - assert(device->type() == CPU); - assert(cpu_get_type(device) == CPU_SCMP || cpu_get_type(device) == CPU_INS8060); + assert(device->type() == SCMP || device->type() == INS8060); return (scmp_state *)downcast<legacy_cpu_device *>(device)->token(); } @@ -664,3 +663,6 @@ CPU_GET_INFO( ins8060 ) default: CPU_GET_INFO_CALL(scmp); break; } } + +DEFINE_LEGACY_CPU_DEVICE(SCMP, scmp); +DEFINE_LEGACY_CPU_DEVICE(INS8060, ins8060); diff --git a/src/emu/cpu/scmp/scmp.h b/src/emu/cpu/scmp/scmp.h index e8fccffe9ff..c0ff8a4c8ad 100644 --- a/src/emu/cpu/scmp/scmp.h +++ b/src/emu/cpu/scmp/scmp.h @@ -33,12 +33,10 @@ struct _scmp_config FUNCTION PROTOTYPES ***************************************************************************/ -CPU_GET_INFO( scmp ); -#define CPU_SCMP CPU_GET_INFO_NAME( scmp ) +DECLARE_LEGACY_CPU_DEVICE(SCMP, scmp); CPU_DISASSEMBLE( scmp ); -CPU_GET_INFO( ins8060 ); -#define CPU_INS8060 CPU_GET_INFO_NAME( ins8060 ) +DECLARE_LEGACY_CPU_DEVICE(INS8060, ins8060); #endif diff --git a/src/emu/cpu/se3208/se3208.c b/src/emu/cpu/se3208/se3208.c index 8d4641f475d..07b5659d3b8 100644 --- a/src/emu/cpu/se3208/se3208.c +++ b/src/emu/cpu/se3208/se3208.c @@ -61,8 +61,7 @@ static _OP *OpTable=NULL; INLINE se3208_state_t *get_safe_token(running_device *device) { assert(device != NULL); - assert(device->type() == CPU); - assert(cpu_get_type(device) == CPU_SE3208); + assert(device->type() == SE3208); return (se3208_state_t *)downcast<legacy_cpu_device *>(device)->token(); } @@ -1935,3 +1934,5 @@ CPU_GET_INFO( se3208 ) } } + +DEFINE_LEGACY_CPU_DEVICE(SE3208, se3208); diff --git a/src/emu/cpu/se3208/se3208.h b/src/emu/cpu/se3208/se3208.h index b580e900ad4..272fb7beddd 100644 --- a/src/emu/cpu/se3208/se3208.h +++ b/src/emu/cpu/se3208/se3208.h @@ -7,7 +7,6 @@ enum #define SE3208_INT 0 -extern CPU_GET_INFO( se3208 ); -#define CPU_SE3208 CPU_GET_INFO_NAME( se3208 ) +DECLARE_LEGACY_CPU_DEVICE(SE3208, se3208); CPU_DISASSEMBLE( se3208 ); diff --git a/src/emu/cpu/sh2/sh2.c b/src/emu/cpu/sh2/sh2.c index 1bacc091a98..d24b9277e38 100644 --- a/src/emu/cpu/sh2/sh2.c +++ b/src/emu/cpu/sh2/sh2.c @@ -116,7 +116,7 @@ CPU_DISASSEMBLE( sh2 ); #define LOG(x) do { if (VERBOSE) logerror x; } while (0) static int sh2_icount; -SH2 *sh2; +sh2_state *sh2; INLINE UINT8 RB(offs_t A) { @@ -2154,7 +2154,7 @@ static CPU_RESET( sh2 ) save_is_slave = sh2->is_slave; dma_callback_kludge = sh2->dma_callback_kludge; - memset(sh2, 0, sizeof(SH2)); + memset(sh2, 0, sizeof(sh2_state)); sh2->dma_callback_kludge = dma_callback_kludge; sh2->is_slave = save_is_slave; @@ -2318,7 +2318,7 @@ CPU_GET_INFO( sh2 ) switch (state) { /* --- the following bits of info are returned as 64-bit signed integers --- */ - case CPUINFO_INT_CONTEXT_SIZE: info->i = sizeof(SH2); break; + case CPUINFO_INT_CONTEXT_SIZE: info->i = sizeof(sh2_state); break; case CPUINFO_INT_INPUT_LINES: info->i = 16; break; case CPUINFO_INT_DEFAULT_IRQ_VECTOR: info->i = 0; break; case DEVINFO_INT_ENDIANNESS: info->i = ENDIANNESS_BIG; break; @@ -2464,4 +2464,7 @@ void sh2drc_add_pcflush(running_device *device, offs_t address) /* doesn't apply here */ } +DEFINE_LEGACY_CPU_DEVICE(SH1, sh1); +DEFINE_LEGACY_CPU_DEVICE(SH2, sh2); + #endif diff --git a/src/emu/cpu/sh2/sh2.h b/src/emu/cpu/sh2/sh2.h index 792147ddeb2..fd93257fec3 100644 --- a/src/emu/cpu/sh2/sh2.h +++ b/src/emu/cpu/sh2/sh2.h @@ -64,11 +64,8 @@ struct _sh2_cpu_core int (*dma_callback_kludge)(UINT32 src, UINT32 dst, UINT32 data, int size); }; -extern CPU_GET_INFO( sh1 ); -extern CPU_GET_INFO( sh2 ); - -#define CPU_SH1 CPU_GET_INFO_NAME( sh1 ) -#define CPU_SH2 CPU_GET_INFO_NAME( sh2 ) +DECLARE_LEGACY_CPU_DEVICE(SH1, sh1); +DECLARE_LEGACY_CPU_DEVICE(SH2, sh2); WRITE32_HANDLER( sh2_internal_w ); READ32_HANDLER( sh2_internal_r ); diff --git a/src/emu/cpu/sh2/sh2comn.c b/src/emu/cpu/sh2/sh2comn.c index 94f95085f7a..a40b3bc4876 100644 --- a/src/emu/cpu/sh2/sh2comn.c +++ b/src/emu/cpu/sh2/sh2comn.c @@ -16,15 +16,15 @@ #define LOG(x) do { if (VERBOSE) logerror x; } while (0) #ifdef USE_SH2DRC -#define GET_SH2(dev) *(SH2 **)downcast<legacy_cpu_device *>(dev)->token() +#define GET_SH2(dev) *(sh2_state **)downcast<legacy_cpu_device *>(dev)->token() #else -#define GET_SH2(dev) (SH2 *)downcast<legacy_cpu_device *>(dev)->token() +#define GET_SH2(dev) (sh2_state *)downcast<legacy_cpu_device *>(dev)->token() #endif static const int div_tab[4] = { 3, 5, 7, 0 }; -INLINE UINT32 RL(SH2 *sh2, offs_t A) +INLINE UINT32 RL(sh2_state *sh2, offs_t A) { if (A >= 0xe0000000) return sh2_internal_r(sh2->internal, (A & 0x1fc)>>2, 0xffffffff); @@ -38,7 +38,7 @@ INLINE UINT32 RL(SH2 *sh2, offs_t A) return memory_read_dword_32be(sh2->program, A & AM); } -INLINE void WL(SH2 *sh2, offs_t A, UINT32 V) +INLINE void WL(sh2_state *sh2, offs_t A, UINT32 V) { if (A >= 0xe0000000) { @@ -58,7 +58,7 @@ INLINE void WL(SH2 *sh2, offs_t A, UINT32 V) memory_write_dword_32be(sh2->program, A & AM,V); } -static void sh2_timer_resync(SH2 *sh2) +static void sh2_timer_resync(sh2_state *sh2) { int divider = div_tab[(sh2->m[5] >> 8) & 3]; UINT64 cur_time = sh2->device->total_cycles(); @@ -68,7 +68,7 @@ static void sh2_timer_resync(SH2 *sh2) sh2->frc_base = cur_time; } -static void sh2_timer_activate(SH2 *sh2) +static void sh2_timer_activate(sh2_state *sh2) { int max_delta = 0xfffff; UINT16 frc; @@ -108,7 +108,7 @@ static void sh2_timer_activate(SH2 *sh2) static TIMER_CALLBACK( sh2_timer_callback ) { - SH2 *sh2 = (SH2 *)ptr; + sh2_state *sh2 = (sh2_state *)ptr; UINT16 frc; sh2_timer_resync(sh2); @@ -136,7 +136,7 @@ static TIMER_CALLBACK( sh2_timer_callback ) static TIMER_CALLBACK( sh2_dmac_callback ) { int dma = param & 1; - SH2 *sh2 = (SH2 *)ptr; + sh2_state *sh2 = (sh2_state *)ptr; LOG(("SH2.%s: DMA %d complete\n", sh2->device->tag(), dma)); sh2->m[0x63+4*dma] |= 2; @@ -144,7 +144,7 @@ static TIMER_CALLBACK( sh2_dmac_callback ) sh2_recalc_irq(sh2); } -static void sh2_dmac_check(SH2 *sh2, int dma) +static void sh2_dmac_check(sh2_state *sh2, int dma) { if(sh2->m[0x63+4*dma] & sh2->m[0x6c] & 1) { @@ -284,7 +284,7 @@ static void sh2_dmac_check(SH2 *sh2, int dma) WRITE32_HANDLER( sh2_internal_w ) { - SH2 *sh2 = GET_SH2(space->cpu); + sh2_state *sh2 = GET_SH2(space->cpu); UINT32 old; #ifdef USE_SH2DRC @@ -462,7 +462,7 @@ WRITE32_HANDLER( sh2_internal_w ) READ32_HANDLER( sh2_internal_r ) { - SH2 *sh2 = GET_SH2(space->cpu); + sh2_state *sh2 = GET_SH2(space->cpu); #ifdef USE_SH2DRC offset &= 0x7f; @@ -502,13 +502,13 @@ READ32_HANDLER( sh2_internal_r ) void sh2_set_ftcsr_read_callback(running_device *device, void (*callback)(UINT32)) { - SH2 *sh2 = GET_SH2(device); + sh2_state *sh2 = GET_SH2(device); sh2->ftcsr_read_callback = callback; } void sh2_set_frt_input(running_device *device, int state) { - SH2 *sh2 = GET_SH2(device); + sh2_state *sh2 = GET_SH2(device); if(state == PULSE_LINE) { @@ -540,7 +540,7 @@ void sh2_set_frt_input(running_device *device, int state) sh2_recalc_irq(sh2); } -void sh2_set_irq_line(SH2 *sh2, int irqline, int state) +void sh2_set_irq_line(sh2_state *sh2, int irqline, int state) { if (irqline == INPUT_LINE_NMI) { @@ -590,7 +590,7 @@ void sh2_set_irq_line(SH2 *sh2, int irqline, int state) } } -void sh2_recalc_irq(SH2 *sh2) +void sh2_recalc_irq(sh2_state *sh2) { int irq = 0, vector = -1; int level; @@ -634,7 +634,7 @@ void sh2_recalc_irq(SH2 *sh2) sh2->test_irq = 1; } -void sh2_exception(SH2 *sh2, const char *message, int irqline) +void sh2_exception(sh2_state *sh2, const char *message, int irqline) { int vector; @@ -699,7 +699,7 @@ void sh2_exception(SH2 *sh2, const char *message, int irqline) #endif } -void sh2_common_init(SH2 *sh2, legacy_cpu_device *device, device_irq_callback irqcallback) +void sh2_common_init(sh2_state *sh2, legacy_cpu_device *device, device_irq_callback irqcallback) { const sh2_cpu_core *conf = (const sh2_cpu_core *)device->baseconfig().static_config(); diff --git a/src/emu/cpu/sh2/sh2comn.h b/src/emu/cpu/sh2/sh2comn.h index ad3b9ad2591..73558cb96de 100644 --- a/src/emu/cpu/sh2/sh2comn.h +++ b/src/emu/cpu/sh2/sh2comn.h @@ -170,11 +170,11 @@ typedef struct drcuml_codehandle * nocode; /* nocode */ drcuml_codehandle * out_of_cycles; /* out of cycles exception handler */ #endif -} SH2; +} sh2_state; -void sh2_common_init(SH2 *sh2, legacy_cpu_device *device, device_irq_callback irqcallback); -void sh2_recalc_irq(SH2 *sh2); -void sh2_set_irq_line(SH2 *sh2, int irqline, int state); -void sh2_exception(SH2 *sh2, const char *message, int irqline); +void sh2_common_init(sh2_state *sh2, legacy_cpu_device *device, device_irq_callback irqcallback); +void sh2_recalc_irq(sh2_state *sh2); +void sh2_set_irq_line(sh2_state *sh2, int irqline, int state); +void sh2_exception(sh2_state *sh2, const char *message, int irqline); #endif /* __SH2COMN_H__ */ diff --git a/src/emu/cpu/sh2/sh2drc.c b/src/emu/cpu/sh2/sh2drc.c index 9e3b76fbaf6..d7626db72cb 100644 --- a/src/emu/cpu/sh2/sh2drc.c +++ b/src/emu/cpu/sh2/sh2drc.c @@ -99,26 +99,26 @@ struct _compiler_state FUNCTION PROTOTYPES ***************************************************************************/ -static void static_generate_entry_point(SH2 *sh2); -static void static_generate_nocode_handler(SH2 *sh2); -static void static_generate_out_of_cycles(SH2 *sh2); -static void static_generate_memory_accessor(SH2 *sh2, int size, int iswrite, const char *name, drcuml_codehandle **handleptr); - -static void generate_update_cycles(SH2 *sh2, drcuml_block *block, compiler_state *compiler, drcuml_ptype ptype, UINT64 pvalue, int allow_exception); -static void generate_checksum_block(SH2 *sh2, drcuml_block *block, compiler_state *compiler, const opcode_desc *seqhead, const opcode_desc *seqlast); -static void generate_sequence_instruction(SH2 *sh2, drcuml_block *block, compiler_state *compiler, const opcode_desc *desc); -static void generate_delay_slot(SH2 *sh2, drcuml_block *block, compiler_state *compiler, const opcode_desc *desc); - -static int generate_opcode(SH2 *sh2, drcuml_block *block, compiler_state *compiler, const opcode_desc *desc); -static int generate_group_0(SH2 *sh2, drcuml_block *block, compiler_state *compiler, const opcode_desc *desc, UINT16 opcode, int in_delay_slot); -static int generate_group_2(SH2 *sh2, drcuml_block *block, compiler_state *compiler, const opcode_desc *desc, UINT16 opcode, int in_delay_slot); -static int generate_group_3(SH2 *sh2, drcuml_block *block, compiler_state *compiler, const opcode_desc *desc, UINT16 opcode); -static int generate_group_4(SH2 *sh2, drcuml_block *block, compiler_state *compiler, const opcode_desc *desc, UINT16 opcode, int in_delay_slot); -static int generate_group_6(SH2 *sh2, drcuml_block *block, compiler_state *compiler, const opcode_desc *desc, UINT16 opcode, int in_delay_slot); -static int generate_group_8(SH2 *sh2, drcuml_block *block, compiler_state *compiler, const opcode_desc *desc, UINT16 opcode, int in_delay_slot); -static int generate_group_12(SH2 *sh2, drcuml_block *block, compiler_state *compiler, const opcode_desc *desc, UINT16 opcode, int in_delay_slot); - -static void code_compile_block(SH2 *sh2, UINT8 mode, offs_t pc); +static void static_generate_entry_point(sh2_state *sh2); +static void static_generate_nocode_handler(sh2_state *sh2); +static void static_generate_out_of_cycles(sh2_state *sh2); +static void static_generate_memory_accessor(sh2_state *sh2, int size, int iswrite, const char *name, drcuml_codehandle **handleptr); + +static void generate_update_cycles(sh2_state *sh2, drcuml_block *block, compiler_state *compiler, drcuml_ptype ptype, UINT64 pvalue, int allow_exception); +static void generate_checksum_block(sh2_state *sh2, drcuml_block *block, compiler_state *compiler, const opcode_desc *seqhead, const opcode_desc *seqlast); +static void generate_sequence_instruction(sh2_state *sh2, drcuml_block *block, compiler_state *compiler, const opcode_desc *desc); +static void generate_delay_slot(sh2_state *sh2, drcuml_block *block, compiler_state *compiler, const opcode_desc *desc); + +static int generate_opcode(sh2_state *sh2, drcuml_block *block, compiler_state *compiler, const opcode_desc *desc); +static int generate_group_0(sh2_state *sh2, drcuml_block *block, compiler_state *compiler, const opcode_desc *desc, UINT16 opcode, int in_delay_slot); +static int generate_group_2(sh2_state *sh2, drcuml_block *block, compiler_state *compiler, const opcode_desc *desc, UINT16 opcode, int in_delay_slot); +static int generate_group_3(sh2_state *sh2, drcuml_block *block, compiler_state *compiler, const opcode_desc *desc, UINT16 opcode); +static int generate_group_4(sh2_state *sh2, drcuml_block *block, compiler_state *compiler, const opcode_desc *desc, UINT16 opcode, int in_delay_slot); +static int generate_group_6(sh2_state *sh2, drcuml_block *block, compiler_state *compiler, const opcode_desc *desc, UINT16 opcode, int in_delay_slot); +static int generate_group_8(sh2_state *sh2, drcuml_block *block, compiler_state *compiler, const opcode_desc *desc, UINT16 opcode, int in_delay_slot); +static int generate_group_12(sh2_state *sh2, drcuml_block *block, compiler_state *compiler, const opcode_desc *desc, UINT16 opcode, int in_delay_slot); + +static void code_compile_block(sh2_state *sh2, UINT8 mode, offs_t pc); static void log_opcode_desc(drcuml_state *drcuml, const opcode_desc *desclist, int indent); static void log_register_list(drcuml_state *drcuml, const char *string, const UINT32 *reglist, const UINT32 *regnostarlist); @@ -137,16 +137,15 @@ static void cfunc_DIV1(void *param); INLINE FUNCTIONS ***************************************************************************/ -INLINE SH2 *get_safe_token(running_device *device) +INLINE sh2_state *get_safe_token(running_device *device) { assert(device != NULL); - assert(device->type() == CPU); - assert(cpu_get_type(device) == CPU_SH1 || - cpu_get_type(device) == CPU_SH2); - return *(SH2 **)downcast<legacy_cpu_device *>(device)->token(); + assert(device->type() == SH1 || + device->type() == SH2); + return *(sh2_state **)downcast<legacy_cpu_device *>(device)->token(); } -INLINE UINT16 RW(SH2 *sh2, offs_t A) +INLINE UINT16 RW(sh2_state *sh2, offs_t A) { if (A >= 0xe0000000) return sh2_internal_r(sh2->internal, (A & 0x1fc)>>2, 0xffff << (((~A) & 2)*8)) >> (((~A) & 2)*8); @@ -157,7 +156,7 @@ INLINE UINT16 RW(SH2 *sh2, offs_t A) return memory_read_word_32be(sh2->program, A & AM); } -INLINE UINT32 RL(SH2 *sh2, offs_t A) +INLINE UINT32 RL(sh2_state *sh2, offs_t A) { if (A >= 0xe0000000) return sh2_internal_r(sh2->internal, (A & 0x1fc)>>2, 0xffffffff); @@ -194,7 +193,7 @@ INLINE void alloc_handle(drcuml_state *drcuml, drcuml_codehandle **handleptr, co registers -------------------------------------------------*/ -INLINE void load_fast_iregs(SH2 *sh2, drcuml_block *block) +INLINE void load_fast_iregs(sh2_state *sh2, drcuml_block *block) { int regnum; @@ -213,7 +212,7 @@ INLINE void load_fast_iregs(SH2 *sh2, drcuml_block *block) registers -------------------------------------------------*/ -INLINE void save_fast_iregs(SH2 *sh2, drcuml_block *block) +INLINE void save_fast_iregs(sh2_state *sh2, drcuml_block *block) { int regnum; @@ -233,7 +232,7 @@ INLINE void save_fast_iregs(SH2 *sh2, drcuml_block *block) static void cfunc_printf_probe(void *param) { - SH2 *sh2 = (SH2 *)param; + sh2_state *sh2 = (sh2_state *)param; UINT32 pc = sh2->pc; printf(" PC=%08X r0=%08X r1=%08X r2=%08X\n", @@ -273,7 +272,7 @@ static void cfunc_printf_probe(void *param) static void cfunc_unimplemented(void *param) { - SH2 *sh2 = (SH2 *)param; + sh2_state *sh2 = (sh2_state *)param; UINT16 opcode = sh2->arg0; fatalerror("PC=%08X: Unimplemented op %04X", sh2->pc, opcode); } @@ -283,7 +282,7 @@ static void cfunc_unimplemented(void *param) -------------------------------------------------*/ static void cfunc_checkirqs(void *param) { - SH2 *sh2 = (SH2 *)param; + sh2_state *sh2 = (sh2_state *)param; // if NMI is pending, evec etc are already set up if (sh2->pending_nmi) { @@ -301,7 +300,7 @@ static void cfunc_checkirqs(void *param) -------------------------------------------------*/ static void cfunc_fastirq(void *param) { - SH2 *sh2 = (SH2 *)param; + sh2_state *sh2 = (sh2_state *)param; sh2_exception(sh2, "fastirq",sh2->irqline); } @@ -310,7 +309,7 @@ static void cfunc_fastirq(void *param) -------------------------------------------------*/ static void cfunc_MAC_W(void *param) { - SH2 *sh2 = (SH2 *)param; + sh2_state *sh2 = (sh2_state *)param; INT32 tempm, tempn, dest, src, ans; UINT32 templ; UINT16 opcode; @@ -393,7 +392,7 @@ static void cfunc_MAC_W(void *param) -------------------------------------------------*/ static void cfunc_MAC_L(void *param) { - SH2 *sh2 = (SH2 *)param; + sh2_state *sh2 = (sh2_state *)param; UINT32 RnL, RnH, RmL, RmH, Res0, Res1, Res2; UINT32 temp0, temp1, temp2, temp3; INT32 tempm, tempn, fnLmL; @@ -481,7 +480,7 @@ static void cfunc_MAC_L(void *param) -------------------------------------------------*/ static void cfunc_DIV1(void *param) { - SH2 *sh2 = (SH2 *)param; + sh2_state *sh2 = (sh2_state *)param; UINT32 tmp0; UINT32 old_q; UINT16 opcode; @@ -586,7 +585,7 @@ static void cfunc_DIV1(void *param) -------------------------------------------------*/ static void cfunc_ADDV(void *param) { - SH2 *sh2 = (SH2 *)param; + sh2_state *sh2 = (sh2_state *)param; INT32 dest, src, ans; UINT16 opcode; int n, m; @@ -629,7 +628,7 @@ static void cfunc_ADDV(void *param) -------------------------------------------------*/ static void cfunc_SUBV(void *param) { - SH2 *sh2 = (SH2 *)param; + sh2_state *sh2 = (sh2_state *)param; INT32 dest, src, ans; UINT16 opcode; int n, m; @@ -681,20 +680,20 @@ static CPU_INIT( sh2 ) COMPILE_MAX_SEQUENCE, /* maximum instructions to include in a sequence */ sh2_describe /* callback to describe a single instruction */ }; - SH2 *sh2 = get_safe_token(device); + sh2_state *sh2 = get_safe_token(device); drccache *cache; drcbe_info beinfo; UINT32 flags = 0; int regnum; /* allocate enough space for the cache and the core */ - cache = drccache_alloc(CACHE_SIZE + sizeof(SH2)); + cache = drccache_alloc(CACHE_SIZE + sizeof(sh2_state)); if (cache == NULL) - fatalerror("Unable to allocate cache of size %d", (UINT32)(CACHE_SIZE + sizeof(SH2))); + fatalerror("Unable to allocate cache of size %d", (UINT32)(CACHE_SIZE + sizeof(sh2_state))); /* allocate the core memory */ - *(SH2 **)device->token() = sh2 = (SH2 *)drccache_memory_alloc_near(cache, sizeof(SH2)); - memset(sh2, 0, sizeof(SH2)); + *(sh2_state **)device->token() = sh2 = (sh2_state *)drccache_memory_alloc_near(cache, sizeof(sh2_state)); + memset(sh2, 0, sizeof(sh2_state)); /* initialize the common core parts */ sh2_common_init(sh2, device, irqcallback); @@ -776,7 +775,7 @@ static CPU_INIT( sh2 ) static CPU_EXIT( sh2 ) { - SH2 *sh2 = get_safe_token(device); + sh2_state *sh2 = get_safe_token(device); /* clean up the DRC */ drcfe_exit(sh2->drcfe); @@ -791,7 +790,7 @@ static CPU_EXIT( sh2 ) static CPU_RESET( sh2 ) { - SH2 *sh2 = get_safe_token(device); + sh2_state *sh2 = get_safe_token(device); emu_timer *tsave, *tsaved0, *tsaved1; UINT32 *m; @@ -845,7 +844,7 @@ static CPU_RESET( sh2 ) static CPU_RESET( sh1 ) { - SH2 *sh2 = get_safe_token(device); + sh2_state *sh2 = get_safe_token(device); CPU_RESET_CALL(sh2); sh2->cpu_type = CPU_TYPE_SH1; } @@ -855,7 +854,7 @@ static CPU_RESET( sh1 ) regenerate static code -------------------------------------------------*/ -static void code_flush_cache(SH2 *sh2) +static void code_flush_cache(sh2_state *sh2) { drcuml_state *drcuml = sh2->drcuml; @@ -881,7 +880,7 @@ static void code_flush_cache(SH2 *sh2) /* Execute cycles - returns number of cycles actually run */ static CPU_EXECUTE( sh2 ) { - SH2 *sh2 = get_safe_token(device); + sh2_state *sh2 = get_safe_token(device); drcuml_state *drcuml = sh2->drcuml; int execute_result; @@ -916,7 +915,7 @@ static CPU_EXECUTE( sh2 ) given mode at the specified pc -------------------------------------------------*/ -static void code_compile_block(SH2 *sh2, UINT8 mode, offs_t pc) +static void code_compile_block(sh2_state *sh2, UINT8 mode, offs_t pc) { drcuml_state *drcuml = sh2->drcuml; compiler_state compiler = { 0 }; @@ -1025,7 +1024,7 @@ static void code_compile_block(SH2 *sh2, UINT8 mode, offs_t pc) static entry point -------------------------------------------------*/ -static void static_generate_entry_point(SH2 *sh2) +static void static_generate_entry_point(sh2_state *sh2) { drcuml_state *drcuml = sh2->drcuml; drcuml_codelabel skip = 1; @@ -1110,7 +1109,7 @@ static void static_generate_entry_point(SH2 *sh2) exception handler for "out of code" -------------------------------------------------*/ -static void static_generate_nocode_handler(SH2 *sh2) +static void static_generate_nocode_handler(sh2_state *sh2) { drcuml_state *drcuml = sh2->drcuml; drcuml_block *block; @@ -1140,7 +1139,7 @@ static void static_generate_nocode_handler(SH2 *sh2) out of cycles exception handler -------------------------------------------------*/ -static void static_generate_out_of_cycles(SH2 *sh2) +static void static_generate_out_of_cycles(sh2_state *sh2) { drcuml_state *drcuml = sh2->drcuml; drcuml_block *block; @@ -1168,7 +1167,7 @@ static void static_generate_out_of_cycles(SH2 *sh2) static_generate_memory_accessor ------------------------------------------------------------------*/ -static void static_generate_memory_accessor(SH2 *sh2, int size, int iswrite, const char *name, drcuml_codehandle **handleptr) +static void static_generate_memory_accessor(sh2_state *sh2, int size, int iswrite, const char *name, drcuml_codehandle **handleptr) { /* on entry, address is in I0; data for writes is in I1 */ /* on exit, read result is in I0 */ @@ -1427,7 +1426,7 @@ static void log_add_disasm_comment(drcuml_block *block, UINT32 pc, UINT32 op) subtract cycles from the icount and generate an exception if out -------------------------------------------------*/ -static void generate_update_cycles(SH2 *sh2, drcuml_block *block, compiler_state *compiler, drcuml_ptype ptype, UINT64 pvalue, int allow_exception) +static void generate_update_cycles(sh2_state *sh2, drcuml_block *block, compiler_state *compiler, drcuml_ptype ptype, UINT64 pvalue, int allow_exception) { /* check full interrupts if pending */ if (compiler->checkints) @@ -1505,7 +1504,7 @@ static void generate_update_cycles(SH2 *sh2, drcuml_block *block, compiler_state validate a sequence of opcodes -------------------------------------------------*/ -static void generate_checksum_block(SH2 *sh2, drcuml_block *block, compiler_state *compiler, const opcode_desc *seqhead, const opcode_desc *seqlast) +static void generate_checksum_block(sh2_state *sh2, drcuml_block *block, compiler_state *compiler, const opcode_desc *seqhead, const opcode_desc *seqlast) { const opcode_desc *curdesc; if (LOG_UML) @@ -1560,7 +1559,7 @@ static void generate_checksum_block(SH2 *sh2, drcuml_block *block, compiler_stat for a single instruction in a sequence -------------------------------------------------*/ -static void generate_sequence_instruction(SH2 *sh2, drcuml_block *block, compiler_state *compiler, const opcode_desc *desc) +static void generate_sequence_instruction(sh2_state *sh2, drcuml_block *block, compiler_state *compiler, const opcode_desc *desc) { offs_t expc; @@ -1644,7 +1643,7 @@ static void generate_sequence_instruction(SH2 *sh2, drcuml_block *block, compile generate_delay_slot ------------------------------------------------------------------*/ -static void generate_delay_slot(SH2 *sh2, drcuml_block *block, compiler_state *compiler, const opcode_desc *desc) +static void generate_delay_slot(sh2_state *sh2, drcuml_block *block, compiler_state *compiler, const opcode_desc *desc) { compiler_state compiler_temp = *compiler; @@ -1661,7 +1660,7 @@ static void generate_delay_slot(SH2 *sh2, drcuml_block *block, compiler_state *c opcode -------------------------------------------------*/ -static int generate_opcode(SH2 *sh2, drcuml_block *block, compiler_state *compiler, const opcode_desc *desc) +static int generate_opcode(sh2_state *sh2, drcuml_block *block, compiler_state *compiler, const opcode_desc *desc) { UINT32 scratch, scratch2; INT32 disp; @@ -1795,7 +1794,7 @@ static int generate_opcode(SH2 *sh2, drcuml_block *block, compiler_state *compil return FALSE; } -static int generate_group_0(SH2 *sh2, drcuml_block *block, compiler_state *compiler, const opcode_desc *desc, UINT16 opcode, int in_delay_slot) +static int generate_group_0(sh2_state *sh2, drcuml_block *block, compiler_state *compiler, const opcode_desc *desc, UINT16 opcode, int in_delay_slot) { switch (opcode & 0x3F) { @@ -2058,7 +2057,7 @@ static int generate_group_0(SH2 *sh2, drcuml_block *block, compiler_state *compi return FALSE; } -static int generate_group_2(SH2 *sh2, drcuml_block *block, compiler_state *compiler, const opcode_desc *desc, UINT16 opcode, int in_delay_slot) +static int generate_group_2(sh2_state *sh2, drcuml_block *block, compiler_state *compiler, const opcode_desc *desc, UINT16 opcode, int in_delay_slot) { switch (opcode & 15) { @@ -2227,7 +2226,7 @@ static int generate_group_2(SH2 *sh2, drcuml_block *block, compiler_state *compi return FALSE; } -static int generate_group_3(SH2 *sh2, drcuml_block *block, compiler_state *compiler, const opcode_desc *desc, UINT16 opcode) +static int generate_group_3(sh2_state *sh2, drcuml_block *block, compiler_state *compiler, const opcode_desc *desc, UINT16 opcode) { switch (opcode & 15) { @@ -2339,7 +2338,7 @@ static int generate_group_3(SH2 *sh2, drcuml_block *block, compiler_state *compi return FALSE; } -static int generate_group_4(SH2 *sh2, drcuml_block *block, compiler_state *compiler, const opcode_desc *desc, UINT16 opcode, int in_delay_slot) +static int generate_group_4(sh2_state *sh2, drcuml_block *block, compiler_state *compiler, const opcode_desc *desc, UINT16 opcode, int in_delay_slot) { switch (opcode & 0x3F) { @@ -2704,7 +2703,7 @@ static int generate_group_4(SH2 *sh2, drcuml_block *block, compiler_state *compi return FALSE; } -static int generate_group_6(SH2 *sh2, drcuml_block *block, compiler_state *compiler, const opcode_desc *desc, UINT16 opcode, int in_delay_slot) +static int generate_group_6(sh2_state *sh2, drcuml_block *block, compiler_state *compiler, const opcode_desc *desc, UINT16 opcode, int in_delay_slot) { switch (opcode & 15) { @@ -2834,7 +2833,7 @@ static int generate_group_6(SH2 *sh2, drcuml_block *block, compiler_state *compi return FALSE; } -static int generate_group_8(SH2 *sh2, drcuml_block *block, compiler_state *compiler, const opcode_desc *desc, UINT16 opcode, int in_delay_slot) +static int generate_group_8(sh2_state *sh2, drcuml_block *block, compiler_state *compiler, const opcode_desc *desc, UINT16 opcode, int in_delay_slot) { INT32 disp; UINT32 udisp; @@ -2978,7 +2977,7 @@ static int generate_group_8(SH2 *sh2, drcuml_block *block, compiler_state *compi return FALSE; } -static int generate_group_12(SH2 *sh2, drcuml_block *block, compiler_state *compiler, const opcode_desc *desc, UINT16 opcode, int in_delay_slot) +static int generate_group_12(sh2_state *sh2, drcuml_block *block, compiler_state *compiler, const opcode_desc *desc, UINT16 opcode, int in_delay_slot) { UINT32 scratch; @@ -3153,7 +3152,7 @@ static int generate_group_12(SH2 *sh2, drcuml_block *block, compiler_state *comp void sh2drc_set_options(running_device *device, UINT32 options) { - SH2 *sh2 = get_safe_token(device); + sh2_state *sh2 = get_safe_token(device); sh2->drcoptions = options; } @@ -3165,7 +3164,7 @@ void sh2drc_set_options(running_device *device, UINT32 options) void sh2drc_add_pcflush(running_device *device, offs_t address) { - SH2 *sh2 = get_safe_token(device); + sh2_state *sh2 = get_safe_token(device); if (sh2->pcfsel < ARRAY_LENGTH(sh2->pcflushes)) sh2->pcflushes[sh2->pcfsel++] = address; @@ -3199,7 +3198,7 @@ ADDRESS_MAP_END static CPU_SET_INFO( sh2 ) { - SH2 *sh2 = get_safe_token(device); + sh2_state *sh2 = get_safe_token(device); switch (state) { /* --- the following bits of info are set as 64-bit signed integers --- */ @@ -3258,11 +3257,11 @@ static CPU_SET_INFO( sh2 ) CPU_GET_INFO( sh2 ) { - SH2 *sh2 = (device != NULL && device->token() != NULL) ? get_safe_token(device) : NULL; + sh2_state *sh2 = (device != NULL && device->token() != NULL) ? get_safe_token(device) : NULL; switch (state) { /* --- the following bits of info are returned as 64-bit signed integers --- */ - case CPUINFO_INT_CONTEXT_SIZE: info->i = sizeof(SH2 *); break; + case CPUINFO_INT_CONTEXT_SIZE: info->i = sizeof(sh2_state *); break; case CPUINFO_INT_INPUT_LINES: info->i = 16; break; case CPUINFO_INT_DEFAULT_IRQ_VECTOR: info->i = 0; break; case DEVINFO_INT_ENDIANNESS: info->i = ENDIANNESS_BIG; break; @@ -3408,4 +3407,7 @@ CPU_GET_INFO( sh1 ) } } +DEFINE_LEGACY_CPU_DEVICE(SH1, sh1); +DEFINE_LEGACY_CPU_DEVICE(SH2, sh2); + #endif // USE_SH2DRC diff --git a/src/emu/cpu/sh2/sh2fe.c b/src/emu/cpu/sh2/sh2fe.c index 89ea586004d..4afe1778ef9 100644 --- a/src/emu/cpu/sh2/sh2fe.c +++ b/src/emu/cpu/sh2/sh2fe.c @@ -18,13 +18,13 @@ FUNCTION PROTOTYPES ***************************************************************************/ -static int describe_group_0(SH2 *context, opcode_desc *desc, const opcode_desc *prev, UINT16 opcode); -static int describe_group_2(SH2 *context, opcode_desc *desc, const opcode_desc *prev, UINT16 opcode); -static int describe_group_3(SH2 *context, opcode_desc *desc, const opcode_desc *prev, UINT16 opcode); -static int describe_group_4(SH2 *context, opcode_desc *desc, const opcode_desc *prev, UINT16 opcode); -static int describe_group_6(SH2 *context, opcode_desc *desc, const opcode_desc *prev, UINT16 opcode); -static int describe_group_8(SH2 *context, opcode_desc *desc, const opcode_desc *prev, UINT16 opcode); -static int describe_group_12(SH2 *context, opcode_desc *desc, const opcode_desc *prev, UINT16 opcode); +static int describe_group_0(sh2_state *context, opcode_desc *desc, const opcode_desc *prev, UINT16 opcode); +static int describe_group_2(sh2_state *context, opcode_desc *desc, const opcode_desc *prev, UINT16 opcode); +static int describe_group_3(sh2_state *context, opcode_desc *desc, const opcode_desc *prev, UINT16 opcode); +static int describe_group_4(sh2_state *context, opcode_desc *desc, const opcode_desc *prev, UINT16 opcode); +static int describe_group_6(sh2_state *context, opcode_desc *desc, const opcode_desc *prev, UINT16 opcode); +static int describe_group_8(sh2_state *context, opcode_desc *desc, const opcode_desc *prev, UINT16 opcode); +static int describe_group_12(sh2_state *context, opcode_desc *desc, const opcode_desc *prev, UINT16 opcode); @@ -39,7 +39,7 @@ static int describe_group_12(SH2 *context, opcode_desc *desc, const opcode_desc int sh2_describe(void *param, opcode_desc *desc, const opcode_desc *prev) { - SH2 *context = (SH2 *)param; + sh2_state *context = (sh2_state *)param; UINT16 opcode; /* fetch the opcode */ @@ -123,7 +123,7 @@ int sh2_describe(void *param, opcode_desc *desc, const opcode_desc *prev) return FALSE; } -static int describe_group_0(SH2 *context, opcode_desc *desc, const opcode_desc *prev, UINT16 opcode) +static int describe_group_0(sh2_state *context, opcode_desc *desc, const opcode_desc *prev, UINT16 opcode) { switch (opcode & 0x3F) { @@ -292,7 +292,7 @@ static int describe_group_0(SH2 *context, opcode_desc *desc, const opcode_desc * return FALSE; } -static int describe_group_2(SH2 *context, opcode_desc *desc, const opcode_desc *prev, UINT16 opcode) +static int describe_group_2(sh2_state *context, opcode_desc *desc, const opcode_desc *prev, UINT16 opcode) { switch (opcode & 15) { @@ -340,7 +340,7 @@ static int describe_group_2(SH2 *context, opcode_desc *desc, const opcode_desc * return FALSE; } -static int describe_group_3(SH2 *context, opcode_desc *desc, const opcode_desc *prev, UINT16 opcode) +static int describe_group_3(sh2_state *context, opcode_desc *desc, const opcode_desc *prev, UINT16 opcode) { switch (opcode & 15) { @@ -389,7 +389,7 @@ static int describe_group_3(SH2 *context, opcode_desc *desc, const opcode_desc * return FALSE; } -static int describe_group_4(SH2 *context, opcode_desc *desc, const opcode_desc *prev, UINT16 opcode) +static int describe_group_4(sh2_state *context, opcode_desc *desc, const opcode_desc *prev, UINT16 opcode) { switch (opcode & 0x3F) { @@ -619,7 +619,7 @@ static int describe_group_4(SH2 *context, opcode_desc *desc, const opcode_desc * return FALSE; } -static int describe_group_6(SH2 *context, opcode_desc *desc, const opcode_desc *prev, UINT16 opcode) +static int describe_group_6(sh2_state *context, opcode_desc *desc, const opcode_desc *prev, UINT16 opcode) { switch (opcode & 15) { @@ -660,7 +660,7 @@ static int describe_group_6(SH2 *context, opcode_desc *desc, const opcode_desc * return FALSE; } -static int describe_group_8(SH2 *context, opcode_desc *desc, const opcode_desc *prev, UINT16 opcode) +static int describe_group_8(sh2_state *context, opcode_desc *desc, const opcode_desc *prev, UINT16 opcode) { INT32 disp; @@ -715,7 +715,7 @@ static int describe_group_8(SH2 *context, opcode_desc *desc, const opcode_desc * return FALSE; } -static int describe_group_12(SH2 *context, opcode_desc *desc, const opcode_desc *prev, UINT16 opcode) +static int describe_group_12(sh2_state *context, opcode_desc *desc, const opcode_desc *prev, UINT16 opcode) { switch (opcode & (15<<8)) { diff --git a/src/emu/cpu/sh4/sh4.c b/src/emu/cpu/sh4/sh4.c index 5a2dd91fe9b..d7e1784cd4f 100644 --- a/src/emu/cpu/sh4/sh4.c +++ b/src/emu/cpu/sh4/sh4.c @@ -30,16 +30,15 @@ CPU_DISASSEMBLE( sh4 ); -INLINE SH4 *get_safe_token(running_device *device) +INLINE sh4_state *get_safe_token(running_device *device) { assert(device != NULL); - assert(device->type() == CPU); - assert(cpu_get_type(device) == CPU_SH4); - return (SH4 *)downcast<legacy_cpu_device *>(device)->token(); + assert(device->type() == SH4); + return (sh4_state *)downcast<legacy_cpu_device *>(device)->token(); } /* Called for unimplemented opcodes */ -static void TODO(SH4 *sh4) +static void TODO(sh4_state *sh4) { } @@ -121,7 +120,7 @@ UINT32 abs; } #endif -INLINE UINT8 RB(SH4 *sh4, offs_t A) +INLINE UINT8 RB(sh4_state *sh4, offs_t A) { if (A >= 0xfe000000) return sh4_internal_r(sh4->internal, ((A & 0x0fc) >> 2) | ((A & 0x1fe0000) >> 11), 0xff << ((A & 3)*8)) >> ((A & 3)*8); @@ -132,7 +131,7 @@ INLINE UINT8 RB(SH4 *sh4, offs_t A) return memory_read_byte_64le(sh4->program, A & AM); } -INLINE UINT16 RW(SH4 *sh4, offs_t A) +INLINE UINT16 RW(sh4_state *sh4, offs_t A) { if (A >= 0xfe000000) return sh4_internal_r(sh4->internal, ((A & 0x0fc) >> 2) | ((A & 0x1fe0000) >> 11), 0xffff << ((A & 2)*8)) >> ((A & 2)*8); @@ -143,7 +142,7 @@ INLINE UINT16 RW(SH4 *sh4, offs_t A) return memory_read_word_64le(sh4->program, A & AM); } -INLINE UINT32 RL(SH4 *sh4, offs_t A) +INLINE UINT32 RL(sh4_state *sh4, offs_t A) { if (A >= 0xfe000000) return sh4_internal_r(sh4->internal, ((A & 0x0fc) >> 2) | ((A & 0x1fe0000) >> 11), 0xffffffff); @@ -154,7 +153,7 @@ INLINE UINT32 RL(SH4 *sh4, offs_t A) return memory_read_dword_64le(sh4->program, A & AM); } -INLINE void WB(SH4 *sh4, offs_t A, UINT8 V) +INLINE void WB(sh4_state *sh4, offs_t A, UINT8 V) { if (A >= 0xfe000000) @@ -172,7 +171,7 @@ INLINE void WB(SH4 *sh4, offs_t A, UINT8 V) memory_write_byte_64le(sh4->program, A & AM,V); } -INLINE void WW(SH4 *sh4, offs_t A, UINT16 V) +INLINE void WW(sh4_state *sh4, offs_t A, UINT16 V) { if (A >= 0xfe000000) { @@ -189,7 +188,7 @@ INLINE void WW(SH4 *sh4, offs_t A, UINT16 V) memory_write_word_64le(sh4->program, A & AM,V); } -INLINE void WL(SH4 *sh4, offs_t A, UINT32 V) +INLINE void WL(sh4_state *sh4, offs_t A, UINT32 V) { if (A >= 0xfe000000) { @@ -213,7 +212,7 @@ INLINE void WL(SH4 *sh4, offs_t A, UINT32 V) * 0011 nnnn mmmm 1100 1 - * ADD Rm,Rn */ -INLINE void ADD(SH4 *sh4, UINT32 m, UINT32 n) +INLINE void ADD(sh4_state *sh4, UINT32 m, UINT32 n) { sh4->r[n] += sh4->r[m]; } @@ -222,7 +221,7 @@ INLINE void ADD(SH4 *sh4, UINT32 m, UINT32 n) * 0111 nnnn iiii iiii 1 - * ADD #imm,Rn */ -INLINE void ADDI(SH4 *sh4, UINT32 i, UINT32 n) +INLINE void ADDI(sh4_state *sh4, UINT32 i, UINT32 n) { sh4->r[n] += (INT32)(INT16)(INT8)i; } @@ -231,7 +230,7 @@ INLINE void ADDI(SH4 *sh4, UINT32 i, UINT32 n) * 0011 nnnn mmmm 1110 1 carry * ADDC Rm,Rn */ -INLINE void ADDC(SH4 *sh4, UINT32 m, UINT32 n) +INLINE void ADDC(sh4_state *sh4, UINT32 m, UINT32 n) { UINT32 tmp0, tmp1; @@ -250,7 +249,7 @@ INLINE void ADDC(SH4 *sh4, UINT32 m, UINT32 n) * 0011 nnnn mmmm 1111 1 overflow * ADDV Rm,Rn */ -INLINE void ADDV(SH4 *sh4, UINT32 m, UINT32 n) +INLINE void ADDV(sh4_state *sh4, UINT32 m, UINT32 n) { INT32 dest, src, ans; @@ -284,7 +283,7 @@ INLINE void ADDV(SH4 *sh4, UINT32 m, UINT32 n) * 0010 nnnn mmmm 1001 1 - * AND Rm,Rn */ -INLINE void AND(SH4 *sh4, UINT32 m, UINT32 n) +INLINE void AND(sh4_state *sh4, UINT32 m, UINT32 n) { sh4->r[n] &= sh4->r[m]; } @@ -294,7 +293,7 @@ INLINE void AND(SH4 *sh4, UINT32 m, UINT32 n) * 1100 1001 iiii iiii 1 - * AND #imm,R0 */ -INLINE void ANDI(SH4 *sh4, UINT32 i) +INLINE void ANDI(sh4_state *sh4, UINT32 i) { sh4->r[0] &= i; } @@ -303,7 +302,7 @@ INLINE void ANDI(SH4 *sh4, UINT32 i) * 1100 1101 iiii iiii 1 - * AND.B #imm,@(R0,GBR) */ -INLINE void ANDM(SH4 *sh4, UINT32 i) +INLINE void ANDM(sh4_state *sh4, UINT32 i) { UINT32 temp; @@ -317,7 +316,7 @@ INLINE void ANDM(SH4 *sh4, UINT32 i) * 1000 1011 dddd dddd 3/1 - * BF disp8 */ -INLINE void BF(SH4 *sh4, UINT32 d) +INLINE void BF(sh4_state *sh4, UINT32 d) { if ((sh4->sr & T) == 0) { @@ -331,7 +330,7 @@ INLINE void BF(SH4 *sh4, UINT32 d) * 1000 1111 dddd dddd 3/1 - * BFS disp8 */ -INLINE void BFS(SH4 *sh4, UINT32 d) +INLINE void BFS(sh4_state *sh4, UINT32 d) { if ((sh4->sr & T) == 0) { @@ -346,7 +345,7 @@ INLINE void BFS(SH4 *sh4, UINT32 d) * 1010 dddd dddd dddd 2 - * BRA disp12 */ -INLINE void BRA(SH4 *sh4, UINT32 d) +INLINE void BRA(sh4_state *sh4, UINT32 d) { INT32 disp = ((INT32)d << 20) >> 20; @@ -370,7 +369,7 @@ INLINE void BRA(SH4 *sh4, UINT32 d) * 0000 mmmm 0010 0011 2 - * BRAF Rm */ -INLINE void BRAF(SH4 *sh4, UINT32 m) +INLINE void BRAF(sh4_state *sh4, UINT32 m) { sh4->delay = sh4->pc; sh4->pc += sh4->r[m] + 2; @@ -381,7 +380,7 @@ INLINE void BRAF(SH4 *sh4, UINT32 m) * 1011 dddd dddd dddd 2 - * BSR disp12 */ -INLINE void BSR(SH4 *sh4, UINT32 d) +INLINE void BSR(sh4_state *sh4, UINT32 d) { INT32 disp = ((INT32)d << 20) >> 20; @@ -395,7 +394,7 @@ INLINE void BSR(SH4 *sh4, UINT32 d) * 0000 mmmm 0000 0011 2 - * BSRF Rm */ -INLINE void BSRF(SH4 *sh4, UINT32 m) +INLINE void BSRF(sh4_state *sh4, UINT32 m) { sh4->pr = sh4->pc + 2; sh4->delay = sh4->pc; @@ -407,7 +406,7 @@ INLINE void BSRF(SH4 *sh4, UINT32 m) * 1000 1001 dddd dddd 3/1 - * BT disp8 */ -INLINE void BT(SH4 *sh4, UINT32 d) +INLINE void BT(sh4_state *sh4, UINT32 d) { if ((sh4->sr & T) != 0) { @@ -421,7 +420,7 @@ INLINE void BT(SH4 *sh4, UINT32 d) * 1000 1101 dddd dddd 2/1 - * BTS disp8 */ -INLINE void BTS(SH4 *sh4, UINT32 d) +INLINE void BTS(sh4_state *sh4, UINT32 d) { if ((sh4->sr & T) != 0) { @@ -436,7 +435,7 @@ INLINE void BTS(SH4 *sh4, UINT32 d) * 0000 0000 0010 1000 1 - * CLRMAC */ -INLINE void CLRMAC(SH4 *sh4) +INLINE void CLRMAC(sh4_state *sh4) { sh4->mach = 0; sh4->macl = 0; @@ -446,7 +445,7 @@ INLINE void CLRMAC(SH4 *sh4) * 0000 0000 0000 1000 1 - * CLRT */ -INLINE void CLRT(SH4 *sh4) +INLINE void CLRT(sh4_state *sh4) { sh4->sr &= ~T; } @@ -455,7 +454,7 @@ INLINE void CLRT(SH4 *sh4) * 0011 nnnn mmmm 0000 1 comparison result * CMP_EQ Rm,Rn */ -INLINE void CMPEQ(SH4 *sh4, UINT32 m, UINT32 n) +INLINE void CMPEQ(sh4_state *sh4, UINT32 m, UINT32 n) { if (sh4->r[n] == sh4->r[m]) sh4->sr |= T; @@ -467,7 +466,7 @@ INLINE void CMPEQ(SH4 *sh4, UINT32 m, UINT32 n) * 0011 nnnn mmmm 0011 1 comparison result * CMP_GE Rm,Rn */ -INLINE void CMPGE(SH4 *sh4, UINT32 m, UINT32 n) +INLINE void CMPGE(sh4_state *sh4, UINT32 m, UINT32 n) { if ((INT32) sh4->r[n] >= (INT32) sh4->r[m]) sh4->sr |= T; @@ -479,7 +478,7 @@ INLINE void CMPGE(SH4 *sh4, UINT32 m, UINT32 n) * 0011 nnnn mmmm 0111 1 comparison result * CMP_GT Rm,Rn */ -INLINE void CMPGT(SH4 *sh4, UINT32 m, UINT32 n) +INLINE void CMPGT(sh4_state *sh4, UINT32 m, UINT32 n) { if ((INT32) sh4->r[n] > (INT32) sh4->r[m]) sh4->sr |= T; @@ -491,7 +490,7 @@ INLINE void CMPGT(SH4 *sh4, UINT32 m, UINT32 n) * 0011 nnnn mmmm 0110 1 comparison result * CMP_HI Rm,Rn */ -INLINE void CMPHI(SH4 *sh4, UINT32 m, UINT32 n) +INLINE void CMPHI(sh4_state *sh4, UINT32 m, UINT32 n) { if ((UINT32) sh4->r[n] > (UINT32) sh4->r[m]) sh4->sr |= T; @@ -503,7 +502,7 @@ INLINE void CMPHI(SH4 *sh4, UINT32 m, UINT32 n) * 0011 nnnn mmmm 0010 1 comparison result * CMP_HS Rm,Rn */ -INLINE void CMPHS(SH4 *sh4, UINT32 m, UINT32 n) +INLINE void CMPHS(sh4_state *sh4, UINT32 m, UINT32 n) { if ((UINT32) sh4->r[n] >= (UINT32) sh4->r[m]) sh4->sr |= T; @@ -516,7 +515,7 @@ INLINE void CMPHS(SH4 *sh4, UINT32 m, UINT32 n) * 0100 nnnn 0001 0101 1 comparison result * CMP_PL Rn */ -INLINE void CMPPL(SH4 *sh4, UINT32 n) +INLINE void CMPPL(sh4_state *sh4, UINT32 n) { if ((INT32) sh4->r[n] > 0) sh4->sr |= T; @@ -528,7 +527,7 @@ INLINE void CMPPL(SH4 *sh4, UINT32 n) * 0100 nnnn 0001 0001 1 comparison result * CMP_PZ Rn */ -INLINE void CMPPZ(SH4 *sh4, UINT32 n) +INLINE void CMPPZ(sh4_state *sh4, UINT32 n) { if ((INT32) sh4->r[n] >= 0) sh4->sr |= T; @@ -540,7 +539,7 @@ INLINE void CMPPZ(SH4 *sh4, UINT32 n) * 0010 nnnn mmmm 1100 1 comparison result * CMP_STR Rm,Rn */ -INLINE void CMPSTR(SH4 *sh4, UINT32 m, UINT32 n) +INLINE void CMPSTR(sh4_state *sh4, UINT32 m, UINT32 n) { UINT32 temp; INT32 HH, HL, LH, LL; @@ -560,7 +559,7 @@ INLINE void CMPSTR(SH4 *sh4, UINT32 m, UINT32 n) * 1000 1000 iiii iiii 1 comparison result * CMP/EQ #imm,R0 */ -INLINE void CMPIM(SH4 *sh4, UINT32 i) +INLINE void CMPIM(sh4_state *sh4, UINT32 i) { UINT32 imm = (UINT32)(INT32)(INT16)(INT8)i; @@ -574,7 +573,7 @@ INLINE void CMPIM(SH4 *sh4, UINT32 i) * 0010 nnnn mmmm 0111 1 calculation result * DIV0S Rm,Rn */ -INLINE void DIV0S(SH4 *sh4, UINT32 m, UINT32 n) +INLINE void DIV0S(sh4_state *sh4, UINT32 m, UINT32 n) { if ((sh4->r[n] & 0x80000000) == 0) sh4->sr &= ~Q; @@ -594,7 +593,7 @@ INLINE void DIV0S(SH4 *sh4, UINT32 m, UINT32 n) * 0000 0000 0001 1001 1 0 * DIV0U */ -INLINE void DIV0U(SH4 *sh4) +INLINE void DIV0U(sh4_state *sh4) { sh4->sr &= ~(M | Q | T); } @@ -603,7 +602,7 @@ INLINE void DIV0U(SH4 *sh4) * 0011 nnnn mmmm 0100 1 calculation result * DIV1 Rm,Rn */ -INLINE void DIV1(SH4 *sh4, UINT32 m, UINT32 n) +INLINE void DIV1(sh4_state *sh4, UINT32 m, UINT32 n) { UINT32 tmp0; UINT32 old_q; @@ -695,7 +694,7 @@ INLINE void DIV1(SH4 *sh4, UINT32 m, UINT32 n) } /* DMULS.L Rm,Rn */ -INLINE void DMULS(SH4 *sh4, UINT32 m, UINT32 n) +INLINE void DMULS(sh4_state *sh4, UINT32 m, UINT32 n) { UINT32 RnL, RnH, RmL, RmH, Res0, Res1, Res2; UINT32 temp0, temp1, temp2, temp3; @@ -744,7 +743,7 @@ INLINE void DMULS(SH4 *sh4, UINT32 m, UINT32 n) } /* DMULU.L Rm,Rn */ -INLINE void DMULU(SH4 *sh4, UINT32 m, UINT32 n) +INLINE void DMULU(sh4_state *sh4, UINT32 m, UINT32 n) { UINT32 RnL, RnH, RmL, RmH, Res0, Res1, Res2; UINT32 temp0, temp1, temp2, temp3; @@ -772,7 +771,7 @@ INLINE void DMULU(SH4 *sh4, UINT32 m, UINT32 n) } /* DT Rn */ -INLINE void DT(SH4 *sh4, UINT32 n) +INLINE void DT(sh4_state *sh4, UINT32 n) { sh4->r[n]--; if (sh4->r[n] == 0) @@ -798,38 +797,38 @@ INLINE void DT(SH4 *sh4, UINT32 n) } /* EXTS.B Rm,Rn */ -INLINE void EXTSB(SH4 *sh4, UINT32 m, UINT32 n) +INLINE void EXTSB(sh4_state *sh4, UINT32 m, UINT32 n) { sh4->r[n] = ((INT32)sh4->r[m] << 24) >> 24; } /* EXTS.W Rm,Rn */ -INLINE void EXTSW(SH4 *sh4, UINT32 m, UINT32 n) +INLINE void EXTSW(sh4_state *sh4, UINT32 m, UINT32 n) { sh4->r[n] = ((INT32)sh4->r[m] << 16) >> 16; } /* EXTU.B Rm,Rn */ -INLINE void EXTUB(SH4 *sh4, UINT32 m, UINT32 n) +INLINE void EXTUB(sh4_state *sh4, UINT32 m, UINT32 n) { sh4->r[n] = sh4->r[m] & 0x000000ff; } /* EXTU.W Rm,Rn */ -INLINE void EXTUW(SH4 *sh4, UINT32 m, UINT32 n) +INLINE void EXTUW(sh4_state *sh4, UINT32 m, UINT32 n) { sh4->r[n] = sh4->r[m] & 0x0000ffff; } /* JMP @Rm */ -INLINE void JMP(SH4 *sh4, UINT32 m) +INLINE void JMP(sh4_state *sh4, UINT32 m) { sh4->delay = sh4->pc; sh4->pc = sh4->ea = sh4->r[m]; } /* JSR @Rm */ -INLINE void JSR(SH4 *sh4, UINT32 m) +INLINE void JSR(sh4_state *sh4, UINT32 m) { sh4->delay = sh4->pc; sh4->pr = sh4->pc + 2; @@ -839,7 +838,7 @@ INLINE void JSR(SH4 *sh4, UINT32 m) /* LDC Rm,SR */ -INLINE void LDCSR(SH4 *sh4, UINT32 m) +INLINE void LDCSR(sh4_state *sh4, UINT32 m) { UINT32 reg; @@ -853,19 +852,19 @@ UINT32 reg; } /* LDC Rm,GBR */ -INLINE void LDCGBR(SH4 *sh4, UINT32 m) +INLINE void LDCGBR(sh4_state *sh4, UINT32 m) { sh4->gbr = sh4->r[m]; } /* LDC Rm,VBR */ -INLINE void LDCVBR(SH4 *sh4, UINT32 m) +INLINE void LDCVBR(sh4_state *sh4, UINT32 m) { sh4->vbr = sh4->r[m]; } /* LDC.L @Rm+,SR */ -INLINE void LDCMSR(SH4 *sh4, UINT32 m) +INLINE void LDCMSR(sh4_state *sh4, UINT32 m) { UINT32 old; @@ -882,7 +881,7 @@ UINT32 old; } /* LDC.L @Rm+,GBR */ -INLINE void LDCMGBR(SH4 *sh4, UINT32 m) +INLINE void LDCMGBR(sh4_state *sh4, UINT32 m) { sh4->ea = sh4->r[m]; sh4->gbr = RL(sh4, sh4->ea ); @@ -891,7 +890,7 @@ INLINE void LDCMGBR(SH4 *sh4, UINT32 m) } /* LDC.L @Rm+,VBR */ -INLINE void LDCMVBR(SH4 *sh4, UINT32 m) +INLINE void LDCMVBR(sh4_state *sh4, UINT32 m) { sh4->ea = sh4->r[m]; sh4->vbr = RL(sh4, sh4->ea ); @@ -900,25 +899,25 @@ INLINE void LDCMVBR(SH4 *sh4, UINT32 m) } /* LDS Rm,MACH */ -INLINE void LDSMACH(SH4 *sh4, UINT32 m) +INLINE void LDSMACH(sh4_state *sh4, UINT32 m) { sh4->mach = sh4->r[m]; } /* LDS Rm,MACL */ -INLINE void LDSMACL(SH4 *sh4, UINT32 m) +INLINE void LDSMACL(sh4_state *sh4, UINT32 m) { sh4->macl = sh4->r[m]; } /* LDS Rm,PR */ -INLINE void LDSPR(SH4 *sh4, UINT32 m) +INLINE void LDSPR(sh4_state *sh4, UINT32 m) { sh4->pr = sh4->r[m]; } /* LDS.L @Rm+,MACH */ -INLINE void LDSMMACH(SH4 *sh4, UINT32 m) +INLINE void LDSMMACH(sh4_state *sh4, UINT32 m) { sh4->ea = sh4->r[m]; sh4->mach = RL(sh4, sh4->ea ); @@ -926,7 +925,7 @@ INLINE void LDSMMACH(SH4 *sh4, UINT32 m) } /* LDS.L @Rm+,MACL */ -INLINE void LDSMMACL(SH4 *sh4, UINT32 m) +INLINE void LDSMMACL(sh4_state *sh4, UINT32 m) { sh4->ea = sh4->r[m]; sh4->macl = RL(sh4, sh4->ea ); @@ -934,7 +933,7 @@ INLINE void LDSMMACL(SH4 *sh4, UINT32 m) } /* LDS.L @Rm+,PR */ -INLINE void LDSMPR(SH4 *sh4, UINT32 m) +INLINE void LDSMPR(sh4_state *sh4, UINT32 m) { sh4->ea = sh4->r[m]; sh4->pr = RL(sh4, sh4->ea ); @@ -942,7 +941,7 @@ INLINE void LDSMPR(SH4 *sh4, UINT32 m) } /* MAC.L @Rm+,@Rn+ */ -INLINE void MAC_L(SH4 *sh4, UINT32 m, UINT32 n) +INLINE void MAC_L(sh4_state *sh4, UINT32 m, UINT32 n) { UINT32 RnL, RnH, RmL, RmH, Res0, Res1, Res2; UINT32 temp0, temp1, temp2, temp3; @@ -1019,7 +1018,7 @@ INLINE void MAC_L(SH4 *sh4, UINT32 m, UINT32 n) } /* MAC.W @Rm+,@Rn+ */ -INLINE void MAC_W(SH4 *sh4, UINT32 m, UINT32 n) +INLINE void MAC_W(sh4_state *sh4, UINT32 m, UINT32 n) { INT32 tempm, tempn, dest, src, ans; UINT32 templ; @@ -1071,55 +1070,55 @@ INLINE void MAC_W(SH4 *sh4, UINT32 m, UINT32 n) } /* MOV Rm,Rn */ -INLINE void MOV(SH4 *sh4, UINT32 m, UINT32 n) +INLINE void MOV(sh4_state *sh4, UINT32 m, UINT32 n) { sh4->r[n] = sh4->r[m]; } /* MOV.B Rm,@Rn */ -INLINE void MOVBS(SH4 *sh4, UINT32 m, UINT32 n) +INLINE void MOVBS(sh4_state *sh4, UINT32 m, UINT32 n) { sh4->ea = sh4->r[n]; WB(sh4, sh4->ea, sh4->r[m] & 0x000000ff); } /* MOV.W Rm,@Rn */ -INLINE void MOVWS(SH4 *sh4, UINT32 m, UINT32 n) +INLINE void MOVWS(sh4_state *sh4, UINT32 m, UINT32 n) { sh4->ea = sh4->r[n]; WW(sh4, sh4->ea, sh4->r[m] & 0x0000ffff); } /* MOV.L Rm,@Rn */ -INLINE void MOVLS(SH4 *sh4, UINT32 m, UINT32 n) +INLINE void MOVLS(sh4_state *sh4, UINT32 m, UINT32 n) { sh4->ea = sh4->r[n]; WL(sh4, sh4->ea, sh4->r[m] ); } /* MOV.B @Rm,Rn */ -INLINE void MOVBL(SH4 *sh4, UINT32 m, UINT32 n) +INLINE void MOVBL(sh4_state *sh4, UINT32 m, UINT32 n) { sh4->ea = sh4->r[m]; sh4->r[n] = (UINT32)(INT32)(INT16)(INT8) RB(sh4, sh4->ea ); } /* MOV.W @Rm,Rn */ -INLINE void MOVWL(SH4 *sh4, UINT32 m, UINT32 n) +INLINE void MOVWL(sh4_state *sh4, UINT32 m, UINT32 n) { sh4->ea = sh4->r[m]; sh4->r[n] = (UINT32)(INT32)(INT16) RW(sh4, sh4->ea ); } /* MOV.L @Rm,Rn */ -INLINE void MOVLL(SH4 *sh4, UINT32 m, UINT32 n) +INLINE void MOVLL(sh4_state *sh4, UINT32 m, UINT32 n) { sh4->ea = sh4->r[m]; sh4->r[n] = RL(sh4, sh4->ea ); } /* MOV.B Rm,@-Rn */ -INLINE void MOVBM(SH4 *sh4, UINT32 m, UINT32 n) +INLINE void MOVBM(sh4_state *sh4, UINT32 m, UINT32 n) { /* SMG : bug fix, was reading sh4->r[n] */ UINT32 data = sh4->r[m] & 0x000000ff; @@ -1129,7 +1128,7 @@ INLINE void MOVBM(SH4 *sh4, UINT32 m, UINT32 n) } /* MOV.W Rm,@-Rn */ -INLINE void MOVWM(SH4 *sh4, UINT32 m, UINT32 n) +INLINE void MOVWM(sh4_state *sh4, UINT32 m, UINT32 n) { UINT32 data = sh4->r[m] & 0x0000ffff; @@ -1138,7 +1137,7 @@ INLINE void MOVWM(SH4 *sh4, UINT32 m, UINT32 n) } /* MOV.L Rm,@-Rn */ -INLINE void MOVLM(SH4 *sh4, UINT32 m, UINT32 n) +INLINE void MOVLM(sh4_state *sh4, UINT32 m, UINT32 n) { UINT32 data = sh4->r[m]; @@ -1147,7 +1146,7 @@ INLINE void MOVLM(SH4 *sh4, UINT32 m, UINT32 n) } /* MOV.B @Rm+,Rn */ -INLINE void MOVBP(SH4 *sh4, UINT32 m, UINT32 n) +INLINE void MOVBP(sh4_state *sh4, UINT32 m, UINT32 n) { sh4->r[n] = (UINT32)(INT32)(INT16)(INT8) RB(sh4, sh4->r[m] ); if (n != m) @@ -1155,7 +1154,7 @@ INLINE void MOVBP(SH4 *sh4, UINT32 m, UINT32 n) } /* MOV.W @Rm+,Rn */ -INLINE void MOVWP(SH4 *sh4, UINT32 m, UINT32 n) +INLINE void MOVWP(sh4_state *sh4, UINT32 m, UINT32 n) { sh4->r[n] = (UINT32)(INT32)(INT16) RW(sh4, sh4->r[m] ); if (n != m) @@ -1163,7 +1162,7 @@ INLINE void MOVWP(SH4 *sh4, UINT32 m, UINT32 n) } /* MOV.L @Rm+,Rn */ -INLINE void MOVLP(SH4 *sh4, UINT32 m, UINT32 n) +INLINE void MOVLP(sh4_state *sh4, UINT32 m, UINT32 n) { sh4->r[n] = RL(sh4, sh4->r[m] ); if (n != m) @@ -1171,55 +1170,55 @@ INLINE void MOVLP(SH4 *sh4, UINT32 m, UINT32 n) } /* MOV.B Rm,@(R0,Rn) */ -INLINE void MOVBS0(SH4 *sh4, UINT32 m, UINT32 n) +INLINE void MOVBS0(sh4_state *sh4, UINT32 m, UINT32 n) { sh4->ea = sh4->r[n] + sh4->r[0]; WB(sh4, sh4->ea, sh4->r[m] & 0x000000ff ); } /* MOV.W Rm,@(R0,Rn) */ -INLINE void MOVWS0(SH4 *sh4, UINT32 m, UINT32 n) +INLINE void MOVWS0(sh4_state *sh4, UINT32 m, UINT32 n) { sh4->ea = sh4->r[n] + sh4->r[0]; WW(sh4, sh4->ea, sh4->r[m] & 0x0000ffff ); } /* MOV.L Rm,@(R0,Rn) */ -INLINE void MOVLS0(SH4 *sh4, UINT32 m, UINT32 n) +INLINE void MOVLS0(sh4_state *sh4, UINT32 m, UINT32 n) { sh4->ea = sh4->r[n] + sh4->r[0]; WL(sh4, sh4->ea, sh4->r[m] ); } /* MOV.B @(R0,Rm),Rn */ -INLINE void MOVBL0(SH4 *sh4, UINT32 m, UINT32 n) +INLINE void MOVBL0(sh4_state *sh4, UINT32 m, UINT32 n) { sh4->ea = sh4->r[m] + sh4->r[0]; sh4->r[n] = (UINT32)(INT32)(INT16)(INT8) RB(sh4, sh4->ea ); } /* MOV.W @(R0,Rm),Rn */ -INLINE void MOVWL0(SH4 *sh4, UINT32 m, UINT32 n) +INLINE void MOVWL0(sh4_state *sh4, UINT32 m, UINT32 n) { sh4->ea = sh4->r[m] + sh4->r[0]; sh4->r[n] = (UINT32)(INT32)(INT16) RW(sh4, sh4->ea ); } /* MOV.L @(R0,Rm),Rn */ -INLINE void MOVLL0(SH4 *sh4, UINT32 m, UINT32 n) +INLINE void MOVLL0(sh4_state *sh4, UINT32 m, UINT32 n) { sh4->ea = sh4->r[m] + sh4->r[0]; sh4->r[n] = RL(sh4, sh4->ea ); } /* MOV #imm,Rn */ -INLINE void MOVI(SH4 *sh4, UINT32 i, UINT32 n) +INLINE void MOVI(sh4_state *sh4, UINT32 i, UINT32 n) { sh4->r[n] = (UINT32)(INT32)(INT16)(INT8) i; } /* MOV.W @(disp8,PC),Rn */ -INLINE void MOVWI(SH4 *sh4, UINT32 d, UINT32 n) +INLINE void MOVWI(sh4_state *sh4, UINT32 d, UINT32 n) { UINT32 disp = d & 0xff; sh4->ea = sh4->pc + disp * 2 + 2; @@ -1227,7 +1226,7 @@ INLINE void MOVWI(SH4 *sh4, UINT32 d, UINT32 n) } /* MOV.L @(disp8,PC),Rn */ -INLINE void MOVLI(SH4 *sh4, UINT32 d, UINT32 n) +INLINE void MOVLI(sh4_state *sh4, UINT32 d, UINT32 n) { UINT32 disp = d & 0xff; sh4->ea = ((sh4->pc + 2) & ~3) + disp * 4; @@ -1235,7 +1234,7 @@ INLINE void MOVLI(SH4 *sh4, UINT32 d, UINT32 n) } /* MOV.B @(disp8,GBR),R0 */ -INLINE void MOVBLG(SH4 *sh4, UINT32 d) +INLINE void MOVBLG(sh4_state *sh4, UINT32 d) { UINT32 disp = d & 0xff; sh4->ea = sh4->gbr + disp; @@ -1243,7 +1242,7 @@ INLINE void MOVBLG(SH4 *sh4, UINT32 d) } /* MOV.W @(disp8,GBR),R0 */ -INLINE void MOVWLG(SH4 *sh4, UINT32 d) +INLINE void MOVWLG(sh4_state *sh4, UINT32 d) { UINT32 disp = d & 0xff; sh4->ea = sh4->gbr + disp * 2; @@ -1251,7 +1250,7 @@ INLINE void MOVWLG(SH4 *sh4, UINT32 d) } /* MOV.L @(disp8,GBR),R0 */ -INLINE void MOVLLG(SH4 *sh4, UINT32 d) +INLINE void MOVLLG(sh4_state *sh4, UINT32 d) { UINT32 disp = d & 0xff; sh4->ea = sh4->gbr + disp * 4; @@ -1259,7 +1258,7 @@ INLINE void MOVLLG(SH4 *sh4, UINT32 d) } /* MOV.B R0,@(disp8,GBR) */ -INLINE void MOVBSG(SH4 *sh4, UINT32 d) +INLINE void MOVBSG(sh4_state *sh4, UINT32 d) { UINT32 disp = d & 0xff; sh4->ea = sh4->gbr + disp; @@ -1267,7 +1266,7 @@ INLINE void MOVBSG(SH4 *sh4, UINT32 d) } /* MOV.W R0,@(disp8,GBR) */ -INLINE void MOVWSG(SH4 *sh4, UINT32 d) +INLINE void MOVWSG(sh4_state *sh4, UINT32 d) { UINT32 disp = d & 0xff; sh4->ea = sh4->gbr + disp * 2; @@ -1275,7 +1274,7 @@ INLINE void MOVWSG(SH4 *sh4, UINT32 d) } /* MOV.L R0,@(disp8,GBR) */ -INLINE void MOVLSG(SH4 *sh4, UINT32 d) +INLINE void MOVLSG(sh4_state *sh4, UINT32 d) { UINT32 disp = d & 0xff; sh4->ea = sh4->gbr + disp * 4; @@ -1283,7 +1282,7 @@ INLINE void MOVLSG(SH4 *sh4, UINT32 d) } /* MOV.B R0,@(disp4,Rn) */ -INLINE void MOVBS4(SH4 *sh4, UINT32 d, UINT32 n) +INLINE void MOVBS4(sh4_state *sh4, UINT32 d, UINT32 n) { UINT32 disp = d & 0x0f; sh4->ea = sh4->r[n] + disp; @@ -1291,7 +1290,7 @@ INLINE void MOVBS4(SH4 *sh4, UINT32 d, UINT32 n) } /* MOV.W R0,@(disp4,Rn) */ -INLINE void MOVWS4(SH4 *sh4, UINT32 d, UINT32 n) +INLINE void MOVWS4(sh4_state *sh4, UINT32 d, UINT32 n) { UINT32 disp = d & 0x0f; sh4->ea = sh4->r[n] + disp * 2; @@ -1299,7 +1298,7 @@ INLINE void MOVWS4(SH4 *sh4, UINT32 d, UINT32 n) } /* MOV.L Rm,@(disp4,Rn) */ -INLINE void MOVLS4(SH4 *sh4, UINT32 m, UINT32 d, UINT32 n) +INLINE void MOVLS4(sh4_state *sh4, UINT32 m, UINT32 d, UINT32 n) { UINT32 disp = d & 0x0f; sh4->ea = sh4->r[n] + disp * 4; @@ -1307,7 +1306,7 @@ INLINE void MOVLS4(SH4 *sh4, UINT32 m, UINT32 d, UINT32 n) } /* MOV.B @(disp4,Rm),R0 */ -INLINE void MOVBL4(SH4 *sh4, UINT32 m, UINT32 d) +INLINE void MOVBL4(sh4_state *sh4, UINT32 m, UINT32 d) { UINT32 disp = d & 0x0f; sh4->ea = sh4->r[m] + disp; @@ -1315,7 +1314,7 @@ INLINE void MOVBL4(SH4 *sh4, UINT32 m, UINT32 d) } /* MOV.W @(disp4,Rm),R0 */ -INLINE void MOVWL4(SH4 *sh4, UINT32 m, UINT32 d) +INLINE void MOVWL4(sh4_state *sh4, UINT32 m, UINT32 d) { UINT32 disp = d & 0x0f; sh4->ea = sh4->r[m] + disp * 2; @@ -1323,7 +1322,7 @@ INLINE void MOVWL4(SH4 *sh4, UINT32 m, UINT32 d) } /* MOV.L @(disp4,Rm),Rn */ -INLINE void MOVLL4(SH4 *sh4, UINT32 m, UINT32 d, UINT32 n) +INLINE void MOVLL4(sh4_state *sh4, UINT32 m, UINT32 d, UINT32 n) { UINT32 disp = d & 0x0f; sh4->ea = sh4->r[m] + disp * 4; @@ -1331,7 +1330,7 @@ INLINE void MOVLL4(SH4 *sh4, UINT32 m, UINT32 d, UINT32 n) } /* MOVA @(disp8,PC),R0 */ -INLINE void MOVA(SH4 *sh4, UINT32 d) +INLINE void MOVA(sh4_state *sh4, UINT32 d) { UINT32 disp = d & 0xff; sh4->ea = ((sh4->pc + 2) & ~3) + disp * 4; @@ -1339,38 +1338,38 @@ INLINE void MOVA(SH4 *sh4, UINT32 d) } /* MOVT Rn */ -INLINE void MOVT(SH4 *sh4, UINT32 n) +INLINE void MOVT(sh4_state *sh4, UINT32 n) { sh4->r[n] = sh4->sr & T; } /* MUL.L Rm,Rn */ -INLINE void MULL(SH4 *sh4, UINT32 m, UINT32 n) +INLINE void MULL(sh4_state *sh4, UINT32 m, UINT32 n) { sh4->macl = sh4->r[n] * sh4->r[m]; sh4->sh4_icount--; } /* MULS Rm,Rn */ -INLINE void MULS(SH4 *sh4, UINT32 m, UINT32 n) +INLINE void MULS(sh4_state *sh4, UINT32 m, UINT32 n) { sh4->macl = (INT16) sh4->r[n] * (INT16) sh4->r[m]; } /* MULU Rm,Rn */ -INLINE void MULU(SH4 *sh4, UINT32 m, UINT32 n) +INLINE void MULU(sh4_state *sh4, UINT32 m, UINT32 n) { sh4->macl = (UINT16) sh4->r[n] * (UINT16) sh4->r[m]; } /* NEG Rm,Rn */ -INLINE void NEG(SH4 *sh4, UINT32 m, UINT32 n) +INLINE void NEG(sh4_state *sh4, UINT32 m, UINT32 n) { sh4->r[n] = 0 - sh4->r[m]; } /* NEGC Rm,Rn */ -INLINE void NEGC(SH4 *sh4, UINT32 m, UINT32 n) +INLINE void NEGC(sh4_state *sh4, UINT32 m, UINT32 n) { UINT32 temp; @@ -1383,31 +1382,31 @@ INLINE void NEGC(SH4 *sh4, UINT32 m, UINT32 n) } /* NOP */ -INLINE void NOP(SH4 *sh4) +INLINE void NOP(sh4_state *sh4) { } /* NOT Rm,Rn */ -INLINE void NOT(SH4 *sh4, UINT32 m, UINT32 n) +INLINE void NOT(sh4_state *sh4, UINT32 m, UINT32 n) { sh4->r[n] = ~sh4->r[m]; } /* OR Rm,Rn */ -INLINE void OR(SH4 *sh4, UINT32 m, UINT32 n) +INLINE void OR(sh4_state *sh4, UINT32 m, UINT32 n) { sh4->r[n] |= sh4->r[m]; } /* OR #imm,R0 */ -INLINE void ORI(SH4 *sh4, UINT32 i) +INLINE void ORI(sh4_state *sh4, UINT32 i) { sh4->r[0] |= i; sh4->sh4_icount -= 2; } /* OR.B #imm,@(R0,GBR) */ -INLINE void ORM(SH4 *sh4, UINT32 i) +INLINE void ORM(sh4_state *sh4, UINT32 i) { UINT32 temp; @@ -1418,7 +1417,7 @@ INLINE void ORM(SH4 *sh4, UINT32 i) } /* ROTCL Rn */ -INLINE void ROTCL(SH4 *sh4, UINT32 n) +INLINE void ROTCL(sh4_state *sh4, UINT32 n) { UINT32 temp; @@ -1428,7 +1427,7 @@ INLINE void ROTCL(SH4 *sh4, UINT32 n) } /* ROTCR Rn */ -INLINE void ROTCR(SH4 *sh4, UINT32 n) +INLINE void ROTCR(sh4_state *sh4, UINT32 n) { UINT32 temp; temp = (sh4->sr & T) << 31; @@ -1440,21 +1439,21 @@ INLINE void ROTCR(SH4 *sh4, UINT32 n) } /* ROTL Rn */ -INLINE void ROTL(SH4 *sh4, UINT32 n) +INLINE void ROTL(sh4_state *sh4, UINT32 n) { sh4->sr = (sh4->sr & ~T) | ((sh4->r[n] >> 31) & T); sh4->r[n] = (sh4->r[n] << 1) | (sh4->r[n] >> 31); } /* ROTR Rn */ -INLINE void ROTR(SH4 *sh4, UINT32 n) +INLINE void ROTR(sh4_state *sh4, UINT32 n) { sh4->sr = (sh4->sr & ~T) | (sh4->r[n] & T); sh4->r[n] = (sh4->r[n] >> 1) | (sh4->r[n] << 31); } /* RTE */ -INLINE void RTE(SH4 *sh4) +INLINE void RTE(sh4_state *sh4) { sh4->delay = sh4->pc; sh4->pc = sh4->ea = sh4->spc; @@ -1468,7 +1467,7 @@ INLINE void RTE(SH4 *sh4) } /* RTS */ -INLINE void RTS(SH4 *sh4) +INLINE void RTS(sh4_state *sh4) { sh4->delay = sh4->pc; sh4->pc = sh4->ea = sh4->pr; @@ -1476,77 +1475,77 @@ INLINE void RTS(SH4 *sh4) } /* SETT */ -INLINE void SETT(SH4 *sh4) +INLINE void SETT(sh4_state *sh4) { sh4->sr |= T; } /* SHAL Rn (same as SHLL) */ -INLINE void SHAL(SH4 *sh4, UINT32 n) +INLINE void SHAL(sh4_state *sh4, UINT32 n) { sh4->sr = (sh4->sr & ~T) | ((sh4->r[n] >> 31) & T); sh4->r[n] <<= 1; } /* SHAR Rn */ -INLINE void SHAR(SH4 *sh4, UINT32 n) +INLINE void SHAR(sh4_state *sh4, UINT32 n) { sh4->sr = (sh4->sr & ~T) | (sh4->r[n] & T); sh4->r[n] = (UINT32)((INT32)sh4->r[n] >> 1); } /* SHLL Rn (same as SHAL) */ -INLINE void SHLL(SH4 *sh4, UINT32 n) +INLINE void SHLL(sh4_state *sh4, UINT32 n) { sh4->sr = (sh4->sr & ~T) | ((sh4->r[n] >> 31) & T); sh4->r[n] <<= 1; } /* SHLL2 Rn */ -INLINE void SHLL2(SH4 *sh4, UINT32 n) +INLINE void SHLL2(sh4_state *sh4, UINT32 n) { sh4->r[n] <<= 2; } /* SHLL8 Rn */ -INLINE void SHLL8(SH4 *sh4, UINT32 n) +INLINE void SHLL8(sh4_state *sh4, UINT32 n) { sh4->r[n] <<= 8; } /* SHLL16 Rn */ -INLINE void SHLL16(SH4 *sh4, UINT32 n) +INLINE void SHLL16(sh4_state *sh4, UINT32 n) { sh4->r[n] <<= 16; } /* SHLR Rn */ -INLINE void SHLR(SH4 *sh4, UINT32 n) +INLINE void SHLR(sh4_state *sh4, UINT32 n) { sh4->sr = (sh4->sr & ~T) | (sh4->r[n] & T); sh4->r[n] >>= 1; } /* SHLR2 Rn */ -INLINE void SHLR2(SH4 *sh4, UINT32 n) +INLINE void SHLR2(sh4_state *sh4, UINT32 n) { sh4->r[n] >>= 2; } /* SHLR8 Rn */ -INLINE void SHLR8(SH4 *sh4, UINT32 n) +INLINE void SHLR8(sh4_state *sh4, UINT32 n) { sh4->r[n] >>= 8; } /* SHLR16 Rn */ -INLINE void SHLR16(SH4 *sh4, UINT32 n) +INLINE void SHLR16(sh4_state *sh4, UINT32 n) { sh4->r[n] >>= 16; } /* SLEEP */ -INLINE void SLEEP(SH4 *sh4) +INLINE void SLEEP(sh4_state *sh4) { /* 0 = normal mode */ /* 1 = enters into power-down mode */ @@ -1562,25 +1561,25 @@ INLINE void SLEEP(SH4 *sh4) } /* STC SR,Rn */ -INLINE void STCSR(SH4 *sh4, UINT32 n) +INLINE void STCSR(sh4_state *sh4, UINT32 n) { sh4->r[n] = sh4->sr; } /* STC GBR,Rn */ -INLINE void STCGBR(SH4 *sh4, UINT32 n) +INLINE void STCGBR(sh4_state *sh4, UINT32 n) { sh4->r[n] = sh4->gbr; } /* STC VBR,Rn */ -INLINE void STCVBR(SH4 *sh4, UINT32 n) +INLINE void STCVBR(sh4_state *sh4, UINT32 n) { sh4->r[n] = sh4->vbr; } /* STC.L SR,@-Rn */ -INLINE void STCMSR(SH4 *sh4, UINT32 n) +INLINE void STCMSR(sh4_state *sh4, UINT32 n) { sh4->r[n] -= 4; sh4->ea = sh4->r[n]; @@ -1589,7 +1588,7 @@ INLINE void STCMSR(SH4 *sh4, UINT32 n) } /* STC.L GBR,@-Rn */ -INLINE void STCMGBR(SH4 *sh4, UINT32 n) +INLINE void STCMGBR(sh4_state *sh4, UINT32 n) { sh4->r[n] -= 4; sh4->ea = sh4->r[n]; @@ -1598,7 +1597,7 @@ INLINE void STCMGBR(SH4 *sh4, UINT32 n) } /* STC.L VBR,@-Rn */ -INLINE void STCMVBR(SH4 *sh4, UINT32 n) +INLINE void STCMVBR(sh4_state *sh4, UINT32 n) { sh4->r[n] -= 4; sh4->ea = sh4->r[n]; @@ -1607,25 +1606,25 @@ INLINE void STCMVBR(SH4 *sh4, UINT32 n) } /* STS MACH,Rn */ -INLINE void STSMACH(SH4 *sh4, UINT32 n) +INLINE void STSMACH(sh4_state *sh4, UINT32 n) { sh4->r[n] = sh4->mach; } /* STS MACL,Rn */ -INLINE void STSMACL(SH4 *sh4, UINT32 n) +INLINE void STSMACL(sh4_state *sh4, UINT32 n) { sh4->r[n] = sh4->macl; } /* STS PR,Rn */ -INLINE void STSPR(SH4 *sh4, UINT32 n) +INLINE void STSPR(sh4_state *sh4, UINT32 n) { sh4->r[n] = sh4->pr; } /* STS.L MACH,@-Rn */ -INLINE void STSMMACH(SH4 *sh4, UINT32 n) +INLINE void STSMMACH(sh4_state *sh4, UINT32 n) { sh4->r[n] -= 4; sh4->ea = sh4->r[n]; @@ -1633,7 +1632,7 @@ INLINE void STSMMACH(SH4 *sh4, UINT32 n) } /* STS.L MACL,@-Rn */ -INLINE void STSMMACL(SH4 *sh4, UINT32 n) +INLINE void STSMMACL(sh4_state *sh4, UINT32 n) { sh4->r[n] -= 4; sh4->ea = sh4->r[n]; @@ -1641,7 +1640,7 @@ INLINE void STSMMACL(SH4 *sh4, UINT32 n) } /* STS.L PR,@-Rn */ -INLINE void STSMPR(SH4 *sh4, UINT32 n) +INLINE void STSMPR(sh4_state *sh4, UINT32 n) { sh4->r[n] -= 4; sh4->ea = sh4->r[n]; @@ -1649,13 +1648,13 @@ INLINE void STSMPR(SH4 *sh4, UINT32 n) } /* SUB Rm,Rn */ -INLINE void SUB(SH4 *sh4, UINT32 m, UINT32 n) +INLINE void SUB(sh4_state *sh4, UINT32 m, UINT32 n) { sh4->r[n] -= sh4->r[m]; } /* SUBC Rm,Rn */ -INLINE void SUBC(SH4 *sh4, UINT32 m, UINT32 n) +INLINE void SUBC(sh4_state *sh4, UINT32 m, UINT32 n) { UINT32 tmp0, tmp1; @@ -1671,7 +1670,7 @@ INLINE void SUBC(SH4 *sh4, UINT32 m, UINT32 n) } /* SUBV Rm,Rn */ -INLINE void SUBV(SH4 *sh4, UINT32 m, UINT32 n) +INLINE void SUBV(sh4_state *sh4, UINT32 m, UINT32 n) { INT32 dest, src, ans; @@ -1702,7 +1701,7 @@ INLINE void SUBV(SH4 *sh4, UINT32 m, UINT32 n) } /* SWAP.B Rm,Rn */ -INLINE void SWAPB(SH4 *sh4, UINT32 m, UINT32 n) +INLINE void SWAPB(sh4_state *sh4, UINT32 m, UINT32 n) { UINT32 temp0, temp1; @@ -1713,7 +1712,7 @@ INLINE void SWAPB(SH4 *sh4, UINT32 m, UINT32 n) } /* SWAP.W Rm,Rn */ -INLINE void SWAPW(SH4 *sh4, UINT32 m, UINT32 n) +INLINE void SWAPW(sh4_state *sh4, UINT32 m, UINT32 n) { UINT32 temp; @@ -1722,7 +1721,7 @@ INLINE void SWAPW(SH4 *sh4, UINT32 m, UINT32 n) } /* TAS.B @Rn */ -INLINE void TAS(SH4 *sh4, UINT32 n) +INLINE void TAS(sh4_state *sh4, UINT32 n) { UINT32 temp; sh4->ea = sh4->r[n]; @@ -1739,7 +1738,7 @@ INLINE void TAS(SH4 *sh4, UINT32 n) } /* TRAPA #imm */ -INLINE void TRAPA(SH4 *sh4, UINT32 i) +INLINE void TRAPA(sh4_state *sh4, UINT32 i) { UINT32 imm = i & 0xff; @@ -1764,7 +1763,7 @@ INLINE void TRAPA(SH4 *sh4, UINT32 i) } /* TST Rm,Rn */ -INLINE void TST(SH4 *sh4, UINT32 m, UINT32 n) +INLINE void TST(sh4_state *sh4, UINT32 m, UINT32 n) { if ((sh4->r[n] & sh4->r[m]) == 0) sh4->sr |= T; @@ -1773,7 +1772,7 @@ INLINE void TST(SH4 *sh4, UINT32 m, UINT32 n) } /* TST #imm,R0 */ -INLINE void TSTI(SH4 *sh4, UINT32 i) +INLINE void TSTI(sh4_state *sh4, UINT32 i) { UINT32 imm = i & 0xff; @@ -1784,7 +1783,7 @@ INLINE void TSTI(SH4 *sh4, UINT32 i) } /* TST.B #imm,@(R0,GBR) */ -INLINE void TSTM(SH4 *sh4, UINT32 i) +INLINE void TSTM(sh4_state *sh4, UINT32 i) { UINT32 imm = i & 0xff; @@ -1797,20 +1796,20 @@ INLINE void TSTM(SH4 *sh4, UINT32 i) } /* XOR Rm,Rn */ -INLINE void XOR(SH4 *sh4, UINT32 m, UINT32 n) +INLINE void XOR(sh4_state *sh4, UINT32 m, UINT32 n) { sh4->r[n] ^= sh4->r[m]; } /* XOR #imm,R0 */ -INLINE void XORI(SH4 *sh4, UINT32 i) +INLINE void XORI(sh4_state *sh4, UINT32 i) { UINT32 imm = i & 0xff; sh4->r[0] ^= imm; } /* XOR.B #imm,@(R0,GBR) */ -INLINE void XORM(SH4 *sh4, UINT32 i) +INLINE void XORM(sh4_state *sh4, UINT32 i) { UINT32 imm = i & 0xff; UINT32 temp; @@ -1823,7 +1822,7 @@ INLINE void XORM(SH4 *sh4, UINT32 i) } /* XTRCT Rm,Rn */ -INLINE void XTRCT(SH4 *sh4, UINT32 m, UINT32 n) +INLINE void XTRCT(sh4_state *sh4, UINT32 m, UINT32 n) { UINT32 temp; @@ -1833,49 +1832,49 @@ INLINE void XTRCT(SH4 *sh4, UINT32 m, UINT32 n) } /* STC SSR,Rn */ -INLINE void STCSSR(SH4 *sh4, UINT32 n) +INLINE void STCSSR(sh4_state *sh4, UINT32 n) { sh4->r[n] = sh4->ssr; } /* STC SPC,Rn */ -INLINE void STCSPC(SH4 *sh4, UINT32 n) +INLINE void STCSPC(sh4_state *sh4, UINT32 n) { sh4->r[n] = sh4->spc; } /* STC SGR,Rn */ -INLINE void STCSGR(SH4 *sh4, UINT32 n) +INLINE void STCSGR(sh4_state *sh4, UINT32 n) { sh4->r[n] = sh4->sgr; } /* STS FPUL,Rn */ -INLINE void STSFPUL(SH4 *sh4, UINT32 n) +INLINE void STSFPUL(sh4_state *sh4, UINT32 n) { sh4->r[n] = sh4->fpul; } /* STS FPSCR,Rn */ -INLINE void STSFPSCR(SH4 *sh4, UINT32 n) +INLINE void STSFPSCR(sh4_state *sh4, UINT32 n) { sh4->r[n] = sh4->fpscr & 0x003FFFFF; } /* STC DBR,Rn */ -INLINE void STCDBR(SH4 *sh4, UINT32 n) +INLINE void STCDBR(sh4_state *sh4, UINT32 n) { sh4->r[n] = sh4->dbr; } /* STCRBANK Rm_BANK,Rn */ -INLINE void STCRBANK(SH4 *sh4, UINT32 m, UINT32 n) +INLINE void STCRBANK(sh4_state *sh4, UINT32 m, UINT32 n) { sh4->r[n] = sh4->rbnk[sh4->sr&sRB ? 0 : 1][m & 7]; } /* STCMRBANK Rm_BANK,@-Rn */ -INLINE void STCMRBANK(SH4 *sh4, UINT32 m, UINT32 n) +INLINE void STCMRBANK(sh4_state *sh4, UINT32 m, UINT32 n) { sh4->r[n] -= 4; sh4->ea = sh4->r[n]; @@ -1884,24 +1883,24 @@ INLINE void STCMRBANK(SH4 *sh4, UINT32 m, UINT32 n) } /* MOVCA.L R0,@Rn */ -INLINE void MOVCAL(SH4 *sh4, UINT32 n) +INLINE void MOVCAL(sh4_state *sh4, UINT32 n) { sh4->ea = sh4->r[n]; WL(sh4, sh4->ea, sh4->r[0] ); } -INLINE void CLRS(SH4 *sh4) +INLINE void CLRS(sh4_state *sh4) { sh4->sr &= ~S; } -INLINE void SETS(SH4 *sh4) +INLINE void SETS(sh4_state *sh4) { sh4->sr |= S; } /* STS.L SGR,@-Rn */ -INLINE void STCMSGR(SH4 *sh4, UINT32 n) +INLINE void STCMSGR(sh4_state *sh4, UINT32 n) { sh4->r[n] -= 4; sh4->ea = sh4->r[n]; @@ -1909,7 +1908,7 @@ INLINE void STCMSGR(SH4 *sh4, UINT32 n) } /* STS.L FPUL,@-Rn */ -INLINE void STSMFPUL(SH4 *sh4, UINT32 n) +INLINE void STSMFPUL(sh4_state *sh4, UINT32 n) { sh4->r[n] -= 4; sh4->ea = sh4->r[n]; @@ -1917,7 +1916,7 @@ INLINE void STSMFPUL(SH4 *sh4, UINT32 n) } /* STS.L FPSCR,@-Rn */ -INLINE void STSMFPSCR(SH4 *sh4, UINT32 n) +INLINE void STSMFPSCR(sh4_state *sh4, UINT32 n) { sh4->r[n] -= 4; sh4->ea = sh4->r[n]; @@ -1925,7 +1924,7 @@ INLINE void STSMFPSCR(SH4 *sh4, UINT32 n) } /* STC.L DBR,@-Rn */ -INLINE void STCMDBR(SH4 *sh4, UINT32 n) +INLINE void STCMDBR(sh4_state *sh4, UINT32 n) { sh4->r[n] -= 4; sh4->ea = sh4->r[n]; @@ -1933,7 +1932,7 @@ INLINE void STCMDBR(SH4 *sh4, UINT32 n) } /* STC.L SSR,@-Rn */ -INLINE void STCMSSR(SH4 *sh4, UINT32 n) +INLINE void STCMSSR(sh4_state *sh4, UINT32 n) { sh4->r[n] -= 4; sh4->ea = sh4->r[n]; @@ -1941,7 +1940,7 @@ INLINE void STCMSSR(SH4 *sh4, UINT32 n) } /* STC.L SPC,@-Rn */ -INLINE void STCMSPC(SH4 *sh4, UINT32 n) +INLINE void STCMSPC(sh4_state *sh4, UINT32 n) { sh4->r[n] -= 4; sh4->ea = sh4->r[n]; @@ -1949,7 +1948,7 @@ INLINE void STCMSPC(SH4 *sh4, UINT32 n) } /* LDS.L @Rm+,FPUL */ -INLINE void LDSMFPUL(SH4 *sh4, UINT32 m) +INLINE void LDSMFPUL(sh4_state *sh4, UINT32 m) { sh4->ea = sh4->r[m]; sh4->fpul = RL(sh4, sh4->ea ); @@ -1957,7 +1956,7 @@ INLINE void LDSMFPUL(SH4 *sh4, UINT32 m) } /* LDS.L @Rm+,FPSCR */ -INLINE void LDSMFPSCR(SH4 *sh4, UINT32 m) +INLINE void LDSMFPSCR(sh4_state *sh4, UINT32 m) { UINT32 s; @@ -1977,7 +1976,7 @@ UINT32 s; } /* LDC.L @Rm+,DBR */ -INLINE void LDCMDBR(SH4 *sh4, UINT32 m) +INLINE void LDCMDBR(sh4_state *sh4, UINT32 m) { sh4->ea = sh4->r[m]; sh4->dbr = RL(sh4, sh4->ea ); @@ -1985,7 +1984,7 @@ INLINE void LDCMDBR(SH4 *sh4, UINT32 m) } /* LDC.L @Rn+,Rm_BANK */ -INLINE void LDCMRBANK(SH4 *sh4, UINT32 m, UINT32 n) +INLINE void LDCMRBANK(sh4_state *sh4, UINT32 m, UINT32 n) { sh4->ea = sh4->r[n]; sh4->rbnk[sh4->sr&sRB ? 0 : 1][m & 7] = RL(sh4, sh4->ea ); @@ -1993,7 +1992,7 @@ INLINE void LDCMRBANK(SH4 *sh4, UINT32 m, UINT32 n) } /* LDC.L @Rm+,SSR */ -INLINE void LDCMSSR(SH4 *sh4, UINT32 m) +INLINE void LDCMSSR(sh4_state *sh4, UINT32 m) { sh4->ea = sh4->r[m]; sh4->ssr = RL(sh4, sh4->ea ); @@ -2001,7 +2000,7 @@ INLINE void LDCMSSR(SH4 *sh4, UINT32 m) } /* LDC.L @Rm+,SPC */ -INLINE void LDCMSPC(SH4 *sh4, UINT32 m) +INLINE void LDCMSPC(sh4_state *sh4, UINT32 m) { sh4->ea = sh4->r[m]; sh4->spc = RL(sh4, sh4->ea ); @@ -2009,13 +2008,13 @@ INLINE void LDCMSPC(SH4 *sh4, UINT32 m) } /* LDS Rm,FPUL */ -INLINE void LDSFPUL(SH4 *sh4, UINT32 m) +INLINE void LDSFPUL(sh4_state *sh4, UINT32 m) { sh4->fpul = sh4->r[m]; } /* LDS Rm,FPSCR */ -INLINE void LDSFPSCR(SH4 *sh4, UINT32 m) +INLINE void LDSFPSCR(sh4_state *sh4, UINT32 m) { UINT32 s; @@ -2032,13 +2031,13 @@ UINT32 s; } /* LDC Rm,DBR */ -INLINE void LDCDBR(SH4 *sh4, UINT32 m) +INLINE void LDCDBR(sh4_state *sh4, UINT32 m) { sh4->dbr = sh4->r[m]; } /* SHAD Rm,Rn */ -INLINE void SHAD(SH4 *sh4, UINT32 m,UINT32 n) +INLINE void SHAD(sh4_state *sh4, UINT32 m,UINT32 n) { if ((sh4->r[m] & 0x80000000) == 0) sh4->r[n] = sh4->r[n] << (sh4->r[m] & 0x1F); @@ -2052,7 +2051,7 @@ INLINE void SHAD(SH4 *sh4, UINT32 m,UINT32 n) } /* SHLD Rm,Rn */ -INLINE void SHLD(SH4 *sh4, UINT32 m,UINT32 n) +INLINE void SHLD(sh4_state *sh4, UINT32 m,UINT32 n) { if ((sh4->r[m] & 0x80000000) == 0) sh4->r[n] = sh4->r[n] << (sh4->r[m] & 0x1F); @@ -2063,24 +2062,24 @@ INLINE void SHLD(SH4 *sh4, UINT32 m,UINT32 n) } /* LDCRBANK Rn,Rm_BANK */ -INLINE void LDCRBANK(SH4 *sh4, UINT32 m, UINT32 n) +INLINE void LDCRBANK(sh4_state *sh4, UINT32 m, UINT32 n) { sh4->rbnk[sh4->sr&sRB ? 0 : 1][m & 7] = sh4->r[n]; } /* LDC Rm,SSR */ -INLINE void LDCSSR(SH4 *sh4, UINT32 m) +INLINE void LDCSSR(sh4_state *sh4, UINT32 m) { sh4->ssr = sh4->r[m]; } /* LDC Rm,SPC */ -INLINE void LDCSPC(SH4 *sh4, UINT32 m) +INLINE void LDCSPC(sh4_state *sh4, UINT32 m) { sh4->spc = sh4->r[m]; } -static UINT32 sh4_getsqremap(SH4 *sh4, UINT32 address) +static UINT32 sh4_getsqremap(sh4_state *sh4, UINT32 address) { if (!sh4->sh4_mmu_enabled) return address; @@ -2102,7 +2101,7 @@ static UINT32 sh4_getsqremap(SH4 *sh4, UINT32 address) } /* PREF @Rn */ -INLINE void PREFM(SH4 *sh4, UINT32 n) +INLINE void PREFM(sh4_state *sh4, UINT32 n) { int a; UINT32 addr,dest,sq; @@ -2140,7 +2139,7 @@ INLINE void PREFM(SH4 *sh4, UINT32 n) /***************************************************************************** * OPCODE DISPATCHERS *****************************************************************************/ -INLINE void op0000(SH4 *sh4, UINT16 opcode) +INLINE void op0000(sh4_state *sh4, UINT16 opcode) { switch (opcode & 0xF) { @@ -2261,12 +2260,12 @@ INLINE void op0000(SH4 *sh4, UINT16 opcode) } } -INLINE void op0001(SH4 *sh4, UINT16 opcode) +INLINE void op0001(sh4_state *sh4, UINT16 opcode) { MOVLS4(sh4, Rm, opcode & 0x0f, Rn); } -INLINE void op0010(SH4 *sh4, UINT16 opcode) +INLINE void op0010(sh4_state *sh4, UINT16 opcode) { switch (opcode & 15) { @@ -2289,7 +2288,7 @@ INLINE void op0010(SH4 *sh4, UINT16 opcode) } } -INLINE void op0011(SH4 *sh4, UINT16 opcode) +INLINE void op0011(sh4_state *sh4, UINT16 opcode) { switch (opcode & 15) { @@ -2312,7 +2311,7 @@ INLINE void op0011(SH4 *sh4, UINT16 opcode) } } -INLINE void op0100(SH4 *sh4, UINT16 opcode) +INLINE void op0100(sh4_state *sh4, UINT16 opcode) { switch (opcode & 0xF) { @@ -2507,12 +2506,12 @@ INLINE void op0100(SH4 *sh4, UINT16 opcode) } } -INLINE void op0101(SH4 *sh4, UINT16 opcode) +INLINE void op0101(sh4_state *sh4, UINT16 opcode) { MOVLL4(sh4, Rm, opcode & 0x0f, Rn); } -INLINE void op0110(SH4 *sh4, UINT16 opcode) +INLINE void op0110(sh4_state *sh4, UINT16 opcode) { switch (opcode & 15) { @@ -2535,12 +2534,12 @@ INLINE void op0110(SH4 *sh4, UINT16 opcode) } } -INLINE void op0111(SH4 *sh4, UINT16 opcode) +INLINE void op0111(sh4_state *sh4, UINT16 opcode) { ADDI(sh4, opcode & 0xff, Rn); } -INLINE void op1000(SH4 *sh4, UINT16 opcode) +INLINE void op1000(sh4_state *sh4, UINT16 opcode) { switch ( opcode & (15<<8) ) { @@ -2564,22 +2563,22 @@ INLINE void op1000(SH4 *sh4, UINT16 opcode) } -INLINE void op1001(SH4 *sh4, UINT16 opcode) +INLINE void op1001(sh4_state *sh4, UINT16 opcode) { MOVWI(sh4, opcode & 0xff, Rn); } -INLINE void op1010(SH4 *sh4, UINT16 opcode) +INLINE void op1010(sh4_state *sh4, UINT16 opcode) { BRA(sh4, opcode & 0xfff); } -INLINE void op1011(SH4 *sh4, UINT16 opcode) +INLINE void op1011(sh4_state *sh4, UINT16 opcode) { BSR(sh4, opcode & 0xfff); } -INLINE void op1100(SH4 *sh4, UINT16 opcode) +INLINE void op1100(sh4_state *sh4, UINT16 opcode) { switch (opcode & (15<<8)) { @@ -2602,12 +2601,12 @@ INLINE void op1100(SH4 *sh4, UINT16 opcode) } } -INLINE void op1101(SH4 *sh4, UINT16 opcode) +INLINE void op1101(sh4_state *sh4, UINT16 opcode) { MOVLI(sh4, opcode & 0xff, Rn); } -INLINE void op1110(SH4 *sh4, UINT16 opcode) +INLINE void op1110(sh4_state *sh4, UINT16 opcode) { MOVI(sh4, opcode & 0xff, Rn); } @@ -2616,7 +2615,7 @@ INLINE void op1110(SH4 *sh4, UINT16 opcode) /* FMOV @Rm+,DRn PR=0 SZ=1 1111nnn0mmmm1001 */ /* FMOV @Rm+,XDn PR=0 SZ=1 1111nnn1mmmm1001 */ /* FMOV @Rm+,XDn PR=1 1111nnn1mmmm1001 */ -INLINE void FMOVMRIFR(SH4 *sh4, UINT32 m,UINT32 n) +INLINE void FMOVMRIFR(sh4_state *sh4, UINT32 m,UINT32 n) { if (sh4->fpu_pr) { /* PR = 1 */ n = n & 14; @@ -2652,7 +2651,7 @@ INLINE void FMOVMRIFR(SH4 *sh4, UINT32 m,UINT32 n) /* FMOV DRm,@Rn PR=0 SZ=1 1111nnnnmmm01010 */ /* FMOV XDm,@Rn PR=0 SZ=1 1111nnnnmmm11010 */ /* FMOV XDm,@Rn PR=1 1111nnnnmmm11010 */ -INLINE void FMOVFRMR(SH4 *sh4,UINT32 m,UINT32 n) +INLINE void FMOVFRMR(sh4_state *sh4,UINT32 m,UINT32 n) { if (sh4->fpu_pr) { /* PR = 1 */ m= m & 14; @@ -2682,7 +2681,7 @@ INLINE void FMOVFRMR(SH4 *sh4,UINT32 m,UINT32 n) /* FMOV DRm,@-Rn PR=0 SZ=1 1111nnnnmmm01011 */ /* FMOV XDm,@-Rn PR=0 SZ=1 1111nnnnmmm11011 */ /* FMOV XDm,@-Rn PR=1 1111nnnnmmm11011 */ -INLINE void FMOVFRMDR(SH4 *sh4,UINT32 m,UINT32 n) +INLINE void FMOVFRMDR(sh4_state *sh4,UINT32 m,UINT32 n) { if (sh4->fpu_pr) { /* PR = 1 */ m= m & 14; @@ -2716,7 +2715,7 @@ INLINE void FMOVFRMDR(SH4 *sh4,UINT32 m,UINT32 n) /* FMOV DRm,@(R0,Rn) PR=0 SZ=1 1111nnnnmmm00111 */ /* FMOV XDm,@(R0,Rn) PR=0 SZ=1 1111nnnnmmm10111 */ /* FMOV XDm,@(R0,Rn) PR=1 1111nnnnmmm10111 */ -INLINE void FMOVFRS0(SH4 *sh4,UINT32 m,UINT32 n) +INLINE void FMOVFRS0(sh4_state *sh4,UINT32 m,UINT32 n) { if (sh4->fpu_pr) { /* PR = 1 */ m= m & 14; @@ -2746,7 +2745,7 @@ INLINE void FMOVFRS0(SH4 *sh4,UINT32 m,UINT32 n) /* FMOV @(R0,Rm),DRn PR=0 SZ=1 1111nnn0mmmm0110 */ /* FMOV @(R0,Rm),XDn PR=0 SZ=1 1111nnn1mmmm0110 */ /* FMOV @(R0,Rm),XDn PR=1 1111nnn1mmmm0110 */ -INLINE void FMOVS0FR(SH4 *sh4,UINT32 m,UINT32 n) +INLINE void FMOVS0FR(sh4_state *sh4,UINT32 m,UINT32 n) { if (sh4->fpu_pr) { /* PR = 1 */ n= n & 14; @@ -2777,7 +2776,7 @@ INLINE void FMOVS0FR(SH4 *sh4,UINT32 m,UINT32 n) /* FMOV @Rm,XDn PR=0 SZ=1 1111nnn1mmmm1000 */ /* FMOV @Rm,XDn PR=1 1111nnn1mmmm1000 */ /* FMOV @Rm,DRn PR=1 1111nnn0mmmm1000 */ -INLINE void FMOVMRFR(SH4 *sh4,UINT32 m,UINT32 n) +INLINE void FMOVMRFR(sh4_state *sh4,UINT32 m,UINT32 n) { if (sh4->fpu_pr) { /* PR = 1 */ if (n & 1) { @@ -2816,7 +2815,7 @@ INLINE void FMOVMRFR(SH4 *sh4,UINT32 m,UINT32 n) /* FMOV XDm,DRn PR=1 XDm -> DRn 1111nnn0mmm11100 */ /* FMOV DRm,XDn PR=1 DRm -> XDn 1111nnn1mmm01100 */ /* FMOV XDm,XDn PR=1 XDm -> XDn 1111nnn1mmm11100 */ -INLINE void FMOVFR(SH4 *sh4,UINT32 m,UINT32 n) +INLINE void FMOVFR(sh4_state *sh4,UINT32 m,UINT32 n) { if ((sh4->fpu_sz == 0) && (sh4->fpu_pr == 0)) /* SZ = 0 */ sh4->fr[n] = sh4->fr[m]; @@ -2842,38 +2841,38 @@ INLINE void FMOVFR(SH4 *sh4,UINT32 m,UINT32 n) } /* FLDI1 FRn 1111nnnn10011101 */ -INLINE void FLDI1(SH4 *sh4, UINT32 n) +INLINE void FLDI1(sh4_state *sh4, UINT32 n) { sh4->fr[n] = 0x3F800000; } /* FLDI0 FRn 1111nnnn10001101 */ -INLINE void FLDI0(SH4 *sh4, UINT32 n) +INLINE void FLDI0(sh4_state *sh4, UINT32 n) { sh4->fr[n] = 0; } /* FLDS FRm,FPUL 1111mmmm00011101 */ -INLINE void FLDS(SH4 *sh4, UINT32 m) +INLINE void FLDS(sh4_state *sh4, UINT32 m) { sh4->fpul = sh4->fr[m]; } /* FSTS FPUL,FRn 1111nnnn00001101 */ -INLINE void FSTS(SH4 *sh4, UINT32 n) +INLINE void FSTS(sh4_state *sh4, UINT32 n) { sh4->fr[n] = sh4->fpul; } /* FRCHG 1111101111111101 */ -INLINE void FRCHG(SH4 *sh4) +INLINE void FRCHG(sh4_state *sh4) { sh4->fpscr ^= FR; sh4_swap_fp_registers(sh4); } /* FSCHG 1111001111111101 */ -INLINE void FSCHG(SH4 *sh4) +INLINE void FSCHG(sh4_state *sh4) { sh4->fpscr ^= SZ; sh4->fpu_sz = (sh4->fpscr & SZ) ? 1 : 0; @@ -2881,7 +2880,7 @@ INLINE void FSCHG(SH4 *sh4) /* FTRC FRm,FPUL PR=0 1111mmmm00111101 */ /* FTRC DRm,FPUL PR=1 1111mmm000111101 */ -INLINE void FTRC(SH4 *sh4, UINT32 n) +INLINE void FTRC(sh4_state *sh4, UINT32 n) { if (sh4->fpu_pr) { /* PR = 1 */ n = n & 14; @@ -2894,7 +2893,7 @@ INLINE void FTRC(SH4 *sh4, UINT32 n) /* FLOAT FPUL,FRn PR=0 1111nnnn00101101 */ /* FLOAT FPUL,DRn PR=1 1111nnn000101101 */ -INLINE void FLOAT(SH4 *sh4, UINT32 n) +INLINE void FLOAT(sh4_state *sh4, UINT32 n) { if (sh4->fpu_pr) { /* PR = 1 */ n = n & 14; @@ -2906,7 +2905,7 @@ INLINE void FLOAT(SH4 *sh4, UINT32 n) /* FNEG FRn PR=0 1111nnnn01001101 */ /* FNEG DRn PR=1 1111nnn001001101 */ -INLINE void FNEG(SH4 *sh4, UINT32 n) +INLINE void FNEG(sh4_state *sh4, UINT32 n) { if (sh4->fpu_pr) { /* PR = 1 */ FP_RFD(n) = -FP_RFD(n); @@ -2917,7 +2916,7 @@ INLINE void FNEG(SH4 *sh4, UINT32 n) /* FABS FRn PR=0 1111nnnn01011101 */ /* FABS DRn PR=1 1111nnn001011101 */ -INLINE void FABS(SH4 *sh4, UINT32 n) +INLINE void FABS(sh4_state *sh4, UINT32 n) { if (sh4->fpu_pr) { /* PR = 1 */ #ifdef LSB_FIRST @@ -2934,7 +2933,7 @@ INLINE void FABS(SH4 *sh4, UINT32 n) /* FCMP/EQ FRm,FRn PR=0 1111nnnnmmmm0100 */ /* FCMP/EQ DRm,DRn PR=1 1111nnn0mmm00100 */ -INLINE void FCMP_EQ(SH4 *sh4, UINT32 m,UINT32 n) +INLINE void FCMP_EQ(sh4_state *sh4, UINT32 m,UINT32 n) { if (sh4->fpu_pr) { /* PR = 1 */ n = n & 14; @@ -2953,7 +2952,7 @@ INLINE void FCMP_EQ(SH4 *sh4, UINT32 m,UINT32 n) /* FCMP/GT FRm,FRn PR=0 1111nnnnmmmm0101 */ /* FCMP/GT DRm,DRn PR=1 1111nnn0mmm00101 */ -INLINE void FCMP_GT(SH4 *sh4, UINT32 m,UINT32 n) +INLINE void FCMP_GT(sh4_state *sh4, UINT32 m,UINT32 n) { if (sh4->fpu_pr) { /* PR = 1 */ n = n & 14; @@ -2971,7 +2970,7 @@ INLINE void FCMP_GT(SH4 *sh4, UINT32 m,UINT32 n) } /* FCNVDS DRm,FPUL PR=1 1111mmm010111101 */ -INLINE void FCNVDS(SH4 *sh4, UINT32 n) +INLINE void FCNVDS(sh4_state *sh4, UINT32 n) { if (sh4->fpu_pr) { /* PR = 1 */ n = n & 14; @@ -2982,7 +2981,7 @@ INLINE void FCNVDS(SH4 *sh4, UINT32 n) } /* FCNVSD FPUL, DRn PR=1 1111nnn010101101 */ -INLINE void FCNVSD(SH4 *sh4, UINT32 n) +INLINE void FCNVSD(sh4_state *sh4, UINT32 n) { if (sh4->fpu_pr) { /* PR = 1 */ n = n & 14; @@ -2992,7 +2991,7 @@ INLINE void FCNVSD(SH4 *sh4, UINT32 n) /* FADD FRm,FRn PR=0 1111nnnnmmmm0000 */ /* FADD DRm,DRn PR=1 1111nnn0mmm00000 */ -INLINE void FADD(SH4 *sh4, UINT32 m,UINT32 n) +INLINE void FADD(sh4_state *sh4, UINT32 m,UINT32 n) { if (sh4->fpu_pr) { /* PR = 1 */ n = n & 14; @@ -3005,7 +3004,7 @@ INLINE void FADD(SH4 *sh4, UINT32 m,UINT32 n) /* FSUB FRm,FRn PR=0 1111nnnnmmmm0001 */ /* FSUB DRm,DRn PR=1 1111nnn0mmm00001 */ -INLINE void FSUB(SH4 *sh4, UINT32 m,UINT32 n) +INLINE void FSUB(sh4_state *sh4, UINT32 m,UINT32 n) { if (sh4->fpu_pr) { /* PR = 1 */ n = n & 14; @@ -3019,7 +3018,7 @@ INLINE void FSUB(SH4 *sh4, UINT32 m,UINT32 n) /* FMUL FRm,FRn PR=0 1111nnnnmmmm0010 */ /* FMUL DRm,DRn PR=1 1111nnn0mmm00010 */ -INLINE void FMUL(SH4 *sh4, UINT32 m,UINT32 n) +INLINE void FMUL(sh4_state *sh4, UINT32 m,UINT32 n) { if (sh4->fpu_pr) { /* PR = 1 */ n = n & 14; @@ -3032,7 +3031,7 @@ INLINE void FMUL(SH4 *sh4, UINT32 m,UINT32 n) /* FDIV FRm,FRn PR=0 1111nnnnmmmm0011 */ /* FDIV DRm,DRn PR=1 1111nnn0mmm00011 */ -INLINE void FDIV(SH4 *sh4, UINT32 m,UINT32 n) +INLINE void FDIV(sh4_state *sh4, UINT32 m,UINT32 n) { if (sh4->fpu_pr) { /* PR = 1 */ n = n & 14; @@ -3048,7 +3047,7 @@ INLINE void FDIV(SH4 *sh4, UINT32 m,UINT32 n) } /* FMAC FR0,FRm,FRn PR=0 1111nnnnmmmm1110 */ -INLINE void FMAC(SH4 *sh4, UINT32 m,UINT32 n) +INLINE void FMAC(sh4_state *sh4, UINT32 m,UINT32 n) { if (sh4->fpu_pr == 0) { /* PR = 0 */ FP_RFS(n) = (FP_RFS(0) * FP_RFS(m)) + FP_RFS(n); @@ -3057,7 +3056,7 @@ INLINE void FMAC(SH4 *sh4, UINT32 m,UINT32 n) /* FSQRT FRn PR=0 1111nnnn01101101 */ /* FSQRT DRn PR=1 1111nnnn01101101 */ -INLINE void FSQRT(SH4 *sh4, UINT32 n) +INLINE void FSQRT(sh4_state *sh4, UINT32 n) { if (sh4->fpu_pr) { /* PR = 1 */ n = n & 14; @@ -3072,7 +3071,7 @@ INLINE void FSQRT(SH4 *sh4, UINT32 n) } /* FSRRA FRn PR=0 1111nnnn01111101 */ -INLINE void FSRRA(SH4 *sh4, UINT32 n) +INLINE void FSRRA(sh4_state *sh4, UINT32 n) { if (FP_RFS(n) < 0) return; @@ -3080,7 +3079,7 @@ INLINE void FSRRA(SH4 *sh4, UINT32 n) } /* FSSCA FPUL,FRn PR=0 1111nnn011111101 */ -INLINE void FSSCA(SH4 *sh4, UINT32 n) +INLINE void FSSCA(sh4_state *sh4, UINT32 n) { float angle; @@ -3090,7 +3089,7 @@ float angle; } /* FIPR FVm,FVn PR=0 1111nnmm11101101 */ -INLINE void FIPR(SH4 *sh4, UINT32 n) +INLINE void FIPR(sh4_state *sh4, UINT32 n) { UINT32 m; float ml[4]; @@ -3104,7 +3103,7 @@ int a; } /* FTRV XMTRX,FVn PR=0 1111nn0111111101 */ -INLINE void FTRV(SH4 *sh4, UINT32 n) +INLINE void FTRV(sh4_state *sh4, UINT32 n) { int i,j; float sum[4]; @@ -3119,7 +3118,7 @@ float sum[4]; FP_RFS(n + i) = sum[i]; } -INLINE void op1111(SH4 *sh4, UINT16 opcode) +INLINE void op1111(sh4_state *sh4, UINT16 opcode) { switch (opcode & 0xf) { @@ -3246,7 +3245,7 @@ INLINE void op1111(SH4 *sh4, UINT16 opcode) static CPU_RESET( sh4 ) { - SH4 *sh4 = get_safe_token(device); + sh4_state *sh4 = get_safe_token(device); emu_timer *tsaved[4]; emu_timer *tsave[5]; UINT32 *m; @@ -3327,7 +3326,7 @@ static CPU_RESET( sh4 ) /* Execute cycles - returns number of cycles actually run */ static CPU_EXECUTE( sh4 ) { - SH4 *sh4 = get_safe_token(device); + sh4_state *sh4 = get_safe_token(device); if (sh4->cpu_off) { @@ -3384,7 +3383,7 @@ static CPU_EXECUTE( sh4 ) static CPU_INIT( sh4 ) { const struct sh4_config *conf = (const struct sh4_config *)device->baseconfig().static_config(); - SH4 *sh4 = get_safe_token(device); + sh4_state *sh4 = get_safe_token(device); sh4_common_init(device); @@ -3472,7 +3471,7 @@ static CPU_INIT( sh4 ) static CPU_SET_INFO( sh4 ) { - SH4 *sh4 = get_safe_token(device); + sh4_state *sh4 = get_safe_token(device); switch (state) { @@ -3608,7 +3607,7 @@ static CPU_SET_INFO( sh4 ) void sh4_set_ftcsr_callback(running_device *device, sh4_ftcsr_callback callback) { - SH4 *sh4 = get_safe_token(device); + sh4_state *sh4 = get_safe_token(device); sh4->ftcsr_read_callback = callback; } @@ -3625,7 +3624,7 @@ ADDRESS_MAP_END static READ64_HANDLER( sh4_tlb_r ) { - SH4 *sh4 = get_safe_token(space->cpu); + sh4_state *sh4 = get_safe_token(space->cpu); int offs = offset*8; @@ -3643,7 +3642,7 @@ static READ64_HANDLER( sh4_tlb_r ) static WRITE64_HANDLER( sh4_tlb_w ) { - SH4 *sh4 = get_safe_token(space->cpu); + sh4_state *sh4 = get_safe_token(space->cpu); int offs = offset*8; @@ -3674,12 +3673,12 @@ ADDRESS_MAP_END CPU_GET_INFO( sh4 ) { - SH4 *sh4 = (device != NULL && device->token() != NULL) ? get_safe_token(device) : NULL; + sh4_state *sh4 = (device != NULL && device->token() != NULL) ? get_safe_token(device) : NULL; switch (state) { /* --- the following bits of info are returned as 64-bit signed integers --- */ - case CPUINFO_INT_CONTEXT_SIZE: info->i = sizeof(SH4); break; + case CPUINFO_INT_CONTEXT_SIZE: info->i = sizeof(sh4_state); break; case CPUINFO_INT_INPUT_LINES: info->i = 5; break; case CPUINFO_INT_DEFAULT_IRQ_VECTOR: info->i = 0; break; case DEVINFO_INT_ENDIANNESS: info->i = ENDIANNESS_LITTLE; break; @@ -3882,3 +3881,5 @@ CPU_GET_INFO( sh4 ) #endif } } + +DEFINE_LEGACY_CPU_DEVICE(SH4, sh4); diff --git a/src/emu/cpu/sh4/sh4.h b/src/emu/cpu/sh4/sh4.h index a1ba8368f84..ce2d2845ff9 100644 --- a/src/emu/cpu/sh4/sh4.h +++ b/src/emu/cpu/sh4/sh4.h @@ -90,8 +90,7 @@ struct sh4_ddt_dma typedef void (*sh4_ftcsr_callback)(UINT32); -extern CPU_GET_INFO( sh4 ); -#define CPU_SH4 CPU_GET_INFO_NAME( sh4 ) +DECLARE_LEGACY_CPU_DEVICE(SH4, sh4); WRITE32_HANDLER( sh4_internal_w ); READ32_HANDLER( sh4_internal_r ); diff --git a/src/emu/cpu/sh4/sh4comn.c b/src/emu/cpu/sh4/sh4comn.c index c5079e51a41..18ec0ae9b2a 100644 --- a/src/emu/cpu/sh4/sh4comn.c +++ b/src/emu/cpu/sh4/sh4comn.c @@ -30,15 +30,14 @@ static const UINT16 tcnt[] = { TCNT0, TCNT1, TCNT2 }; static const UINT16 tcor[] = { TCOR0, TCOR1, TCOR2 }; static const UINT16 tcr[] = { TCR0, TCR1, TCR2 }; -INLINE SH4 *get_safe_token(running_device *device) +INLINE sh4_state *get_safe_token(running_device *device) { assert(device != NULL); - assert(device->type() == CPU); - assert(cpu_get_type(device) == CPU_SH4); - return (SH4 *)downcast<legacy_cpu_device *>(device)->token(); + assert(device->type() == SH4); + return (sh4_state *)downcast<legacy_cpu_device *>(device)->token(); } -void sh4_change_register_bank(SH4 *sh4, int to) +void sh4_change_register_bank(sh4_state *sh4, int to) { int s; @@ -60,7 +59,7 @@ int s; } } -void sh4_swap_fp_registers(SH4 *sh4) +void sh4_swap_fp_registers(sh4_state *sh4) { int s; UINT32 z; @@ -74,7 +73,7 @@ UINT32 z; } #ifdef LSB_FIRST -void sh4_swap_fp_couples(SH4 *sh4) +void sh4_swap_fp_couples(sh4_state *sh4) { int s; UINT32 z; @@ -91,7 +90,7 @@ UINT32 z; } #endif -void sh4_syncronize_register_bank(SH4 *sh4, int to) +void sh4_syncronize_register_bank(sh4_state *sh4, int to) { int s; @@ -101,7 +100,7 @@ int s; } } -void sh4_default_exception_priorities(SH4 *sh4) // setup default priorities for exceptions +void sh4_default_exception_priorities(sh4_state *sh4) // setup default priorities for exceptions { int a; @@ -117,7 +116,7 @@ int a; sh4->exception_priority[a] = INTPRI(0, a); } -void sh4_exception_recompute(SH4 *sh4) // checks if there is any interrupt with high enough priority +void sh4_exception_recompute(sh4_state *sh4) // checks if there is any interrupt with high enough priority { int a,z; @@ -136,7 +135,7 @@ void sh4_exception_recompute(SH4 *sh4) // checks if there is any interrupt with } } -void sh4_exception_request(SH4 *sh4, int exception) // start requesting an exception +void sh4_exception_request(sh4_state *sh4, int exception) // start requesting an exception { if (!sh4->exception_requesting[exception]) { @@ -146,7 +145,7 @@ void sh4_exception_request(SH4 *sh4, int exception) // start requesting an excep } } -void sh4_exception_unrequest(SH4 *sh4, int exception) // stop requesting an exception +void sh4_exception_unrequest(sh4_state *sh4, int exception) // stop requesting an exception { if (sh4->exception_requesting[exception]) { @@ -156,7 +155,7 @@ void sh4_exception_unrequest(SH4 *sh4, int exception) // stop requesting an exce } } -void sh4_exception_checkunrequest(SH4 *sh4, int exception) +void sh4_exception_checkunrequest(sh4_state *sh4, int exception) { if (exception == SH4_INTC_NMI) sh4_exception_unrequest(sh4, exception); @@ -165,7 +164,7 @@ void sh4_exception_checkunrequest(SH4 *sh4, int exception) sh4_exception_unrequest(sh4, exception); } -void sh4_exception(SH4 *sh4, const char *message, int exception) // handle exception +void sh4_exception(sh4_state *sh4, const char *message, int exception) // handle exception { UINT32 vector; @@ -223,7 +222,7 @@ static UINT32 compute_ticks_refresh_timer(emu_timer *timer, int hertz, int base, return base + (UINT32)((attotime_to_double(timer_timeelapsed(timer)) * (double)hertz) / (double)divisor); } -static void sh4_refresh_timer_recompute(SH4 *sh4) +static void sh4_refresh_timer_recompute(sh4_state *sh4) { UINT32 ticks; @@ -254,7 +253,7 @@ static UINT32 compute_ticks_timer(emu_timer *timer, int hertz, int divisor) return (UINT32)ret; } -static void sh4_timer_recompute(SH4 *sh4, int which) +static void sh4_timer_recompute(sh4_state *sh4, int which) { double ticks; @@ -264,7 +263,7 @@ static void sh4_timer_recompute(SH4 *sh4, int which) static TIMER_CALLBACK( sh4_refresh_timer_callback ) { - SH4 *sh4 = (SH4 *)ptr; + sh4_state *sh4 = (sh4_state *)ptr; sh4->m[RTCNT] = 0; sh4_refresh_timer_recompute(sh4); @@ -280,7 +279,7 @@ static TIMER_CALLBACK( sh4_refresh_timer_callback ) } } -static void increment_rtc_time(SH4 *sh4, int mode) +static void increment_rtc_time(sh4_state *sh4, int mode) { int carry, year, leap, days; @@ -375,7 +374,7 @@ static void increment_rtc_time(SH4 *sh4, int mode) static TIMER_CALLBACK( sh4_rtc_timer_callback ) { - SH4 *sh4 = (SH4 *)ptr; + sh4_state *sh4 = (sh4_state *)ptr; timer_adjust_oneshot(sh4->rtc_timer, ATTOTIME_IN_HZ(128), 0); sh4->m[R64CNT] = (sh4->m[R64CNT]+1) & 0x7f; @@ -390,7 +389,7 @@ static TIMER_CALLBACK( sh4_rtc_timer_callback ) static TIMER_CALLBACK( sh4_timer_callback ) { static const UINT16 tuni[] = { SH4_INTC_TUNI0, SH4_INTC_TUNI1, SH4_INTC_TUNI2 }; - SH4 *sh4 = (SH4 *)ptr; + sh4_state *sh4 = (sh4_state *)ptr; int which = param; int idx = tcr[which]; @@ -403,7 +402,7 @@ static TIMER_CALLBACK( sh4_timer_callback ) static TIMER_CALLBACK( sh4_dmac_callback ) { - SH4 *sh4 = (SH4 *)ptr; + sh4_state *sh4 = (sh4_state *)ptr; int channel = param; LOG(("SH4 '%s': DMA %d complete\n", sh4->device->tag(), channel)); @@ -437,7 +436,7 @@ static TIMER_CALLBACK( sh4_dmac_callback ) } } -static int sh4_dma_transfer(SH4 *sh4, int channel, int timermode, UINT32 chcr, UINT32 *sar, UINT32 *dar, UINT32 *dmatcr) +static int sh4_dma_transfer(sh4_state *sh4, int channel, int timermode, UINT32 chcr, UINT32 *sar, UINT32 *dar, UINT32 *dmatcr) { int incs, incd, size; UINT32 src, dst, count; @@ -564,7 +563,7 @@ static int sh4_dma_transfer(SH4 *sh4, int channel, int timermode, UINT32 chcr, U return 1; } -static void sh4_dmac_check(SH4 *sh4, int channel) +static void sh4_dmac_check(sh4_state *sh4, int channel) { UINT32 dmatcr,chcr,sar,dar; @@ -615,7 +614,7 @@ UINT32 dmatcr,chcr,sar,dar; } } -static void sh4_dmac_nmi(SH4 *sh4) // manage dma when nmi +static void sh4_dmac_nmi(sh4_state *sh4) // manage dma when nmi { int s; @@ -633,7 +632,7 @@ int s; WRITE32_HANDLER( sh4_internal_w ) { - SH4 *sh4 = get_safe_token(space->cpu); + sh4_state *sh4 = get_safe_token(space->cpu); int a; UINT32 old = sh4->m[offset]; COMBINE_DATA(sh4->m+offset); @@ -945,7 +944,7 @@ WRITE32_HANDLER( sh4_internal_w ) READ32_HANDLER( sh4_internal_r ) { - SH4 *sh4 = get_safe_token(space->cpu); + sh4_state *sh4 = get_safe_token(space->cpu); // logerror("sh4_internal_r: Read %08x (%x) @ %08x\n", 0xfe000000+((offset & 0x3fc0) << 11)+((offset & 0x3f) << 2), offset, mem_mask); switch( offset ) { @@ -998,7 +997,7 @@ READ32_HANDLER( sh4_internal_r ) void sh4_set_frt_input(running_device *device, int state) { - SH4 *sh4 = get_safe_token(device); + sh4_state *sh4 = get_safe_token(device); if(state == PULSE_LINE) { @@ -1034,7 +1033,7 @@ void sh4_set_frt_input(running_device *device, int state) void sh4_set_irln_input(running_device *device, int value) { - SH4 *sh4 = get_safe_token(device); + sh4_state *sh4 = get_safe_token(device); if (sh4->irln == value) return; @@ -1043,7 +1042,7 @@ void sh4_set_irln_input(running_device *device, int value) cpu_set_input_line(device, SH4_IRLn, CLEAR_LINE); } -void sh4_set_irq_line(SH4 *sh4, int irqline, int state) // set state of external interrupt line +void sh4_set_irq_line(sh4_state *sh4, int irqline, int state) // set state of external interrupt line { int s; @@ -1113,7 +1112,7 @@ void sh4_set_irq_line(SH4 *sh4, int irqline, int state) // set state of external sh4_check_pending_irq(sh4, "sh4_set_irq_line"); } -void sh4_parse_configuration(SH4 *sh4, const struct sh4_config *conf) +void sh4_parse_configuration(sh4_state *sh4, const struct sh4_config *conf) { if(conf) { @@ -1163,7 +1162,7 @@ void sh4_parse_configuration(SH4 *sh4, const struct sh4_config *conf) void sh4_common_init(running_device *device) { - SH4 *sh4 = get_safe_token(device); + sh4_state *sh4 = get_safe_token(device); int i; for (i=0; i<3; i++) @@ -1190,7 +1189,7 @@ void sh4_common_init(running_device *device) void sh4_dma_ddt(running_device *device, struct sh4_ddt_dma *s) { - SH4 *sh4 = get_safe_token(device); + sh4_state *sh4 = get_safe_token(device); UINT32 chcr; UINT32 *p32bits; UINT64 *p32bytes; diff --git a/src/emu/cpu/sh4/sh4comn.h b/src/emu/cpu/sh4/sh4comn.h index 9feb8750318..b25f7aaeaf3 100644 --- a/src/emu/cpu/sh4/sh4comn.h +++ b/src/emu/cpu/sh4/sh4comn.h @@ -98,7 +98,7 @@ typedef struct UINT32 sh4_tlb_data[64]; UINT8 sh4_mmu_enabled; -} SH4; +} sh4_state; enum { @@ -134,23 +134,23 @@ enum #define Rn ((opcode>>8)&15) #define Rm ((opcode>>4)&15) -void sh4_exception_recompute(SH4 *sh4); // checks if there is any interrupt with high enough priority -void sh4_exception_request(SH4 *sh4, int exception); // start requesting an exception -void sh4_exception_unrequest(SH4 *sh4, int exception); // stop requesting an exception -void sh4_exception_checkunrequest(SH4 *sh4, int exception); -void sh4_exception(SH4 *sh4, const char *message, int exception); // handle exception -void sh4_change_register_bank(SH4 *sh4, int to); -void sh4_syncronize_register_bank(SH4 *sh4, int to); -void sh4_swap_fp_registers(SH4 *sh4); -void sh4_default_exception_priorities(SH4 *sh4); // setup default priorities for exceptions -void sh4_parse_configuration(SH4 *sh4, const struct sh4_config *conf); -void sh4_set_irq_line(SH4 *sh4, int irqline, int state); // set state of external interrupt line +void sh4_exception_recompute(sh4_state *sh4); // checks if there is any interrupt with high enough priority +void sh4_exception_request(sh4_state *sh4, int exception); // start requesting an exception +void sh4_exception_unrequest(sh4_state *sh4, int exception); // stop requesting an exception +void sh4_exception_checkunrequest(sh4_state *sh4, int exception); +void sh4_exception(sh4_state *sh4, const char *message, int exception); // handle exception +void sh4_change_register_bank(sh4_state *sh4, int to); +void sh4_syncronize_register_bank(sh4_state *sh4, int to); +void sh4_swap_fp_registers(sh4_state *sh4); +void sh4_default_exception_priorities(sh4_state *sh4); // setup default priorities for exceptions +void sh4_parse_configuration(sh4_state *sh4, const struct sh4_config *conf); +void sh4_set_irq_line(sh4_state *sh4, int irqline, int state); // set state of external interrupt line #ifdef LSB_FIRST -void sh4_swap_fp_couples(SH4 *sh4); +void sh4_swap_fp_couples(sh4_state *sh4); #endif void sh4_common_init(running_device *device); -INLINE void sh4_check_pending_irq(SH4 *sh4, const char *message) // look for highest priority active exception and handle it +INLINE void sh4_check_pending_irq(sh4_state *sh4, const char *message) // look for highest priority active exception and handle it { int a,irq,z; diff --git a/src/emu/cpu/sharc/sharc.c b/src/emu/cpu/sharc/sharc.c index dc59a52a56b..cdab5130735 100644 --- a/src/emu/cpu/sharc/sharc.c +++ b/src/emu/cpu/sharc/sharc.c @@ -187,8 +187,7 @@ static void (* sharc_op[512])(SHARC_REGS *cpustate); INLINE SHARC_REGS *get_safe_token(running_device *device) { assert(device != NULL); - assert(device->type() == CPU); - assert(cpu_get_type(device) == CPU_ADSP21062); + assert(device->type() == ADSP21062); return (SHARC_REGS *)downcast<legacy_cpu_device *>(device)->token(); } @@ -1319,3 +1318,5 @@ CPU_GET_INFO( adsp21062 ) default: CPU_GET_INFO_CALL(sharc); break; } } + +DEFINE_LEGACY_CPU_DEVICE(ADSP21062, adsp21062); diff --git a/src/emu/cpu/sharc/sharc.h b/src/emu/cpu/sharc/sharc.h index 7b011457deb..b857a822ca0 100644 --- a/src/emu/cpu/sharc/sharc.h +++ b/src/emu/cpu/sharc/sharc.h @@ -26,8 +26,7 @@ extern void sharc_set_flag_input(running_device *device, int flag_num, int state extern void sharc_external_iop_write(running_device *device, UINT32 address, UINT32 data); extern void sharc_external_dma_write(running_device *device, UINT32 address, UINT64 data); -CPU_GET_INFO( adsp21062 ); -#define CPU_ADSP21062 CPU_GET_INFO_NAME( adsp21062 ) +DECLARE_LEGACY_CPU_DEVICE(ADSP21062, adsp21062); extern UINT32 sharc_dasm_one(char *buffer, offs_t pc, UINT64 opcode); diff --git a/src/emu/cpu/sm8500/sm8500.c b/src/emu/cpu/sm8500/sm8500.c index 379aba6bd37..cf2e33d9109 100644 --- a/src/emu/cpu/sm8500/sm8500.c +++ b/src/emu/cpu/sm8500/sm8500.c @@ -59,8 +59,7 @@ struct _sm8500_state INLINE sm8500_state *get_safe_token(running_device *device) { assert(device != NULL); - assert(device->type() == CPU); - assert(cpu_get_type(device) == CPU_SM8500); + assert(device->type() == SM8500); return (sm8500_state *)downcast<legacy_cpu_device *>(device)->token(); } @@ -553,3 +552,5 @@ CPU_GET_INFO( sm8500 ) } } + +DEFINE_LEGACY_CPU_DEVICE(SM8500, sm8500); diff --git a/src/emu/cpu/sm8500/sm8500.h b/src/emu/cpu/sm8500/sm8500.h index c63f5dd9445..3d54aca46c6 100644 --- a/src/emu/cpu/sm8500/sm8500.h +++ b/src/emu/cpu/sm8500/sm8500.h @@ -32,8 +32,7 @@ enum SM8500_SPH, SM8500_SPL, SM8500_PS0, SM8500_PS1, SM8500_P0C, SM8500_P1C, SM8500_P2C, SM8500_P3C, }; -extern CPU_GET_INFO( sm8500 ); -#define CPU_SM8500 CPU_GET_INFO_NAME( sm8500 ) +DECLARE_LEGACY_CPU_DEVICE(SM8500, sm8500); extern CPU_DISASSEMBLE( sm8500 ); diff --git a/src/emu/cpu/spc700/spc700.c b/src/emu/cpu/spc700/spc700.c index 022f6dbef7f..3ede181ec6e 100644 --- a/src/emu/cpu/spc700/spc700.c +++ b/src/emu/cpu/spc700/spc700.c @@ -101,8 +101,7 @@ typedef struct INLINE spc700i_cpu *get_safe_token(running_device *device) { assert(device != NULL); - assert(device->type() == CPU); - assert(cpu_get_type(device) == CPU_SPC700); + assert(device->type() == SPC700); return (spc700i_cpu *)downcast<legacy_cpu_device *>(device)->token(); } @@ -1750,6 +1749,7 @@ CPU_GET_INFO( spc700 ) } } +DEFINE_LEGACY_CPU_DEVICE(SPC700, spc700); /* ======================================================================== */ /* ============================== END OF FILE ============================= */ diff --git a/src/emu/cpu/spc700/spc700.h b/src/emu/cpu/spc700/spc700.h index 9e587c3998a..a5700a28aaf 100644 --- a/src/emu/cpu/spc700/spc700.h +++ b/src/emu/cpu/spc700/spc700.h @@ -4,8 +4,7 @@ #define __SPC700_H__ -extern CPU_GET_INFO( spc700 ); -#define CPU_SPC700 CPU_GET_INFO_NAME( spc700 ) +DECLARE_LEGACY_CPU_DEVICE(SPC700, spc700); /* ======================================================================== */ /* ============================= Configuration ============================ */ diff --git a/src/emu/cpu/ssem/ssem.c b/src/emu/cpu/ssem/ssem.c index 7484a82fde3..a83e8e71cfb 100644 --- a/src/emu/cpu/ssem/ssem.c +++ b/src/emu/cpu/ssem/ssem.c @@ -29,8 +29,7 @@ struct _ssem_state INLINE ssem_state *get_safe_token(running_device *device) { assert(device != NULL); - assert(device->type() == CPU); - assert(cpu_get_type(device) == CPU_SSEM); + assert(device->type() == SSEM); return (ssem_state *)downcast<legacy_cpu_device *>(device)->token(); } @@ -306,3 +305,5 @@ CPU_GET_INFO( ssem ) case CPUINFO_STR_REGISTER + SSEM_HALT: sprintf(info->s, "HALT: %d", cpustate->halt); break; } } + +DEFINE_LEGACY_CPU_DEVICE(SSEM, ssem); diff --git a/src/emu/cpu/ssem/ssem.h b/src/emu/cpu/ssem/ssem.h index 1478e54dc67..f75f7dc0b2a 100644 --- a/src/emu/cpu/ssem/ssem.h +++ b/src/emu/cpu/ssem/ssem.h @@ -16,8 +16,7 @@ enum SSEM_HALT, }; -CPU_GET_INFO( ssem ); -#define CPU_SSEM CPU_GET_INFO_NAME( ssem ) +DECLARE_LEGACY_CPU_DEVICE(SSEM, ssem); extern offs_t ssem_dasm_one(char *buffer, offs_t pc, UINT32 op); diff --git a/src/emu/cpu/ssp1601/ssp1601.c b/src/emu/cpu/ssp1601/ssp1601.c index 0ce300a84b9..46cb2b9c3cb 100644 --- a/src/emu/cpu/ssp1601/ssp1601.c +++ b/src/emu/cpu/ssp1601/ssp1601.c @@ -60,8 +60,7 @@ struct _ssp1601_state_t INLINE ssp1601_state_t *get_safe_token(running_device *device) { assert(device != NULL); - assert(device->type() == CPU); - assert(cpu_get_type(device) == CPU_SSP1601); + assert(device->type() == SSP1601); return (ssp1601_state_t *)downcast<legacy_cpu_device *>(device)->token(); } @@ -911,3 +910,5 @@ CPU_GET_INFO( ssp1601 ) // vim:ts=4 + +DEFINE_LEGACY_CPU_DEVICE(SSP1601, ssp1601); diff --git a/src/emu/cpu/ssp1601/ssp1601.h b/src/emu/cpu/ssp1601/ssp1601.h index 0297f337e94..5ba83a45143 100644 --- a/src/emu/cpu/ssp1601/ssp1601.h +++ b/src/emu/cpu/ssp1601/ssp1601.h @@ -15,8 +15,7 @@ enum SSP_PR0, SSP_PR1, SSP_PR2, SSP_PR3, SSP_PR4, SSP_PR5, SSP_PR6, SSP_PR7 }; -CPU_GET_INFO( ssp1601 ); -#define CPU_SSP1601 CPU_GET_INFO_NAME( ssp1601 ) +DECLARE_LEGACY_CPU_DEVICE(SSP1601, ssp1601); extern unsigned dasm_ssp1601(char *buffer, unsigned pc, const UINT8 *oprom); diff --git a/src/emu/cpu/superfx/superfx.c b/src/emu/cpu/superfx/superfx.c index e1ecbe79420..e647f873056 100644 --- a/src/emu/cpu/superfx/superfx.c +++ b/src/emu/cpu/superfx/superfx.c @@ -69,8 +69,7 @@ struct _superfx_state INLINE superfx_state *get_safe_token(running_device *device) { assert(device != NULL); - assert(device->type() == CPU); - assert(cpu_get_type(device) == CPU_SUPERFX); + assert(device->type() == SUPERFX); return (superfx_state *)downcast<legacy_cpu_device *>(device)->token(); } @@ -1677,3 +1676,5 @@ CPU_GET_INFO( superfx ) case CPUINFO_STR_REGISTER + SUPERFX_RAMADDR: sprintf(info->s, "RAMADDR: %04X", cpustate->ramaddr); break; } } + +DEFINE_LEGACY_CPU_DEVICE(SUPERFX, superfx); diff --git a/src/emu/cpu/superfx/superfx.h b/src/emu/cpu/superfx/superfx.h index 7ac58d5f3f6..5e89882de99 100644 --- a/src/emu/cpu/superfx/superfx.h +++ b/src/emu/cpu/superfx/superfx.h @@ -90,8 +90,7 @@ struct _superfx_config }; #define SUPERFX_CONFIG(name) const superfx_config (name) = -CPU_GET_INFO( superfx ); -#define CPU_SUPERFX CPU_GET_INFO_NAME( superfx ) +DECLARE_LEGACY_CPU_DEVICE(SUPERFX, superfx); CPU_DISASSEMBLE( superfx ); extern offs_t superfx_dasm_one(char *buffer, offs_t pc, UINT8 op, UINT8 param0, UINT8 param1, UINT16 alt); diff --git a/src/emu/cpu/t11/t11.c b/src/emu/cpu/t11/t11.c index 0fab8e1446e..7627a6350dc 100644 --- a/src/emu/cpu/t11/t11.c +++ b/src/emu/cpu/t11/t11.c @@ -41,8 +41,7 @@ struct _t11_state INLINE t11_state *get_safe_token(running_device *device) { assert(device != NULL); - assert(device->type() == CPU); - assert(cpu_get_type(device) == CPU_T11); + assert(device->type() == T11); return (t11_state *)downcast<legacy_cpu_device *>(device)->token(); } @@ -493,3 +492,5 @@ CPU_GET_INFO( t11 ) case CPUINFO_STR_REGISTER + T11_R5: sprintf(info->s, "R5:%04X", cpustate->reg[5].w.l); break; } } + +DEFINE_LEGACY_CPU_DEVICE(T11, t11); diff --git a/src/emu/cpu/t11/t11.h b/src/emu/cpu/t11/t11.h index 7fee036d816..962e2788776 100644 --- a/src/emu/cpu/t11/t11.h +++ b/src/emu/cpu/t11/t11.h @@ -32,8 +32,7 @@ struct t11_setup }; -extern CPU_GET_INFO( t11 ); -#define CPU_T11 CPU_GET_INFO_NAME( t11 ) +DECLARE_LEGACY_CPU_DEVICE(T11, t11); CPU_DISASSEMBLE( t11 ); diff --git a/src/emu/cpu/tlcs90/tlcs90.c b/src/emu/cpu/tlcs90/tlcs90.c index 7424bfd53eb..2f2a7c4f279 100644 --- a/src/emu/cpu/tlcs90/tlcs90.c +++ b/src/emu/cpu/tlcs90/tlcs90.c @@ -63,11 +63,10 @@ typedef struct INLINE t90_Regs *get_safe_token(running_device *device) { assert(device != NULL); - assert(device->type() == CPU); - assert(cpu_get_type(device) == CPU_TMP90840 || - cpu_get_type(device) == CPU_TMP90841 || - cpu_get_type(device) == CPU_TMP91640 || - cpu_get_type(device) == CPU_TMP91641); + assert(device->type() == TMP90840 || + device->type() == TMP90841 || + device->type() == TMP91640 || + device->type() == TMP91641); return (t90_Regs *)downcast<legacy_cpu_device *>(device)->token(); } @@ -2938,3 +2937,8 @@ CPU_GET_INFO( tmp91641 ) CPU_GET_INFO_CALL(tmp90840); } + +DEFINE_LEGACY_CPU_DEVICE(TMP90840, tmp90840); +DEFINE_LEGACY_CPU_DEVICE(TMP90841, tmp90841); +DEFINE_LEGACY_CPU_DEVICE(TMP91640, tmp91640); +DEFINE_LEGACY_CPU_DEVICE(TMP91641, tmp91641); diff --git a/src/emu/cpu/tlcs90/tlcs90.h b/src/emu/cpu/tlcs90/tlcs90.h index 7fc5c1d53e1..e584d444e97 100644 --- a/src/emu/cpu/tlcs90/tlcs90.h +++ b/src/emu/cpu/tlcs90/tlcs90.h @@ -4,15 +4,10 @@ #define __TLCS90_H__ -CPU_GET_INFO( tmp90840 ); -CPU_GET_INFO( tmp90841 ); -CPU_GET_INFO( tmp91640 ); -CPU_GET_INFO( tmp91641 ); - -#define CPU_TMP90840 CPU_GET_INFO_NAME( tmp90840 ) -#define CPU_TMP90841 CPU_GET_INFO_NAME( tmp90841 ) -#define CPU_TMP91640 CPU_GET_INFO_NAME( tmp91640 ) -#define CPU_TMP91641 CPU_GET_INFO_NAME( tmp91641 ) +DECLARE_LEGACY_CPU_DEVICE(TMP90840, tmp90840); +DECLARE_LEGACY_CPU_DEVICE(TMP90841, tmp90841); +DECLARE_LEGACY_CPU_DEVICE(TMP91640, tmp91640); +DECLARE_LEGACY_CPU_DEVICE(TMP91641, tmp91641); CPU_DISASSEMBLE( t90 ); diff --git a/src/emu/cpu/tlcs900/tlcs900.c b/src/emu/cpu/tlcs900/tlcs900.c index c6a22c43f52..50464b03037 100644 --- a/src/emu/cpu/tlcs900/tlcs900.c +++ b/src/emu/cpu/tlcs900/tlcs900.c @@ -207,8 +207,7 @@ struct _tlcs900_state INLINE tlcs900_state *get_safe_token( running_device *device ) { assert( device != NULL ); - assert( device->type() == CPU ); - assert( cpu_get_type(device) == CPU_TLCS900H ); + assert( device->type() == TLCS900H ); return (tlcs900_state *) downcast<legacy_cpu_device *>(device)->token(); } @@ -1242,3 +1241,4 @@ CPU_GET_INFO( tlcs900h ) } } +DEFINE_LEGACY_CPU_DEVICE(TLCS900H, tlcs900h); diff --git a/src/emu/cpu/tlcs900/tlcs900.h b/src/emu/cpu/tlcs900/tlcs900.h index 5be5736637a..f950ba77afe 100644 --- a/src/emu/cpu/tlcs900/tlcs900.h +++ b/src/emu/cpu/tlcs900/tlcs900.h @@ -39,8 +39,7 @@ struct _tlcs900_interface }; -extern CPU_GET_INFO( tlcs900h ); -#define CPU_TLCS900H CPU_GET_INFO_NAME( tlcs900h ) +DECLARE_LEGACY_CPU_DEVICE(TLCS900H, tlcs900h); extern CPU_DISASSEMBLE( tlcs900 ); diff --git a/src/emu/cpu/tms0980/tms0980.c b/src/emu/cpu/tms0980/tms0980.c index cf9ea2fdf2c..ee519c105aa 100644 --- a/src/emu/cpu/tms0980/tms0980.c +++ b/src/emu/cpu/tms0980/tms0980.c @@ -449,14 +449,13 @@ static const UINT32 tms1100_default_decode[256] = { INLINE tms0980_state *get_safe_token(running_device *device) { assert(device != NULL); - assert(device->type() == CPU); - assert(cpu_get_type(device) == CPU_TMS0980 || - cpu_get_type(device) == CPU_TMS1000 || - cpu_get_type(device) == CPU_TMS1070 || - cpu_get_type(device) == CPU_TMS1100 || - cpu_get_type(device) == CPU_TMS1200 || - cpu_get_type(device) == CPU_TMS1270 || - cpu_get_type(device) == CPU_TMS1300 ); + assert(device->type() == TMS0980 || + device->type() == TMS1000 || + device->type() == TMS1070 || + device->type() == TMS1100 || + device->type() == TMS1200 || + device->type() == TMS1270 || + device->type() == TMS1300 ); return (tms0980_state *)downcast<legacy_cpu_device *>(device)->token(); } @@ -1275,3 +1274,12 @@ CPU_GET_INFO( tms1300 ) } } + +DEFINE_LEGACY_CPU_DEVICE(TMS0980, tms0980); + +DEFINE_LEGACY_CPU_DEVICE(TMS1000, tms1000); +DEFINE_LEGACY_CPU_DEVICE(TMS1070, tms1070); +DEFINE_LEGACY_CPU_DEVICE(TMS1100, tms1100); +DEFINE_LEGACY_CPU_DEVICE(TMS1200, tms1200); +DEFINE_LEGACY_CPU_DEVICE(TMS1270, tms1270); +DEFINE_LEGACY_CPU_DEVICE(TMS1300, tms1300); diff --git a/src/emu/cpu/tms0980/tms0980.h b/src/emu/cpu/tms0980/tms0980.h index 03544ee83c6..a0ac1547df2 100644 --- a/src/emu/cpu/tms0980/tms0980.h +++ b/src/emu/cpu/tms0980/tms0980.h @@ -23,25 +23,17 @@ struct _tms0980_config { /* 9-bit family */ -#define CPU_TMS0980 CPU_GET_INFO_NAME( tms0980 ) +DECLARE_LEGACY_CPU_DEVICE(TMS0980, tms0980); -extern CPU_GET_INFO( tms0980 ); extern CPU_DISASSEMBLE( tms0980 ); /* 8-bit family */ -#define CPU_TMS1000 CPU_GET_INFO_NAME( tms1000 ) -#define CPU_TMS1070 CPU_GET_INFO_NAME( tms1070 ) -#define CPU_TMS1100 CPU_GET_INFO_NAME( tms1100 ) -#define CPU_TMS1200 CPU_GET_INFO_NAME( tms1200 ) -#define CPU_TMS1270 CPU_GET_INFO_NAME( tms1270 ) -#define CPU_TMS1300 CPU_GET_INFO_NAME( tms1300 ) - -extern CPU_GET_INFO( tms1000 ); -extern CPU_GET_INFO( tms1070 ); -extern CPU_GET_INFO( tms1100 ); -extern CPU_GET_INFO( tms1200 ); -extern CPU_GET_INFO( tms1270 ); -extern CPU_GET_INFO( tms1300 ); +DECLARE_LEGACY_CPU_DEVICE(TMS1000, tms1000); +DECLARE_LEGACY_CPU_DEVICE(TMS1070, tms1070); +DECLARE_LEGACY_CPU_DEVICE(TMS1100, tms1100); +DECLARE_LEGACY_CPU_DEVICE(TMS1200, tms1200); +DECLARE_LEGACY_CPU_DEVICE(TMS1270, tms1270); +DECLARE_LEGACY_CPU_DEVICE(TMS1300, tms1300); extern CPU_DISASSEMBLE( tms1000 ); extern CPU_DISASSEMBLE( tms1100 ); diff --git a/src/emu/cpu/tms32010/tms32010.c b/src/emu/cpu/tms32010/tms32010.c index 5f11b3887d8..0b180ba6f98 100644 --- a/src/emu/cpu/tms32010/tms32010.c +++ b/src/emu/cpu/tms32010/tms32010.c @@ -100,8 +100,7 @@ struct _tms32010_state INLINE tms32010_state *get_safe_token(running_device *device) { assert(device != NULL); - assert(device->type() == CPU); - assert(cpu_get_type(device) == CPU_TMS32010); + assert(device->type() == TMS32010); return (tms32010_state *)downcast<legacy_cpu_device *>(device)->token(); } @@ -1034,3 +1033,5 @@ CPU_GET_INFO( tms32010 ) case CPUINFO_STR_REGISTER + TMS32010_STK3: sprintf(info->s, "STK3:%04X", cpustate->STACK[3]); break; } } + +DEFINE_LEGACY_CPU_DEVICE(TMS32010, tms32010); diff --git a/src/emu/cpu/tms32010/tms32010.h b/src/emu/cpu/tms32010/tms32010.h index 07ba9371c95..47ba9522d47 100644 --- a/src/emu/cpu/tms32010/tms32010.h +++ b/src/emu/cpu/tms32010/tms32010.h @@ -49,8 +49,7 @@ enum * Public Functions */ -CPU_GET_INFO( tms32010 ); -#define CPU_TMS32010 CPU_GET_INFO_NAME( tms32010 ) +DECLARE_LEGACY_CPU_DEVICE(TMS32010, tms32010); CPU_DISASSEMBLE( tms32010 ); diff --git a/src/emu/cpu/tms32025/tms32025.c b/src/emu/cpu/tms32025/tms32025.c index 2a5acbbae10..daccc1b0167 100644 --- a/src/emu/cpu/tms32025/tms32025.c +++ b/src/emu/cpu/tms32025/tms32025.c @@ -185,9 +185,8 @@ struct _tms32025_state INLINE tms32025_state *get_safe_token(running_device *device) { assert(device != NULL); - assert(device->type() == CPU); - assert(cpu_get_type(device) == CPU_TMS32025 || - cpu_get_type(device) == CPU_TMS32026); + assert(device->type() == TMS32025 || + device->type() == TMS32026); return (tms32025_state *)downcast<legacy_cpu_device *>(device)->token(); } @@ -2471,3 +2470,6 @@ CPU_GET_INFO( tms32026 ) default: CPU_GET_INFO_CALL(tms32025); break; } } + +DEFINE_LEGACY_CPU_DEVICE(TMS32025, tms32025); +DEFINE_LEGACY_CPU_DEVICE(TMS32026, tms32026); diff --git a/src/emu/cpu/tms32025/tms32025.h b/src/emu/cpu/tms32025/tms32025.h index cc8174b9c29..01ecb8b5a8f 100644 --- a/src/emu/cpu/tms32025/tms32025.h +++ b/src/emu/cpu/tms32025/tms32025.h @@ -66,11 +66,8 @@ enum * Public Functions */ -extern CPU_GET_INFO( tms32025 ); -extern CPU_GET_INFO( tms32026 ); - -#define CPU_TMS32025 CPU_GET_INFO_NAME( tms32025 ) -#define CPU_TMS32026 CPU_GET_INFO_NAME( tms32026 ) +DECLARE_LEGACY_CPU_DEVICE(TMS32025, tms32025); +DECLARE_LEGACY_CPU_DEVICE(TMS32026, tms32026); CPU_DISASSEMBLE( tms32025 ); diff --git a/src/emu/cpu/tms32031/tms32031.c b/src/emu/cpu/tms32031/tms32031.c index 77628c9a7b2..07b86529615 100644 --- a/src/emu/cpu/tms32031/tms32031.c +++ b/src/emu/cpu/tms32031/tms32031.c @@ -126,9 +126,8 @@ struct _tms32031_state INLINE tms32031_state *get_safe_token(running_device *device) { assert(device != NULL); - assert(device->type() == CPU); - assert(cpu_get_type(device) == CPU_TMS32031 || - cpu_get_type(device) == CPU_TMS32032); + assert(device->type() == TMS32031 || + device->type() == TMS32032); return (tms32031_state *)downcast<legacy_cpu_device *>(device)->token(); } @@ -859,3 +858,6 @@ CPU_GET_INFO( tms32032 ) default: CPU_GET_INFO_CALL(tms32031); break; } } + +DEFINE_LEGACY_CPU_DEVICE(TMS32031, tms32031); +DEFINE_LEGACY_CPU_DEVICE(TMS32032, tms32032); diff --git a/src/emu/cpu/tms32031/tms32031.h b/src/emu/cpu/tms32031/tms32031.h index 2dbd6fe73ec..39903508ad8 100644 --- a/src/emu/cpu/tms32031/tms32031.h +++ b/src/emu/cpu/tms32031/tms32031.h @@ -72,11 +72,8 @@ enum PUBLIC FUNCTIONS ***************************************************************************/ -extern CPU_GET_INFO( tms32031 ); -extern CPU_GET_INFO( tms32032 ); - -#define CPU_TMS32031 CPU_GET_INFO_NAME( tms32031 ) -#define CPU_TMS32032 CPU_GET_INFO_NAME( tms32032 ) +DECLARE_LEGACY_CPU_DEVICE(TMS32031, tms32031); +DECLARE_LEGACY_CPU_DEVICE(TMS32032, tms32032); extern float convert_tms3203x_fp_to_float(UINT32 floatdata); extern double convert_tms3203x_fp_to_double(UINT32 floatdata); diff --git a/src/emu/cpu/tms32051/tms32051.c b/src/emu/cpu/tms32051/tms32051.c index d01af3a6837..8c36bffba2c 100644 --- a/src/emu/cpu/tms32051/tms32051.c +++ b/src/emu/cpu/tms32051/tms32051.c @@ -152,8 +152,7 @@ struct _tms32051_state INLINE tms32051_state *get_safe_token(running_device *device) { assert(device != NULL); - assert(device->type() == CPU); - assert(cpu_get_type(device) == CPU_TMS32051); + assert(device->type() == TMS32051); return (tms32051_state *)downcast<legacy_cpu_device *>(device)->token(); } @@ -727,3 +726,5 @@ CPU_GET_INFO( tms32051 ) default: CPU_GET_INFO_CALL(tms); break; } } + +DEFINE_LEGACY_CPU_DEVICE(TMS32051, tms32051); diff --git a/src/emu/cpu/tms32051/tms32051.h b/src/emu/cpu/tms32051/tms32051.h index 3d119e59e6c..3a8ca16cf7b 100644 --- a/src/emu/cpu/tms32051/tms32051.h +++ b/src/emu/cpu/tms32051/tms32051.h @@ -3,8 +3,7 @@ #ifndef __TMS32051_H__ #define __TMS32051_H__ -CPU_GET_INFO( tms32051 ); -#define CPU_TMS32051 CPU_GET_INFO_NAME( tms32051 ) +DECLARE_LEGACY_CPU_DEVICE(TMS32051, tms32051); CPU_DISASSEMBLE( tms32051 ); diff --git a/src/emu/cpu/tms34010/tms34010.c b/src/emu/cpu/tms34010/tms34010.c index daa41ac2a51..6ad43f07f2e 100644 --- a/src/emu/cpu/tms34010/tms34010.c +++ b/src/emu/cpu/tms34010/tms34010.c @@ -83,9 +83,8 @@ struct _tms34010_state INLINE tms34010_state *get_safe_token(running_device *device) { assert(device != NULL); - assert(device->type() == CPU); - assert(cpu_get_type(device) == CPU_TMS34010 || - cpu_get_type(device) == CPU_TMS34020); + assert(device->type() == TMS34010 || + device->type() == TMS34020); return (tms34010_state *)downcast<legacy_cpu_device *>(device)->token(); } @@ -1087,8 +1086,8 @@ VIDEO_UPDATE( tms340x0 ) /* find the owning CPU */ for (cpu = screen->machine->firstcpu; cpu != NULL; cpu = cpu_next(cpu)) { - cpu_type type = cpu_get_type(cpu); - if (type == CPU_TMS34010 || type == CPU_TMS34020) + device_type type = cpu->type(); + if (type == TMS34010 || type == TMS34020) { tms = get_safe_token(cpu); if (tms->config != NULL && tms->config->scanline_callback != NULL && tms->screen == screen) @@ -1785,3 +1784,6 @@ CPU_GET_INFO( tms34020 ) default: CPU_GET_INFO_CALL(tms34010); break; } } + +DEFINE_LEGACY_CPU_DEVICE(TMS34010, tms34010); +DEFINE_LEGACY_CPU_DEVICE(TMS34020, tms34020); diff --git a/src/emu/cpu/tms34010/tms34010.h b/src/emu/cpu/tms34010/tms34010.h index 6e1d453bc00..b63bf7715a4 100644 --- a/src/emu/cpu/tms34010/tms34010.h +++ b/src/emu/cpu/tms34010/tms34010.h @@ -207,12 +207,8 @@ struct _tms34010_config VIDEO_UPDATE( tms340x0 ); void tms34010_get_display_params(running_device *cpu, tms34010_display_params *params); -CPU_GET_INFO( tms34010 ); -#define CPU_TMS34010 CPU_GET_INFO_NAME( tms34010 ) - -/* PUBLIC FUNCTIONS - 34020 */ -CPU_GET_INFO( tms34020 ); -#define CPU_TMS34020 CPU_GET_INFO_NAME( tms34020 ) +DECLARE_LEGACY_CPU_DEVICE(TMS34010, tms34010); +DECLARE_LEGACY_CPU_DEVICE(TMS34020, tms34020); /* Host control interface */ diff --git a/src/emu/cpu/tms57002/tms57002.c b/src/emu/cpu/tms57002/tms57002.c index e94d2c2078b..6520828199f 100644 --- a/src/emu/cpu/tms57002/tms57002.c +++ b/src/emu/cpu/tms57002/tms57002.c @@ -112,8 +112,7 @@ typedef struct { INLINE tms57002_t *get_safe_token(running_device *device) { assert(device != NULL); - assert(device->type() == CPU); - assert(cpu_get_type(device) == CPU_TMS57002); + assert(device->type() == TMS57002); return (tms57002_t *)downcast<legacy_cpu_device *>(device)->token(); } @@ -1390,3 +1389,5 @@ CPU_GET_INFO(tms57002) case DEVINFO_STR_CREDITS: strcpy( info->s, "Copyright Olivier Galibert" ); break; } } + +DEFINE_LEGACY_CPU_DEVICE(TMS57002, tms57002); diff --git a/src/emu/cpu/tms57002/tms57002.h b/src/emu/cpu/tms57002/tms57002.h index 5c0a3f37a45..f157c19cfc3 100644 --- a/src/emu/cpu/tms57002/tms57002.h +++ b/src/emu/cpu/tms57002/tms57002.h @@ -8,8 +8,7 @@ enum { TMS57002_PC=1 }; -CPU_GET_INFO(tms57002); -#define CPU_TMS57002 CPU_GET_INFO_NAME(tms57002) +DECLARE_LEGACY_CPU_DEVICE(TMS57002, tms57002); WRITE8_DEVICE_HANDLER(tms57002_data_w); READ8_DEVICE_HANDLER(tms57002_data_r); diff --git a/src/emu/cpu/tms7000/tms7000.c b/src/emu/cpu/tms7000/tms7000.c index 8e24e5ea11a..372d4c15bef 100644 --- a/src/emu/cpu/tms7000/tms7000.c +++ b/src/emu/cpu/tms7000/tms7000.c @@ -88,9 +88,8 @@ struct _tms7000_state INLINE tms7000_state *get_safe_token(running_device *device) { assert(device != NULL); - assert(device->type() == CPU); - assert(cpu_get_type(device) == CPU_TMS7000 || - cpu_get_type(device) == CPU_TMS7000_EXL); + assert(device->type() == TMS7000 || + device->type() == TMS7000_EXL); return (tms7000_state *)downcast<legacy_cpu_device *>(device)->token(); } @@ -726,3 +725,6 @@ static READ8_HANDLER( tms7000_internal_r ) { tms7000_state *cpustate = get_safe_token(space->cpu); return cpustate->rf[ offset ]; } + +DEFINE_LEGACY_CPU_DEVICE(TMS7000, tms7000); +DEFINE_LEGACY_CPU_DEVICE(TMS7000_EXL, tms7000_exl); diff --git a/src/emu/cpu/tms7000/tms7000.h b/src/emu/cpu/tms7000/tms7000.h index 2cd8379d569..5fa5c1609fb 100644 --- a/src/emu/cpu/tms7000/tms7000.h +++ b/src/emu/cpu/tms7000/tms7000.h @@ -47,11 +47,9 @@ enum /* PUBLIC FUNCTIONS */ extern void tms7000_A6EC1( running_device *device ); /* External event counter */ -extern CPU_GET_INFO( tms7000 ); -extern CPU_GET_INFO( tms7000_exl ); -#define CPU_TMS7000 CPU_GET_INFO_NAME( tms7000 ) -#define CPU_TMS7000_EXL CPU_GET_INFO_NAME( tms7000_exl ) +DECLARE_LEGACY_CPU_DEVICE(TMS7000, tms7000); +DECLARE_LEGACY_CPU_DEVICE(TMS7000_EXL, tms7000_exl); extern CPU_DISASSEMBLE( tms7000 ); diff --git a/src/emu/cpu/tms9900/99xxcore.h b/src/emu/cpu/tms9900/99xxcore.h index f5c6d6f0160..b7364f0e205 100644 --- a/src/emu/cpu/tms9900/99xxcore.h +++ b/src/emu/cpu/tms9900/99xxcore.h @@ -512,8 +512,7 @@ struct _tms99xx_state INLINE tms99xx_state *get_safe_token(running_device *device) { assert(device != NULL); - assert(device->type() == CPU); - assert(cpu_get_type(device) == TMS99XX_GET_INFO); +// assert(device->type() == TMS99XX_GET_INFO); return (tms99xx_state *)downcast<legacy_cpu_device *>(device)->token(); } diff --git a/src/emu/cpu/tms9900/ti990_10.c b/src/emu/cpu/tms9900/ti990_10.c index 31b46642499..c15efba995b 100644 --- a/src/emu/cpu/tms9900/ti990_10.c +++ b/src/emu/cpu/tms9900/ti990_10.c @@ -9,3 +9,5 @@ #define TMS99XX_MODEL TI990_10_ID #include "99xxcore.h" + +DEFINE_LEGACY_CPU_DEVICE(TI990_10, ti990_10); diff --git a/src/emu/cpu/tms9900/tms9900.c b/src/emu/cpu/tms9900/tms9900.c index 480e026f02c..7d2c77878fc 100644 --- a/src/emu/cpu/tms9900/tms9900.c +++ b/src/emu/cpu/tms9900/tms9900.c @@ -9,3 +9,5 @@ #define TMS99XX_MODEL TMS9900_ID #include "99xxcore.h" + +DEFINE_LEGACY_CPU_DEVICE(TMS9900, tms9900); diff --git a/src/emu/cpu/tms9900/tms9900.h b/src/emu/cpu/tms9900/tms9900.h index ce2ea5c25dc..ecb264d990b 100644 --- a/src/emu/cpu/tms9900/tms9900.h +++ b/src/emu/cpu/tms9900/tms9900.h @@ -55,8 +55,7 @@ typedef void (*ti99xx_ckon_ckof_func)(running_device *device, int state); typedef void (*ti99xx_error_interrupt_func)(running_device *device, int state); -extern CPU_GET_INFO( ti990_10 ); -#define CPU_TI990_10 CPU_GET_INFO_NAME( ti990_10 ) +DECLARE_LEGACY_CPU_DEVICE(TI990_10, ti990_10); /* structure with the parameters ti990_10_reset wants. @@ -83,8 +82,7 @@ extern WRITE8_HANDLER(ti990_10_eir_cru_w); -extern CPU_GET_INFO( tms9900 ); -#define CPU_TMS9900 CPU_GET_INFO_NAME( tms9900 ) +DECLARE_LEGACY_CPU_DEVICE(TMS9900, tms9900); /* structure with optional parameters for tms9900_reset. @@ -96,8 +94,7 @@ typedef struct tms9900reset_param -extern CPU_GET_INFO( tms9940 ); -#define CPU_TMS9940 CPU_GET_INFO_NAME( tms9940 ) +//DECLARE_LEGACY_CPU_DEVICE(TMS9940, tms9940); /* structure with optional parameters for tms9940_reset. @@ -109,8 +106,7 @@ typedef struct tms9940reset_param -extern CPU_GET_INFO( tms9980a ); -#define CPU_TMS9980 CPU_GET_INFO_NAME( tms9980a ) +DECLARE_LEGACY_CPU_DEVICE(TMS9980, tms9980a); /* structure with optional parameters for tms9980a_reset. @@ -122,10 +118,9 @@ typedef struct tms9980areset_param -extern CPU_GET_INFO( tms9985 ); -#define CPU_TMS9986 CPU_GET_INFO_NAME( tms9985 ) +//DECLARE_LEGACY_CPU_DEVICE(TMS9985, tms9985); -/* +/*// structure with optional parameters for tms9985_reset. */ typedef struct tms9985reset_param @@ -135,8 +130,7 @@ typedef struct tms9985reset_param -extern CPU_GET_INFO( tms9989 ); -#define CPU_TMS9989 CPU_GET_INFO_NAME( tms9989 ) +//DECLARE_LEGACY_CPU_DEVICE(TMS9989, tms9989); /* structure with optional parameters for tms9989_reset. @@ -148,8 +142,7 @@ typedef struct tms9989reset_param -extern CPU_GET_INFO( tms9995 ); -#define CPU_TMS9995 CPU_GET_INFO_NAME( tms9995 ) +DECLARE_LEGACY_CPU_DEVICE(TMS9995, tms9995); /* structure with the parameters tms9995_reset wants. @@ -177,8 +170,7 @@ extern WRITE8_HANDLER(tms9995_internal2_w); -extern CPU_GET_INFO( tms99000 ); -#define CPU_TMS99000 CPU_GET_INFO_NAME( tms99000 ) +//DECLARE_LEGACY_CPU_DEVICE(TMS99000, tms99000); /* structure with optional parameters for tms99000_reset. @@ -190,8 +182,7 @@ typedef struct tms99000reset_param -extern CPU_GET_INFO( tms99105a ); -#define CPU_TMS99105A CPU_GET_INFO_NAME( tms99105a ) +//DECLARE_LEGACY_CPU_DEVICE(TMS99105A, tms99105a); /* structure with optional parameters for tms99105a_reset. @@ -203,8 +194,7 @@ typedef struct tms99105areset_param -extern CPU_GET_INFO( tms99110a ); -#define CPU_TMS99110A CPU_GET_INFO_NAME( tms99110a ) +//DECLARE_LEGACY_CPU_DEVICE(TMS99110A, tms99110a); /* structure with optional parameters for tms99110a_reset. diff --git a/src/emu/cpu/tms9900/tms9980a.c b/src/emu/cpu/tms9900/tms9980a.c index cd79af38ff0..5ef7444fc86 100644 --- a/src/emu/cpu/tms9900/tms9980a.c +++ b/src/emu/cpu/tms9900/tms9980a.c @@ -9,3 +9,5 @@ #define TMS99XX_MODEL TMS9980_ID #include "99xxcore.h" + +DEFINE_LEGACY_CPU_DEVICE(TMS9980, tms9980a); diff --git a/src/emu/cpu/tms9900/tms9995.c b/src/emu/cpu/tms9900/tms9995.c index 9721094e43e..4e0c05a48a7 100644 --- a/src/emu/cpu/tms9900/tms9995.c +++ b/src/emu/cpu/tms9900/tms9995.c @@ -9,3 +9,5 @@ #define TMS99XX_MODEL TMS9995_ID #include "99xxcore.h" + +DEFINE_LEGACY_CPU_DEVICE(TMS9995, tms9995); diff --git a/src/emu/cpu/unsp/unsp.c b/src/emu/cpu/unsp/unsp.c index 4a94bac045e..945554b4088 100644 --- a/src/emu/cpu/unsp/unsp.c +++ b/src/emu/cpu/unsp/unsp.c @@ -13,8 +13,7 @@ INLINE unsp_state *get_safe_token(running_device *device) { assert(device != NULL); - assert(device->type() == CPU); - assert(cpu_get_type(device) == CPU_UNSP); + assert(device->type() == UNSP); return (unsp_state *)downcast<legacy_cpu_device *>(device)->token(); } @@ -921,3 +920,5 @@ CPU_GET_INFO( unsp ) case CPUINFO_STR_REGISTER + UNSP_SB: sprintf(info->s, "SB: %d", unsp->sb); break; } } + +DEFINE_LEGACY_CPU_DEVICE(UNSP, unsp); diff --git a/src/emu/cpu/unsp/unsp.h b/src/emu/cpu/unsp/unsp.h index 229588bde40..14a394469da 100644 --- a/src/emu/cpu/unsp/unsp.h +++ b/src/emu/cpu/unsp/unsp.h @@ -65,8 +65,7 @@ enum UNSP_NUM_LINES }; -CPU_GET_INFO( unsp ); -#define CPU_UNSP CPU_GET_INFO_NAME( unsp ) +DECLARE_LEGACY_CPU_DEVICE(UNSP, unsp); CPU_DISASSEMBLE( unsp ); #endif /* __UNSP_H__ */ diff --git a/src/emu/cpu/upd7810/upd7810.c b/src/emu/cpu/upd7810/upd7810.c index cffd7f36362..6b1f67e203e 100644 --- a/src/emu/cpu/upd7810/upd7810.c +++ b/src/emu/cpu/upd7810/upd7810.c @@ -508,12 +508,11 @@ struct _upd7810_state INLINE upd7810_state *get_safe_token(running_device *device) { assert(device != NULL); - assert(device->type() == CPU); - assert(cpu_get_type(device) == CPU_UPD7810 || - cpu_get_type(device) == CPU_UPD7807 || - cpu_get_type(device) == CPU_UPD7801 || - cpu_get_type(device) == CPU_UPD78C05 || - cpu_get_type(device) == CPU_UPD78C06); + assert(device->type() == UPD7810 || + device->type() == UPD7807 || + device->type() == UPD7801 || + device->type() == UPD78C05 || + device->type() == UPD78C06); return (upd7810_state *)downcast<legacy_cpu_device *>(device)->token(); } @@ -2380,3 +2379,9 @@ CPU_GET_INFO( upd78c06 ) { default: CPU_GET_INFO_CALL(upd78c05); break; } } + +DEFINE_LEGACY_CPU_DEVICE(UPD7810, upd7810); +DEFINE_LEGACY_CPU_DEVICE(UPD7807, upd7807); +DEFINE_LEGACY_CPU_DEVICE(UPD7801, upd7801); +DEFINE_LEGACY_CPU_DEVICE(UPD78C05, upd78c05); +DEFINE_LEGACY_CPU_DEVICE(UPD78C06, upd78c06); diff --git a/src/emu/cpu/upd7810/upd7810.h b/src/emu/cpu/upd7810/upd7810.h index d2748d44914..3f434a54e11 100644 --- a/src/emu/cpu/upd7810/upd7810.h +++ b/src/emu/cpu/upd7810/upd7810.h @@ -71,17 +71,11 @@ enum #define UPD7810_INTF0 2 #define UPD7810_INTFE1 4 -CPU_GET_INFO( upd7810 ); -CPU_GET_INFO( upd7807 ); -CPU_GET_INFO( upd7801 ); -CPU_GET_INFO( upd78c05 ); -CPU_GET_INFO( upd78c06 ); - -#define CPU_UPD7810 CPU_GET_INFO_NAME( upd7810 ) -#define CPU_UPD7807 CPU_GET_INFO_NAME( upd7807 ) -#define CPU_UPD7801 CPU_GET_INFO_NAME( upd7801 ) -#define CPU_UPD78C05 CPU_GET_INFO_NAME( upd78c05 ) -#define CPU_UPD78C06 CPU_GET_INFO_NAME( upd78c06 ) +DECLARE_LEGACY_CPU_DEVICE(UPD7810, upd7810); +DECLARE_LEGACY_CPU_DEVICE(UPD7807, upd7807); +DECLARE_LEGACY_CPU_DEVICE(UPD7801, upd7801); +DECLARE_LEGACY_CPU_DEVICE(UPD78C05, upd78c05); +DECLARE_LEGACY_CPU_DEVICE(UPD78C06, upd78c06); CPU_DISASSEMBLE( upd7810 ); CPU_DISASSEMBLE( upd7807 ); diff --git a/src/emu/cpu/v30mz/nec.h b/src/emu/cpu/v30mz/nec.h index a5ef666f0d4..a3e575b3413 100644 --- a/src/emu/cpu/v30mz/nec.h +++ b/src/emu/cpu/v30mz/nec.h @@ -18,7 +18,6 @@ enum }; /* Public functions */ -extern CPU_GET_INFO( v30mz ); -#define CPU_V30MZ CPU_GET_INFO_NAME( v30mz ) +DECLARE_LEGACY_CPU_DEVICE(V30MZ, v30mz); #endif /* __NECINTRF_H__ */ diff --git a/src/emu/cpu/v30mz/v30mz.c b/src/emu/cpu/v30mz/v30mz.c index 0c5e268a837..f62fe584631 100644 --- a/src/emu/cpu/v30mz/v30mz.c +++ b/src/emu/cpu/v30mz/v30mz.c @@ -104,8 +104,7 @@ extern int necv_dasm_one(char *buffer, UINT32 eip, const UINT8 *oprom, const nec INLINE v30mz_state *get_safe_token(running_device *device) { assert(device != NULL); - assert(device->type() == CPU); - assert(cpu_get_type(device) == CPU_V30MZ); + assert(device->type() == V30MZ); return (v30mz_state *)downcast<legacy_cpu_device *>(device)->token(); } @@ -1167,3 +1166,4 @@ CPU_GET_INFO( v30mz ) } } +DEFINE_LEGACY_CPU_DEVICE(V30MZ, v30mz); diff --git a/src/emu/cpu/v60/v60.c b/src/emu/cpu/v60/v60.c index c77bc6f1457..c96e6747777 100644 --- a/src/emu/cpu/v60/v60.c +++ b/src/emu/cpu/v60/v60.c @@ -114,9 +114,8 @@ struct _v60_state INLINE v60_state *get_safe_token(running_device *device) { assert(device != NULL); - assert(device->type() == CPU); - assert(cpu_get_type(device) == CPU_V60 || - cpu_get_type(device) == CPU_V70); + assert(device->type() == V60 || + device->type() == V70); return (v60_state *)downcast<legacy_cpu_device *>(device)->token(); } @@ -744,3 +743,6 @@ CPU_GET_INFO( v70 ) default: CPU_GET_INFO_CALL(v60); break; } } + +DEFINE_LEGACY_CPU_DEVICE(V60, v60); +DEFINE_LEGACY_CPU_DEVICE(V70, v70); diff --git a/src/emu/cpu/v60/v60.h b/src/emu/cpu/v60/v60.h index aa56110905d..9ac1f69549f 100644 --- a/src/emu/cpu/v60/v60.h +++ b/src/emu/cpu/v60/v60.h @@ -79,10 +79,7 @@ enum void v60_stall(running_device *device); -CPU_GET_INFO( v60 ); -#define CPU_V60 CPU_GET_INFO_NAME( v60 ) - -CPU_GET_INFO( v70 ); -#define CPU_V70 CPU_GET_INFO_NAME( v70 ) +DECLARE_LEGACY_CPU_DEVICE(V60, v60); +DECLARE_LEGACY_CPU_DEVICE(V70, v70); #endif /* __V60_H__ */ diff --git a/src/emu/cpu/v810/v810.c b/src/emu/cpu/v810/v810.c index 7a50be93fd0..431cdde424c 100644 --- a/src/emu/cpu/v810/v810.c +++ b/src/emu/cpu/v810/v810.c @@ -40,8 +40,7 @@ struct _v810_state INLINE v810_state *get_safe_token(running_device *device) { assert(device != NULL); - assert(device->type() == CPU); - assert(cpu_get_type(device) == CPU_V810); + assert(device->type() == V810); return (v810_state *)downcast<legacy_cpu_device *>(device)->token(); } @@ -1285,3 +1284,5 @@ CPU_GET_INFO( v810 ) case CPUINFO_STR_REGISTER + V810_ADTRE: sprintf(info->s, "ADTRE:%08X", cpustate->ADTRE); break; } } + +DEFINE_LEGACY_CPU_DEVICE(V810, v810); diff --git a/src/emu/cpu/v810/v810.h b/src/emu/cpu/v810/v810.h index cbdf6b36fc6..bbca2c59424 100644 --- a/src/emu/cpu/v810/v810.h +++ b/src/emu/cpu/v810/v810.h @@ -4,8 +4,7 @@ #define __V810_H__ -CPU_GET_INFO( v810 ); -#define CPU_V810 CPU_GET_INFO_NAME( v810 ) +DECLARE_LEGACY_CPU_DEVICE(V810, v810); CPU_DISASSEMBLE( v810 ); diff --git a/src/emu/cpu/z180/z180.c b/src/emu/cpu/z180/z180.c index 8bf80c1cf75..f44b27e41f6 100644 --- a/src/emu/cpu/z180/z180.c +++ b/src/emu/cpu/z180/z180.c @@ -152,8 +152,7 @@ struct _z180_state INLINE z180_state *get_safe_token(running_device *device) { assert(device != NULL); - assert(device->type() == CPU); - assert(cpu_get_type(device) == CPU_Z180); + assert(device->type() == Z180); return (z180_state *)downcast<legacy_cpu_device *>(device)->token(); } @@ -2733,3 +2732,5 @@ CPU_GET_INFO( z180 ) break; } } + +DEFINE_LEGACY_CPU_DEVICE(Z180, z180); diff --git a/src/emu/cpu/z180/z180.h b/src/emu/cpu/z180/z180.h index f773847997f..36180a20e75 100644 --- a/src/emu/cpu/z180/z180.h +++ b/src/emu/cpu/z180/z180.h @@ -134,8 +134,7 @@ extern UINT8 z180_readmem(running_device *device, offs_t offset); extern void z180_writemem(running_device *device, offs_t offset, UINT8 data); #endif -extern CPU_GET_INFO( z180 ); -#define CPU_Z180 CPU_GET_INFO_NAME( z180 ) +DECLARE_LEGACY_CPU_DEVICE(Z180, z180); CPU_DISASSEMBLE( z180 ); diff --git a/src/emu/cpu/z8/z8.c b/src/emu/cpu/z8/z8.c index d96e9b74ca5..25ce548e346 100644 --- a/src/emu/cpu/z8/z8.c +++ b/src/emu/cpu/z8/z8.c @@ -194,10 +194,9 @@ struct _z8_state INLINE z8_state *get_safe_token(running_device *device) { assert(device != NULL); - assert(device->type() == CPU); - assert((cpu_get_type(device) == CPU_Z8601) || - (cpu_get_type(device) == CPU_UB8830D) || - (cpu_get_type(device) == CPU_Z8611)); + assert((device->type() == Z8601) || + (device->type() == UB8830D) || + (device->type() == Z8611)); return (z8_state *)downcast<legacy_cpu_device *>(device)->token(); } @@ -916,3 +915,7 @@ CPU_GET_INFO( z8611 ) default: CPU_GET_INFO_CALL(z8); break; } } + +DEFINE_LEGACY_CPU_DEVICE(Z8601, z8601); +DEFINE_LEGACY_CPU_DEVICE(UB8830D, ub8830d); +DEFINE_LEGACY_CPU_DEVICE(Z8611, z8611); diff --git a/src/emu/cpu/z8/z8.h b/src/emu/cpu/z8/z8.h index cdf148c0ef8..61735952450 100644 --- a/src/emu/cpu/z8/z8.h +++ b/src/emu/cpu/z8/z8.h @@ -24,16 +24,13 @@ enum }; /* Zilog Z8601 */ -CPU_GET_INFO( z8601 ); -#define CPU_Z8601 CPU_GET_INFO_NAME( z8601 ) +DECLARE_LEGACY_CPU_DEVICE(Z8601, z8601); /* VEB Mikroelektronik Erfurt UB8830D MME */ -CPU_GET_INFO( ub8830d ); -#define CPU_UB8830D CPU_GET_INFO_NAME( ub8830d ) +DECLARE_LEGACY_CPU_DEVICE(UB8830D, ub8830d); /* Zilog Z8611 */ -CPU_GET_INFO( z8611 ); -#define CPU_Z8611 CPU_GET_INFO_NAME( z8611 ) +DECLARE_LEGACY_CPU_DEVICE(Z8611, z8611); CPU_DISASSEMBLE( z8 ); diff --git a/src/emu/cpu/z80/z80.c b/src/emu/cpu/z80/z80.c index 377ca95e507..6932ec59959 100644 --- a/src/emu/cpu/z80/z80.c +++ b/src/emu/cpu/z80/z80.c @@ -166,8 +166,7 @@ struct _z80_state INLINE z80_state *get_safe_token(running_device *device) { assert(device != NULL); - assert(device->type() == CPU); - assert(cpu_get_type(device) == CPU_Z80 || cpu_get_type(device) == CPU_NSC800); + assert(device->type() == Z80 || device->type() == NSC800); return (z80_state *)downcast<legacy_cpu_device *>(device)->token(); } @@ -3886,3 +3885,6 @@ CPU_GET_INFO( nsc800 ) default: CPU_GET_INFO_CALL(z80); break; } } + +DEFINE_LEGACY_CPU_DEVICE(Z80, z80); +DEFINE_LEGACY_CPU_DEVICE(NSC800, nsc800); diff --git a/src/emu/cpu/z80/z80.h b/src/emu/cpu/z80/z80.h index 0ff4219146d..e500c6d670f 100644 --- a/src/emu/cpu/z80/z80.h +++ b/src/emu/cpu/z80/z80.h @@ -24,10 +24,8 @@ enum Z80_GENPCBASE = STATE_GENPCBASE }; -CPU_GET_INFO( z80 ); -#define CPU_Z80 CPU_GET_INFO_NAME( z80 ) -CPU_GET_INFO( nsc800 ); -#define CPU_NSC800 CPU_GET_INFO_NAME( nsc800 ) +DECLARE_LEGACY_CPU_DEVICE(Z80, z80); +DECLARE_LEGACY_CPU_DEVICE(NSC800, nsc800); CPU_DISASSEMBLE( z80 ); diff --git a/src/emu/cpu/z8000/z8000.c b/src/emu/cpu/z8000/z8000.c index 8c81dd39bf8..17869269b5f 100644 --- a/src/emu/cpu/z8000/z8000.c +++ b/src/emu/cpu/z8000/z8000.c @@ -93,8 +93,7 @@ struct _z8000_state INLINE z8000_state *get_safe_token(running_device *device) { assert(device != NULL); - assert(device->type() == CPU); - assert(cpu_get_type(device) == CPU_Z8001 || cpu_get_type(device) == CPU_Z8002); + assert(device->type() == Z8001 || device->type() == Z8002); return (z8000_state *)downcast<legacy_cpu_device *>(device)->token(); } @@ -710,3 +709,6 @@ CPU_GET_INFO( z8001 ) default: CPU_GET_INFO_CALL(z8002); break; } } + +DEFINE_LEGACY_CPU_DEVICE(Z8001, z8001); +DEFINE_LEGACY_CPU_DEVICE(Z8002, z8002); diff --git a/src/emu/cpu/z8000/z8000.h b/src/emu/cpu/z8000/z8000.h index 0e7657a8fb9..06baa037fec 100644 --- a/src/emu/cpu/z8000/z8000.h +++ b/src/emu/cpu/z8000/z8000.h @@ -24,10 +24,8 @@ enum #define Z8000_HALT 0x0100 /* halted flag */ /* PUBLIC FUNCTIONS */ -extern CPU_GET_INFO( z8001 ); -#define CPU_Z8001 CPU_GET_INFO_NAME( z8001 ) -extern CPU_GET_INFO( z8002 ); -#define CPU_Z8002 CPU_GET_INFO_NAME( z8002 ) +DECLARE_LEGACY_CPU_DEVICE(Z8001, z8001); +DECLARE_LEGACY_CPU_DEVICE(Z8002, z8002); CPU_DISASSEMBLE( z8000 ); diff --git a/src/emu/debug/debugcmd.c b/src/emu/debug/debugcmd.c index fc756fb7116..147b2438e08 100644 --- a/src/emu/debug/debugcmd.c +++ b/src/emu/debug/debugcmd.c @@ -536,9 +536,13 @@ int debug_command_parameter_cpu(running_machine *machine, const char *param, dev } /* if we got a valid one, return */ - *result = machine->m_devicelist.find(CPU, cpunum); - if (*result != NULL) - return TRUE; + device_execute_interface *exec; + for (bool gotone = machine->m_devicelist.first(exec); gotone; gotone = exec->next(exec)) + if (cpunum-- == 0) + { + *result = &exec->device(); + return TRUE; + } /* if out of range, complain */ debug_console_printf(machine, "Invalid CPU index %d\n", (UINT32)cpunum); diff --git a/src/emu/debug/debugcpu.c b/src/emu/debug/debugcpu.c index f1d6caeb26d..6a0b3e24c54 100644 --- a/src/emu/debug/debugcpu.c +++ b/src/emu/debug/debugcpu.c @@ -339,11 +339,9 @@ symbol_table *debug_cpu_get_symtable(device_t *device) int debug_cpu_translate(const address_space *space, int intention, offs_t *address) { - if (space->cpu != NULL && space->cpu->type() == CPU) - { - cpu_debug_data *cpudebug = cpu_get_debug_data(space->cpu); - return cpudebug->cpudevice->translate(space->spacenum, intention, *address); - } + device_memory_interface *memory; + if (space->cpu->interface(memory)) + return memory->translate(space->spacenum, intention, *address); return TRUE; } @@ -1283,7 +1281,6 @@ int debug_cpu_hotspot_track(device_t *device, int numspots, int threshhold) UINT8 debug_read_byte(const address_space *space, offs_t address, int apply_translation) { - cpu_debug_data *cpudebug = (space->cpu->type() == CPU) ? cpu_get_debug_data(space->cpu) : NULL; debugcpu_private *global = space->machine->debugcpu_data; UINT64 custom; UINT8 result; @@ -1299,7 +1296,7 @@ UINT8 debug_read_byte(const address_space *space, offs_t address, int apply_tran result = 0xff; /* if there is a custom read handler, and it returns TRUE, use that value */ - else if (cpudebug != NULL && cpudebug->cpudevice->read(space->spacenum, address, 1, custom)) + else if (device_memory(space->cpu)->read(space->spacenum, address, 1, custom)) result = custom; /* otherwise, call the byte reading function for the translated address */ @@ -1341,7 +1338,6 @@ UINT16 debug_read_word(const address_space *space, offs_t address, int apply_tra /* otherwise, this proceeds like the byte case */ else { - cpu_debug_data *cpudebug = (space->cpu->type() == CPU) ? cpu_get_debug_data(space->cpu) : NULL; UINT64 custom; /* all accesses from this point on are for the debugger */ @@ -1352,7 +1348,7 @@ UINT16 debug_read_word(const address_space *space, offs_t address, int apply_tra result = 0xffff; /* if there is a custom read handler, and it returns TRUE, use that value */ - else if (cpudebug != NULL && cpudebug->cpudevice->read(space->spacenum, address, 2, custom)) + else if (device_memory(space->cpu)->read(space->spacenum, address, 2, custom)) result = custom; /* otherwise, call the byte reading function for the translated address */ @@ -1396,7 +1392,6 @@ UINT32 debug_read_dword(const address_space *space, offs_t address, int apply_tr /* otherwise, this proceeds like the byte case */ else { - cpu_debug_data *cpudebug = (space->cpu->type() == CPU) ? cpu_get_debug_data(space->cpu) : NULL; UINT64 custom; /* all accesses from this point on are for the debugger */ @@ -1407,7 +1402,7 @@ UINT32 debug_read_dword(const address_space *space, offs_t address, int apply_tr result = 0xffffffff; /* if there is a custom read handler, and it returns TRUE, use that value */ - else if (cpudebug != NULL && cpudebug->cpudevice->read(space->spacenum, address, 4, custom)) + else if (device_memory(space->cpu)->read(space->spacenum, address, 4, custom)) result = custom; /* otherwise, call the byte reading function for the translated address */ @@ -1451,7 +1446,6 @@ UINT64 debug_read_qword(const address_space *space, offs_t address, int apply_tr /* otherwise, this proceeds like the byte case */ else { - cpu_debug_data *cpudebug = (space->cpu->type() == CPU) ? cpu_get_debug_data(space->cpu) : NULL; UINT64 custom; /* all accesses from this point on are for the debugger */ @@ -1462,7 +1456,7 @@ UINT64 debug_read_qword(const address_space *space, offs_t address, int apply_tr result = ~(UINT64)0; /* if there is a custom read handler, and it returns TRUE, use that value */ - else if (cpudebug != NULL && cpudebug->cpudevice->read(space->spacenum, address, 8, custom)) + else if (device_memory(space->cpu)->read(space->spacenum, address, 8, custom)) result = custom; /* otherwise, call the byte reading function for the translated address */ @@ -1503,7 +1497,6 @@ UINT64 debug_read_memory(const address_space *space, offs_t address, int size, i void debug_write_byte(const address_space *space, offs_t address, UINT8 data, int apply_translation) { - cpu_debug_data *cpudebug = (space->cpu->type() == CPU) ? cpu_get_debug_data(space->cpu) : NULL; debugcpu_private *global = space->machine->debugcpu_data; /* mask against the logical byte mask */ @@ -1517,7 +1510,7 @@ void debug_write_byte(const address_space *space, offs_t address, UINT8 data, in ; /* if there is a custom write handler, and it returns TRUE, use that */ - else if (cpudebug != NULL && cpudebug->cpudevice->write(space->spacenum, address, 1, data)) + else if (device_memory(space->cpu)->write(space->spacenum, address, 1, data)) ; /* otherwise, call the byte reading function for the translated address */ @@ -1560,8 +1553,6 @@ void debug_write_word(const address_space *space, offs_t address, UINT16 data, i /* otherwise, this proceeds like the byte case */ else { - cpu_debug_data *cpudebug = (space->cpu->type() == CPU) ? cpu_get_debug_data(space->cpu) : NULL; - /* all accesses from this point on are for the debugger */ memory_set_debugger_access(space, global->debugger_access = TRUE); @@ -1570,7 +1561,7 @@ void debug_write_word(const address_space *space, offs_t address, UINT16 data, i ; /* if there is a custom write handler, and it returns TRUE, use that */ - else if (cpudebug != NULL && cpudebug->cpudevice->write(space->spacenum, address, 2, data)) + else if (device_memory(space->cpu)->write(space->spacenum, address, 2, data)) ; /* otherwise, call the byte reading function for the translated address */ @@ -1614,8 +1605,6 @@ void debug_write_dword(const address_space *space, offs_t address, UINT32 data, /* otherwise, this proceeds like the byte case */ else { - cpu_debug_data *cpudebug = (space->cpu->type() == CPU) ? cpu_get_debug_data(space->cpu) : NULL; - /* all accesses from this point on are for the debugger */ memory_set_debugger_access(space, global->debugger_access = TRUE); @@ -1624,7 +1613,7 @@ void debug_write_dword(const address_space *space, offs_t address, UINT32 data, ; /* if there is a custom write handler, and it returns TRUE, use that */ - else if (cpudebug != NULL && cpudebug->cpudevice->write(space->spacenum, address, 4, data)) + else if (device_memory(space->cpu)->write(space->spacenum, address, 4, data)) ; /* otherwise, call the byte reading function for the translated address */ @@ -1668,8 +1657,6 @@ void debug_write_qword(const address_space *space, offs_t address, UINT64 data, /* otherwise, this proceeds like the byte case */ else { - cpu_debug_data *cpudebug = (space->cpu->type() == CPU) ? cpu_get_debug_data(space->cpu) : NULL; - /* all accesses from this point on are for the debugger */ memory_set_debugger_access(space, global->debugger_access = TRUE); @@ -1678,7 +1665,7 @@ void debug_write_qword(const address_space *space, offs_t address, UINT64 data, ; /* if there is a custom write handler, and it returns TRUE, use that */ - else if (cpudebug != NULL && cpudebug->cpudevice->write(space->spacenum, address, 8, data)) + else if (device_memory(space->cpu)->write(space->spacenum, address, 8, data)) ; /* otherwise, call the byte reading function for the translated address */ @@ -2852,7 +2839,17 @@ static UINT64 get_wpdata(void *globalref, void *ref) static UINT64 get_cpunum(void *globalref, void *ref) { running_machine *machine = (running_machine *)globalref; - return cpu_get_index(machine->debugcpu_data->visiblecpu); + device_t *target = machine->debugcpu_data->visiblecpu; + + device_execute_interface *exec; + int index = 0; + for (bool gotone = machine->m_devicelist.first(exec); gotone; gotone = exec->next(exec)) + { + if (&exec->device() == target) + return index; + index++; + } + return 0; } diff --git a/src/emu/devcpu.c b/src/emu/devcpu.c index db348ba05e5..659eecb5df5 100644 --- a/src/emu/devcpu.c +++ b/src/emu/devcpu.c @@ -64,68 +64,27 @@ cpu_device_config::cpu_device_config(const machine_config &mconfig, device_type // legacy_cpu_device_config - constructor //------------------------------------------------- -legacy_cpu_device_config::legacy_cpu_device_config(const machine_config &mconfig, device_type type, const char *tag, const device_config *owner, UINT32 clock) +legacy_cpu_device_config::legacy_cpu_device_config(const machine_config &mconfig, device_type type, const char *tag, const device_config *owner, UINT32 clock, cpu_get_info_func get_info) : cpu_device_config(mconfig, type, "CPU", tag, owner, clock), - m_cputype(NULL) + m_get_info(get_info) { + // build up our address spaces; legacy devices don't have logical spaces memset(m_space_config, 0, sizeof(m_space_config)); -} - - -//------------------------------------------------- -// static_alloc_device_config - static allocator -//------------------------------------------------- - -device_config *legacy_cpu_device_config::static_alloc_device_config(const machine_config &mconfig, const char *tag, const device_config *owner, UINT32 clock) -{ - return global_alloc(legacy_cpu_device_config(mconfig, static_alloc_device_config, tag, owner, clock)); -} - - -//------------------------------------------------- -// alloc_device - allocate a device based on the -// provided configuration -//------------------------------------------------- - -device_t *legacy_cpu_device_config::alloc_device(running_machine &machine) const -{ - return auto_alloc(&machine, legacy_cpu_device(machine, *this)); -} - - -//------------------------------------------------- -// device_process_token - custom inline -// config callback for populating class data -//------------------------------------------------- - -bool legacy_cpu_device_config::device_process_token(UINT32 entrytype, const machine_config_token *&tokens) -{ - switch (entrytype) + for (int spacenum = 0; spacenum < ARRAY_LENGTH(m_space_config); spacenum++) { - // custom config 1 is the CPU type - case MCONFIG_TOKEN_DEVICE_CONFIG_CUSTOM_1: - m_cputype = TOKEN_GET_PTR(tokens, cputype); - - // build up our address spaces; legacy devices don't have logical spaces - memset(m_space_config, 0, sizeof(m_space_config)); - for (int spacenum = 0; spacenum < ARRAY_LENGTH(m_space_config); spacenum++) - { - m_space_config[spacenum].m_name = (spacenum == 1) ? "data" : (spacenum == 2) ? "i/o" : "program"; - m_space_config[spacenum].m_endianness = static_cast<endianness_t>(get_legacy_config_int(DEVINFO_INT_ENDIANNESS)); - m_space_config[spacenum].m_databus_width = get_legacy_config_int(DEVINFO_INT_DATABUS_WIDTH + spacenum); - m_space_config[spacenum].m_addrbus_width = get_legacy_config_int(DEVINFO_INT_ADDRBUS_WIDTH + spacenum); - m_space_config[spacenum].m_addrbus_shift = get_legacy_config_int(DEVINFO_INT_ADDRBUS_SHIFT + spacenum); - m_space_config[spacenum].m_logaddr_width = get_legacy_config_int(CPUINFO_INT_LOGADDR_WIDTH + spacenum); - m_space_config[spacenum].m_page_shift = get_legacy_config_int(CPUINFO_INT_PAGE_SHIFT + spacenum); - m_space_config[spacenum].m_internal_map = reinterpret_cast<const addrmap_token *>(get_legacy_config_ptr(DEVINFO_PTR_INTERNAL_MEMORY_MAP + spacenum)); - m_space_config[spacenum].m_default_map = reinterpret_cast<const addrmap_token *>(get_legacy_config_ptr(DEVINFO_PTR_DEFAULT_MEMORY_MAP + spacenum)); - } - m_name = get_legacy_config_string(DEVINFO_STR_NAME); - return true; + m_space_config[spacenum].m_name = (spacenum == 1) ? "data" : (spacenum == 2) ? "i/o" : "program"; + m_space_config[spacenum].m_endianness = static_cast<endianness_t>(get_legacy_config_int(DEVINFO_INT_ENDIANNESS)); + m_space_config[spacenum].m_databus_width = get_legacy_config_int(DEVINFO_INT_DATABUS_WIDTH + spacenum); + m_space_config[spacenum].m_addrbus_width = get_legacy_config_int(DEVINFO_INT_ADDRBUS_WIDTH + spacenum); + m_space_config[spacenum].m_addrbus_shift = get_legacy_config_int(DEVINFO_INT_ADDRBUS_SHIFT + spacenum); + m_space_config[spacenum].m_logaddr_width = get_legacy_config_int(CPUINFO_INT_LOGADDR_WIDTH + spacenum); + m_space_config[spacenum].m_page_shift = get_legacy_config_int(CPUINFO_INT_PAGE_SHIFT + spacenum); + m_space_config[spacenum].m_internal_map = reinterpret_cast<const addrmap_token *>(get_legacy_config_ptr(DEVINFO_PTR_INTERNAL_MEMORY_MAP + spacenum)); + m_space_config[spacenum].m_default_map = reinterpret_cast<const addrmap_token *>(get_legacy_config_ptr(DEVINFO_PTR_DEFAULT_MEMORY_MAP + spacenum)); } - - // everything else goes to our parent - return device_config::device_process_token(entrytype, tokens); + + // set the real name + m_name = get_legacy_config_string(DEVINFO_STR_NAME); } @@ -171,7 +130,7 @@ UINT64 legacy_cpu_device_config::execute_cycles_to_clocks(UINT64 cycles) const INT64 legacy_cpu_device_config::get_legacy_config_int(UINT32 state) const { cpuinfo info = { 0 }; - (*m_cputype)(this, NULL, state, &info); + (*m_get_info)(this, NULL, state, &info); return info.i; } @@ -184,7 +143,7 @@ INT64 legacy_cpu_device_config::get_legacy_config_int(UINT32 state) const void *legacy_cpu_device_config::get_legacy_config_ptr(UINT32 state) const { cpuinfo info = { 0 }; - (*m_cputype)(this, NULL, state, &info); + (*m_get_info)(this, NULL, state, &info); return info.p; } @@ -197,7 +156,7 @@ void *legacy_cpu_device_config::get_legacy_config_ptr(UINT32 state) const genf *legacy_cpu_device_config::get_legacy_config_fct(UINT32 state) const { cpuinfo info = { 0 }; - (*m_cputype)(this, NULL, state, &info); + (*m_get_info)(this, NULL, state, &info); return info.f; } @@ -211,7 +170,7 @@ const char *legacy_cpu_device_config::get_legacy_config_string(UINT32 state) con { cpuinfo info; info.s = get_temp_string_buffer(); - (*m_cputype)(this, NULL, state, &info); + (*m_get_info)(this, NULL, state, &info); return info.s; } @@ -488,7 +447,7 @@ offs_t legacy_cpu_device::disasm_disassemble(char *buffer, offs_t pc, const UINT INT64 legacy_cpu_device::get_legacy_runtime_int(UINT32 state) { cpuinfo info = { 0 }; - (*m_cpu_config.m_cputype)(&m_cpu_config, this, state, &info); + (*m_cpu_config.m_get_info)(&m_cpu_config, this, state, &info); return info.i; } @@ -501,7 +460,7 @@ INT64 legacy_cpu_device::get_legacy_runtime_int(UINT32 state) void *legacy_cpu_device::get_legacy_runtime_ptr(UINT32 state) { cpuinfo info = { 0 }; - (*m_cpu_config.m_cputype)(&m_cpu_config, this, state, &info); + (*m_cpu_config.m_get_info)(&m_cpu_config, this, state, &info); return info.p; } @@ -515,7 +474,7 @@ const char *legacy_cpu_device::get_legacy_runtime_string(UINT32 state) { cpuinfo info; info.s = get_temp_string_buffer(); - (*m_cpu_config.m_cputype)(&m_cpu_config, this, state, &info); + (*m_cpu_config.m_get_info)(&m_cpu_config, this, state, &info); return info.s; } @@ -579,5 +538,3 @@ void legacy_cpu_device::state_string_export(const device_state_entry &entry, ast else if (m_string_export != NULL) (*m_string_export)(this, entry, string); } - -const device_type CPU = legacy_cpu_device_config::static_alloc_device_config; diff --git a/src/emu/devcpu.h b/src/emu/devcpu.h index 5614cd35e96..a92e311c2de 100644 --- a/src/emu/devcpu.h +++ b/src/emu/devcpu.h @@ -147,20 +147,9 @@ enum // CPU DEVICE CONFIGURATION MACROS //************************************************************************** -#define MDRV_CPU_ADD(_tag, _type, _clock) \ - MDRV_DEVICE_ADD(_tag, CPU, _clock) \ - MDRV_CPU_TYPE(_type) - -#define MDRV_CPU_MODIFY(_tag) \ - MDRV_DEVICE_MODIFY(_tag) - -#define MDRV_CPU_TYPE(_type) \ - TOKEN_UINT32_PACK1(MCONFIG_TOKEN_DEVICE_CONFIG_CUSTOM_1, 8), \ - TOKEN_PTR(cputype, CPU_##_type), \ - -#define MDRV_CPU_REPLACE(_tag, _type, _clock) \ - MDRV_DEVICE_REPLACE(_tag, CPU, _clock) \ - MDRV_CPU_TYPE(_type) +#define MDRV_CPU_ADD MDRV_DEVICE_ADD +#define MDRV_CPU_MODIFY MDRV_DEVICE_MODIFY +#define MDRV_CPU_REPLACE MDRV_DEVICE_REPLACE #define MDRV_CPU_CLOCK MDRV_DEVICE_CLOCK #define MDRV_CPU_CONFIG MDRV_DEVICE_CONFIG @@ -178,11 +167,59 @@ enum // MACROS //************************************************************************** +// macro for declaring the configuration and device classes of a legacy CPU device +#define DECLARE_LEGACY_CPU_DEVICE(name, basename) \ + \ +CPU_GET_INFO( basename ); \ + \ +class basename##_device_config; \ + \ +class basename##_device : public legacy_cpu_device \ +{ \ + friend class basename##_device_config; \ + basename##_device(running_machine &_machine, const basename##_device_config &config); \ +}; \ + \ +class basename##_device_config : public legacy_cpu_device_config \ +{ \ + basename##_device_config(const machine_config &mconfig, device_type type, const char *tag, const device_config *owner, UINT32 clock); \ + \ +public: \ + static device_config *static_alloc_device_config(const machine_config &mconfig, const char *tag, const device_config *owner, UINT32 clock); \ + virtual device_t *alloc_device(running_machine &machine) const; \ +}; \ + \ +extern const device_type name + +// macro for defining the implementation needed for configuration and device classes +#define DEFINE_LEGACY_CPU_DEVICE(name, basename) \ + \ +basename##_device::basename##_device(running_machine &_machine, const basename##_device_config &config) \ + : legacy_cpu_device(_machine, config) \ +{ \ +} \ + \ +basename##_device_config::basename##_device_config(const machine_config &mconfig, device_type type, const char *tag, const device_config *owner, UINT32 clock) \ + : legacy_cpu_device_config(mconfig, type, tag, owner, clock, CPU_GET_INFO_NAME(basename)) \ +{ \ +} \ + \ +device_config *basename##_device_config::static_alloc_device_config(const machine_config &mconfig, const char *tag, const device_config *owner, UINT32 clock) \ +{ \ + return global_alloc(basename##_device_config(mconfig, static_alloc_device_config, tag, owner, clock)); \ +} \ + \ +device_t *basename##_device_config::alloc_device(running_machine &machine) const \ +{ \ + return pool_alloc(machine_get_pool(machine), basename##_device(machine, *this)); \ +} \ +const device_type name = basename##_device_config::static_alloc_device_config + + // device iteration helpers #define cpu_count(config) (config)->m_devicelist.count(CPU) #define cpu_first(config) (config)->m_devicelist.first(CPU) #define cpu_next(previous) (previous)->typenext() -#define cpu_get_index(cpu) (cpu)->machine->m_devicelist.index(CPU, (cpu)->tag()) // CPU interface functions @@ -340,10 +377,6 @@ typedef void (*cpu_state_io_func)(legacy_cpu_device *device, const device_state_ typedef void (*cpu_string_io_func)(legacy_cpu_device *device, const device_state_entry &entry, astring &string); -// 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 { @@ -404,22 +437,16 @@ class legacy_cpu_device_config : public cpu_device_config { friend class legacy_cpu_device; +protected: // construction/destruction - legacy_cpu_device_config(const machine_config &mconfig, device_type _type, const char *_tag, const device_config *_owner, UINT32 _clock); + legacy_cpu_device_config(const machine_config &mconfig, device_type _type, const char *_tag, const device_config *_owner, UINT32 _clock, cpu_get_info_func get_info); public: - // allocators - static device_config *static_alloc_device_config(const machine_config &mconfig, const char *tag, const device_config *owner, UINT32 clock); - virtual device_t *alloc_device(running_machine &machine) const; - // basic information getters virtual const rom_entry *rom_region() const { return reinterpret_cast<const rom_entry *>(get_legacy_config_ptr(DEVINFO_PTR_ROM_REGION)); } virtual const machine_config_token *machine_config_tokens() const { return reinterpret_cast<const machine_config_token *>(get_legacy_config_ptr(DEVINFO_PTR_MACHINE_CONFIG)); } protected: - // device_config overrides - virtual bool device_process_token(UINT32 entrytype, const machine_config_token *&tokens); - // device_config_execute_interface overrides virtual UINT64 execute_clocks_to_cycles(UINT64 clocks) const; virtual UINT64 execute_cycles_to_clocks(UINT64 cycles) const; @@ -442,12 +469,10 @@ protected: const char *get_legacy_config_string(UINT32 state) const; // internal state - cpu_type m_cputype; // internal CPU type + cpu_get_info_func m_get_info; address_space_config m_space_config[3]; // array of address space configs }; -extern const device_type CPU; - // ======================> cpu_device @@ -479,14 +504,12 @@ class legacy_cpu_device : public cpu_device friend class legacy_cpu_device_config; friend resource_pool_object<legacy_cpu_device>::~resource_pool_object(); +protected: // construction/destruction legacy_cpu_device(running_machine &machine, const legacy_cpu_device_config &config); virtual ~legacy_cpu_device(); public: - // additional CPU-specific configuration properties ... pass through to underlying config - cpu_type cputype() const { return m_cpu_config.m_cputype; } - void *token() const { return m_token; } protected: @@ -550,12 +573,6 @@ protected: // ======================> additional helpers -// return the type of the specified CPU -inline cpu_type cpu_get_type(device_t *device) -{ - return downcast<legacy_cpu_device *>(device)->cputype(); -} - // return a pointer to the given CPU's debugger data inline cpu_debug_data *cpu_get_debug_data(device_t *device) { diff --git a/src/emu/devintrf.c b/src/emu/devintrf.c index c7e39361618..84051f4b3da 100644 --- a/src/emu/devintrf.c +++ b/src/emu/devintrf.c @@ -112,7 +112,11 @@ void device_list::import_config_list(const device_config_list &list, running_mac // append each device from the configuration list for (const device_config *devconfig = list.first(); devconfig != NULL; devconfig = devconfig->next()) - append(devconfig->tag(), devconfig->alloc_device(*m_machine)); + { + device_t *newdevice = devconfig->alloc_device(*m_machine); + append(devconfig->tag(), newdevice); + newdevice->find_interfaces(); + } } @@ -684,6 +688,7 @@ device_t::device_t(running_machine &_machine, const device_config &config) : machine(&_machine), m_machine(_machine), m_execute(NULL), + m_memory(NULL), m_state(NULL), m_next(NULL), m_owner((config.m_owner != NULL) ? _machine.m_devicelist.find(config.m_owner->tag()) : NULL), @@ -816,14 +821,24 @@ UINT64 device_t::attotime_to_clocks(attotime duration) const //------------------------------------------------- -// start - start a device +// find_interfaces - locate fast interfaces //------------------------------------------------- -void device_t::start() +void device_t::find_interfaces() { // look up the common interfaces m_execute = dynamic_cast<device_execute_interface *>(this); + m_memory = dynamic_cast<device_memory_interface *>(this); m_state = dynamic_cast<device_state_interface *>(this); +} + + +//------------------------------------------------- +// start - start a device +//------------------------------------------------- + +void device_t::start() +{ // populate the region field m_region = m_machine.region(tag()); diff --git a/src/emu/devintrf.h b/src/emu/devintrf.h index 034111d244a..df548eb9823 100644 --- a/src/emu/devintrf.h +++ b/src/emu/devintrf.h @@ -107,6 +107,7 @@ class device_config_interface; class device_t; class device_interface; class device_execute_interface; +class device_memory_interface; class device_state_interface; struct rom_entry; union machine_config_token; @@ -377,6 +378,7 @@ public: // specialized helpers bool interface(device_execute_interface *&intf) { intf = m_execute; return (intf != NULL); } + bool interface(device_memory_interface *&intf) { intf = m_memory; return (intf != NULL); } bool interface(device_state_interface *&intf) { intf = m_state; return (intf != NULL); } // owned object helpers @@ -417,6 +419,7 @@ public: protected: // miscellaneous helpers + void find_interfaces(); void start(); void debug_setup(); void pre_save(); @@ -439,6 +442,7 @@ protected: // for speed device_execute_interface *m_execute; + device_memory_interface *m_memory; device_state_interface *m_state; // device relationships diff --git a/src/emu/devlegcy.h b/src/emu/devlegcy.h index 4299096d79d..17dd462730a 100644 --- a/src/emu/devlegcy.h +++ b/src/emu/devlegcy.h @@ -202,12 +202,12 @@ public: \ extern const device_type name // macro for defining the implementation needed for configuration and device classes -#define _DEFINE_LEGACY_DEVICE(name, basename, configclass, deviceclass, baseconfigclass, basedeviceclass) \ +#define _DEFINE_LEGACY_DEVICE(name, basename, configclass, deviceclass, baseconfigclass, basedeviceclass) \ \ deviceclass::deviceclass(running_machine &_machine, const configclass &config) \ - : basedeviceclass(_machine, config) \ - { \ - } \ + : basedeviceclass(_machine, config) \ +{ \ +} \ \ configclass::configclass(const machine_config &mconfig, device_type type, const char *tag, const device_config *owner, UINT32 clock) \ : baseconfigclass(mconfig, type, tag, owner, clock, DEVICE_GET_INFO_NAME(basename)) \ diff --git a/src/emu/info.c b/src/emu/info.c index 2cda98b9312..45979c0feb0 100644 --- a/src/emu/info.c +++ b/src/emu/info.c @@ -635,16 +635,15 @@ 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 *devconfig; - /* iterate over CPUs */ - for (devconfig = cpu_first(config); devconfig != NULL; devconfig = cpu_next(devconfig)) + const device_config_execute_interface *exec; + for (bool gotone = config->m_devicelist.first(exec); gotone; gotone = exec->next(exec)) { fprintf(out, "\t\t<chip"); fprintf(out, " type=\"cpu\""); - fprintf(out, " tag=\"%s\"", xml_normalize_string(devconfig->tag())); - fprintf(out, " name=\"%s\"", xml_normalize_string(devconfig->name())); - fprintf(out, " clock=\"%d\"", devconfig->clock()); + fprintf(out, " tag=\"%s\"", xml_normalize_string(exec->devconfig().tag())); + fprintf(out, " name=\"%s\"", xml_normalize_string(exec->devconfig().name())); + fprintf(out, " clock=\"%d\"", exec->devconfig().clock()); fprintf(out, "/>\n"); } diff --git a/src/emu/machine.c b/src/emu/machine.c index 3ed83094bd1..7d4a3fce979 100644 --- a/src/emu/machine.c +++ b/src/emu/machine.c @@ -205,8 +205,13 @@ running_machine::running_machine(const game_driver &driver, const machine_config driver_data = (*m_config.m_driver_data_alloc)(*this); // find devices - firstcpu = downcast<cpu_device *>(cpu_first(this)); primary_screen = screen_first(*this); + for (device_t *device = m_devicelist.first(); device != NULL; device = device->next()) + if (dynamic_cast<cpu_device *>(device) != NULL) + { + firstcpu = downcast<cpu_device *>(device); + break; + } // fetch core options if (options_get_bool(&m_options, OPTION_DEBUG)) diff --git a/src/emu/machine/generic.c b/src/emu/machine/generic.c index 8108d8f2dfc..c2e5282abdc 100644 --- a/src/emu/machine/generic.c +++ b/src/emu/machine/generic.c @@ -41,6 +41,7 @@ struct _generic_machine_private int memcard_inserted; /* interrupt status for up to 8 CPUs */ + device_t * interrupt_device[8]; UINT8 interrupt_enable[8]; }; @@ -58,8 +59,10 @@ struct _generic_machine_private INLINE int interrupt_enabled(running_device *device) { generic_machine_private *state = device->machine->generic_machine_data; - int cpunum = cpu_get_index(device); - return (cpunum >= ARRAY_LENGTH(state->interrupt_enable) || state->interrupt_enable[cpunum]); + for (int index = 0; index < ARRAY_LENGTH(state->interrupt_device); index++) + if (state->interrupt_device[index] == device) + return state->interrupt_enable[index]; + return TRUE; } @@ -89,6 +92,13 @@ void generic_machine_init(running_machine *machine) state->coinlockedout[counternum] = 0; } + // map devices to the interrupt state + memset(state->interrupt_device, 0, sizeof(state->interrupt_device)); + device_execute_interface *exec; + int index = 0; + for (bool gotone = machine->m_devicelist.first(exec); gotone && index < ARRAY_LENGTH(state->interrupt_device); gotone = exec->next(exec)) + state->interrupt_device[index++] = &exec->device(); + /* register coin save state */ state_save_register_item_array(machine, "coin", NULL, 0, state->coin_count); state_save_register_item_array(machine, "coin", NULL, 0, state->coinlockedout); @@ -708,12 +718,15 @@ void cpu_interrupt_enable(running_device *device, int enabled) cpu_device *cpudevice = downcast<cpu_device *>(device); generic_machine_private *state = device->machine->generic_machine_data; - int cpunum = cpu_get_index(device); - assert_always(cpunum < ARRAY_LENGTH(state->interrupt_enable), "cpu_interrupt_enable() called for a CPU > position 7!"); + int index; + for (index = 0; index < ARRAY_LENGTH(state->interrupt_device); index++) + if (state->interrupt_device[index] == device) + break; + assert_always(index < ARRAY_LENGTH(state->interrupt_enable), "cpu_interrupt_enable() called for invalid CPU!"); /* set the new state */ - if (cpunum < ARRAY_LENGTH(state->interrupt_enable)) - state->interrupt_enable[cpunum] = enabled; + if (index < ARRAY_LENGTH(state->interrupt_enable)) + state->interrupt_enable[index] = enabled; /* make sure there are no queued interrupts */ if (enabled == 0) diff --git a/src/emu/mconfig.h b/src/emu/mconfig.h index 5fb37662f35..254caa707d3 100644 --- a/src/emu/mconfig.h +++ b/src/emu/mconfig.h @@ -308,7 +308,6 @@ union machine_config_token palette_init_func palette_init; video_eof_func video_eof; video_update_func video_update; - cpu_type cputype; device_interrupt_func cpu_interrupt; driver_data_alloc_func driver_data_alloc; }; diff --git a/src/emu/sound/scsp.c b/src/emu/sound/scsp.c index 47d722ad1d4..ac244b65f86 100644 --- a/src/emu/sound/scsp.c +++ b/src/emu/sound/scsp.c @@ -1216,7 +1216,7 @@ static void dma_scsp(const address_space *space, struct _SCSP *SCSP) /*Job done,request a dma end irq*/ if(scsp_regs[0x1e/2] & 0x10) - cpu_set_input_line(space->machine->m_devicelist.find(CPU, 2),dma_transfer_end,HOLD_LINE); + cpu_set_input_line(space->machine->device("audiocpu"),dma_transfer_end,HOLD_LINE); } #ifdef UNUSED_FUNCTION diff --git a/src/emu/ui.c b/src/emu/ui.c index 102b2f5445b..6fe2bcd4c56 100644 --- a/src/emu/ui.c +++ b/src/emu/ui.c @@ -1016,7 +1016,7 @@ astring &game_info_astring(running_machine *machine, astring &string) count = 1; for (scandevice = device->typenext(); scandevice != NULL; scandevice = scandevice->typenext()) { - if (cpu_get_type(device) != cpu_get_type(scandevice) || device->clock() != scandevice->clock()) + if (device->type() != scandevice->type() || device->clock() != scandevice->clock()) break; count++; } diff --git a/src/mame/audio/mario.c b/src/mame/audio/mario.c index a0e22cf5932..c9d61eb9c88 100644 --- a/src/mame/audio/mario.c +++ b/src/mame/audio/mario.c @@ -474,7 +474,7 @@ static SOUND_START( mario ) #endif state->eabank = NULL; - if (audiocpu != NULL && cpu_get_type(audiocpu) != CPU_Z80) + if (audiocpu != NULL && audiocpu->type() != Z80) { state->eabank = "bank1"; memory_install_read_bank(cpu_get_address_space(audiocpu, ADDRESS_SPACE_PROGRAM), 0x000, 0x7ff, 0, 0, "bank1"); diff --git a/src/mame/audio/namcoc7x.c b/src/mame/audio/namcoc7x.c index 555c12f1828..47f19a42a42 100644 --- a/src/mame/audio/namcoc7x.c +++ b/src/mame/audio/namcoc7x.c @@ -89,7 +89,7 @@ void namcoc7x_on_driver_init(running_machine *machine) // install speedup cheat for (cpu = devtag_get_device(machine, "maincpu"); cpu != NULL; cpu = cpu->typenext()) - if (cpu_get_type(cpu) == CPU_M37702) + if (cpu->type() == M37702) memory_install_readwrite16_handler(cpu_get_address_space(cpu, ADDRESS_SPACE_PROGRAM), 0x82, 0x83, 0, 0, speedup_r, speedup_w); } diff --git a/src/mame/audio/redalert.c b/src/mame/audio/redalert.c index 84579bbe809..7da21179b93 100644 --- a/src/mame/audio/redalert.c +++ b/src/mame/audio/redalert.c @@ -239,7 +239,7 @@ MACHINE_DRIVER_END static MACHINE_DRIVER_START( redalert_audio_voice ) - MDRV_CPU_ADD("voice", 8085A, REDALERT_VOICE_CPU_CLOCK) + MDRV_CPU_ADD("voice", I8085A, REDALERT_VOICE_CPU_CLOCK) MDRV_CPU_CONFIG(redalert_voice_i8085_config) MDRV_CPU_PROGRAM_MAP(redalert_voice_map) diff --git a/src/mame/drivers/8080bw.c b/src/mame/drivers/8080bw.c index a84e9e96ede..c8985e4c6e2 100644 --- a/src/mame/drivers/8080bw.c +++ b/src/mame/drivers/8080bw.c @@ -1059,7 +1059,7 @@ static MACHINE_DRIVER_START( schaser ) /* basic machine hardware */ MDRV_IMPORT_FROM(mw8080bw_root) - MDRV_CPU_REPLACE("maincpu",8080,1996800) /* 19.968MHz / 10 */ + MDRV_CPU_REPLACE("maincpu",I8080,1996800) /* 19.968MHz / 10 */ MDRV_CPU_PROGRAM_MAP(schaser_map) MDRV_CPU_IO_MAP(schaser_io_map) MDRV_WATCHDOG_VBLANK_INIT(255) @@ -1468,7 +1468,7 @@ static MACHINE_DRIVER_START( polaris ) /* basic machine hardware */ MDRV_IMPORT_FROM(mw8080bw_root) - MDRV_CPU_REPLACE("maincpu",8080,1996800) /* 19.968MHz / 10 */ + MDRV_CPU_REPLACE("maincpu",I8080,1996800) /* 19.968MHz / 10 */ MDRV_CPU_PROGRAM_MAP(schaser_map) MDRV_CPU_IO_MAP(polaris_io_map) MDRV_WATCHDOG_VBLANK_INIT(255) diff --git a/src/mame/drivers/ace.c b/src/mame/drivers/ace.c index d2576c5d673..27c14db6f15 100644 --- a/src/mame/drivers/ace.c +++ b/src/mame/drivers/ace.c @@ -339,7 +339,7 @@ static MACHINE_DRIVER_START( ace ) MDRV_DRIVER_DATA(ace_state) /* basic machine hardware */ - MDRV_CPU_ADD("maincpu", 8080, MASTER_CLOCK/9) /* 2 MHz ? */ + MDRV_CPU_ADD("maincpu", I8080, MASTER_CLOCK/9) /* 2 MHz ? */ MDRV_CPU_PROGRAM_MAP(main_map) MDRV_MACHINE_START(ace) diff --git a/src/mame/drivers/blockade.c b/src/mame/drivers/blockade.c index 174f045ec99..14804a209a3 100644 --- a/src/mame/drivers/blockade.c +++ b/src/mame/drivers/blockade.c @@ -486,7 +486,7 @@ static MACHINE_DRIVER_START( blockade ) MDRV_DRIVER_DATA(blockade_state) /* basic machine hardware */ - MDRV_CPU_ADD("maincpu", 8080, MASTER_CLOCK/10) + MDRV_CPU_ADD("maincpu", I8080, MASTER_CLOCK/10) MDRV_CPU_PROGRAM_MAP(main_map) MDRV_CPU_IO_MAP(main_io_map) MDRV_CPU_VBLANK_INT("screen", blockade_interrupt) diff --git a/src/mame/drivers/cojag.c b/src/mame/drivers/cojag.c index df53d4ca74d..cf7e8785dfb 100644 --- a/src/mame/drivers/cojag.c +++ b/src/mame/drivers/cojag.c @@ -1507,7 +1507,7 @@ static void cojag_common_init(running_machine *machine, UINT16 gpu_jump_offs, UI { /* copy over the ROM */ main_cpu = machine->device<cpu_device>("maincpu"); - cojag_is_r3000 = (cpu_get_type(main_cpu) == CPU_R3041BE); + cojag_is_r3000 = (main_cpu->type() == R3041BE); /* install synchronization hooks for GPU */ if (cojag_is_r3000) diff --git a/src/mame/drivers/dwarfd.c b/src/mame/drivers/dwarfd.c index 090072df437..6b6b9055cd4 100644 --- a/src/mame/drivers/dwarfd.c +++ b/src/mame/drivers/dwarfd.c @@ -965,7 +965,7 @@ static MACHINE_DRIVER_START( dwarfd ) /* basic machine hardware */ /* FIXME: The 8085A had a max clock of 6MHz, internally divided by 2! */ - MDRV_CPU_ADD("maincpu", 8085A, 10595000/3*2) /* ? MHz */ + MDRV_CPU_ADD("maincpu", I8085A, 10595000/3*2) /* ? MHz */ MDRV_CPU_CONFIG(dwarfd_i8085_config) MDRV_CPU_PROGRAM_MAP(mem_map) MDRV_CPU_IO_MAP(io_map) diff --git a/src/mame/drivers/dynadice.c b/src/mame/drivers/dynadice.c index 99e2d2a3684..b200bffc5ce 100644 --- a/src/mame/drivers/dynadice.c +++ b/src/mame/drivers/dynadice.c @@ -240,7 +240,7 @@ static MACHINE_DRIVER_START( dynadice ) MDRV_DRIVER_DATA(dynadice_state) /* basic machine hardware */ - MDRV_CPU_ADD("maincpu", 8080,18432000/8) + MDRV_CPU_ADD("maincpu", I8080,18432000/8) MDRV_CPU_PROGRAM_MAP(dynadice_map) MDRV_CPU_IO_MAP(dynadice_io_map) diff --git a/src/mame/drivers/enigma2.c b/src/mame/drivers/enigma2.c index 4d4940b7ba0..8afb0865faa 100644 --- a/src/mame/drivers/enigma2.c +++ b/src/mame/drivers/enigma2.c @@ -639,7 +639,7 @@ static MACHINE_DRIVER_START( enigma2a ) MDRV_DRIVER_DATA(enigma2_state) /* basic machine hardware */ - MDRV_CPU_ADD("maincpu", 8080, CPU_CLOCK) + MDRV_CPU_ADD("maincpu", I8080, CPU_CLOCK) MDRV_CPU_PROGRAM_MAP(engima2a_main_cpu_map) MDRV_CPU_IO_MAP(engima2a_main_cpu_io_map) diff --git a/src/mame/drivers/equites.c b/src/mame/drivers/equites.c index a792ba9227d..2bc48c65361 100644 --- a/src/mame/drivers/equites.c +++ b/src/mame/drivers/equites.c @@ -1141,7 +1141,7 @@ static const samples_interface alphamc07_samples_interface = // the sound board is the same in all games static MACHINE_DRIVER_START( common_sound ) - MDRV_CPU_ADD("audiocpu", 8085A, XTAL_6_144MHz) /* verified on pcb */ + MDRV_CPU_ADD("audiocpu", I8085A, XTAL_6_144MHz) /* verified on pcb */ MDRV_CPU_PROGRAM_MAP(sound_map) MDRV_CPU_IO_MAP(sound_portmap) diff --git a/src/mame/drivers/harddriv.c b/src/mame/drivers/harddriv.c index 4e195df141b..908e56a6b3b 100644 --- a/src/mame/drivers/harddriv.c +++ b/src/mame/drivers/harddriv.c @@ -3714,10 +3714,10 @@ static void init_ds3(running_machine *machine) memory_install_write16_handler(cpu_get_address_space(state->maincpu, ADDRESS_SPACE_PROGRAM), 0x823800, 0x823fff, 0, 0, hd68k_ds3_control_w); /* if we have a sound DSP, boot it */ - if (state->soundcpu != NULL && cpu_get_type(state->soundcpu) == CPU_ADSP2105) + if (state->soundcpu != NULL && state->soundcpu->type() == ADSP2105) adsp2105_load_boot_data(state->soundcpu->region()->base() + 0x10000, &state->soundcpu->region()->u32()); - if (state->sounddsp != NULL && cpu_get_type(state->sounddsp) == CPU_ADSP2105) + if (state->sounddsp != NULL && state->sounddsp->type() == ADSP2105) adsp2105_load_boot_data(state->sounddsp->region()->base() + 0x10000, &state->sounddsp->region()->u32()); /* diff --git a/src/mame/drivers/hitme.c b/src/mame/drivers/hitme.c index d0189968b92..49a38cf7521 100644 --- a/src/mame/drivers/hitme.c +++ b/src/mame/drivers/hitme.c @@ -322,7 +322,7 @@ static MACHINE_DRIVER_START( hitme ) MDRV_DRIVER_DATA(hitme_state) /* basic machine hardware */ - MDRV_CPU_ADD("maincpu", 8080, MASTER_CLOCK/16) + MDRV_CPU_ADD("maincpu", I8080, MASTER_CLOCK/16) MDRV_CPU_PROGRAM_MAP(hitme_map) MDRV_CPU_IO_MAP(hitme_portmap) diff --git a/src/mame/drivers/itech8.c b/src/mame/drivers/itech8.c index 792bef504d4..21957615439 100644 --- a/src/mame/drivers/itech8.c +++ b/src/mame/drivers/itech8.c @@ -592,7 +592,7 @@ 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(devtag_get_device(machine, "maincpu")); + device_type main_cpu_type = machine->device("maincpu")->type(); /* update the states */ if (periodic != -1) periodic_int = periodic; @@ -600,7 +600,7 @@ void itech8_update_interrupts(running_machine *machine, int periodic, int tms340 if (blitter != -1) blitter_int = blitter; /* handle the 6809 case */ - if (main_cpu_type == CPU_M6809 || main_cpu_type == CPU_HD6309) + if (main_cpu_type == M6809 || main_cpu_type == HD6309) { /* just modify lines that have changed */ if (periodic != -1) cputag_set_input_line(machine, "maincpu", INPUT_LINE_NMI, periodic ? ASSERT_LINE : CLEAR_LINE); @@ -671,10 +671,10 @@ static MACHINE_START( sstrike ) static MACHINE_RESET( itech8 ) { - cpu_type main_cpu_type = cpu_get_type(devtag_get_device(machine, "maincpu")); + device_type main_cpu_type = machine->device("maincpu")->type(); /* make sure bank 0 is selected */ - if (main_cpu_type == CPU_M6809 || main_cpu_type == CPU_HD6309) + if (main_cpu_type == M6809 || main_cpu_type == HD6309) { memory_set_bankptr(machine, "bank1", &memory_region(machine, "maincpu")[0x4000]); machine->device("maincpu")->reset(); diff --git a/src/mame/drivers/kopunch.c b/src/mame/drivers/kopunch.c index 68c5fc13133..5915dfb5c46 100644 --- a/src/mame/drivers/kopunch.c +++ b/src/mame/drivers/kopunch.c @@ -193,7 +193,7 @@ static MACHINE_DRIVER_START( kopunch ) MDRV_DRIVER_DATA(kopunch_state) /* basic machine hardware */ - MDRV_CPU_ADD("maincpu", 8085A, 4000000) /* 4 MHz ???? Uses SIM, must be 8085 */ + MDRV_CPU_ADD("maincpu", I8085A, 4000000) /* 4 MHz ???? Uses SIM, must be 8085 */ MDRV_CPU_PROGRAM_MAP(kopunch_map) MDRV_CPU_IO_MAP(kopunch_io_map) MDRV_CPU_VBLANK_INT("screen",kopunch_interrupt) diff --git a/src/mame/drivers/liberate.c b/src/mame/drivers/liberate.c index 11b847022e1..0f018d12f55 100644 --- a/src/mame/drivers/liberate.c +++ b/src/mame/drivers/liberate.c @@ -874,10 +874,8 @@ static MACHINE_DRIVER_START( liberatb ) MDRV_IMPORT_FROM(liberate) /* basic machine hardware */ - MDRV_CPU_MODIFY("maincpu") - MDRV_CPU_TYPE(M6502) + MDRV_CPU_REPLACE("maincpu", M6502, 2000000) MDRV_CPU_PROGRAM_MAP(liberatb_map) - MDRV_CPU_IO_MAP(0) MDRV_CPU_VBLANK_INT("screen", deco16_interrupt) MACHINE_DRIVER_END diff --git a/src/mame/drivers/m14.c b/src/mame/drivers/m14.c index 346bd65e29a..19b09ea6e5b 100644 --- a/src/mame/drivers/m14.c +++ b/src/mame/drivers/m14.c @@ -336,7 +336,7 @@ static MACHINE_DRIVER_START( m14 ) MDRV_DRIVER_DATA(m14_state) /* basic machine hardware */ - MDRV_CPU_ADD("maincpu",8085A,6000000/2) //guess: 6 Mhz internally divided by 2 + MDRV_CPU_ADD("maincpu",I8085A,6000000/2) //guess: 6 Mhz internally divided by 2 MDRV_CPU_PROGRAM_MAP(m14_map) MDRV_CPU_IO_MAP(m14_io_map) MDRV_CPU_VBLANK_INT("screen",m14_irq) diff --git a/src/mame/drivers/m79amb.c b/src/mame/drivers/m79amb.c index c3828f2dd91..7b8e3e5ae36 100644 --- a/src/mame/drivers/m79amb.c +++ b/src/mame/drivers/m79amb.c @@ -210,7 +210,7 @@ static MACHINE_DRIVER_START( m79amb ) MDRV_DRIVER_DATA(m79amb_state) /* basic machine hardware */ - MDRV_CPU_ADD("maincpu", 8080, XTAL_19_6608MHz / 10) + MDRV_CPU_ADD("maincpu", I8080, XTAL_19_6608MHz / 10) MDRV_CPU_PROGRAM_MAP(main_map) MDRV_CPU_VBLANK_INT("screen", m79amb_interrupt) diff --git a/src/mame/drivers/megadriv.c b/src/mame/drivers/megadriv.c index ee8a976a6da..2e016ecec4f 100644 --- a/src/mame/drivers/megadriv.c +++ b/src/mame/drivers/megadriv.c @@ -6368,7 +6368,7 @@ static void megadriv_init_common(running_machine *machine) _genesis_snd_z80_cpu = machine->device<cpu_device>("genesis_snd_z80"); if (_genesis_snd_z80_cpu != NULL) { - //printf("GENESIS Sound Z80 cpu found %d\n", cpu_get_index(_genesis_snd_z80_cpu) ); + //printf("GENESIS Sound Z80 cpu found '%s'\n", _genesis_snd_z80_cpu->tag() ); genz80.z80_prgram = auto_alloc_array(machine, UINT8, 0x2000); memory_set_bankptr(machine, "bank1", genz80.z80_prgram ); @@ -6378,14 +6378,14 @@ static void megadriv_init_common(running_machine *machine) _32x_master_cpu = machine->device<cpu_device>("32x_master_sh2"); if (_32x_master_cpu != NULL) { - printf("32x MASTER SH2 cpu found %d\n", cpu_get_index(_32x_master_cpu) ); + printf("32x MASTER SH2 cpu found '%s'\n", _32x_master_cpu->tag() ); } /* Look to see if this system has the 32x Slave SH2 */ _32x_slave_cpu = machine->device<cpu_device>("32x_slave_sh2"); if (_32x_slave_cpu != NULL) { - printf("32x SLAVE SH2 cpu found %d\n", cpu_get_index(_32x_slave_cpu) ); + printf("32x SLAVE SH2 cpu found '%s'\n", _32x_slave_cpu->tag() ); } if ((_32x_master_cpu != NULL) && (_32x_slave_cpu != NULL)) @@ -6400,13 +6400,13 @@ static void megadriv_init_common(running_machine *machine) _segacd_68k_cpu = machine->device<cpu_device>("segacd_68k"); if (_segacd_68k_cpu != NULL) { - printf("Sega CD secondary 68k cpu found %d\n", cpu_get_index(_segacd_68k_cpu) ); + printf("Sega CD secondary 68k cpu found '%s'\n", _segacd_68k_cpu->tag() ); } _svp_cpu = machine->device<cpu_device>("svp"); if (_svp_cpu != NULL) { - printf("SVP (cpu) found %d\n", cpu_get_index(_svp_cpu) ); + printf("SVP (cpu) found '%s'\n", _svp_cpu->tag() ); } diff --git a/src/mame/drivers/mw8080bw.c b/src/mame/drivers/mw8080bw.c index 6f75c249e88..9ff8b676ea4 100644 --- a/src/mame/drivers/mw8080bw.c +++ b/src/mame/drivers/mw8080bw.c @@ -228,7 +228,7 @@ MACHINE_DRIVER_START( mw8080bw_root ) MDRV_DRIVER_DATA(mw8080bw_state) /* basic machine hardware */ - MDRV_CPU_ADD("maincpu",8080,MW8080BW_CPU_CLOCK) + MDRV_CPU_ADD("maincpu",I8080,MW8080BW_CPU_CLOCK) MDRV_CPU_PROGRAM_MAP(main_map) MDRV_MACHINE_START(mw8080bw) MDRV_MACHINE_RESET(mw8080bw) diff --git a/src/mame/drivers/n8080.c b/src/mame/drivers/n8080.c index b5043ebccbb..bcf5006a4a1 100644 --- a/src/mame/drivers/n8080.c +++ b/src/mame/drivers/n8080.c @@ -512,7 +512,7 @@ static MACHINE_DRIVER_START( spacefev ) MDRV_DRIVER_DATA(n8080_state) /* basic machine hardware */ - MDRV_CPU_ADD("maincpu", 8080, MASTER_CLOCK / 10) + MDRV_CPU_ADD("maincpu", I8080, MASTER_CLOCK / 10) MDRV_CPU_CONFIG(n8080_cpu_config) MDRV_CPU_PROGRAM_MAP(main_cpu_map) MDRV_CPU_IO_MAP(main_io_map) @@ -546,7 +546,7 @@ static MACHINE_DRIVER_START( sheriff ) MDRV_DRIVER_DATA(n8080_state) /* basic machine hardware */ - MDRV_CPU_ADD("maincpu", 8080, MASTER_CLOCK / 10) + MDRV_CPU_ADD("maincpu", I8080, MASTER_CLOCK / 10) MDRV_CPU_CONFIG(n8080_cpu_config) MDRV_CPU_PROGRAM_MAP(main_cpu_map) MDRV_CPU_IO_MAP(main_io_map) @@ -580,7 +580,7 @@ static MACHINE_DRIVER_START( helifire ) MDRV_DRIVER_DATA(n8080_state) /* basic machine hardware */ - MDRV_CPU_ADD("maincpu", 8080, MASTER_CLOCK / 10) + MDRV_CPU_ADD("maincpu", I8080, MASTER_CLOCK / 10) MDRV_CPU_CONFIG(n8080_cpu_config) MDRV_CPU_PROGRAM_MAP(helifire_main_cpu_map) MDRV_CPU_IO_MAP(main_io_map) diff --git a/src/mame/drivers/nbmj8991.c b/src/mame/drivers/nbmj8991.c index 689d426c38b..6396ddd56d5 100644 --- a/src/mame/drivers/nbmj8991.c +++ b/src/mame/drivers/nbmj8991.c @@ -66,7 +66,8 @@ static READ8_HANDLER( nbmj8991_sound_r ) static MACHINE_RESET( nbmj8991 ) { - if (devtag_get_device(machine, "audiocpu") != NULL && cpu_get_type(devtag_get_device(machine, "audiocpu")) == CPU_Z80) + device_t *audiocpu = machine->device("audiocpu"); + if (audiocpu != NULL && audiocpu->type() == Z80) { memory_configure_bank(machine, "bank1", 0, 4, memory_region(machine, "audiocpu") + 0x8000, 0x8000); memory_set_bank(machine, "bank1", 0); diff --git a/src/mame/drivers/norautp.c b/src/mame/drivers/norautp.c index 7184413ecb8..cc9ec5655d4 100644 --- a/src/mame/drivers/norautp.c +++ b/src/mame/drivers/norautp.c @@ -1337,7 +1337,7 @@ static MACHINE_DRIVER_START( dphl ) MDRV_IMPORT_FROM(noraut_base) /* basic machine hardware */ - MDRV_CPU_REPLACE("maincpu", 8080, DPHL_CPU_CLOCK) + MDRV_CPU_REPLACE("maincpu", I8080, DPHL_CPU_CLOCK) MDRV_CPU_PROGRAM_MAP(dphl_map) MDRV_CPU_IO_MAP(norautp_portmap) @@ -1351,7 +1351,7 @@ static MACHINE_DRIVER_START( dphla ) MDRV_IMPORT_FROM(noraut_base) /* basic machine hardware */ - MDRV_CPU_REPLACE("maincpu", 8080, DPHL_CPU_CLOCK) + MDRV_CPU_REPLACE("maincpu", I8080, DPHL_CPU_CLOCK) MDRV_CPU_PROGRAM_MAP(dphla_map) MDRV_CPU_IO_MAP(norautp_portmap) @@ -1365,7 +1365,7 @@ static MACHINE_DRIVER_START( kimbldhl ) MDRV_IMPORT_FROM(noraut_base) /* basic machine hardware */ - MDRV_CPU_REPLACE("maincpu", 8080, DPHL_CPU_CLOCK) + MDRV_CPU_REPLACE("maincpu", I8080, DPHL_CPU_CLOCK) MDRV_CPU_PROGRAM_MAP(kimbldhl_map) MDRV_CPU_IO_MAP(norautp_portmap) @@ -1379,7 +1379,7 @@ static MACHINE_DRIVER_START( dphltest ) MDRV_IMPORT_FROM(noraut_base) /* basic machine hardware */ - MDRV_CPU_REPLACE("maincpu", 8080, DPHL_CPU_CLOCK) + MDRV_CPU_REPLACE("maincpu", I8080, DPHL_CPU_CLOCK) MDRV_CPU_PROGRAM_MAP(dphltest_map) MDRV_CPU_IO_MAP(norautp_portmap) @@ -1393,7 +1393,7 @@ static MACHINE_DRIVER_START( drhl ) MDRV_IMPORT_FROM(noraut_base) /* basic machine hardware */ - MDRV_CPU_REPLACE("maincpu", 8080, DPHL_CPU_CLOCK) + MDRV_CPU_REPLACE("maincpu", I8080, DPHL_CPU_CLOCK) MDRV_CPU_PROGRAM_MAP(drhl_map) MDRV_CPU_IO_MAP(norautp_portmap) diff --git a/src/mame/drivers/nss.c b/src/mame/drivers/nss.c index b301ed436d1..34e2b739dff 100644 --- a/src/mame/drivers/nss.c +++ b/src/mame/drivers/nss.c @@ -294,11 +294,8 @@ Contra III CONTRA_III_1 TC574000 CONTRA_III_0 TC574000 GAME1_NSSU ***************************************************************************/ #include "emu.h" -#include "cpu/spc700/spc700.h" -#include "cpu/g65816/g65816.h" #include "cpu/z80/z80.h" #include "includes/snes.h" -#include "audio/snes_snd.h" static ADDRESS_MAP_START( snes_map, ADDRESS_SPACE_PROGRAM, 8) AM_RANGE(0x000000, 0x2fffff) AM_READWRITE(snes_r_bank1, snes_w_bank1) /* I/O and ROM (repeats for each bank) */ @@ -618,7 +615,7 @@ static MACHINE_DRIVER_START( snes ) MDRV_DRIVER_DATA(snes_state) /* basic machine hardware */ - MDRV_CPU_ADD("maincpu", 5A22, 3580000*6) /* 2.68Mhz, also 3.58Mhz */ + MDRV_CPU_ADD("maincpu", _5A22, 3580000*6) /* 2.68Mhz, also 3.58Mhz */ MDRV_CPU_PROGRAM_MAP(snes_map) MDRV_CPU_ADD("soundcpu", SPC700, 2048000/2) /* 2.048 Mhz, but internal divider */ diff --git a/src/mame/drivers/paranoia.c b/src/mame/drivers/paranoia.c index 35d0dd0f7fb..e05c3bfed7a 100644 --- a/src/mame/drivers/paranoia.c +++ b/src/mame/drivers/paranoia.c @@ -144,7 +144,7 @@ static MACHINE_DRIVER_START( paranoia ) MDRV_QUANTUM_TIME(HZ(60)) - MDRV_CPU_ADD("sub", 8085A, 18000000/3) + MDRV_CPU_ADD("sub", I8085A, 18000000/3) MDRV_CPU_PROGRAM_MAP(paranoia_8085_map) MDRV_CPU_IO_MAP(paranoia_8085_io_map) diff --git a/src/mame/drivers/phoenix.c b/src/mame/drivers/phoenix.c index 2727e35a0e6..d212494b12a 100644 --- a/src/mame/drivers/phoenix.c +++ b/src/mame/drivers/phoenix.c @@ -452,7 +452,7 @@ static MACHINE_RESET( phoenix ) static MACHINE_DRIVER_START( phoenix ) /* basic machine hardware */ - MDRV_CPU_ADD("maincpu", 8085A, CPU_CLOCK) /* 2.75 MHz */ + MDRV_CPU_ADD("maincpu", I8085A, CPU_CLOCK) /* 2.75 MHz */ MDRV_CPU_PROGRAM_MAP(phoenix_memory_map) MDRV_MACHINE_RESET(phoenix) @@ -524,7 +524,7 @@ static I8085_CONFIG( survival_i8085_config ) static MACHINE_DRIVER_START( survival ) /* basic machine hardware */ - MDRV_CPU_ADD("maincpu", 8085A, CPU_CLOCK) /* 5.50 MHz */ + MDRV_CPU_ADD("maincpu", I8085A, CPU_CLOCK) /* 5.50 MHz */ MDRV_CPU_CONFIG(survival_i8085_config) MDRV_CPU_PROGRAM_MAP(survival_memory_map) diff --git a/src/mame/drivers/photon.c b/src/mame/drivers/photon.c index 8a750648fb7..824af2004e6 100644 --- a/src/mame/drivers/photon.c +++ b/src/mame/drivers/photon.c @@ -195,7 +195,7 @@ static VIDEO_UPDATE( photon ) static MACHINE_DRIVER_START( photon ) /* basic machine hardware */ - MDRV_CPU_ADD("maincpu",8080, 1780000) + MDRV_CPU_ADD("maincpu",I8080, 1780000) MDRV_CPU_PROGRAM_MAP(pk8000_mem) MDRV_CPU_IO_MAP(pk8000_io) MDRV_CPU_VBLANK_INT("screen", pk8000_interrupt) diff --git a/src/mame/drivers/rcorsair.c b/src/mame/drivers/rcorsair.c index 7e273dfe135..b9eb29e6a1b 100644 --- a/src/mame/drivers/rcorsair.c +++ b/src/mame/drivers/rcorsair.c @@ -116,7 +116,7 @@ static MACHINE_DRIVER_START( rcorsair ) /* Main CPU is probably inside Custom Block with program code, unknown type */ - MDRV_CPU_ADD("maincpu", 8085A,8000000) /* Sound CPU? */ + MDRV_CPU_ADD("maincpu", I8085A,8000000) /* Sound CPU? */ MDRV_CPU_PROGRAM_MAP(rcorsair_map) // MDRV_CPU_VBLANK_INT("screen", irq0_line_hold) diff --git a/src/mame/drivers/rotaryf.c b/src/mame/drivers/rotaryf.c index 733f7cfb6d7..023cdfdf454 100644 --- a/src/mame/drivers/rotaryf.c +++ b/src/mame/drivers/rotaryf.c @@ -151,7 +151,7 @@ INPUT_PORTS_END static MACHINE_DRIVER_START( rotaryf ) /* basic machine hardware */ - MDRV_CPU_ADD("maincpu",8085A,4000000) /* 8080? */ /* 2 MHz? */ + MDRV_CPU_ADD("maincpu",I8085A,4000000) /* 8080? */ /* 2 MHz? */ MDRV_CPU_PROGRAM_MAP(rotaryf_map) MDRV_CPU_IO_MAP(rotaryf_io_map) MDRV_CPU_VBLANK_INT_HACK(rotaryf_interrupt,5) diff --git a/src/mame/drivers/safarir.c b/src/mame/drivers/safarir.c index c07f1a55b35..3075ccd8fcd 100644 --- a/src/mame/drivers/safarir.c +++ b/src/mame/drivers/safarir.c @@ -401,7 +401,7 @@ static MACHINE_DRIVER_START( safarir ) MDRV_DRIVER_DATA( safarir_state ) /* basic machine hardware */ - MDRV_CPU_ADD("maincpu", 8085A, 18000000/8) /* 2.25 MHz ? */ + MDRV_CPU_ADD("maincpu", I8085A, 18000000/8) /* 2.25 MHz ? */ MDRV_CPU_PROGRAM_MAP(main_map) MDRV_MACHINE_START(safarir) diff --git a/src/mame/drivers/sbowling.c b/src/mame/drivers/sbowling.c index 33166f63d39..d5a4542f665 100644 --- a/src/mame/drivers/sbowling.c +++ b/src/mame/drivers/sbowling.c @@ -373,7 +373,7 @@ static MACHINE_DRIVER_START( sbowling ) MDRV_DRIVER_DATA( sbowling_state ) - MDRV_CPU_ADD("maincpu", 8080, XTAL_19_968MHz/10) /* ? */ + MDRV_CPU_ADD("maincpu", I8080, XTAL_19_968MHz/10) /* ? */ MDRV_CPU_PROGRAM_MAP(main_map) MDRV_CPU_IO_MAP(port_map) MDRV_CPU_VBLANK_INT_HACK(sbw_interrupt, 2) diff --git a/src/mame/drivers/sbugger.c b/src/mame/drivers/sbugger.c index ed98fc8ad26..771090737f7 100644 --- a/src/mame/drivers/sbugger.c +++ b/src/mame/drivers/sbugger.c @@ -216,7 +216,7 @@ static MACHINE_DRIVER_START( sbugger ) MDRV_DRIVER_DATA( sbugger_state ) - MDRV_CPU_ADD("maincpu", 8085A, 6000000) /* 3.00 MHz??? */ + MDRV_CPU_ADD("maincpu", I8085A, 6000000) /* 3.00 MHz??? */ MDRV_CPU_PROGRAM_MAP(sbugger_map) MDRV_CPU_IO_MAP(sbugger_io_map) MDRV_CPU_VBLANK_INT_HACK(irq3_line_hold,NUM_INTS_FRAME) diff --git a/src/mame/drivers/segas18.c b/src/mame/drivers/segas18.c index 58dbe7e4122..6e5a20bf399 100644 --- a/src/mame/drivers/segas18.c +++ b/src/mame/drivers/segas18.c @@ -215,7 +215,7 @@ static MACHINE_RESET( system18 ) fd1094_machine_init(devtag_get_device(machine, "maincpu")); /* if we are running with a real live 8751, we need to boost the interleave at startup */ - if (state->mcu != NULL && cpu_get_type(state->mcu) == CPU_I8751) + if (state->mcu != NULL && state->mcu->type() == I8751) timer_call_after_resynch(machine, NULL, 0, boost_interleave); } diff --git a/src/mame/drivers/sfcbox.c b/src/mame/drivers/sfcbox.c index d3e4c7fbf5a..7ed50e52ced 100644 --- a/src/mame/drivers/sfcbox.c +++ b/src/mame/drivers/sfcbox.c @@ -212,7 +212,7 @@ static MACHINE_DRIVER_START( snes ) MDRV_DRIVER_DATA(snes_state) /* basic machine hardware */ - MDRV_CPU_ADD("maincpu", 5A22, 3580000*6) /* 2.68Mhz, also 3.58Mhz */ + MDRV_CPU_ADD("maincpu", _5A22, 3580000*6) /* 2.68Mhz, also 3.58Mhz */ MDRV_CPU_PROGRAM_MAP(snes_map) MDRV_CPU_ADD("soundcpu", SPC700, 2048000/2) /* 2.048 Mhz, but internal divider */ diff --git a/src/mame/drivers/snesb.c b/src/mame/drivers/snesb.c index 3ab58c3152f..50e70ae08ba 100644 --- a/src/mame/drivers/snesb.c +++ b/src/mame/drivers/snesb.c @@ -503,7 +503,7 @@ static MACHINE_DRIVER_START( kinstb ) MDRV_DRIVER_DATA(snes_state) /* basic machine hardware */ - MDRV_CPU_ADD("maincpu", 5A22, 3580000*6) /* 2.68Mhz, also 3.58Mhz */ + MDRV_CPU_ADD("maincpu", _5A22, 3580000*6) /* 2.68Mhz, also 3.58Mhz */ MDRV_CPU_PROGRAM_MAP(snesb_map) /* audio CPU */ diff --git a/src/mame/drivers/spcforce.c b/src/mame/drivers/spcforce.c index 7ff1e36f8cd..55b1a7415be 100644 --- a/src/mame/drivers/spcforce.c +++ b/src/mame/drivers/spcforce.c @@ -246,7 +246,7 @@ static MACHINE_DRIVER_START( spcforce ) /* basic machine hardware */ /* FIXME: The 8085A had a max clock of 6MHz, internally divided by 2! */ - MDRV_CPU_ADD("maincpu", 8085A, 8000000 * 2) /* 4.00 MHz??? */ + MDRV_CPU_ADD("maincpu", I8085A, 8000000 * 2) /* 4.00 MHz??? */ MDRV_CPU_PROGRAM_MAP(spcforce_map) MDRV_CPU_VBLANK_INT("screen", irq3_line_pulse) diff --git a/src/mame/drivers/sstrangr.c b/src/mame/drivers/sstrangr.c index 9517c86bf45..6466b066926 100644 --- a/src/mame/drivers/sstrangr.c +++ b/src/mame/drivers/sstrangr.c @@ -197,7 +197,7 @@ static MACHINE_DRIVER_START( sstrangr ) MDRV_DRIVER_DATA( sstrangr_state ) /* basic machine hardware */ - MDRV_CPU_ADD("maincpu",8080,1996800) /* clock is a guess, taken from mw8080bw */ + MDRV_CPU_ADD("maincpu",I8080,1996800) /* clock is a guess, taken from mw8080bw */ MDRV_CPU_PROGRAM_MAP(sstrangr_map) MDRV_CPU_IO_MAP(sstrangr_io_map) MDRV_CPU_VBLANK_INT_HACK(irq0_line_hold,2) diff --git a/src/mame/drivers/stactics.c b/src/mame/drivers/stactics.c index 128b2bf6974..432ee8060a8 100644 --- a/src/mame/drivers/stactics.c +++ b/src/mame/drivers/stactics.c @@ -307,7 +307,7 @@ static MACHINE_DRIVER_START( stactics ) MDRV_DRIVER_DATA(stactics_state) /* basic machine hardware */ - MDRV_CPU_ADD("maincpu", 8080, 1933560) + MDRV_CPU_ADD("maincpu", I8080, 1933560) MDRV_CPU_PROGRAM_MAP(main_map) MDRV_CPU_VBLANK_INT("screen", stactics_interrupt) diff --git a/src/mame/drivers/starcrus.c b/src/mame/drivers/starcrus.c index aa6fd30e502..39f34ea09fc 100644 --- a/src/mame/drivers/starcrus.c +++ b/src/mame/drivers/starcrus.c @@ -153,7 +153,7 @@ static const samples_interface starcrus_samples_interface = static MACHINE_DRIVER_START( starcrus ) /* basic machine hardware */ - MDRV_CPU_ADD("maincpu", 8080,9750000/9) /* 8224 chip is a divide by 9 */ + MDRV_CPU_ADD("maincpu", I8080,9750000/9) /* 8224 chip is a divide by 9 */ MDRV_CPU_PROGRAM_MAP(starcrus_map) MDRV_CPU_IO_MAP(starcrus_io_map) MDRV_CPU_VBLANK_INT("screen", irq0_line_hold) diff --git a/src/mame/drivers/statriv2.c b/src/mame/drivers/statriv2.c index 5135a22e2d0..26ab35d3f7c 100644 --- a/src/mame/drivers/statriv2.c +++ b/src/mame/drivers/statriv2.c @@ -568,7 +568,7 @@ static const tms9927_interface tms9927_intf = static MACHINE_DRIVER_START( statriv2 ) /* basic machine hardware */ /* FIXME: The 8085A had a max clock of 6MHz, internally divided by 2! */ - MDRV_CPU_ADD("maincpu", 8085A, MASTER_CLOCK) + MDRV_CPU_ADD("maincpu", I8085A, MASTER_CLOCK) MDRV_CPU_PROGRAM_MAP(statriv2_map) MDRV_CPU_IO_MAP(statriv2_io_map) MDRV_CPU_VBLANK_INT("screen", statriv2_interrupt) diff --git a/src/mame/drivers/tiamc1.c b/src/mame/drivers/tiamc1.c index ddf2aeabdbd..dc7844a965c 100644 --- a/src/mame/drivers/tiamc1.c +++ b/src/mame/drivers/tiamc1.c @@ -220,7 +220,7 @@ GFXDECODE_END static MACHINE_DRIVER_START( tiamc1 ) /* basic machine hardware */ - MDRV_CPU_ADD("maincpu", 8080,16000000/9) /* 16 MHz */ + MDRV_CPU_ADD("maincpu", I8080,16000000/9) /* 16 MHz */ MDRV_CPU_PROGRAM_MAP(tiamc1_map) MDRV_CPU_IO_MAP(tiamc1_io_map) diff --git a/src/mame/drivers/vicdual.c b/src/mame/drivers/vicdual.c index 5f21fe68713..44e0f727e0b 100644 --- a/src/mame/drivers/vicdual.c +++ b/src/mame/drivers/vicdual.c @@ -307,7 +307,7 @@ static MACHINE_DRIVER_START( depthch ) /* basic machine hardware */ MDRV_IMPORT_FROM(vicdual_root) - MDRV_CPU_REPLACE("maincpu", 8080, VICDUAL_MAIN_CPU_CLOCK) + MDRV_CPU_REPLACE("maincpu", I8080, VICDUAL_MAIN_CPU_CLOCK) MDRV_CPU_PROGRAM_MAP(depthch_map) MDRV_CPU_IO_MAP(depthch_io_map) diff --git a/src/mame/drivers/warpwarp.c b/src/mame/drivers/warpwarp.c index 08d38a0fae2..ded959f0ede 100644 --- a/src/mame/drivers/warpwarp.c +++ b/src/mame/drivers/warpwarp.c @@ -725,7 +725,7 @@ GFXDECODE_END static MACHINE_DRIVER_START( geebee ) /* basic machine hardware */ - MDRV_CPU_ADD("maincpu", 8080, MASTER_CLOCK/9) /* verified on pcb */ + MDRV_CPU_ADD("maincpu", I8080, MASTER_CLOCK/9) /* verified on pcb */ MDRV_CPU_PROGRAM_MAP(geebee_map) MDRV_CPU_IO_MAP(geebee_port_map) MDRV_CPU_VBLANK_INT("screen", irq0_line_hold) @@ -765,7 +765,7 @@ MACHINE_DRIVER_END static MACHINE_DRIVER_START( bombbee ) /* basic machine hardware */ - MDRV_CPU_ADD("maincpu", 8080, MASTER_CLOCK/9) /* 18.432 MHz / 9 */ + MDRV_CPU_ADD("maincpu", I8080, MASTER_CLOCK/9) /* 18.432 MHz / 9 */ MDRV_CPU_PROGRAM_MAP(bombbee_map) MDRV_CPU_VBLANK_INT("screen", irq0_line_assert) diff --git a/src/mame/drivers/wldarrow.c b/src/mame/drivers/wldarrow.c index d3c4c75ae50..4e09d9adad6 100644 --- a/src/mame/drivers/wldarrow.c +++ b/src/mame/drivers/wldarrow.c @@ -347,7 +347,7 @@ INPUT_PORTS_END static MACHINE_DRIVER_START( wldarrow ) /* basic machine hardware */ - MDRV_CPU_ADD("maincpu", 8080, 2000000) + MDRV_CPU_ADD("maincpu", I8080, 2000000) MDRV_CPU_PROGRAM_MAP(wldarrow_map) MDRV_NVRAM_HANDLER(generic_0fill) diff --git a/src/mame/includes/snes.h b/src/mame/includes/snes.h index 403e7f65b8b..0f3a4863ba7 100644 --- a/src/mame/includes/snes.h +++ b/src/mame/includes/snes.h @@ -4,6 +4,9 @@ #include "devlegcy.h" #include "devcb.h" #include "streams.h" +#include "cpu/spc700/spc700.h" +#include "cpu/g65816/g65816.h" +#include "audio/snes_snd.h" /* SNES timing theory: @@ -457,9 +460,9 @@ public: snes_cart_info cart[2]; // the second one is used by MESS for Sufami Turbo and, eventually, BS-X /* devices */ - cpu_device *maincpu; - cpu_device *soundcpu; - cpu_device *spc700; + _5a22_device *maincpu; + spc700_device *soundcpu; + snes_sound_sound_device *spc700; cpu_device *superfx; }; diff --git a/src/mame/machine/leland.c b/src/mame/machine/leland.c index fcbe8921faf..0c3b356455c 100644 --- a/src/mame/machine/leland.c +++ b/src/mame/machine/leland.c @@ -407,7 +407,8 @@ MACHINE_RESET( leland ) memory_set_bankptr(machine, "bank3", &slave_base[0x10000]); /* if we have an I80186 CPU, reset it */ - if (devtag_get_device(machine, "audiocpu") != NULL && cpu_get_type(devtag_get_device(machine, "audiocpu")) == CPU_I80186) + device_t *audiocpu = machine->device("audiocpu"); + if (audiocpu != NULL && audiocpu->type() == I80186) leland_80186_sound_init(); } diff --git a/src/mame/machine/namcos1.c b/src/mame/machine/namcos1.c index f5c16f23e0e..a783857c433 100644 --- a/src/mame/machine/namcos1.c +++ b/src/mame/machine/namcos1.c @@ -596,7 +596,13 @@ WRITE8_HANDLER( namcos1_cpu_control_w ) WRITE8_HANDLER( namcos1_watchdog_w ) { - wdog |= 1 << cpu_get_index(space->cpu); + if (space->cpu == space->machine->device("maincpu")) + wdog |= 1; + else if (space->cpu == space->machine->device("sub")) + wdog |= 2; + else if (space->cpu == space->machine->device("audiocpu")) + wdog |= 4; + if (wdog == 7 || !namcos1_reset) { wdog = 0; diff --git a/src/mame/machine/slapstic.c b/src/mame/machine/slapstic.c index 827392687b9..a7e3240f979 100644 --- a/src/mame/machine/slapstic.c +++ b/src/mame/machine/slapstic.c @@ -807,7 +807,7 @@ static FILE *slapsticlog; void slapstic_init(running_machine *machine, int chip) { - cpu_type cputype = cpu_get_type(devtag_get_device(machine, "maincpu")); + device_type cputype = machine->device("maincpu")->type(); /* only a small number of chips are known to exist */ if (chip < 101 || chip > 118) @@ -822,7 +822,7 @@ void slapstic_init(running_machine *machine, int chip) slapstic_reset(); /* see if we're 68k or 6502/6809 based */ - access_68k = (cputype == CPU_M68000 || cputype == CPU_M68010); + access_68k = (cputype == M68000 || cputype == M68010); /* save state */ state_save_register_item(machine, "slapstic", NULL, 0, state); diff --git a/src/mame/machine/snes.c b/src/mame/machine/snes.c index 349b9c34875..2346c7d3fcc 100644 --- a/src/mame/machine/snes.c +++ b/src/mame/machine/snes.c @@ -1697,9 +1697,9 @@ MACHINE_START( snes ) memory_set_direct_update_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), snes_direct); memory_set_direct_update_handler(cputag_get_address_space(machine, "soundcpu", ADDRESS_SPACE_PROGRAM), spc_direct); - state->maincpu = machine->device<cpu_device>("maincpu"); - state->soundcpu = machine->device<cpu_device>("soundcpu"); - state->spc700 = machine->device<cpu_device>("spc700"); + state->maincpu = machine->device<_5a22_device>("maincpu"); + state->soundcpu = machine->device<spc700_device>("soundcpu"); + state->spc700 = machine->device<snes_sound_sound_device>("spc700"); state->superfx = machine->device<cpu_device>("superfx"); // power-on sets these registers like this diff --git a/src/mame/machine/tnzs.c b/src/mame/machine/tnzs.c index d7f55e8c40f..88f57c81470 100644 --- a/src/mame/machine/tnzs.c +++ b/src/mame/machine/tnzs.c @@ -773,7 +773,7 @@ WRITE8_HANDLER( tnzs_bankswitch1_w ) /* bit 2 resets the mcu */ if (data & 0x04) { - if (state->mcu != NULL && cpu_get_type(state->mcu) == CPU_I8742) + if (state->mcu != NULL && state->mcu->type() == I8742) cpu_set_input_line(state->mcu, INPUT_LINE_RESET, PULSE_LINE); } /* Coin count and lockout is handled by the i8742 */ diff --git a/src/mame/machine/toaplan1.c b/src/mame/machine/toaplan1.c index c5dd2eee6c5..a3836d8621e 100644 --- a/src/mame/machine/toaplan1.c +++ b/src/mame/machine/toaplan1.c @@ -302,8 +302,9 @@ WRITE16_HANDLER( toaplan1_reset_sound ) { logerror("PC:%04x Resetting Sound CPU and Sound chip (%08x)\n", cpu_get_previouspc(space->cpu), data); devtag_reset(space->machine, "ymsnd"); - if (devtag_get_device(space->machine, "audiocpu") != NULL && cpu_get_type(devtag_get_device(space->machine, "audiocpu")) == CPU_Z80) - cputag_set_input_line(space->machine, "audiocpu", INPUT_LINE_RESET, PULSE_LINE); + device_t *audiocpu = space->machine->device("audiocpu"); + if (audiocpu != NULL && audiocpu->type() == Z80) + cpu_set_input_line(audiocpu, INPUT_LINE_RESET, PULSE_LINE); } } diff --git a/src/osd/windows/winmain.c b/src/osd/windows/winmain.c index 885ed31ee87..ae0ba8735ab 100644 --- a/src/osd/windows/winmain.c +++ b/src/osd/windows/winmain.c @@ -389,7 +389,8 @@ int main(int argc, char *argv[]) InitCommonControls(); // allocate symbols - symbols = global_alloc(symbol_manager(argv[0])); + symbol_manager local_symbols(argv[0]); + symbols = &local_symbols; // set up exception handling pass_thru_filter = SetUnhandledExceptionFilter(exception_filter); @@ -409,7 +410,7 @@ int main(int argc, char *argv[]) DWORD result = cli_execute(argc, argv, mame_win_options); // free symbols - global_free(symbols); + symbols = NULL; return result; } |