summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatarGravatar Aaron Giles <aaron@aarongiles.com>2010-06-08 06:09:57 +0000
committerGravatarGravatar Aaron Giles <aaron@aarongiles.com>2010-06-08 06:09:57 +0000
commit100564d41225bfd2fa163c0174557ed979285b4e (patch)
tree0be83fbde1ddb95633293c9faee60d0f2bc6ace1
parent962dca9f57d61cdea65ee32c6362bf3d0d1e2dae (diff)
downloadmame-100564d41225bfd2fa163c0174557ed979285b4e.tar.xz
mame-100564d41225bfd2fa163c0174557ed979285b4e.zip
WARNING: There are likely to be regressions in both functionality and
performance as a result of this change. Do not panic; report issues to the list in the short term and I will look into them. There are probably also some details I forgot to mention. Please ask questions if anything is not clear. NOTE: This is a major internal change to the way devices are handled in MAME. There is a small impact on drivers, but the bulk of the changes are to the devices themselves. Full documentation on the new device handling is in progress at http://mamedev.org/devwiki/index.php/MAME_Device_Basics Defined two new casting helpers: [Aaron Giles] downcast<type>(value) should be used for safe and efficient downcasting from a base class to a derived class. It wraps static_cast<> by adding an assert that a matching dynamic_cast<> returns the same result in debug builds. crosscast<type>(value) should be used for safe casting from one type to another in multiple inheritance scenarios. It compiles to a dynamic_cast<> plus an assert on the result. Since it does not optimize down to static_cast<>, you should prefer downcast<> over crosscast<> when you can. Redefined running_device to be a proper C++ class (now called device_t). Same for device_config (still called device_config). All devices and device_configs must now be derived from these base classes. This means each device type now has a pair of its own unique classes that describe the device. Drivers are encouraged to use the specific device types instead of the generic running_device or device_t classes. Drivers that have a state class defined in their header file are encouraged to use initializers off the constructor to locate devices. [Aaron Giles] Removed the following fields from the device and device configuration classes as they never were necessary or provided any use: device class, device family, source file, version, credits. [Aaron Giles] Added templatized variant of machine->device() which performs a downcast as part of the device fetch. Thus machine->device<timer_device>("timer") will locate a device named "timer", downcast it to a timer_device, and assert if the downcast fails. [Aaron Giles] Removed most publically accessible members of running_device/device_t in favor of inline accessor functions. The only remaining public member is machine. Thus all references to device->type are now device->type(), etc. [Aaron Giles] Created a number of device interface classes which are designed to be mix- ins for the device classes, providing specific extended functionality and information. There are standard interface classes for sound, execution, state, nvram, memory, and disassembly. Devices can opt into 0 or more of these classes. [Aaron Giles] Converted the classic CPU device to a standard device that uses the execution, state, memory, and disassembly interfaces. Used this new class (cpu_device) to implement the existing CPU device interface. In the future it will be possible to convert each CPU core to its own device type, but for now they are still all CPU devices with a cpu_type() that specifies exactly which kind of CPU. [Aaron Giles] Created a new header devlegcy.h which wraps the old device interface using some special template classes. To use these with an existing device, simply remove from the device header the DEVICE_GET_INFO() declaration and the #define mapping the ALL_CAPS name to the DEVICE_GET_INFO. In their place #include "devlegcy.h" and use the DECLARE_LEGACY_DEVICE() macro. In addition, there is a DECLARE_LEGACY_SOUND_DEVICE() macro for wrapping existing sound devices into new-style devices, and a DECLARE_LEGACY_NVRAM_DEVICE() for wrapping NVRAM devices. Also moved the token and inline_config members to the legacy device class, as these are not used in modern devices. [Aaron Giles] Converted the standard base devices (VIDEO_SCREEN, SPEAKER, and TIMER) from legacy devices to the new C++ style. Also renamed VIDEO_SCREEN to simply SCREEN. The various global functions that were previously used to access information or modify the state of these devices are now replaced by methods on the device classes. Specifically: video_screen_configure() == screen->configure() video_screen_set_visarea() == screen->set_visible_area() video_screen_update_partial() == screen->update_partial() video_screen_update_now() == screen->update_now() video_screen_get_vpos() == screen->vpos() video_screen_get_hpos() == screen->hpos() video_screen_get_vblank() == screen->vblank() video_screen_get_hblank() == screen->hblank() video_screen_get_width() == screen->width() video_screen_get_height() == screen->height() video_screen_get_visible_area() == screen->visible_area() video_screen_get_time_until_pos() == screen->time_until_pos() video_screen_get_time_until_vblank_start() == screen->time_until_vblank_start() video_screen_get_time_until_vblank_end() == screen->time_until_vblank_end() video_screen_get_time_until_update() == screen->time_until_update() video_screen_get_scan_period() == screen->scan_period() video_screen_get_frame_period() == screen->frame_period() video_screen_get_frame_number() == screen->frame_number() timer_device_adjust_oneshot() == timer->adjust() timer_device_adjust_periodic() == timer->adjust() timer_device_reset() == timer->reset() timer_device_enable() == timer->enable() timer_device_enabled() == timer->enabled() timer_device_get_param() == timer->param() timer_device_set_param() == timer->set_param() timer_device_get_ptr() == timer->get_ptr() timer_device_set_ptr() == timer->set_ptr() timer_device_timeelapsed() == timer->time_elapsed() timer_device_timeleft() == timer->time_left() timer_device_starttime() == timer->start_time() timer_device_firetime() == timer->fire_time() Updated all drivers that use the above functions to fetch the specific device type (timer_device or screen_device) and call the appropriate method. [Aaron Giles] Changed machine->primary_screen and the 'screen' parameter to VIDEO_UPDATE to specifically pass in a screen_device object. [Aaron Giles] Defined a new custom interface for the Z80 daisy chain. This interface behaves like the standard interfaces, and can be added to any device that implements the Z80 daisy chain behavior. Converted all existing Z80 daisy chain devices to new-style devices that inherit this interface. [Aaron Giles] Changed the way CPU state tables are built up. Previously, these were data structures defined by a CPU core which described all the registers and how to output them. This functionality is now part of the state interface and is implemented via the device_state_entry class. Updated all CPU cores which were using the old data structure to use the new form. The syntax is currently awkward, but will be cleaner for CPUs that are native new devices. [Aaron Giles] Converted the okim6295 and eeprom devices to the new model. These were necessary because they both require multiple interfaces to operate and it didn't make sense to create legacy device templates for these single cases. (okim6295 needs the sound interface and the memory interface, while eeprom requires both the nvram and memory interfaces). [Aaron Giles] Changed parameters in a few callback functions from pointers to references in situations where they are guaranteed to never be NULL. [Aaron Giles] Removed MDRV_CPU_FLAGS() which was only used for disabling a CPU. Changed it to MDRV_DEVICE_DISABLE() instead. Updated drivers. [Aaron Giles] Reorganized the token parsing for machine configurations. The core parsing code knows how to create/replace/remove devices, but all device token parsing is now handled in the device_config class, which in turn will make use of any interface classes or device-specific token handling for custom token processing. [Aaron Giles] Moved many validity checks out of validity.c and into the device interface classes. For example, address space validation is now part of the memory interface class. [Aaron Giles] Consolidated address space parameters (bus width, endianness, etc.) into a single address_space_config class. Updated all code that queried for address space parameters to use the new mechanism. [Aaron Giles]
-rw-r--r--.gitattributes21
-rw-r--r--src/emu/audit.c14
-rw-r--r--src/emu/clifront.c39
-rw-r--r--src/emu/cpu/adsp2100/adsp2100.c280
-rw-r--r--src/emu/cpu/adsp2100/adsp2100.h6
-rw-r--r--src/emu/cpu/alph8201/alph8201.c9
-rw-r--r--src/emu/cpu/am29000/am29000.c13
-rw-r--r--src/emu/cpu/apexc/apexc.c11
-rw-r--r--src/emu/cpu/arm/arm.c15
-rw-r--r--src/emu/cpu/arm7/arm7.c11
-rw-r--r--src/emu/cpu/arm7/arm7core.c4
-rw-r--r--src/emu/cpu/arm7/arm7core.h2
-rw-r--r--src/emu/cpu/asap/asap.c11
-rw-r--r--src/emu/cpu/avr8/avr8.c11
-rw-r--r--src/emu/cpu/ccpu/ccpu.c15
-rw-r--r--src/emu/cpu/cdp1802/cdp1802.c182
-rw-r--r--src/emu/cpu/cdp1802/cdp1802.h2
-rw-r--r--src/emu/cpu/cop400/cop400.c213
-rw-r--r--src/emu/cpu/cop400/cop400.h6
-rw-r--r--src/emu/cpu/cp1610/cp1610.c11
-rw-r--r--src/emu/cpu/cubeqcpu/cubeqcpu.c33
-rw-r--r--src/emu/cpu/drcbec.c2
-rw-r--r--src/emu/cpu/drcbex64.c2
-rw-r--r--src/emu/cpu/drcbex86.c2
-rw-r--r--src/emu/cpu/drcfe.c18
-rw-r--r--src/emu/cpu/drcuml.c5
-rw-r--r--src/emu/cpu/dsp32/dsp32.c11
-rw-r--r--src/emu/cpu/dsp56k/dsp56def.h5
-rw-r--r--src/emu/cpu/dsp56k/dsp56k.c8
-rw-r--r--src/emu/cpu/dsp56k/dsp56mem.c4
-rw-r--r--src/emu/cpu/e132xs/e132xs.c25
-rw-r--r--src/emu/cpu/esrip/esrip.c13
-rw-r--r--src/emu/cpu/f8/f8.c19
-rw-r--r--src/emu/cpu/g65816/g65816.c11
-rw-r--r--src/emu/cpu/g65816/g65816cm.h2
-rw-r--r--src/emu/cpu/g65816/g65816op.h12
-rw-r--r--src/emu/cpu/h6280/h6280.c25
-rw-r--r--src/emu/cpu/h6280/h6280.h2
-rw-r--r--src/emu/cpu/h83002/h8_16.c18
-rw-r--r--src/emu/cpu/h83002/h8_8.c10
-rw-r--r--src/emu/cpu/h83002/h8priv.h7
-rw-r--r--src/emu/cpu/hd6309/hd6309.c11
-rw-r--r--src/emu/cpu/i386/i386.c36
-rw-r--r--src/emu/cpu/i386/i386priv.h7
-rw-r--r--src/emu/cpu/i4004/i4004.c113
-rw-r--r--src/emu/cpu/i4004/i4004.h6
-rw-r--r--src/emu/cpu/i8008/i8008.c120
-rw-r--r--src/emu/cpu/i8008/i8008.h6
-rw-r--r--src/emu/cpu/i8085/i8085.c131
-rw-r--r--src/emu/cpu/i8085/i8085.h6
-rw-r--r--src/emu/cpu/i86/i286.c17
-rw-r--r--src/emu/cpu/i86/i86.c159
-rw-r--r--src/emu/cpu/i86/i86.h6
-rw-r--r--src/emu/cpu/i860/i860.c4
-rw-r--r--src/emu/cpu/i860/i860.h5
-rw-r--r--src/emu/cpu/i960/i960.c11
-rw-r--r--src/emu/cpu/jaguar/jaguar.c17
-rw-r--r--src/emu/cpu/konami/konami.c11
-rw-r--r--src/emu/cpu/lh5801/lh5801.c11
-rw-r--r--src/emu/cpu/lr35902/lr35902.c13
-rw-r--r--src/emu/cpu/m37710/m37710.c12
-rw-r--r--src/emu/cpu/m37710/m37710cm.h7
-rw-r--r--src/emu/cpu/m37710/m37710op.h2
-rw-r--r--src/emu/cpu/m6502/m4510.c13
-rw-r--r--src/emu/cpu/m6502/m6502.c19
-rw-r--r--src/emu/cpu/m6502/m6509.c21
-rw-r--r--src/emu/cpu/m6502/m65ce02.c13
-rw-r--r--src/emu/cpu/m6800/m6800.c57
-rw-r--r--src/emu/cpu/m68000/m68000.h6
-rw-r--r--src/emu/cpu/m68000/m68kcpu.c309
-rw-r--r--src/emu/cpu/m68000/m68kcpu.h3
-rw-r--r--src/emu/cpu/m6805/m6805.c19
-rw-r--r--src/emu/cpu/m6809/6809dasm.c2
-rw-r--r--src/emu/cpu/m6809/m6809.c13
-rw-r--r--src/emu/cpu/mb86233/mb86233.c11
-rw-r--r--src/emu/cpu/mb88xx/mb88xx.c23
-rw-r--r--src/emu/cpu/mc68hc11/mc68hc11.c15
-rw-r--r--src/emu/cpu/mcs48/mcs48.c145
-rw-r--r--src/emu/cpu/mcs48/mcs48.h6
-rw-r--r--src/emu/cpu/mcs51/mcs51.c17
-rw-r--r--src/emu/cpu/minx/minx.c25
-rw-r--r--src/emu/cpu/mips/mips3com.c8
-rw-r--r--src/emu/cpu/mips/mips3com.h4
-rw-r--r--src/emu/cpu/mips/mips3drc.c11
-rw-r--r--src/emu/cpu/mips/psx.c13
-rw-r--r--src/emu/cpu/mips/r3000.c13
-rw-r--r--src/emu/cpu/mn10200/mn10200.c13
-rw-r--r--src/emu/cpu/nec/nec.c17
-rw-r--r--src/emu/cpu/pdp1/pdp1.c11
-rw-r--r--src/emu/cpu/pdp1/tx0.c15
-rw-r--r--src/emu/cpu/pic16c5x/pic16c5x.c13
-rw-r--r--src/emu/cpu/pic16c62x/pic16c62x.c13
-rw-r--r--src/emu/cpu/powerpc/ppc.c26
-rw-r--r--src/emu/cpu/powerpc/ppccom.c22
-rw-r--r--src/emu/cpu/powerpc/ppccom.h4
-rw-r--r--src/emu/cpu/powerpc/ppcdrc.c15
-rw-r--r--src/emu/cpu/rsp/rsp.c11
-rw-r--r--src/emu/cpu/rsp/rsp.h2
-rw-r--r--src/emu/cpu/rsp/rspdrc.c15
-rw-r--r--src/emu/cpu/s2650/s2650.c17
-rw-r--r--src/emu/cpu/saturn/saturn.c13
-rw-r--r--src/emu/cpu/sc61860/sc61860.c11
-rw-r--r--src/emu/cpu/scmp/scmp.c93
-rw-r--r--src/emu/cpu/scmp/scmp.h6
-rw-r--r--src/emu/cpu/se3208/se3208.c15
-rw-r--r--src/emu/cpu/sh2/sh2.c2
-rw-r--r--src/emu/cpu/sh2/sh2comn.c12
-rw-r--r--src/emu/cpu/sh2/sh2comn.h4
-rw-r--r--src/emu/cpu/sh2/sh2drc.c11
-rw-r--r--src/emu/cpu/sh4/sh4.c23
-rw-r--r--src/emu/cpu/sh4/sh4comn.c5
-rw-r--r--src/emu/cpu/sh4/sh4comn.h2
-rw-r--r--src/emu/cpu/sharc/sharc.c15
-rw-r--r--src/emu/cpu/sm8500/sm8500.c29
-rw-r--r--src/emu/cpu/spc700/spc700.c11
-rw-r--r--src/emu/cpu/ssem/ssem.c9
-rw-r--r--src/emu/cpu/ssp1601/ssp1601.c11
-rw-r--r--src/emu/cpu/superfx/superfx.c13
-rw-r--r--src/emu/cpu/t11/t11.c13
-rw-r--r--src/emu/cpu/tlcs90/tlcs90.c13
-rw-r--r--src/emu/cpu/tlcs900/tlcs900.c13
-rw-r--r--src/emu/cpu/tms0980/tms0980.c19
-rw-r--r--src/emu/cpu/tms32010/tms32010.c13
-rw-r--r--src/emu/cpu/tms32025/tms32025.c15
-rw-r--r--src/emu/cpu/tms32031/tms32031.c13
-rw-r--r--src/emu/cpu/tms32051/tms32051.c13
-rw-r--r--src/emu/cpu/tms34010/34010gfx.c18
-rw-r--r--src/emu/cpu/tms34010/tms34010.c202
-rw-r--r--src/emu/cpu/tms34010/tms34010.h8
-rw-r--r--src/emu/cpu/tms57002/tms57002.c11
-rw-r--r--src/emu/cpu/tms7000/tms7000.c13
-rw-r--r--src/emu/cpu/tms9900/99xxcore.h15
-rw-r--r--src/emu/cpu/unsp/unsp.c9
-rw-r--r--src/emu/cpu/upd7810/upd7810.c21
-rw-r--r--src/emu/cpu/v30mz/v30mz.c21
-rw-r--r--src/emu/cpu/v60/v60.c19
-rw-r--r--src/emu/cpu/v810/v810.c13
-rw-r--r--src/emu/cpu/vtlb.c23
-rw-r--r--src/emu/cpu/z180/z180.c352
-rw-r--r--src/emu/cpu/z180/z180.h6
-rw-r--r--src/emu/cpu/z180/z180op.c4
-rw-r--r--src/emu/cpu/z180/z180ops.h3
-rw-r--r--src/emu/cpu/z8/z8.c114
-rw-r--r--src/emu/cpu/z8/z8.h4
-rw-r--r--src/emu/cpu/z80/z80.c198
-rw-r--r--src/emu/cpu/z80/z80.h6
-rw-r--r--src/emu/cpu/z80/z80daisy.c184
-rw-r--r--src/emu/cpu/z80/z80daisy.h97
-rw-r--r--src/emu/cpu/z8000/z8000.c29
-rw-r--r--src/emu/cpuexec.c1998
-rw-r--r--src/emu/cpuexec.h347
-rw-r--r--src/emu/cpuintrf.h429
-rw-r--r--src/emu/crsshair.c22
-rw-r--r--src/emu/crsshair.h8
-rw-r--r--src/emu/debug/debugcmd.c119
-rw-r--r--src/emu/debug/debugcmd.h2
-rw-r--r--src/emu/debug/debugcmt.c25
-rw-r--r--src/emu/debug/debugcmt.h14
-rw-r--r--src/emu/debug/debugcpu.c686
-rw-r--r--src/emu/debug/debugcpu.h44
-rw-r--r--src/emu/debug/debugvw.c325
-rw-r--r--src/emu/debug/debugvw.h6
-rw-r--r--src/emu/debugger.h10
-rw-r--r--src/emu/debugint/debugint.c5
-rw-r--r--src/emu/deprecat.h8
-rw-r--r--src/emu/devcb.c108
-rw-r--r--src/emu/devcb.h24
-rw-r--r--src/emu/devconv.h72
-rw-r--r--src/emu/devcpu.c550
-rw-r--r--src/emu/devcpu.h557
-rw-r--r--src/emu/devintrf.c1071
-rw-r--r--src/emu/devintrf.h785
-rw-r--r--src/emu/devlegcy.c332
-rw-r--r--src/emu/devlegcy.h583
-rw-r--r--src/emu/devtempl.h48
-rw-r--r--src/emu/didisasm.c88
-rw-r--r--src/emu/didisasm.h125
-rw-r--r--src/emu/diexec.c1000
-rw-r--r--src/emu/diexec.h519
-rw-r--r--src/emu/dimemory.c368
-rw-r--r--src/emu/dimemory.h292
-rw-r--r--src/emu/dinvram.c89
-rw-r--r--src/emu/dinvram.h97
-rw-r--r--src/emu/disound.c226
-rw-r--r--src/emu/disound.h161
-rw-r--r--src/emu/distate.c630
-rw-r--r--src/emu/distate.h229
-rw-r--r--src/emu/emu.h13
-rw-r--r--src/emu/emu.mak10
-rw-r--r--src/emu/emualloc.c3
-rw-r--r--src/emu/emucore.h181
-rw-r--r--src/emu/emupal.c11
-rw-r--r--src/emu/info.c75
-rw-r--r--src/emu/inptport.c36
-rw-r--r--src/emu/inptport.h4
-rw-r--r--src/emu/machine/6522via.c17
-rw-r--r--src/emu/machine/6522via.h5
-rw-r--r--src/emu/machine/6526cia.c29
-rw-r--r--src/emu/machine/6526cia.h10
-rw-r--r--src/emu/machine/6532riot.c20
-rw-r--r--src/emu/machine/6532riot.h5
-rw-r--r--src/emu/machine/6821pia.c8
-rw-r--r--src/emu/machine/6821pia.h19
-rw-r--r--src/emu/machine/6840ptm.c11
-rw-r--r--src/emu/machine/6840ptm.h7
-rw-r--r--src/emu/machine/6850acia.c9
-rw-r--r--src/emu/machine/6850acia.h6
-rw-r--r--src/emu/machine/68681.c14
-rw-r--r--src/emu/machine/68681.h5
-rw-r--r--src/emu/machine/74123.c8
-rw-r--r--src/emu/machine/74123.h7
-rw-r--r--src/emu/machine/74148.c7
-rw-r--r--src/emu/machine/74148.h6
-rw-r--r--src/emu/machine/74153.c7
-rw-r--r--src/emu/machine/74153.h6
-rw-r--r--src/emu/machine/7474.c7
-rw-r--r--src/emu/machine/7474.h6
-rw-r--r--src/emu/machine/8237dma.c12
-rw-r--r--src/emu/machine/8237dma.h6
-rw-r--r--src/emu/machine/8255ppi.c8
-rw-r--r--src/emu/machine/8255ppi.h6
-rw-r--r--src/emu/machine/8257dma.c10
-rw-r--r--src/emu/machine/8257dma.h6
-rw-r--r--src/emu/machine/adc083x.c34
-rw-r--r--src/emu/machine/adc083x.h16
-rw-r--r--src/emu/machine/adc1038.c10
-rw-r--r--src/emu/machine/adc1038.h11
-rw-r--r--src/emu/machine/adc1213x.c10
-rw-r--r--src/emu/machine/adc1213x.h13
-rw-r--r--src/emu/machine/at28c16.c12
-rw-r--r--src/emu/machine/at28c16.h5
-rw-r--r--src/emu/machine/cdp1852.c14
-rw-r--r--src/emu/machine/cdp1852.h7
-rw-r--r--src/emu/machine/ds1302.c6
-rw-r--r--src/emu/machine/ds1302.h7
-rw-r--r--src/emu/machine/ds2404.c7
-rw-r--r--src/emu/machine/ds2404.h5
-rw-r--r--src/emu/machine/eeprom.c750
-rw-r--r--src/emu/machine/eeprom.h194
-rw-r--r--src/emu/machine/f3853.c10
-rw-r--r--src/emu/machine/f3853.h7
-rw-r--r--src/emu/machine/generic.c108
-rw-r--r--src/emu/machine/i2cmemdev.c12
-rw-r--r--src/emu/machine/i2cmemdev.h5
-rw-r--r--src/emu/machine/i8243.c9
-rw-r--r--src/emu/machine/i8243.h5
-rw-r--r--src/emu/machine/i8255a.c8
-rw-r--r--src/emu/machine/i8255a.h6
-rw-r--r--src/emu/machine/idectrl.c18
-rw-r--r--src/emu/machine/idectrl.h6
-rw-r--r--src/emu/machine/ins8154.c7
-rw-r--r--src/emu/machine/ins8154.h7
-rw-r--r--src/emu/machine/ins8250.c18
-rw-r--r--src/emu/machine/ins8250.h22
-rw-r--r--src/emu/machine/k033906.c10
-rw-r--r--src/emu/machine/k033906.h10
-rw-r--r--src/emu/machine/k056230.c10
-rw-r--r--src/emu/machine/k056230.h10
-rw-r--r--src/emu/machine/laserdsc.h6
-rw-r--r--src/emu/machine/latch8.c8
-rw-r--r--src/emu/machine/latch8.h7
-rw-r--r--src/emu/machine/ldcore.c42
-rw-r--r--src/emu/machine/ldcore.h4
-rw-r--r--src/emu/machine/ldpr8210.c56
-rw-r--r--src/emu/machine/ldv1000.c40
-rw-r--r--src/emu/machine/ldvp931.c40
-rw-r--r--src/emu/machine/mb14241.c6
-rw-r--r--src/emu/machine/mb14241.h9
-rw-r--r--src/emu/machine/mb3773.c6
-rw-r--r--src/emu/machine/mb3773.h7
-rw-r--r--src/emu/machine/mb87078.c10
-rw-r--r--src/emu/machine/mb87078.h10
-rw-r--r--src/emu/machine/msm6242.c6
-rw-r--r--src/emu/machine/msm6242.h7
-rw-r--r--src/emu/machine/pci.c12
-rw-r--r--src/emu/machine/pci.h6
-rw-r--r--src/emu/machine/pd4990a.c6
-rw-r--r--src/emu/machine/pd4990a.h7
-rw-r--r--src/emu/machine/pic8259.c8
-rw-r--r--src/emu/machine/pic8259.h4
-rw-r--r--src/emu/machine/pit8253.c8
-rw-r--r--src/emu/machine/pit8253.h11
-rw-r--r--src/emu/machine/rp5h01.c11
-rw-r--r--src/emu/machine/rp5h01.h7
-rw-r--r--src/emu/machine/rtc65271.c7
-rw-r--r--src/emu/machine/rtc65271.h11
-rw-r--r--src/emu/machine/smc91c9x.c12
-rw-r--r--src/emu/machine/smc91c9x.h9
-rw-r--r--src/emu/machine/timekpr.c32
-rw-r--r--src/emu/machine/timekpr.h14
-rw-r--r--src/emu/machine/tms6100.c9
-rw-r--r--src/emu/machine/tms6100.h8
-rw-r--r--src/emu/machine/upd4701.c6
-rw-r--r--src/emu/machine/upd4701.h7
-rw-r--r--src/emu/machine/x2212.c11
-rw-r--r--src/emu/machine/x2212.h5
-rw-r--r--src/emu/machine/z80ctc.c781
-rw-r--r--src/emu/machine/z80ctc.h176
-rw-r--r--src/emu/machine/z80dart.c1754
-rw-r--r--src/emu/machine/z80dart.h286
-rw-r--r--src/emu/machine/z80dma.c1090
-rw-r--r--src/emu/machine/z80dma.h173
-rw-r--r--src/emu/machine/z80pio.c1273
-rw-r--r--src/emu/machine/z80pio.h190
-rw-r--r--src/emu/machine/z80sio.c1227
-rw-r--r--src/emu/machine/z80sio.h185
-rw-r--r--src/emu/machine/z80sti.c956
-rw-r--r--src/emu/machine/z80sti.h199
-rw-r--r--src/emu/mame.c83
-rw-r--r--src/emu/mame.h30
-rw-r--r--src/emu/mconfig.c111
-rw-r--r--src/emu/mconfig.h167
-rw-r--r--src/emu/memory.c215
-rw-r--r--src/emu/memory.h52
-rw-r--r--src/emu/profiler.c6
-rw-r--r--src/emu/profiler.h4
-rw-r--r--src/emu/render.c48
-rw-r--r--src/emu/render.h10
-rw-r--r--src/emu/rendfont.c7
-rw-r--r--src/emu/rendlay.c48
-rw-r--r--src/emu/rendutil.c2
-rw-r--r--src/emu/romload.c53
-rw-r--r--src/emu/schedule.c413
-rw-r--r--src/emu/schedule.h104
-rw-r--r--src/emu/sound.c771
-rw-r--r--src/emu/sound.h249
-rw-r--r--src/emu/sound/2151intf.c12
-rw-r--r--src/emu/sound/2151intf.h5
-rw-r--r--src/emu/sound/2203intf.c14
-rw-r--r--src/emu/sound/2203intf.h5
-rw-r--r--src/emu/sound/2413intf.c12
-rw-r--r--src/emu/sound/2413intf.h5
-rw-r--r--src/emu/sound/2608intf.c18
-rw-r--r--src/emu/sound/2608intf.h5
-rw-r--r--src/emu/sound/2610intf.c20
-rw-r--r--src/emu/sound/2610intf.h8
-rw-r--r--src/emu/sound/2612intf.c12
-rw-r--r--src/emu/sound/2612intf.h8
-rw-r--r--src/emu/sound/262intf.c12
-rw-r--r--src/emu/sound/262intf.h5
-rw-r--r--src/emu/sound/3526intf.c12
-rw-r--r--src/emu/sound/3526intf.h5
-rw-r--r--src/emu/sound/3812intf.c12
-rw-r--r--src/emu/sound/3812intf.h5
-rw-r--r--src/emu/sound/8950intf.c14
-rw-r--r--src/emu/sound/8950intf.h5
-rw-r--r--src/emu/sound/aica.c12
-rw-r--r--src/emu/sound/aica.h5
-rw-r--r--src/emu/sound/astrocde.c8
-rw-r--r--src/emu/sound/astrocde.h5
-rw-r--r--src/emu/sound/ay8910.c34
-rw-r--r--src/emu/sound/ay8910.h29
-rw-r--r--src/emu/sound/beep.c6
-rw-r--r--src/emu/sound/beep.h5
-rw-r--r--src/emu/sound/bsmt2000.c14
-rw-r--r--src/emu/sound/bsmt2000.h5
-rw-r--r--src/emu/sound/c140.c12
-rw-r--r--src/emu/sound/c140.h5
-rw-r--r--src/emu/sound/c352.c12
-rw-r--r--src/emu/sound/c352.h5
-rw-r--r--src/emu/sound/c6280.c12
-rw-r--r--src/emu/sound/c6280.h5
-rw-r--r--src/emu/sound/cdda.c18
-rw-r--r--src/emu/sound/cdda.h7
-rw-r--r--src/emu/sound/cdp1863.c7
-rw-r--r--src/emu/sound/cdp1863.h11
-rw-r--r--src/emu/sound/cdp1864.c38
-rw-r--r--src/emu/sound/cdp1864.h8
-rw-r--r--src/emu/sound/cdp1869.c15
-rw-r--r--src/emu/sound/cdp1869.h11
-rw-r--r--src/emu/sound/cem3394.c8
-rw-r--r--src/emu/sound/cem3394.h5
-rw-r--r--src/emu/sound/dac.c8
-rw-r--r--src/emu/sound/dac.h5
-rw-r--r--src/emu/sound/digitalk.c8
-rw-r--r--src/emu/sound/digitalk.h5
-rw-r--r--src/emu/sound/disc_inp.c6
-rw-r--r--src/emu/sound/discrete.c6
-rw-r--r--src/emu/sound/discrete.h4
-rw-r--r--src/emu/sound/dmadac.c14
-rw-r--r--src/emu/sound/dmadac.h13
-rw-r--r--src/emu/sound/es5503.c12
-rw-r--r--src/emu/sound/es5503.h5
-rw-r--r--src/emu/sound/es5506.c16
-rw-r--r--src/emu/sound/es5506.h8
-rw-r--r--src/emu/sound/es8712.c10
-rw-r--r--src/emu/sound/es8712.h5
-rw-r--r--src/emu/sound/flt_rc.c8
-rw-r--r--src/emu/sound/flt_rc.h4
-rw-r--r--src/emu/sound/flt_vol.c6
-rw-r--r--src/emu/sound/flt_vol.h6
-rw-r--r--src/emu/sound/gaelco.c15
-rw-r--r--src/emu/sound/gaelco.h9
-rw-r--r--src/emu/sound/hc55516.c12
-rw-r--r--src/emu/sound/hc55516.h12
-rw-r--r--src/emu/sound/ics2115.c10
-rw-r--r--src/emu/sound/ics2115.h5
-rw-r--r--src/emu/sound/iremga20.c12
-rw-r--r--src/emu/sound/iremga20.h5
-rw-r--r--src/emu/sound/k005289.c12
-rw-r--r--src/emu/sound/k005289.h5
-rw-r--r--src/emu/sound/k007232.c18
-rw-r--r--src/emu/sound/k007232.h5
-rw-r--r--src/emu/sound/k051649.c10
-rw-r--r--src/emu/sound/k051649.h5
-rw-r--r--src/emu/sound/k053260.c16
-rw-r--r--src/emu/sound/k053260.h5
-rw-r--r--src/emu/sound/k054539.c16
-rw-r--r--src/emu/sound/k054539.h5
-rw-r--r--src/emu/sound/k056800.c9
-rw-r--r--src/emu/sound/k056800.h10
-rw-r--r--src/emu/sound/mos6560.c21
-rw-r--r--src/emu/sound/mos6560.h10
-rw-r--r--src/emu/sound/msm5205.c12
-rw-r--r--src/emu/sound/msm5205.h5
-rw-r--r--src/emu/sound/msm5232.c12
-rw-r--r--src/emu/sound/msm5232.h5
-rw-r--r--src/emu/sound/multipcm.c10
-rw-r--r--src/emu/sound/multipcm.h5
-rw-r--r--src/emu/sound/n63701x.c10
-rw-r--r--src/emu/sound/n63701x.h5
-rw-r--r--src/emu/sound/namco.c16
-rw-r--r--src/emu/sound/namco.h12
-rw-r--r--src/emu/sound/nes_apu.c16
-rw-r--r--src/emu/sound/nes_apu.h5
-rw-r--r--src/emu/sound/nile.c8
-rw-r--r--src/emu/sound/nile.h5
-rw-r--r--src/emu/sound/okim6258.c12
-rw-r--r--src/emu/sound/okim6258.h5
-rw-r--r--src/emu/sound/okim6295.c797
-rw-r--r--src/emu/sound/okim6295.h192
-rw-r--r--src/emu/sound/okim6376.c12
-rw-r--r--src/emu/sound/okim6376.h5
-rw-r--r--src/emu/sound/pokey.c20
-rw-r--r--src/emu/sound/pokey.h5
-rw-r--r--src/emu/sound/psx.c8
-rw-r--r--src/emu/sound/psx.h5
-rw-r--r--src/emu/sound/qsound.c12
-rw-r--r--src/emu/sound/qsound.h5
-rw-r--r--src/emu/sound/rf5c400.c12
-rw-r--r--src/emu/sound/rf5c400.h5
-rw-r--r--src/emu/sound/rf5c68.c10
-rw-r--r--src/emu/sound/rf5c68.h5
-rw-r--r--src/emu/sound/s14001a.c10
-rw-r--r--src/emu/sound/s14001a.h7
-rw-r--r--src/emu/sound/saa1099.c8
-rw-r--r--src/emu/sound/saa1099.h5
-rw-r--r--src/emu/sound/samples.c8
-rw-r--r--src/emu/sound/samples.h5
-rw-r--r--src/emu/sound/scsp.c14
-rw-r--r--src/emu/sound/scsp.h5
-rw-r--r--src/emu/sound/segapcm.c14
-rw-r--r--src/emu/sound/segapcm.h5
-rw-r--r--src/emu/sound/sid6581.c8
-rw-r--r--src/emu/sound/sid6581.h8
-rw-r--r--src/emu/sound/sn76477.c12
-rw-r--r--src/emu/sound/sn76477.h4
-rw-r--r--src/emu/sound/sn76496.c22
-rw-r--r--src/emu/sound/sn76496.h27
-rw-r--r--src/emu/sound/snkwave.c10
-rw-r--r--src/emu/sound/snkwave.h5
-rw-r--r--src/emu/sound/sp0250.c12
-rw-r--r--src/emu/sound/sp0250.h5
-rw-r--r--src/emu/sound/sp0256.c12
-rw-r--r--src/emu/sound/sp0256.h5
-rw-r--r--src/emu/sound/speaker.c8
-rw-r--r--src/emu/sound/speaker.h12
-rw-r--r--src/emu/sound/st0016.c8
-rw-r--r--src/emu/sound/st0016.h5
-rw-r--r--src/emu/sound/t6w28.c8
-rw-r--r--src/emu/sound/t6w28.h6
-rw-r--r--src/emu/sound/tiaintf.c10
-rw-r--r--src/emu/sound/tiaintf.h5
-rw-r--r--src/emu/sound/tms3615.c12
-rw-r--r--src/emu/sound/tms3615.h5
-rw-r--r--src/emu/sound/tms36xx.c14
-rw-r--r--src/emu/sound/tms36xx.h5
-rw-r--r--src/emu/sound/tms5110.c39
-rw-r--r--src/emu/sound/tms5110.h29
-rw-r--r--src/emu/sound/tms5220.c24
-rw-r--r--src/emu/sound/tms5220.h15
-rw-r--r--src/emu/sound/upd7759.c14
-rw-r--r--src/emu/sound/upd7759.h5
-rw-r--r--src/emu/sound/vlm5030.c14
-rw-r--r--src/emu/sound/vlm5030.h5
-rw-r--r--src/emu/sound/votrax.c6
-rw-r--r--src/emu/sound/votrax.h5
-rw-r--r--src/emu/sound/vrender0.c8
-rw-r--r--src/emu/sound/vrender0.h5
-rw-r--r--src/emu/sound/wave.c4
-rw-r--r--src/emu/sound/wave.h5
-rw-r--r--src/emu/sound/x1_010.c16
-rw-r--r--src/emu/sound/x1_010.h5
-rw-r--r--src/emu/sound/ymf271.c14
-rw-r--r--src/emu/sound/ymf271.h5
-rw-r--r--src/emu/sound/ymf278b.c14
-rw-r--r--src/emu/sound/ymf278b.h5
-rw-r--r--src/emu/sound/ymz280b.c12
-rw-r--r--src/emu/sound/ymz280b.h5
-rw-r--r--src/emu/sound/zsg2.c10
-rw-r--r--src/emu/sound/zsg2.h3
-rw-r--r--src/emu/streams.c15
-rw-r--r--src/emu/streams.h16
-rw-r--r--src/emu/tilemap.c10
-rw-r--r--src/emu/tilemap.h6
-rw-r--r--src/emu/timer.c551
-rw-r--r--src/emu/timer.h220
-rw-r--r--src/emu/ui.c150
-rw-r--r--src/emu/uigfx.c15
-rw-r--r--src/emu/uimenu.c8
-rw-r--r--src/emu/validity.c616
-rw-r--r--src/emu/validity.h4
-rw-r--r--src/emu/video.c2060
-rw-r--r--src/emu/video.h478
-rw-r--r--src/emu/video/generic.c12
-rw-r--r--src/emu/video/hd63484.c12
-rw-r--r--src/emu/video/hd63484.h11
-rw-r--r--src/emu/video/mc6845.c83
-rw-r--r--src/emu/video/mc6845.h25
-rw-r--r--src/emu/video/pc_vga.c6
-rw-r--r--src/emu/video/pc_video.c6
-rw-r--r--src/emu/video/s2636.c16
-rw-r--r--src/emu/video/s2636.h13
-rw-r--r--src/emu/video/saa5050.c10
-rw-r--r--src/emu/video/saa5050.h10
-rw-r--r--src/emu/video/tms34061.c12
-rw-r--r--src/emu/video/tms9927.c24
-rw-r--r--src/emu/video/tms9927.h16
-rw-r--r--src/emu/video/tms9928a.c8
-rw-r--r--src/emu/video/v9938.c10
-rw-r--r--src/emu/video/v9938.h2
-rw-r--r--src/emu/video/vector.c12
-rw-r--r--src/emu/video/vooddefs.h2
-rw-r--r--src/emu/video/voodoo.c46
-rw-r--r--src/emu/video/voodoo.h13
-rw-r--r--src/emu/watchdog.c8
-rw-r--r--src/ldplayer/ldplayer.c4
-rw-r--r--src/lib/util/astring.c14
-rw-r--r--src/lib/util/astring.h2
-rw-r--r--src/mame/audio/amiga.c4
-rw-r--r--src/mame/audio/atarijsa.c43
-rw-r--r--src/mame/audio/cage.c36
-rw-r--r--src/mame/audio/cinemat.c18
-rw-r--r--src/mame/audio/cps3.c2
-rw-r--r--src/mame/audio/dcs.c67
-rw-r--r--src/mame/audio/exidy.c9
-rw-r--r--src/mame/audio/exidy440.c18
-rw-r--r--src/mame/audio/jaguar.c11
-rw-r--r--src/mame/audio/leland.c4
-rw-r--r--src/mame/audio/micro3d.c8
-rw-r--r--src/mame/audio/n8080.c8
-rw-r--r--src/mame/audio/namco52.c23
-rw-r--r--src/mame/audio/namco52.h5
-rw-r--r--src/mame/audio/namco54.c15
-rw-r--r--src/mame/audio/namco54.h5
-rw-r--r--src/mame/audio/segag80r.c7
-rw-r--r--src/mame/audio/segasnd.c4
-rw-r--r--src/mame/audio/seibu.c14
-rw-r--r--src/mame/audio/seibu.h19
-rw-r--r--src/mame/audio/senjyo.c9
-rw-r--r--src/mame/audio/snes_snd.c6
-rw-r--r--src/mame/audio/snes_snd.h11
-rw-r--r--src/mame/audio/taito_en.c11
-rw-r--r--src/mame/audio/taitosnd.c9
-rw-r--r--src/mame/audio/taitosnd.h9
-rw-r--r--src/mame/audio/tiamc1.c2
-rw-r--r--src/mame/audio/williams.c5
-rw-r--r--src/mame/drivers/1945kiii.c22
-rw-r--r--src/mame/drivers/39in1.c12
-rw-r--r--src/mame/drivers/3super8.c3
-rw-r--r--src/mame/drivers/5clown.c3
-rw-r--r--src/mame/drivers/acefruit.c6
-rw-r--r--src/mame/drivers/acommand.c12
-rw-r--r--src/mame/drivers/actfancr.c6
-rw-r--r--src/mame/drivers/adp.c8
-rw-r--r--src/mame/drivers/aerofgt.c23
-rw-r--r--src/mame/drivers/airbustr.c3
-rw-r--r--src/mame/drivers/alg.c14
-rw-r--r--src/mame/drivers/aquarium.c3
-rw-r--r--src/mame/drivers/arcadecl.c12
-rw-r--r--src/mame/drivers/artmagic.c8
-rw-r--r--src/mame/drivers/astinvad.c4
-rw-r--r--src/mame/drivers/astrocde.c2
-rw-r--r--src/mame/drivers/astrocorp.c16
-rw-r--r--src/mame/drivers/astrof.c10
-rw-r--r--src/mame/drivers/atarig1.c2
-rw-r--r--src/mame/drivers/atarig42.c2
-rw-r--r--src/mame/drivers/atarigt.c2
-rw-r--r--src/mame/drivers/atarigx2.c2
-rw-r--r--src/mame/drivers/atarisy1.c7
-rw-r--r--src/mame/drivers/atarisy2.c10
-rw-r--r--src/mame/drivers/atetris.c4
-rw-r--r--src/mame/drivers/backfire.c2
-rw-r--r--src/mame/drivers/badlands.c14
-rw-r--r--src/mame/drivers/batman.c10
-rw-r--r--src/mame/drivers/beaminv.c6
-rw-r--r--src/mame/drivers/beathead.c13
-rw-r--r--src/mame/drivers/berzerk.c10
-rw-r--r--src/mame/drivers/bestleag.c6
-rw-r--r--src/mame/drivers/big10.c2
-rw-r--r--src/mame/drivers/bigstrkb.c6
-rw-r--r--src/mame/drivers/bingor.c8
-rw-r--r--src/mame/drivers/bishjan.c12
-rw-r--r--src/mame/drivers/blackt96.c8
-rw-r--r--src/mame/drivers/blmbycar.c6
-rw-r--r--src/mame/drivers/blockout.c3
-rw-r--r--src/mame/drivers/blstroid.c6
-rw-r--r--src/mame/drivers/bmcbowl.c3
-rw-r--r--src/mame/drivers/boogwing.c23
-rw-r--r--src/mame/drivers/boxer.c10
-rw-r--r--src/mame/drivers/btime.c4
-rw-r--r--src/mame/drivers/calchase.c2
-rw-r--r--src/mame/drivers/capbowl.c6
-rw-r--r--src/mame/drivers/cardline.c3
-rw-r--r--src/mame/drivers/cave.c35
-rw-r--r--src/mame/drivers/cball.c4
-rw-r--r--src/mame/drivers/cbasebal.c3
-rw-r--r--src/mame/drivers/cbuster.c6
-rw-r--r--src/mame/drivers/ccastles.c8
-rw-r--r--src/mame/drivers/cchasm.c2
-rw-r--r--src/mame/drivers/centiped.c4
-rw-r--r--src/mame/drivers/changela.c6
-rw-r--r--src/mame/drivers/chinagat.c9
-rw-r--r--src/mame/drivers/cinemat.c4
-rw-r--r--src/mame/drivers/cischeat.c27
-rw-r--r--src/mame/drivers/cliffhgr.c4
-rw-r--r--src/mame/drivers/cloud9.c8
-rw-r--r--src/mame/drivers/clshroad.c2
-rw-r--r--src/mame/drivers/cninja.c53
-rw-r--r--src/mame/drivers/coolpool.c9
-rw-r--r--src/mame/drivers/coolridr.c4
-rw-r--r--src/mame/drivers/cosmic.c2
-rw-r--r--src/mame/drivers/cps1.c13
-rw-r--r--src/mame/drivers/cps2.c9
-rw-r--r--src/mame/drivers/cps3.c12
-rw-r--r--src/mame/drivers/crospang.c6
-rw-r--r--src/mame/drivers/crystal.c2
-rw-r--r--src/mame/drivers/cubeqst.c4
-rw-r--r--src/mame/drivers/cultures.c3
-rw-r--r--src/mame/drivers/cyberbal.c4
-rw-r--r--src/mame/drivers/cybertnk.c8
-rw-r--r--src/mame/drivers/darkhors.c3
-rw-r--r--src/mame/drivers/darkseal.c6
-rw-r--r--src/mame/drivers/dassault.c21
-rw-r--r--src/mame/drivers/dblewing.c5
-rw-r--r--src/mame/drivers/dbz.c3
-rw-r--r--src/mame/drivers/ddealer.c12
-rw-r--r--src/mame/drivers/ddenlovr.c75
-rw-r--r--src/mame/drivers/ddragon.c9
-rw-r--r--src/mame/drivers/ddragon3.c12
-rw-r--r--src/mame/drivers/dec0.c27
-rw-r--r--src/mame/drivers/deco156.c27
-rw-r--r--src/mame/drivers/deco32.c68
-rw-r--r--src/mame/drivers/deco_mlc.c18
-rw-r--r--src/mame/drivers/deniam.c16
-rw-r--r--src/mame/drivers/destroyr.c8
-rw-r--r--src/mame/drivers/dietgo.c3
-rw-r--r--src/mame/drivers/diverboy.c8
-rw-r--r--src/mame/drivers/djboy.c6
-rw-r--r--src/mame/drivers/dlair.c12
-rw-r--r--src/mame/drivers/dooyong.c6
-rw-r--r--src/mame/drivers/dorachan.c2
-rw-r--r--src/mame/drivers/dotrikun.c2
-rw-r--r--src/mame/drivers/dragrace.c8
-rw-r--r--src/mame/drivers/dreamwld.c6
-rw-r--r--src/mame/drivers/drgnmst.c13
-rw-r--r--src/mame/drivers/drtomy.c6
-rw-r--r--src/mame/drivers/dunhuang.c5
-rw-r--r--src/mame/drivers/dynax.c4
-rw-r--r--src/mame/drivers/egghunt.c6
-rw-r--r--src/mame/drivers/enigma2.c20
-rw-r--r--src/mame/drivers/eolith.c6
-rw-r--r--src/mame/drivers/eolith16.c3
-rw-r--r--src/mame/drivers/eprom.c2
-rw-r--r--src/mame/drivers/esd16.c3
-rw-r--r--src/mame/drivers/esripsys.c8
-rw-r--r--src/mame/drivers/expro02.c3
-rw-r--r--src/mame/drivers/exprraid.c1
-rw-r--r--src/mame/drivers/exterm.c5
-rw-r--r--src/mame/drivers/f-32.c3
-rw-r--r--src/mame/drivers/f1gp.c3
-rw-r--r--src/mame/drivers/fantland.c2
-rw-r--r--src/mame/drivers/fcrash.c3
-rw-r--r--src/mame/drivers/feversoc.c6
-rw-r--r--src/mame/drivers/fgoal.c8
-rw-r--r--src/mame/drivers/firebeat.c8
-rw-r--r--src/mame/drivers/firefox.c8
-rw-r--r--src/mame/drivers/firetrk.c6
-rw-r--r--src/mame/drivers/fitfight.c6
-rw-r--r--src/mame/drivers/flyball.c8
-rw-r--r--src/mame/drivers/foodf.c7
-rw-r--r--src/mame/drivers/funkyjet.c3
-rw-r--r--src/mame/drivers/funworld.c4
-rw-r--r--src/mame/drivers/funybubl.c6
-rw-r--r--src/mame/drivers/fuukifg2.c28
-rw-r--r--src/mame/drivers/fuukifg3.c22
-rw-r--r--src/mame/drivers/gaelco.c12
-rw-r--r--src/mame/drivers/gaelco3d.c28
-rw-r--r--src/mame/drivers/gaiden.c9
-rw-r--r--src/mame/drivers/galaga.c4
-rw-r--r--src/mame/drivers/galaxi.c7
-rw-r--r--src/mame/drivers/galaxian.c2
-rw-r--r--src/mame/drivers/galpani2.c9
-rw-r--r--src/mame/drivers/galpanic.c27
-rw-r--r--src/mame/drivers/galspnbl.c3
-rw-r--r--src/mame/drivers/gameplan.c3
-rw-r--r--src/mame/drivers/gauntlet.c8
-rw-r--r--src/mame/drivers/gcpinbal.c9
-rw-r--r--src/mame/drivers/ghosteo.c4
-rw-r--r--src/mame/drivers/glass.c3
-rw-r--r--src/mame/drivers/go2000.c4
-rw-r--r--src/mame/drivers/goldstar.c15
-rw-r--r--src/mame/drivers/good.c3
-rw-r--r--src/mame/drivers/gotcha.c6
-rw-r--r--src/mame/drivers/gottlieb.c6
-rw-r--r--src/mame/drivers/grchamp.c2
-rw-r--r--src/mame/drivers/gridlee.c14
-rw-r--r--src/mame/drivers/gstream.c21
-rw-r--r--src/mame/drivers/gumbo.c3
-rw-r--r--src/mame/drivers/gunpey.c5
-rw-r--r--src/mame/drivers/halleys.c3
-rw-r--r--src/mame/drivers/harddriv.c30
-rw-r--r--src/mame/drivers/hexion.c3
-rw-r--r--src/mame/drivers/highvdeo.c10
-rw-r--r--src/mame/drivers/hitme.c2
-rw-r--r--src/mame/drivers/hng64.c4
-rw-r--r--src/mame/drivers/homedata.c7
-rw-r--r--src/mame/drivers/homerun.c2
-rw-r--r--src/mame/drivers/hyprduel.c6
-rw-r--r--src/mame/drivers/igs009.c11
-rw-r--r--src/mame/drivers/igs011.c18
-rw-r--r--src/mame/drivers/igs017.c22
-rw-r--r--src/mame/drivers/igspoker.c5
-rw-r--r--src/mame/drivers/ilpag.c20
-rw-r--r--src/mame/drivers/itech32.c8
-rw-r--r--src/mame/drivers/itech8.c22
-rw-r--r--src/mame/drivers/itgambl2.c2
-rw-r--r--src/mame/drivers/itgambl3.c5
-rw-r--r--src/mame/drivers/itgamble.c15
-rw-r--r--src/mame/drivers/jackie.c8
-rw-r--r--src/mame/drivers/jackpool.c3
-rw-r--r--src/mame/drivers/jalmah.c11
-rw-r--r--src/mame/drivers/janshi.c3
-rw-r--r--src/mame/drivers/jantotsu.c2
-rw-r--r--src/mame/drivers/jedi.c4
-rw-r--r--src/mame/drivers/jpmimpct.c5
-rw-r--r--src/mame/drivers/kaneko16.c42
-rw-r--r--src/mame/drivers/kangaroo.c2
-rw-r--r--src/mame/drivers/kickgoal.c66
-rw-r--r--src/mame/drivers/kingdrby.c9
-rw-r--r--src/mame/drivers/klax.c11
-rw-r--r--src/mame/drivers/koftball.c3
-rw-r--r--src/mame/drivers/konamigx.c5
-rw-r--r--src/mame/drivers/laserbas.c2
-rw-r--r--src/mame/drivers/lastduel.c3
-rw-r--r--src/mame/drivers/lastfght.c2
-rw-r--r--src/mame/drivers/legionna.c9
-rw-r--r--src/mame/drivers/lemmings.c3
-rw-r--r--src/mame/drivers/lethalj.c9
-rw-r--r--src/mame/drivers/limenko.c3
-rw-r--r--src/mame/drivers/lordgun.c11
-rw-r--r--src/mame/drivers/luckgrln.c18
-rw-r--r--src/mame/drivers/m10.c20
-rw-r--r--src/mame/drivers/m107.c15
-rw-r--r--src/mame/drivers/m62.c9
-rw-r--r--src/mame/drivers/m72.c14
-rw-r--r--src/mame/drivers/m92.c15
-rw-r--r--src/mame/drivers/madmotor.c6
-rw-r--r--src/mame/drivers/magic10.c3
-rw-r--r--src/mame/drivers/magicard.c12
-rw-r--r--src/mame/drivers/magmax.c4
-rw-r--r--src/mame/drivers/malzak.c2
-rw-r--r--src/mame/drivers/marinedt.c8
-rw-r--r--src/mame/drivers/mario.c5
-rw-r--r--src/mame/drivers/maxaflex.c8
-rw-r--r--src/mame/drivers/mazerbla.c8
-rw-r--r--src/mame/drivers/mcr3.c2
-rw-r--r--src/mame/drivers/meadows.c6
-rw-r--r--src/mame/drivers/mediagx.c35
-rw-r--r--src/mame/drivers/megadriv.c84
-rw-r--r--src/mame/drivers/megasys1.c22
-rw-r--r--src/mame/drivers/merit.c4
-rw-r--r--src/mame/drivers/meritm.c10
-rw-r--r--src/mame/drivers/metro.c61
-rw-r--r--src/mame/drivers/mgolf.c4
-rw-r--r--src/mame/drivers/midvunit.c14
-rw-r--r--src/mame/drivers/midyunit.c14
-rw-r--r--src/mame/drivers/midzeus.c18
-rw-r--r--src/mame/drivers/mil4000.c3
-rw-r--r--src/mame/drivers/mirage.c32
-rw-r--r--src/mame/drivers/missb2.c3
-rw-r--r--src/mame/drivers/missile.c12
-rw-r--r--src/mame/drivers/mitchell.c20
-rw-r--r--src/mame/drivers/mjkjidai.c16
-rw-r--r--src/mame/drivers/mjsister.c4
-rw-r--r--src/mame/drivers/model2.c24
-rw-r--r--src/mame/drivers/model3.c2
-rw-r--r--src/mame/drivers/mogura.c12
-rw-r--r--src/mame/drivers/moo.c5
-rw-r--r--src/mame/drivers/mpu4.c2
-rw-r--r--src/mame/drivers/mugsmash.c3
-rw-r--r--src/mame/drivers/multfish.c2
-rw-r--r--src/mame/drivers/mw8080bw.c2
-rw-r--r--src/mame/drivers/mwarr.c8
-rw-r--r--src/mame/drivers/n8080.c4
-rw-r--r--src/mame/drivers/namcofl.c14
-rw-r--r--src/mame/drivers/namcona1.c4
-rw-r--r--src/mame/drivers/namconb1.c8
-rw-r--r--src/mame/drivers/namcos23.c8
-rw-r--r--src/mame/drivers/nbmj9195.c4
-rw-r--r--src/mame/drivers/neogeo.c16
-rw-r--r--src/mame/drivers/news.c3
-rw-r--r--src/mame/drivers/ninjaw.c2
-rw-r--r--src/mame/drivers/niyanpai.c2
-rw-r--r--src/mame/drivers/nmg5.c5
-rw-r--r--src/mame/drivers/nmk16.c126
-rw-r--r--src/mame/drivers/norautp.c5
-rw-r--r--src/mame/drivers/nyny.c2
-rw-r--r--src/mame/drivers/offtwall.c6
-rw-r--r--src/mame/drivers/ohmygod.c3
-rw-r--r--src/mame/drivers/oneshot.c5
-rw-r--r--src/mame/drivers/onetwo.c3
-rw-r--r--src/mame/drivers/orbit.c4
-rw-r--r--src/mame/drivers/othldrby.c5
-rw-r--r--src/mame/drivers/paradise.c8
-rw-r--r--src/mame/drivers/pasha2.c8
-rw-r--r--src/mame/drivers/pass.c3
-rw-r--r--src/mame/drivers/pcat_dyn.c4
-rw-r--r--src/mame/drivers/pcat_nit.c6
-rw-r--r--src/mame/drivers/pcxt.c12
-rw-r--r--src/mame/drivers/peplus.c8
-rw-r--r--src/mame/drivers/pgm.c2
-rw-r--r--src/mame/drivers/phoenix.c1
-rw-r--r--src/mame/drivers/photoply.c4
-rw-r--r--src/mame/drivers/pipeline.c2
-rw-r--r--src/mame/drivers/pirates.c8
-rw-r--r--src/mame/drivers/pkscram.c13
-rw-r--r--src/mame/drivers/pktgaldx.c14
-rw-r--r--src/mame/drivers/playmark.c17
-rw-r--r--src/mame/drivers/pokechmp.c3
-rw-r--r--src/mame/drivers/polepos.c2
-rw-r--r--src/mame/drivers/policetr.c2
-rw-r--r--src/mame/drivers/polyplay.c10
-rw-r--r--src/mame/drivers/powerbal.c8
-rw-r--r--src/mame/drivers/powerins.c9
-rw-r--r--src/mame/drivers/psikyo.c3
-rw-r--r--src/mame/drivers/puckpkmn.c3
-rw-r--r--src/mame/drivers/pzletime.c9
-rw-r--r--src/mame/drivers/quizdna.c3
-rw-r--r--src/mame/drivers/quizpani.c3
-rw-r--r--src/mame/drivers/rabbit.c2
-rw-r--r--src/mame/drivers/raiden2.c3
-rw-r--r--src/mame/drivers/rampart.c9
-rw-r--r--src/mame/drivers/rbmk.c3
-rw-r--r--src/mame/drivers/redalert.c2
-rw-r--r--src/mame/drivers/relief.c16
-rw-r--r--src/mame/drivers/renegade.c12
-rw-r--r--src/mame/drivers/rohga.c48
-rw-r--r--src/mame/drivers/rotaryf.c2
-rw-r--r--src/mame/drivers/royalmah.c15
-rw-r--r--src/mame/drivers/runaway.c4
-rw-r--r--src/mame/drivers/sandscrp.c3
-rw-r--r--src/mame/drivers/sangho.c2
-rw-r--r--src/mame/drivers/sbowling.c4
-rw-r--r--src/mame/drivers/sbrkout.c18
-rw-r--r--src/mame/drivers/scramble.c3
-rw-r--r--src/mame/drivers/sderby.c9
-rw-r--r--src/mame/drivers/seattle.c24
-rw-r--r--src/mame/drivers/segac2.c6
-rw-r--r--src/mame/drivers/segahang.c12
-rw-r--r--src/mame/drivers/segamsys.c4
-rw-r--r--src/mame/drivers/segaorun.c6
-rw-r--r--src/mame/drivers/segas16b.c2
-rw-r--r--src/mame/drivers/segas24.c22
-rw-r--r--src/mame/drivers/segas32.c20
-rw-r--r--src/mame/drivers/segaxbd.c4
-rw-r--r--src/mame/drivers/segaybd.c9
-rw-r--r--src/mame/drivers/seibuspi.c16
-rw-r--r--src/mame/drivers/seta.c9
-rw-r--r--src/mame/drivers/seta2.c4
-rw-r--r--src/mame/drivers/sfbonus.c9
-rw-r--r--src/mame/drivers/sfkick.c2
-rw-r--r--src/mame/drivers/shadfrce.c19
-rw-r--r--src/mame/drivers/shangha3.c13
-rw-r--r--src/mame/drivers/shuuz.c11
-rw-r--r--src/mame/drivers/silkroad.c8
-rw-r--r--src/mame/drivers/simpl156.c23
-rw-r--r--src/mame/drivers/skeetsht.c4
-rw-r--r--src/mame/drivers/skimaxx.c14
-rw-r--r--src/mame/drivers/skullxbo.c18
-rw-r--r--src/mame/drivers/sliver.c7
-rw-r--r--src/mame/drivers/slotcarn.c4
-rw-r--r--src/mame/drivers/sms.c2
-rw-r--r--src/mame/drivers/snk6502.c4
-rw-r--r--src/mame/drivers/snookr10.c3
-rw-r--r--src/mame/drivers/snowbros.c32
-rw-r--r--src/mame/drivers/sothello.c2
-rw-r--r--src/mame/drivers/spacefb.c6
-rw-r--r--src/mame/drivers/spbactn.c3
-rw-r--r--src/mame/drivers/speedspn.c5
-rw-r--r--src/mame/drivers/spoker.c5
-rw-r--r--src/mame/drivers/spool99.c3
-rw-r--r--src/mame/drivers/sprint2.c6
-rw-r--r--src/mame/drivers/sprint4.c4
-rw-r--r--src/mame/drivers/sprint8.c2
-rw-r--r--src/mame/drivers/srmp5.c4
-rw-r--r--src/mame/drivers/sshangha.c3
-rw-r--r--src/mame/drivers/sslam.c20
-rw-r--r--src/mame/drivers/stadhero.c3
-rw-r--r--src/mame/drivers/stlforce.c8
-rw-r--r--src/mame/drivers/stv.c78
-rw-r--r--src/mame/drivers/subsino.c6
-rw-r--r--src/mame/drivers/suna8.c2
-rw-r--r--src/mame/drivers/supbtime.c6
-rw-r--r--src/mame/drivers/suprnova.c2
-rw-r--r--src/mame/drivers/system1.c4
-rw-r--r--src/mame/drivers/taito_b.c6
-rw-r--r--src/mame/drivers/taito_f2.c9
-rw-r--r--src/mame/drivers/taito_f3.c3
-rw-r--r--src/mame/drivers/taito_l.c2
-rw-r--r--src/mame/drivers/targeth.c3
-rw-r--r--src/mame/drivers/tatsumi.c12
-rw-r--r--src/mame/drivers/tecmo.c6
-rw-r--r--src/mame/drivers/tecmo16.c3
-rw-r--r--src/mame/drivers/tecmosys.c5
-rw-r--r--src/mame/drivers/tetrisp2.c3
-rw-r--r--src/mame/drivers/tgtpanic.c2
-rw-r--r--src/mame/drivers/thoop2.c3
-rw-r--r--src/mame/drivers/thunderj.c8
-rw-r--r--src/mame/drivers/tickee.c38
-rw-r--r--src/mame/drivers/tmaster.c13
-rw-r--r--src/mame/drivers/tmnt.c3
-rw-r--r--src/mame/drivers/toaplan1.c4
-rw-r--r--src/mame/drivers/toaplan2.c66
-rw-r--r--src/mame/drivers/tomcat.c2
-rw-r--r--src/mame/drivers/toobin.c4
-rw-r--r--src/mame/drivers/tubep.c16
-rw-r--r--src/mame/drivers/tugboat.c4
-rw-r--r--src/mame/drivers/tumbleb.c24
-rw-r--r--src/mame/drivers/tumblep.c3
-rw-r--r--src/mame/drivers/turbo.c4
-rw-r--r--src/mame/drivers/twincobr.c2
-rw-r--r--src/mame/drivers/ultraman.c3
-rw-r--r--src/mame/drivers/ultratnk.c4
-rw-r--r--src/mame/drivers/unico.c22
-rw-r--r--src/mame/drivers/vamphalf.c32
-rw-r--r--src/mame/drivers/vaportra.c6
-rw-r--r--src/mame/drivers/vball.c11
-rw-r--r--src/mame/drivers/vegas.c30
-rw-r--r--src/mame/drivers/vicdual.c12
-rw-r--r--src/mame/drivers/videopin.c6
-rw-r--r--src/mame/drivers/videopkr.c11
-rw-r--r--src/mame/drivers/vindictr.c2
-rw-r--r--src/mame/drivers/vmetal.c3
-rw-r--r--src/mame/drivers/wheelfir.c40
-rw-r--r--src/mame/drivers/wolfpack.c6
-rw-r--r--src/mame/drivers/wrally.c3
-rw-r--r--src/mame/drivers/wwfsstar.c13
-rw-r--r--src/mame/drivers/wwfwfest.c13
-rw-r--r--src/mame/drivers/xain.c8
-rw-r--r--src/mame/drivers/xexex.c2
-rw-r--r--src/mame/drivers/xtheball.c2
-rw-r--r--src/mame/drivers/yunsun16.c6
-rw-r--r--src/mame/drivers/zerozone.c3
-rw-r--r--src/mame/drivers/zn.c2
-rw-r--r--src/mame/includes/amiga.h9
-rw-r--r--src/mame/includes/artmagic.h2
-rw-r--r--src/mame/includes/atarig1.h2
-rw-r--r--src/mame/includes/atarig42.h2
-rw-r--r--src/mame/includes/atarigt.h2
-rw-r--r--src/mame/includes/atarigx2.h2
-rw-r--r--src/mame/includes/atarisy1.h14
-rw-r--r--src/mame/includes/balsente.h21
-rw-r--r--src/mame/includes/batman.h2
-rw-r--r--src/mame/includes/blstroid.h2
-rw-r--r--src/mame/includes/boogwing.h20
-rw-r--r--src/mame/includes/btoads.h2
-rw-r--r--src/mame/includes/bzone.h5
-rw-r--r--src/mame/includes/cninja.h20
-rw-r--r--src/mame/includes/cps3.h5
-rw-r--r--src/mame/includes/cyberbal.h2
-rw-r--r--src/mame/includes/dassault.h20
-rw-r--r--src/mame/includes/drgnmst.h10
-rw-r--r--src/mame/includes/dynax.h4
-rw-r--r--src/mame/includes/eprom.h2
-rw-r--r--src/mame/includes/exidy.h5
-rw-r--r--src/mame/includes/exterm.h2
-rw-r--r--src/mame/includes/flower.h5
-rw-r--r--src/mame/includes/gaelco3d.h2
-rw-r--r--src/mame/includes/gcpinbal.h14
-rw-r--r--src/mame/includes/gomoku.h5
-rw-r--r--src/mame/includes/gridlee.h5
-rw-r--r--src/mame/includes/harddriv.h33
-rw-r--r--src/mame/includes/jpmimpct.h2
-rw-r--r--src/mame/includes/kickgoal.h11
-rw-r--r--src/mame/includes/leland.h13
-rw-r--r--src/mame/includes/lethalj.h2
-rw-r--r--src/mame/includes/mcr.h4
-rw-r--r--src/mame/includes/metro.h21
-rw-r--r--src/mame/includes/micro3d.h7
-rw-r--r--src/mame/includes/midtunit.h4
-rw-r--r--src/mame/includes/midyunit.h2
-rw-r--r--src/mame/includes/mitchell.h10
-rw-r--r--src/mame/includes/naomibd.h14
-rw-r--r--src/mame/includes/phoenix.h15
-rw-r--r--src/mame/includes/polepos.h4
-rw-r--r--src/mame/includes/rohga.h20
-rw-r--r--src/mame/includes/segas16.h5
-rw-r--r--src/mame/includes/senjyo.h2
-rw-r--r--src/mame/includes/simpl156.h18
-rw-r--r--src/mame/includes/snes.h1
-rw-r--r--src/mame/includes/snk6502.h4
-rw-r--r--src/mame/includes/taito_f2.h7
-rw-r--r--src/mame/includes/tiamc1.h5
-rw-r--r--src/mame/includes/tx1.h10
-rw-r--r--src/mame/includes/vindictr.h2
-rw-r--r--src/mame/includes/warpwarp.h10
-rw-r--r--src/mame/includes/wiping.h5
-rw-r--r--src/mame/machine/amiga.c16
-rw-r--r--src/mame/machine/archimds.c4
-rw-r--r--src/mame/machine/atari_vg.c6
-rw-r--r--src/mame/machine/atari_vg.h5
-rw-r--r--src/mame/machine/atarigen.c91
-rw-r--r--src/mame/machine/atarigen.h18
-rw-r--r--src/mame/machine/balsente.c70
-rw-r--r--src/mame/machine/dc.c4
-rw-r--r--src/mame/machine/decocass.c22
-rw-r--r--src/mame/machine/decocass.h5
-rw-r--r--src/mame/machine/fddebug.c4
-rw-r--r--src/mame/machine/galaxold.c13
-rw-r--r--src/mame/machine/harddriv.c19
-rw-r--r--src/mame/machine/irobot.c22
-rw-r--r--src/mame/machine/leland.c12
-rw-r--r--src/mame/machine/mathbox.c6
-rw-r--r--src/mame/machine/mathbox.h5
-rw-r--r--src/mame/machine/mcr.c8
-rw-r--r--src/mame/machine/mhavoc.c4
-rw-r--r--src/mame/machine/mw8080bw.c6
-rw-r--r--src/mame/machine/n64.c14
-rw-r--r--src/mame/machine/namco06.c9
-rw-r--r--src/mame/machine/namco06.h5
-rw-r--r--src/mame/machine/namco50.c13
-rw-r--r--src/mame/machine/namco50.h5
-rw-r--r--src/mame/machine/namco51.c11
-rw-r--r--src/mame/machine/namco51.h6
-rw-r--r--src/mame/machine/namco53.c15
-rw-r--r--src/mame/machine/namco53.h6
-rw-r--r--src/mame/machine/namcoio.c9
-rw-r--r--src/mame/machine/namcoio.h14
-rw-r--r--src/mame/machine/namcos2.c6
-rw-r--r--src/mame/machine/naomibd.c121
-rw-r--r--src/mame/machine/nitedrvr.c10
-rw-r--r--src/mame/machine/nmk112.c9
-rw-r--r--src/mame/machine/nmk112.h12
-rw-r--r--src/mame/machine/segaic16.c28
-rw-r--r--src/mame/machine/segaic16.h18
-rw-r--r--src/mame/machine/seicop.c4
-rw-r--r--src/mame/machine/snes.c30
-rw-r--r--src/mame/machine/stvcd.c14
-rw-r--r--src/mame/machine/taitoio.c30
-rw-r--r--src/mame/machine/taitoio.h18
-rw-r--r--src/mame/machine/ticket.c9
-rw-r--r--src/mame/machine/ticket.h7
-rw-r--r--src/mame/machine/williams.c60
-rw-r--r--src/mame/machine/xevious.c18
-rw-r--r--src/mame/video/40love.c4
-rw-r--r--src/mame/video/actfancr.c4
-rw-r--r--src/mame/video/airbustr.c2
-rw-r--r--src/mame/video/amiga.c10
-rw-r--r--src/mame/video/amigaaga.c10
-rw-r--r--src/mame/video/amspdwy.c4
-rw-r--r--src/mame/video/angelkds.c10
-rw-r--r--src/mame/video/argus.c16
-rw-r--r--src/mame/video/artmagic.c2
-rw-r--r--src/mame/video/astrocde.c20
-rw-r--r--src/mame/video/atari.c12
-rw-r--r--src/mame/video/atarig1.c14
-rw-r--r--src/mame/video/atarig42.c14
-rw-r--r--src/mame/video/atarigt.c16
-rw-r--r--src/mame/video/atarigx2.c14
-rw-r--r--src/mame/video/atarimo.c20
-rw-r--r--src/mame/video/atarirle.c38
-rw-r--r--src/mame/video/atarisy1.c39
-rw-r--r--src/mame/video/atarisy2.c10
-rw-r--r--src/mame/video/avgdvg.c16
-rw-r--r--src/mame/video/aztarac.c10
-rw-r--r--src/mame/video/badlands.c2
-rw-r--r--src/mame/video/balsente.c6
-rw-r--r--src/mame/video/batman.c18
-rw-r--r--src/mame/video/battlera.c8
-rw-r--r--src/mame/video/beathead.c4
-rw-r--r--src/mame/video/bfm_dm01.c6
-rw-r--r--src/mame/video/bigevglf.c8
-rw-r--r--src/mame/video/bishi.c2
-rw-r--r--src/mame/video/bking.c4
-rw-r--r--src/mame/video/blockade.c2
-rw-r--r--src/mame/video/blockout.c6
-rw-r--r--src/mame/video/blstroid.c16
-rw-r--r--src/mame/video/boogwing.c2
-rw-r--r--src/mame/video/btime.c2
-rw-r--r--src/mame/video/btoads.c14
-rw-r--r--src/mame/video/buggychl.c4
-rw-r--r--src/mame/video/bwing.c2
-rw-r--r--src/mame/video/carpolo.c2
-rw-r--r--src/mame/video/cave.c28
-rw-r--r--src/mame/video/cbuster.c2
-rw-r--r--src/mame/video/ccastles.c4
-rw-r--r--src/mame/video/cchasm.c6
-rw-r--r--src/mame/video/changela.c12
-rw-r--r--src/mame/video/cheekyms.c4
-rw-r--r--src/mame/video/cinemat.c10
-rw-r--r--src/mame/video/cloak.c2
-rw-r--r--src/mame/video/cloud9.c2
-rw-r--r--src/mame/video/cninja.c8
-rw-r--r--src/mame/video/contra.c4
-rw-r--r--src/mame/video/cosmic.c10
-rw-r--r--src/mame/video/cps1.c6
-rw-r--r--src/mame/video/crospang.c2
-rw-r--r--src/mame/video/cvs.c6
-rw-r--r--src/mame/video/cyberbal.c40
-rw-r--r--src/mame/video/darkseal.c2
-rw-r--r--src/mame/video/dassault.c2
-rw-r--r--src/mame/video/dc.c32
-rw-r--r--src/mame/video/dcheese.c12
-rw-r--r--src/mame/video/dday.c2
-rw-r--r--src/mame/video/dec0.c2
-rw-r--r--src/mame/video/dec8.c2
-rw-r--r--src/mame/video/deco16ic.c22
-rw-r--r--src/mame/video/deco16ic.h14
-rw-r--r--src/mame/video/deco32.c14
-rw-r--r--src/mame/video/deco_mlc.c2
-rw-r--r--src/mame/video/decocass.c4
-rw-r--r--src/mame/video/dietgo.c2
-rw-r--r--src/mame/video/dkong.c16
-rw-r--r--src/mame/video/dogfgt.c2
-rw-r--r--src/mame/video/eprom.c4
-rw-r--r--src/mame/video/equites.c2
-rw-r--r--src/mame/video/esd16.c12
-rw-r--r--src/mame/video/esripsys.c12
-rw-r--r--src/mame/video/exerion.c10
-rw-r--r--src/mame/video/exidy.c8
-rw-r--r--src/mame/video/exidy440.c24
-rw-r--r--src/mame/video/exterm.c4
-rw-r--r--src/mame/video/fantland.c4
-rw-r--r--src/mame/video/fastlane.c4
-rw-r--r--src/mame/video/fgoal.c4
-rw-r--r--src/mame/video/finalizr.c6
-rw-r--r--src/mame/video/firetrk.c18
-rw-r--r--src/mame/video/flkatck.c10
-rw-r--r--src/mame/video/fromance.c38
-rw-r--r--src/mame/video/funkyjet.c2
-rw-r--r--src/mame/video/fuukifg2.c20
-rw-r--r--src/mame/video/fuukifg3.c28
-rw-r--r--src/mame/video/gaelco2.c4
-rw-r--r--src/mame/video/gaelco3d.c30
-rw-r--r--src/mame/video/gaiden.c12
-rw-r--r--src/mame/video/galastrm.c8
-rw-r--r--src/mame/video/galaxian.c26
-rw-r--r--src/mame/video/galaxold.c4
-rw-r--r--src/mame/video/galpanic.c4
-rw-r--r--src/mame/video/galspnbl.c2
-rw-r--r--src/mame/video/gameplan.c6
-rw-r--r--src/mame/video/gaplus.c12
-rw-r--r--src/mame/video/gauntlet.c4
-rw-r--r--src/mame/video/genesis.c28
-rw-r--r--src/mame/video/glass.c2
-rw-r--r--src/mame/video/gomoku.c2
-rw-r--r--src/mame/video/gottlieb.c2
-rw-r--r--src/mame/video/grchamp.c4
-rw-r--r--src/mame/video/gridlee.c2
-rw-r--r--src/mame/video/gstriker.c4
-rw-r--r--src/mame/video/gtia.c2
-rw-r--r--src/mame/video/gticlub.c48
-rw-r--r--src/mame/video/gyruss.c6
-rw-r--r--src/mame/video/harddriv.c16
-rw-r--r--src/mame/video/hng64.c34
-rw-r--r--src/mame/video/homedata.c12
-rw-r--r--src/mame/video/homerun.c2
-rw-r--r--src/mame/video/hyhoo.c2
-rw-r--r--src/mame/video/hyprduel.c8
-rw-r--r--src/mame/video/ikki.c2
-rw-r--r--src/mame/video/irobot.c8
-rw-r--r--src/mame/video/itech32.c10
-rw-r--r--src/mame/video/itech8.c12
-rw-r--r--src/mame/video/jaguar.c30
-rw-r--r--src/mame/video/jpmimpct.c6
-rw-r--r--src/mame/video/kan_pand.c20
-rw-r--r--src/mame/video/kan_pand.h11
-rw-r--r--src/mame/video/kaneko16.c26
-rw-r--r--src/mame/video/karnov.c4
-rw-r--r--src/mame/video/kncljoe.c10
-rw-r--r--src/mame/video/konamigx.c34
-rw-r--r--src/mame/video/konamiic.c18
-rw-r--r--src/mame/video/konicdev.c287
-rw-r--r--src/mame/video/konicdev.h104
-rw-r--r--src/mame/video/labyrunr.c4
-rw-r--r--src/mame/video/leland.c14
-rw-r--r--src/mame/video/lemmings.c4
-rw-r--r--src/mame/video/lethalj.c10
-rw-r--r--src/mame/video/liberatr.c2
-rw-r--r--src/mame/video/lockon.c4
-rw-r--r--src/mame/video/lordgun.c14
-rw-r--r--src/mame/video/m52.c6
-rw-r--r--src/mame/video/m58.c26
-rw-r--r--src/mame/video/madalien.c2
-rw-r--r--src/mame/video/madmotor.c2
-rw-r--r--src/mame/video/magmax.c2
-rw-r--r--src/mame/video/mappy.c2
-rw-r--r--src/mame/video/matmania.c6
-rw-r--r--src/mame/video/mcr68.c2
-rw-r--r--src/mame/video/meadows.c2
-rw-r--r--src/mame/video/megazone.c2
-rw-r--r--src/mame/video/mermaid.c54
-rw-r--r--src/mame/video/metro.c8
-rw-r--r--src/mame/video/micro3d.c4
-rw-r--r--src/mame/video/midtunit.c4
-rw-r--r--src/mame/video/midvunit.c14
-rw-r--r--src/mame/video/midyunit.c8
-rw-r--r--src/mame/video/midzeus.c18
-rw-r--r--src/mame/video/midzeus2.c14
-rw-r--r--src/mame/video/mitchell.c4
-rw-r--r--src/mame/video/model1.c2
-rw-r--r--src/mame/video/model2.c13
-rw-r--r--src/mame/video/model3.c6
-rw-r--r--src/mame/video/moo.c2
-rw-r--r--src/mame/video/mrflea.c2
-rw-r--r--src/mame/video/ms32.c8
-rw-r--r--src/mame/video/munchmo.c2
-rw-r--r--src/mame/video/mustache.c8
-rw-r--r--src/mame/video/mystston.c4
-rw-r--r--src/mame/video/n8080.c6
-rw-r--r--src/mame/video/naughtyb.c2
-rw-r--r--src/mame/video/nbmj8688.c2
-rw-r--r--src/mame/video/nbmj8891.c28
-rw-r--r--src/mame/video/nbmj8900.c12
-rw-r--r--src/mame/video/nbmj8991.c22
-rw-r--r--src/mame/video/nbmj9195.c36
-rw-r--r--src/mame/video/neogeo.c12
-rw-r--r--src/mame/video/ninjakd2.c2
-rw-r--r--src/mame/video/niyanpai.c22
-rw-r--r--src/mame/video/nmk16.c2
-rw-r--r--src/mame/video/ojankohs.c2
-rw-r--r--src/mame/video/pacland.c2
-rw-r--r--src/mame/video/paradise.c2
-rw-r--r--src/mame/video/pastelg.c14
-rw-r--r--src/mame/video/pitnrun.c8
-rw-r--r--src/mame/video/pktgaldx.c2
-rw-r--r--src/mame/video/playch10.c2
-rw-r--r--src/mame/video/policetr.c4
-rw-r--r--src/mame/video/popeye.c4
-rw-r--r--src/mame/video/popper.c2
-rw-r--r--src/mame/video/powerins.c4
-rw-r--r--src/mame/video/ppu2c0x.c78
-rw-r--r--src/mame/video/ppu2c0x.h31
-rw-r--r--src/mame/video/psikyo.c8
-rw-r--r--src/mame/video/psikyo4.c2
-rw-r--r--src/mame/video/psikyosh.c4
-rw-r--r--src/mame/video/psx.c26
-rw-r--r--src/mame/video/qix.c15
-rw-r--r--src/mame/video/quasar.c2
-rw-r--r--src/mame/video/rallyx.c6
-rw-r--r--src/mame/video/realbrk.c12
-rw-r--r--src/mame/video/rohga.c6
-rw-r--r--src/mame/video/rpunch.c4
-rw-r--r--src/mame/video/sega16sp.c22
-rw-r--r--src/mame/video/segag80r.c4
-rw-r--r--src/mame/video/segag80v.c4
-rw-r--r--src/mame/video/segaic16.c28
-rw-r--r--src/mame/video/segaic16.h4
-rw-r--r--src/mame/video/segas18.c10
-rw-r--r--src/mame/video/segas32.c98
-rw-r--r--src/mame/video/seta.c6
-rw-r--r--src/mame/video/shangha3.c2
-rw-r--r--src/mame/video/simpl156.c2
-rw-r--r--src/mame/video/skullxbo.c12
-rw-r--r--src/mame/video/skyfox.c4
-rw-r--r--src/mame/video/skyraid.c2
-rw-r--r--src/mame/video/snes.c30
-rw-r--r--src/mame/video/snk.c4
-rw-r--r--src/mame/video/snk68.c8
-rw-r--r--src/mame/video/spacefb.c16
-rw-r--r--src/mame/video/spbactn.c4
-rw-r--r--src/mame/video/spdodgeb.c4
-rw-r--r--src/mame/video/sprint2.c20
-rw-r--r--src/mame/video/sprint4.c4
-rw-r--r--src/mame/video/sprint8.c18
-rw-r--r--src/mame/video/srmp2.c12
-rw-r--r--src/mame/video/sshangha.c2
-rw-r--r--src/mame/video/ssv.c4
-rw-r--r--src/mame/video/st0016.c10
-rw-r--r--src/mame/video/stadhero.c2
-rw-r--r--src/mame/video/starcrus.c10
-rw-r--r--src/mame/video/starfire.c2
-rw-r--r--src/mame/video/starshp1.c20
-rw-r--r--src/mame/video/stvvdp2.c32
-rw-r--r--src/mame/video/suna16.c4
-rw-r--r--src/mame/video/suna8.c8
-rw-r--r--src/mame/video/supbtime.c2
-rw-r--r--src/mame/video/superqix.c4
-rw-r--r--src/mame/video/suprnova.c4
-rw-r--r--src/mame/video/suprridr.c8
-rw-r--r--src/mame/video/system1.c14
-rw-r--r--src/mame/video/taito_b.c10
-rw-r--r--src/mame/video/taito_f3.c10
-rw-r--r--src/mame/video/taitoic.c102
-rw-r--r--src/mame/video/taitoic.h49
-rw-r--r--src/mame/video/taitojc.c18
-rw-r--r--src/mame/video/taitosj.c14
-rw-r--r--src/mame/video/tank8.c26
-rw-r--r--src/mame/video/taotaido.c10
-rw-r--r--src/mame/video/tceptor.c4
-rw-r--r--src/mame/video/tecmo16.c12
-rw-r--r--src/mame/video/tia.c16
-rw-r--r--src/mame/video/timeplt.c2
-rw-r--r--src/mame/video/toaplan1.c14
-rw-r--r--src/mame/video/toaplan2.c32
-rw-r--r--src/mame/video/toki.c2
-rw-r--r--src/mame/video/toobin.c8
-rw-r--r--src/mame/video/tp84.c16
-rw-r--r--src/mame/video/triplhnt.c4
-rw-r--r--src/mame/video/tumbleb.c6
-rw-r--r--src/mame/video/tumblep.c2
-rw-r--r--src/mame/video/tunhunt.c2
-rw-r--r--src/mame/video/turbo.c2
-rw-r--r--src/mame/video/twin16.c2
-rw-r--r--src/mame/video/tx1.c8
-rw-r--r--src/mame/video/ultratnk.c4
-rw-r--r--src/mame/video/vaportra.c2
-rw-r--r--src/mame/video/vdc.c2
-rw-r--r--src/mame/video/vicdual.c2
-rw-r--r--src/mame/video/victory.c4
-rw-r--r--src/mame/video/vigilant.c2
-rw-r--r--src/mame/video/vindictr.c20
-rw-r--r--src/mame/video/volfied.c4
-rw-r--r--src/mame/video/vrender0.c10
-rw-r--r--src/mame/video/vrender0.h9
-rw-r--r--src/mame/video/wecleman.c6
-rw-r--r--src/mame/video/welltris.c6
-rw-r--r--src/mame/video/williams.c8
-rw-r--r--src/mame/video/wolfpack.c2
-rw-r--r--src/mame/video/xexex.c2
-rw-r--r--src/mame/video/xmen.c2
-rw-r--r--src/mame/video/ygv608.c25
-rw-r--r--src/mame/video/yunsun16.c6
-rw-r--r--src/mame/video/zac2650.c34
-rw-r--r--src/mame/video/zaxxon.c4
-rw-r--r--src/osd/osdepend.h4
-rw-r--r--src/osd/sdl/debugwin.c2
-rw-r--r--src/osd/sdl/drawogl.c8
-rw-r--r--src/osd/sdl/video.c3
-rw-r--r--src/osd/windows/d3d8intf.c1
-rw-r--r--src/osd/windows/d3d9intf.c1
-rw-r--r--src/osd/windows/debugwin.c5
-rw-r--r--src/osd/windows/drawd3d.c8
-rw-r--r--src/osd/windows/drawdd.c8
-rw-r--r--src/osd/windows/input.c1
-rw-r--r--src/osd/windows/sound.c1
-rw-r--r--src/osd/windows/video.c3
-rw-r--r--src/osd/windows/windows.mak4
-rw-r--r--src/osd/windows/winmain.c9
1360 files changed, 24525 insertions, 21339 deletions
diff --git a/.gitattributes b/.gitattributes
index 284ae217ac6..5862cec2c23 100644
--- a/.gitattributes
+++ b/.gitattributes
@@ -533,9 +533,6 @@ src/emu/cpu/z8000/z8000cpu.h svneol=native#text/plain
src/emu/cpu/z8000/z8000dab.h svneol=native#text/plain
src/emu/cpu/z8000/z8000ops.c svneol=native#text/plain
src/emu/cpu/z8000/z8000tbl.c svneol=native#text/plain
-src/emu/cpuexec.c svneol=native#text/plain
-src/emu/cpuexec.h svneol=native#text/plain
-src/emu/cpuintrf.h svneol=native#text/plain
src/emu/crsshair.c svneol=native#text/plain
src/emu/crsshair.h svneol=native#text/plain
src/emu/debug/debugcmd.c svneol=native#text/plain
@@ -562,9 +559,25 @@ src/emu/deprecat.h svneol=native#text/plain
src/emu/devcb.c svneol=native#text/plain
src/emu/devcb.h svneol=native#text/plain
src/emu/devconv.h svneol=native#text/plain
+src/emu/devcpu.c svneol=native#text/plain
+src/emu/devcpu.h svneol=native#text/plain
src/emu/devintrf.c svneol=native#text/plain
src/emu/devintrf.h svneol=native#text/plain
+src/emu/devlegcy.c svneol=native#text/plain
+src/emu/devlegcy.h svneol=native#text/plain
src/emu/devtempl.h svneol=native#text/plain
+src/emu/didisasm.c svneol=native#text/plain
+src/emu/didisasm.h svneol=native#text/plain
+src/emu/diexec.c svneol=native#text/plain
+src/emu/diexec.h svneol=native#text/plain
+src/emu/dimemory.c svneol=native#text/plain
+src/emu/dimemory.h svneol=native#text/plain
+src/emu/dinvram.c svneol=native#text/plain
+src/emu/dinvram.h svneol=native#text/plain
+src/emu/disound.c svneol=native#text/plain
+src/emu/disound.h svneol=native#text/plain
+src/emu/distate.c svneol=native#text/plain
+src/emu/distate.h svneol=native#text/plain
src/emu/drawgfx.c svneol=native#text/plain
src/emu/drawgfx.h svneol=native#text/plain
src/emu/drawgfxm.h svneol=native#text/plain
@@ -792,6 +805,8 @@ src/emu/rendutil.c svneol=native#text/plain
src/emu/rendutil.h svneol=native#text/plain
src/emu/romload.c svneol=native#text/plain
src/emu/romload.h svneol=native#text/plain
+src/emu/schedule.c svneol=native#text/plain
+src/emu/schedule.h svneol=native#text/plain
src/emu/sound.c svneol=native#text/plain
src/emu/sound.h svneol=native#text/plain
src/emu/sound/2151intf.c svneol=native#text/plain
diff --git a/src/emu/audit.c b/src/emu/audit.c
index eb6863b0e6e..526a50f70a8 100644
--- a/src/emu/audit.c
+++ b/src/emu/audit.c
@@ -147,16 +147,16 @@ int audit_images(core_options *options, const game_driver *gamedrv, UINT32 valid
int audit_samples(core_options *options, const game_driver *gamedrv, audit_record **audit)
{
machine_config *config = machine_config_alloc(gamedrv->machine_config);
- const device_config *devconfig;
audit_record *record;
int records = 0;
int sampnum;
/* count the number of sample records attached to this driver */
- for (devconfig = sound_first(config); devconfig != NULL; devconfig = sound_next(devconfig))
- if (sound_get_type(devconfig) == SOUND_SAMPLES)
+ const device_config_sound_interface *sound;
+ for (bool gotone = config->devicelist.first(sound); gotone; gotone = sound->next(sound))
+ if (sound->devconfig().type() == SOUND_SAMPLES)
{
- const samples_interface *intf = (const samples_interface *)devconfig->static_config;
+ const samples_interface *intf = (const samples_interface *)sound->devconfig().static_config();
if (intf->samplenames != NULL)
{
@@ -176,10 +176,10 @@ int audit_samples(core_options *options, const game_driver *gamedrv, audit_recor
record = *audit;
/* now iterate over sample entries */
- for (devconfig = sound_first(config); devconfig != NULL; devconfig = sound_next(devconfig))
- if (sound_get_type(devconfig) == SOUND_SAMPLES)
+ for (bool gotone = config->devicelist.first(sound); gotone; gotone = sound->next(sound))
+ if (sound->devconfig().type() == SOUND_SAMPLES)
{
- const samples_interface *intf = (const samples_interface *)devconfig->static_config;
+ const samples_interface *intf = (const samples_interface *)sound->devconfig().static_config();
const char *sharedname = NULL;
if (intf->samplenames != NULL)
diff --git a/src/emu/clifront.c b/src/emu/clifront.c
index 11d9ac58cb9..f05616006bf 100644
--- a/src/emu/clifront.c
+++ b/src/emu/clifront.c
@@ -621,13 +621,13 @@ int cli_info_listsamples(core_options *options, const char *gamename)
if (mame_strwildcmp(gamename, drivers[drvindex]->name) == 0)
{
machine_config *config = machine_config_alloc(drivers[drvindex]->machine_config);
- const device_config *devconfig;
+ const device_config_sound_interface *sound;
/* find samples interfaces */
- for (devconfig = sound_first(config); devconfig != NULL; devconfig = sound_next(devconfig))
- if (sound_get_type(devconfig) == SOUND_SAMPLES)
+ for (bool gotone = config->devicelist.first(sound); gotone; gotone = sound->next(sound))
+ if (sound->devconfig().type() == SOUND_SAMPLES)
{
- const char *const *samplenames = ((const samples_interface *)devconfig->static_config)->samplenames;
+ const char *const *samplenames = ((const samples_interface *)sound->devconfig().static_config())->samplenames;
int sampnum;
/* if the list is legit, walk it and print the sample info */
@@ -667,26 +667,19 @@ int cli_info_listdevices(core_options *options, const char *gamename)
printf("Driver %s (%s):\n", drivers[drvindex]->name, drivers[drvindex]->description);
/* iterate through devices */
- for (devconfig = config->devicelist.first(); devconfig != NULL; devconfig = devconfig->next)
+ for (devconfig = config->devicelist.first(); devconfig != NULL; devconfig = devconfig->next())
{
- switch (devconfig->devclass)
- {
- case DEVICE_CLASS_AUDIO: printf(" Audio: "); break;
- case DEVICE_CLASS_VIDEO: printf(" Video: "); break;
- case DEVICE_CLASS_CPU_CHIP: printf(" CPU: "); break;
- case DEVICE_CLASS_SOUND_CHIP: printf(" Sound: "); break;
- case DEVICE_CLASS_TIMER: printf(" Timer: "); break;
- default: printf(" Other: "); break;
- }
- printf("%s ('%s')", devconfig->name(), devconfig->tag());
- if (devconfig->clock >= 1000000000)
- printf(" @ %d.%02d GHz\n", devconfig->clock / 1000000000, (devconfig->clock / 10000000) % 100);
- else if (devconfig->clock >= 1000000)
- printf(" @ %d.%02d MHz\n", devconfig->clock / 1000000, (devconfig->clock / 10000) % 100);
- else if (devconfig->clock >= 1000)
- printf(" @ %d.%02d kHz\n", devconfig->clock / 1000, (devconfig->clock / 10) % 100);
- else if (devconfig->clock > 0)
- printf(" @ %d Hz\n", devconfig->clock);
+ printf(" %s ('%s')", devconfig->name(), devconfig->tag());
+
+ UINT32 clock = devconfig->clock();
+ if (clock >= 1000000000)
+ printf(" @ %d.%02d GHz\n", clock / 1000000000, (clock / 10000000) % 100);
+ else if (clock >= 1000000)
+ printf(" @ %d.%02d MHz\n", clock / 1000000, (clock / 10000) % 100);
+ else if (clock >= 1000)
+ printf(" @ %d.%02d kHz\n", clock / 1000, (clock / 10) % 100);
+ else if (clock > 0)
+ printf(" @ %d Hz\n", clock);
else
printf("\n");
}
diff --git a/src/emu/cpu/adsp2100/adsp2100.c b/src/emu/cpu/adsp2100/adsp2100.c
index 129e50f0656..c1ff81cf89f 100644
--- a/src/emu/cpu/adsp2100/adsp2100.c
+++ b/src/emu/cpu/adsp2100/adsp2100.c
@@ -241,7 +241,7 @@ typedef struct
UINT16 ifc;
UINT8 irq_state[9];
UINT8 irq_latch[9];
- cpu_irq_callback irq_callback;
+ device_irq_callback irq_callback;
running_device *device;
/* other internal states */
@@ -266,7 +266,6 @@ typedef struct
const address_space *program;
const address_space *data;
const address_space *io;
- cpu_state_table state;
} adsp2100_state;
@@ -287,132 +286,6 @@ static UINT32 pcbucket[0x4000];
/***************************************************************************
- CPU STATE DESCRIPTION
-***************************************************************************/
-
-#define ADSP21XX_STATE_ENTRY(_name, _format, _member, _datamask, _flags) \
- CPU_STATE_ENTRY(ADSP2100_##_name, #_name, _format, adsp2100_state, _member, _datamask, ~0, _flags)
-
-#define ADSP21XX_STATE_ENTRY_MASK(_name, _format, _member, _datamask, _flags, _validmask) \
- CPU_STATE_ENTRY(ADSP2100_##_name, #_name, _format, adsp2100_state, _member, _datamask, _validmask, _flags)
-
-static const cpu_state_entry state_array[] =
-{
- ADSP21XX_STATE_ENTRY(PC, "%04X", pc, 0xffff, 0)
- ADSP21XX_STATE_ENTRY(GENPC, "%04X", pc, 0xffff, CPUSTATE_NOSHOW)
- ADSP21XX_STATE_ENTRY(GENPCBASE, "%04X", ppc, 0xffff, CPUSTATE_NOSHOW)
-
- ADSP21XX_STATE_ENTRY(AX0, "%04X", core.ax0.u, 0xffff, 0)
- ADSP21XX_STATE_ENTRY(AX1, "%04X", core.ax1.u, 0xffff, 0)
- ADSP21XX_STATE_ENTRY(AY0, "%04X", core.ay0.u, 0xffff, 0)
- ADSP21XX_STATE_ENTRY(AY1, "%04X", core.ay1.u, 0xffff, 0)
- ADSP21XX_STATE_ENTRY(AR, "%04X", core.ar.u, 0xffff, 0)
- ADSP21XX_STATE_ENTRY(AF, "%04X", core.af.u, 0xffff, 0)
-
- ADSP21XX_STATE_ENTRY(MX0, "%04X", core.mx0.u, 0xffff, 0)
- ADSP21XX_STATE_ENTRY(MX1, "%04X", core.mx1.u, 0xffff, 0)
- ADSP21XX_STATE_ENTRY(MY0, "%04X", core.my0.u, 0xffff, 0)
- ADSP21XX_STATE_ENTRY(MY1, "%04X", core.my1.u, 0xffff, 0)
- ADSP21XX_STATE_ENTRY(MR0, "%04X", core.mr.mrx.mr0.u, 0xffff, 0)
- ADSP21XX_STATE_ENTRY(MR1, "%04X", core.mr.mrx.mr1.u, 0xffff, 0)
- ADSP21XX_STATE_ENTRY(MR2, "%02X", core.mr.mrx.mr2.u, 0xff, CPUSTATE_IMPORT_SEXT)
- ADSP21XX_STATE_ENTRY(MF, "%04X", core.mf.u, 0xffff, 0)
-
- ADSP21XX_STATE_ENTRY(SI, "%04X", core.si.u, 0xffff, 0)
- ADSP21XX_STATE_ENTRY(SE, "%02X", core.se.u, 0xff, CPUSTATE_IMPORT_SEXT)
- ADSP21XX_STATE_ENTRY(SB, "%02X", core.sb.u, 0x1f, CPUSTATE_IMPORT_SEXT)
- ADSP21XX_STATE_ENTRY(SR0, "%04X", core.sr.srx.sr0.u, 0xffff, 0)
- ADSP21XX_STATE_ENTRY(SR1, "%04X", core.sr.srx.sr0.u, 0xffff, 0)
-
- ADSP21XX_STATE_ENTRY(AX0_SEC, "%04X", alt.ax0.u, 0xffff, 0)
- ADSP21XX_STATE_ENTRY(AX1_SEC, "%04X", alt.ax1.u, 0xffff, 0)
- ADSP21XX_STATE_ENTRY(AY0_SEC, "%04X", alt.ay0.u, 0xffff, 0)
- ADSP21XX_STATE_ENTRY(AY1_SEC, "%04X", alt.ay1.u, 0xffff, 0)
- ADSP21XX_STATE_ENTRY(AR_SEC, "%04X", alt.ar.u, 0xffff, 0)
- ADSP21XX_STATE_ENTRY(AF_SEC, "%04X", alt.af.u, 0xffff, 0)
-
- ADSP21XX_STATE_ENTRY(MX0_SEC, "%04X", alt.mx0.u, 0xffff, 0)
- ADSP21XX_STATE_ENTRY(MX1_SEC, "%04X", alt.mx1.u, 0xffff, 0)
- ADSP21XX_STATE_ENTRY(MY0_SEC, "%04X", alt.my0.u, 0xffff, 0)
- ADSP21XX_STATE_ENTRY(MY1_SEC, "%04X", alt.my1.u, 0xffff, 0)
- ADSP21XX_STATE_ENTRY(MR0_SEC, "%04X", alt.mr.mrx.mr0.u, 0xffff, 0)
- ADSP21XX_STATE_ENTRY(MR1_SEC, "%04X", alt.mr.mrx.mr1.u, 0xffff, 0)
- ADSP21XX_STATE_ENTRY(MR2_SEC, "%02X", alt.mr.mrx.mr2.u, 0xff, CPUSTATE_IMPORT_SEXT)
- ADSP21XX_STATE_ENTRY(MF_SEC, "%04X", alt.mf.u, 0xffff, 0)
-
- ADSP21XX_STATE_ENTRY(SI_SEC, "%04X", alt.si.u, 0xffff, 0)
- ADSP21XX_STATE_ENTRY(SE_SEC, "%02X", alt.se.u, 0xff, CPUSTATE_IMPORT_SEXT)
- ADSP21XX_STATE_ENTRY(SB_SEC, "%02X", alt.sb.u, 0x1f, CPUSTATE_IMPORT_SEXT)
- ADSP21XX_STATE_ENTRY(SR0_SEC, "%04X", alt.sr.srx.sr0.u, 0xffff, 0)
- ADSP21XX_STATE_ENTRY(SR1_SEC, "%04X", alt.sr.srx.sr0.u, 0xffff, 0)
-
- ADSP21XX_STATE_ENTRY(I0, "%04X", i[0], 0x3fff, CPUSTATE_IMPORT)
- ADSP21XX_STATE_ENTRY(I1, "%04X", i[1], 0x3fff, CPUSTATE_IMPORT)
- ADSP21XX_STATE_ENTRY(I2, "%04X", i[2], 0x3fff, CPUSTATE_IMPORT)
- ADSP21XX_STATE_ENTRY(I3, "%04X", i[3], 0x3fff, CPUSTATE_IMPORT)
- ADSP21XX_STATE_ENTRY(I4, "%04X", i[4], 0x3fff, CPUSTATE_IMPORT)
- ADSP21XX_STATE_ENTRY(I5, "%04X", i[5], 0x3fff, CPUSTATE_IMPORT)
- ADSP21XX_STATE_ENTRY(I6, "%04X", i[6], 0x3fff, CPUSTATE_IMPORT)
- ADSP21XX_STATE_ENTRY(I7, "%04X", i[7], 0x3fff, CPUSTATE_IMPORT)
-
- ADSP21XX_STATE_ENTRY(L0, "%04X", l[0], 0x3fff, CPUSTATE_IMPORT)
- ADSP21XX_STATE_ENTRY(L1, "%04X", l[1], 0x3fff, CPUSTATE_IMPORT)
- ADSP21XX_STATE_ENTRY(L2, "%04X", l[2], 0x3fff, CPUSTATE_IMPORT)
- ADSP21XX_STATE_ENTRY(L3, "%04X", l[3], 0x3fff, CPUSTATE_IMPORT)
- ADSP21XX_STATE_ENTRY(L4, "%04X", l[4], 0x3fff, CPUSTATE_IMPORT)
- ADSP21XX_STATE_ENTRY(L5, "%04X", l[5], 0x3fff, CPUSTATE_IMPORT)
- ADSP21XX_STATE_ENTRY(L6, "%04X", l[6], 0x3fff, CPUSTATE_IMPORT)
- ADSP21XX_STATE_ENTRY(L7, "%04X", l[7], 0x3fff, CPUSTATE_IMPORT)
-
- ADSP21XX_STATE_ENTRY(M0, "%04X", m[0], 0x3fff, CPUSTATE_IMPORT_SEXT)
- ADSP21XX_STATE_ENTRY(M1, "%04X", m[1], 0x3fff, CPUSTATE_IMPORT_SEXT)
- ADSP21XX_STATE_ENTRY(M2, "%04X", m[2], 0x3fff, CPUSTATE_IMPORT_SEXT)
- ADSP21XX_STATE_ENTRY(M3, "%04X", m[3], 0x3fff, CPUSTATE_IMPORT_SEXT)
- ADSP21XX_STATE_ENTRY(M4, "%04X", m[4], 0x3fff, CPUSTATE_IMPORT_SEXT)
- ADSP21XX_STATE_ENTRY(M5, "%04X", m[5], 0x3fff, CPUSTATE_IMPORT_SEXT)
- ADSP21XX_STATE_ENTRY(M6, "%04X", m[6], 0x3fff, CPUSTATE_IMPORT_SEXT)
- ADSP21XX_STATE_ENTRY(M7, "%04X", m[7], 0x3fff, CPUSTATE_IMPORT_SEXT)
-
- ADSP21XX_STATE_ENTRY(PX, "%02X", px, 0xff, 0)
- ADSP21XX_STATE_ENTRY(CNTR, "%04X", cntr, 0x3fff, 0)
- ADSP21XX_STATE_ENTRY(ASTAT, "%02X", astat, 0xff, 0)
- ADSP21XX_STATE_ENTRY(SSTAT, "%02X", sstat, 0xff, 0)
- ADSP21XX_STATE_ENTRY_MASK(MSTAT, "%01X", mstat, 0x0f, CPUSTATE_IMPORT, (1 << CHIP_TYPE_ADSP2100))
- ADSP21XX_STATE_ENTRY_MASK(MSTAT, "%02X", mstat, 0x7f, CPUSTATE_IMPORT, ~(1 << CHIP_TYPE_ADSP2100))
-
- ADSP21XX_STATE_ENTRY(PCSP, "%02X", pc_sp, 0xff, 0)
- ADSP21XX_STATE_ENTRY(GENSP, "%02X", pc_sp, 0xff, CPUSTATE_NOSHOW)
- ADSP21XX_STATE_ENTRY(CNTRSP, "%01X", cntr_sp, 0xf, 0)
- ADSP21XX_STATE_ENTRY(STATSP, "%01X", stat_sp, 0xf, 0)
- ADSP21XX_STATE_ENTRY(LOOPSP, "%01X", loop_sp, 0xf, 0)
-
- ADSP21XX_STATE_ENTRY_MASK(IMASK, "%01X", imask, 0x00f, CPUSTATE_IMPORT, (1 << CHIP_TYPE_ADSP2100))
- ADSP21XX_STATE_ENTRY_MASK(IMASK, "%02X", imask, 0x03f, CPUSTATE_IMPORT, ~((1 << CHIP_TYPE_ADSP2100) | (1 << CHIP_TYPE_ADSP2181)))
- ADSP21XX_STATE_ENTRY_MASK(IMASK, "%03X", imask, 0x3ff, CPUSTATE_IMPORT, (1 << CHIP_TYPE_ADSP2181))
- ADSP21XX_STATE_ENTRY(ICNTL, "%02X", icntl, 0x1f, CPUSTATE_IMPORT)
- ADSP21XX_STATE_ENTRY(IRQSTATE0, "%1u", irq_state[0], 0x1, CPUSTATE_IMPORT)
- ADSP21XX_STATE_ENTRY(IRQSTATE1, "%1u", irq_state[1], 0x1, CPUSTATE_IMPORT)
- ADSP21XX_STATE_ENTRY(IRQSTATE2, "%1u", irq_state[2], 0x1, CPUSTATE_IMPORT)
- ADSP21XX_STATE_ENTRY_MASK(IRQSTATE3, "%1u", irq_state[3], 0x1, CPUSTATE_IMPORT, (1 << CHIP_TYPE_ADSP2100))
-
- ADSP21XX_STATE_ENTRY(FLAGIN, "%1u", flagin, 0x1, 0)
- ADSP21XX_STATE_ENTRY(FLAGOUT, "%1u", flagout, 0x1, 0)
- ADSP21XX_STATE_ENTRY(FL0, "%1u", fl0, 0x1, 0)
- ADSP21XX_STATE_ENTRY(FL1, "%1u", fl1, 0x1, 0)
- ADSP21XX_STATE_ENTRY(FL2, "%1u", fl2, 0x1, 0)
-};
-
-static const cpu_state_table state_table_template =
-{
- NULL, /* pointer to the base of state (offsets are relative to this) */
- 0, /* subtype this table refers to */
- ARRAY_LENGTH(state_array), /* number of entries */
- state_array /* array of entries */
-};
-
-
-
-/***************************************************************************
PRIVATE FUNCTION PROTOTYPES
***************************************************************************/
@@ -428,15 +301,14 @@ static void check_irqs(adsp2100_state *adsp);
INLINE adsp2100_state *get_safe_token(running_device *device)
{
assert(device != NULL);
- assert(device->token != NULL);
- assert(device->type == CPU);
+ 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);
- return (adsp2100_state *)device->token;
+ return (adsp2100_state *)downcast<cpu_device *>(device)->token();
}
@@ -691,9 +563,9 @@ static void set_irq_line(adsp2100_state *adsp, int irqline, int state)
INITIALIZATION AND SHUTDOWN
***************************************************************************/
-static adsp2100_state *adsp21xx_init(running_device *device, cpu_irq_callback irqcallback, int chiptype)
+static adsp2100_state *adsp21xx_init(running_device *device, device_irq_callback irqcallback, int chiptype)
{
- const adsp21xx_config *config = (const adsp21xx_config *)device->baseconfig().static_config;
+ const adsp21xx_config *config = (const adsp21xx_config *)device->baseconfig().static_config();
adsp2100_state *adsp = get_safe_token(device);
/* create the tables */
@@ -706,9 +578,9 @@ static adsp2100_state *adsp21xx_init(running_device *device, cpu_irq_callback ir
/* fetch device parameters */
adsp->device = device;
- adsp->program = device->space(AS_PROGRAM);
- adsp->data = device->space(AS_DATA);
- adsp->io = device->space(AS_IO);
+ adsp->program = device_memory(device)->space(AS_PROGRAM);
+ adsp->data = device_memory(device)->space(AS_DATA);
+ adsp->io = device_memory(device)->space(AS_IO);
/* copy function pointers from the config */
if (config != NULL)
@@ -718,11 +590,6 @@ static adsp2100_state *adsp21xx_init(running_device *device, cpu_irq_callback ir
adsp->timer_fired = config->timer;
}
- /* set up the state table */
- adsp->state = state_table_template;
- adsp->state.baseptr = adsp;
- adsp->state.subtypemask = 1 << chiptype;
-
/* set up ALU register pointers */
adsp->alu_xregs[0] = &adsp->core.ax0;
adsp->alu_xregs[1] = &adsp->core.ax1;
@@ -843,6 +710,93 @@ static adsp2100_state *adsp21xx_init(running_device *device, cpu_irq_callback ir
state_save_register_device_item_array(device, 0, adsp->irq_state);
state_save_register_device_item_array(device, 0, adsp->irq_latch);
+ // eventually this will be built-in
+ device_state_interface *state;
+ device->interface(state);
+ state->state_add(ADSP2100_PC, "PC", adsp->pc);
+ state->state_add(STATE_GENPC, "GENPC", adsp->pc).noshow();
+ state->state_add(STATE_GENPCBASE, "GENPCBASE", adsp->ppc).noshow();
+ state->state_add(STATE_GENFLAGS, "GENFLAGS", adsp->astat).mask(0xff).noshow().formatstr("%8s");
+
+ state->state_add(ADSP2100_AX0, "AX0", adsp->core.ax0.u);
+ state->state_add(ADSP2100_AX1, "AX1", adsp->core.ax1.u);
+ state->state_add(ADSP2100_AY0, "AY0", adsp->core.ay0.u);
+ state->state_add(ADSP2100_AY1, "AY1", adsp->core.ay1.u);
+ state->state_add(ADSP2100_AR, "AR", adsp->core.ar.u);
+ state->state_add(ADSP2100_AF, "AF", adsp->core.af.u);
+
+ state->state_add(ADSP2100_MX0, "MX0", adsp->core.mx0.u);
+ state->state_add(ADSP2100_MX1, "MX1", adsp->core.mx1.u);
+ state->state_add(ADSP2100_MY0, "MY0", adsp->core.my0.u);
+ state->state_add(ADSP2100_MY1, "MY1", adsp->core.my1.u);
+ state->state_add(ADSP2100_MR0, "MR0", adsp->core.mr.mrx.mr0.u);
+ state->state_add(ADSP2100_MR1, "MR1", adsp->core.mr.mrx.mr1.u);
+ state->state_add(ADSP2100_MR2, "MR2", adsp->core.mr.mrx.mr2.u).signed_mask(0xff);
+ state->state_add(ADSP2100_MF, "MF", adsp->core.mf.u);
+
+ state->state_add(ADSP2100_SI, "SI", adsp->core.si.u);
+ state->state_add(ADSP2100_SE, "SE", adsp->core.se.u).signed_mask(0xff);
+ state->state_add(ADSP2100_SB, "SB", adsp->core.sb.u).signed_mask(0x1f);
+ state->state_add(ADSP2100_SR0, "SR0", adsp->core.sr.srx.sr0.u);
+ state->state_add(ADSP2100_SR1, "SR1", adsp->core.sr.srx.sr1.u);
+
+ state->state_add(ADSP2100_AX0_SEC, "AX0_SEC", adsp->alt.ax0.u);
+ state->state_add(ADSP2100_AX1_SEC, "AX1_SEC", adsp->alt.ax1.u);
+ state->state_add(ADSP2100_AY0_SEC, "AY0_SEC", adsp->alt.ay0.u);
+ state->state_add(ADSP2100_AY1_SEC, "AY1_SEC", adsp->alt.ay1.u);
+ state->state_add(ADSP2100_AR_SEC, "AR_SEC", adsp->alt.ar.u);
+ state->state_add(ADSP2100_AF_SEC, "AF_SEC", adsp->alt.af.u);
+
+ state->state_add(ADSP2100_MX0_SEC, "MX0_SEC", adsp->alt.mx0.u);
+ state->state_add(ADSP2100_MX1_SEC, "MX1_SEC", adsp->alt.mx1.u);
+ state->state_add(ADSP2100_MY0_SEC, "MY0_SEC", adsp->alt.my0.u);
+ state->state_add(ADSP2100_MY1_SEC, "MY1_SEC", adsp->alt.my1.u);
+ state->state_add(ADSP2100_MR0_SEC, "MR0_SEC", adsp->alt.mr.mrx.mr0.u);
+ state->state_add(ADSP2100_MR1_SEC, "MR1_SEC", adsp->alt.mr.mrx.mr1.u);
+ state->state_add(ADSP2100_MR2_SEC, "MR2_SEC", adsp->alt.mr.mrx.mr2.u).signed_mask(0xff);
+ state->state_add(ADSP2100_MF_SEC, "MF_SEC", adsp->alt.mf.u);
+
+ state->state_add(ADSP2100_SI_SEC, "SI_SEC", adsp->alt.si.u);
+ state->state_add(ADSP2100_SE_SEC, "SE_SEC", adsp->alt.se.u).signed_mask(0xff);
+ state->state_add(ADSP2100_SB_SEC, "SB_SEC", adsp->alt.sb.u).signed_mask(0x1f);
+ state->state_add(ADSP2100_SR0_SEC, "SR0_SEC", adsp->alt.sr.srx.sr0.u);
+ state->state_add(ADSP2100_SR1_SEC, "SR1_SEC", adsp->alt.sr.srx.sr1.u);
+
+ astring tempstring;
+ for (int ireg = 0; ireg < 8; ireg++)
+ state->state_add(ADSP2100_I0 + ireg, tempstring.format("I%d", ireg), adsp->i[ireg]).mask(0x3fff).callimport();
+
+ for (int lreg = 0; lreg < 8; lreg++)
+ state->state_add(ADSP2100_L0 + lreg, tempstring.format("L%d", lreg), adsp->l[lreg]).mask(0x3fff).callimport();
+
+ for (int mreg = 0; mreg < 8; mreg++)
+ state->state_add(ADSP2100_M0 + mreg, tempstring.format("M%d", mreg), adsp->m[mreg]).signed_mask(0x3fff);
+
+ state->state_add(ADSP2100_PX, "PX", adsp->px);
+ state->state_add(ADSP2100_CNTR, "CNTR", adsp->cntr).mask(0x3fff);
+ state->state_add(ADSP2100_ASTAT, "ASTAT", adsp->astat).mask(0xff);
+ state->state_add(ADSP2100_SSTAT, "SSTAT", adsp->sstat).mask(0xff);
+ state->state_add(ADSP2100_MSTAT, "MSTAT", adsp->mstat).mask((chiptype == CHIP_TYPE_ADSP2100) ? 0x0f : 0x7f).callimport();
+
+ state->state_add(ADSP2100_PCSP, "PCSP", adsp->pc_sp).mask(0xff);
+ state->state_add(STATE_GENSP, "GENSP", adsp->pc_sp).mask(0xff).noshow();
+ state->state_add(ADSP2100_CNTRSP, "CNTRSP", adsp->cntr_sp).mask(0xf);
+ state->state_add(ADSP2100_STATSP, "STATSP", adsp->stat_sp).mask(0xf);
+ state->state_add(ADSP2100_LOOPSP, "LOOPSP", adsp->loop_sp).mask(0xf);
+
+ state->state_add(ADSP2100_IMASK, "IMASK", adsp->imask).mask((chiptype == CHIP_TYPE_ADSP2100) ? 0x00f : (chiptype == CHIP_TYPE_ADSP2181) ? 0x3ff : 0x07f).callimport();
+ state->state_add(ADSP2100_ICNTL, "ICNTL", adsp->icntl).mask(0x1f).callimport();
+
+ for (int irqnum = 0; irqnum < 4; irqnum++)
+ if (irqnum < 4 || chiptype == CHIP_TYPE_ADSP2100)
+ state->state_add(ADSP2100_IRQSTATE0 + irqnum, tempstring.format("IRQ%d", irqnum), adsp->irq_state[irqnum]).mask(1).callimport();
+
+ state->state_add(ADSP2100_FLAGIN, "FLAGIN", adsp->flagin).mask(1);
+ state->state_add(ADSP2100_FLAGOUT, "FLAGOUT", adsp->flagout).mask(1);
+ state->state_add(ADSP2100_FL0, "FL0", adsp->fl0).mask(1);
+ state->state_add(ADSP2100_FL1, "FL1", adsp->fl1).mask(1);
+ state->state_add(ADSP2100_FL2, "FL2", adsp->fl2).mask(1);
+
return adsp;
}
@@ -1807,7 +1761,7 @@ extern CPU_DISASSEMBLE( adsp21xx );
static CPU_IMPORT_STATE( adsp21xx )
{
adsp2100_state *adsp = get_safe_token(device);
- switch (entry->index)
+ switch (entry.index())
{
case ADSP2100_MSTAT:
update_mstat(adsp);
@@ -1830,7 +1784,7 @@ static CPU_IMPORT_STATE( adsp21xx )
case ADSP2100_I5:
case ADSP2100_I6:
case ADSP2100_I7:
- update_i(adsp, entry->index - ADSP2100_I0);
+ update_i(adsp, entry.index() - ADSP2100_I0);
break;
case ADSP2100_L0:
@@ -1841,7 +1795,7 @@ static CPU_IMPORT_STATE( adsp21xx )
case ADSP2100_L5:
case ADSP2100_L6:
case ADSP2100_L7:
- update_l(adsp, entry->index - ADSP2100_L0);
+ update_l(adsp, entry.index() - ADSP2100_L0);
break;
default:
@@ -1851,6 +1805,28 @@ static CPU_IMPORT_STATE( adsp21xx )
}
+static CPU_EXPORT_STRING( adsp21xx )
+{
+ adsp2100_state *adsp = get_safe_token(device);
+
+ switch (entry.index())
+ {
+ case STATE_GENFLAGS:
+ string.printf("%c%c%c%c%c%c%c%c",
+ adsp->astat & 0x80 ? 'X':'.',
+ adsp->astat & 0x40 ? 'M':'.',
+ adsp->astat & 0x20 ? 'Q':'.',
+ adsp->astat & 0x10 ? 'S':'.',
+ adsp->astat & 0x08 ? 'C':'.',
+ adsp->astat & 0x04 ? 'V':'.',
+ adsp->astat & 0x02 ? 'N':'.',
+ adsp->astat & 0x01 ? 'Z':'.');
+ break;
+ }
+}
+
+
+
/**************************************************************************
* Generic set_info
@@ -1885,7 +1861,7 @@ static CPU_SET_INFO( adsp21xx )
static CPU_GET_INFO( adsp21xx )
{
- adsp2100_state *adsp = (device != NULL && device->token != NULL) ? get_safe_token(device) : NULL;
+ adsp2100_state *adsp = (device != NULL && downcast<cpu_device *>(device)->token() != NULL) ? get_safe_token(device) : NULL;
switch (state)
{
/* --- the following bits of info are returned as 64-bit signed integers --- */
@@ -1928,10 +1904,10 @@ static CPU_GET_INFO( adsp21xx )
case CPUINFO_FCT_EXECUTE: info->execute = CPU_EXECUTE_NAME(adsp21xx); break;
case CPUINFO_FCT_DISASSEMBLE: info->disassemble = CPU_DISASSEMBLE_NAME(adsp21xx); break;
case CPUINFO_FCT_IMPORT_STATE: info->import_state = CPU_IMPORT_STATE_NAME(adsp21xx); break;
+ case CPUINFO_FCT_EXPORT_STRING: info->export_string = CPU_EXPORT_STRING_NAME(adsp21xx); break;
/* --- the following bits of info are returned as pointers --- */
case CPUINFO_PTR_INSTRUCTION_COUNTER: info->icount = &adsp->icount; break;
- case CPUINFO_PTR_STATE_TABLE: info->state_table = &adsp->state; break;
/* --- the following bits of info are returned as NULL-terminated strings --- */
case DEVINFO_STR_NAME: /* set per CPU */ break;
@@ -1939,18 +1915,6 @@ static CPU_GET_INFO( adsp21xx )
case DEVINFO_STR_VERSION: strcpy(info->s, "2.0"); break;
case DEVINFO_STR_SOURCE_FILE: strcpy(info->s, __FILE__); break;
case DEVINFO_STR_CREDITS: strcpy(info->s, "Copyright Aaron Giles"); break;
-
- case CPUINFO_STR_FLAGS:
- sprintf(info->s, "%c%c%c%c%c%c%c%c",
- adsp->astat & 0x80 ? 'X':'.',
- adsp->astat & 0x40 ? 'M':'.',
- adsp->astat & 0x20 ? 'Q':'.',
- adsp->astat & 0x10 ? 'S':'.',
- adsp->astat & 0x08 ? 'C':'.',
- adsp->astat & 0x04 ? 'V':'.',
- adsp->astat & 0x02 ? 'N':'.',
- adsp->astat & 0x01 ? 'Z':'.');
- break;
}
}
diff --git a/src/emu/cpu/adsp2100/adsp2100.h b/src/emu/cpu/adsp2100/adsp2100.h
index 1d6d279d26d..d7cb50dd795 100644
--- a/src/emu/cpu/adsp2100/adsp2100.h
+++ b/src/emu/cpu/adsp2100/adsp2100.h
@@ -52,9 +52,9 @@ enum
ADSP2100_MX0_SEC, ADSP2100_MX1_SEC, ADSP2100_MY0_SEC, ADSP2100_MY1_SEC, ADSP2100_MR0_SEC, ADSP2100_MR1_SEC, ADSP2100_MR2_SEC, ADSP2100_MF_SEC,
ADSP2100_SI_SEC, ADSP2100_SE_SEC, ADSP2100_SB_SEC, ADSP2100_SR0_SEC, ADSP2100_SR1_SEC,
- ADSP2100_GENPC = REG_GENPC,
- ADSP2100_GENSP = REG_GENSP,
- ADSP2100_GENPCBASE = REG_GENPCBASE
+ ADSP2100_GENPC = STATE_GENPC,
+ ADSP2100_GENSP = STATE_GENSP,
+ ADSP2100_GENPCBASE = STATE_GENPCBASE
};
diff --git a/src/emu/cpu/alph8201/alph8201.c b/src/emu/cpu/alph8201/alph8201.c
index 17f5b40c831..a68eb843226 100644
--- a/src/emu/cpu/alph8201/alph8201.c
+++ b/src/emu/cpu/alph8201/alph8201.c
@@ -227,11 +227,10 @@ typedef struct {
INLINE alpha8201_state *get_safe_token(running_device *device)
{
assert(device != NULL);
- assert(device->token != NULL);
- assert(device->type == CPU);
+ assert(device->type() == CPU);
assert(cpu_get_type(device) == CPU_ALPHA8201 ||
cpu_get_type(device) == CPU_ALPHA8301);
- return (alpha8201_state *)device->token;
+ return (alpha8201_state *)downcast<cpu_device *>(device)->token();
}
/* Get next opcode argument and increment program counter */
@@ -670,7 +669,7 @@ static CPU_INIT( alpha8201 )
alpha8201_state *cpustate = get_safe_token(device);
cpustate->device = device;
- cpustate->program = device->space(AS_PROGRAM);
+ cpustate->program = device_memory(device)->space(AS_PROGRAM);
state_save_register_device_item_array(device, 0, cpustate->RAM);
state_save_register_device_item(device, 0, cpustate->PREVPC);
@@ -879,7 +878,7 @@ static CPU_SET_INFO( alpha8201 )
/* 8201 and 8301 */
static CPU_GET_INFO( alpha8xxx )
{
- alpha8201_state *cpustate = (device != NULL && device->token != NULL) ? get_safe_token(device) : NULL;
+ alpha8201_state *cpustate = (device != NULL && downcast<cpu_device *>(device)->token() != NULL) ? get_safe_token(device) : NULL;
switch (state)
{
/* --- the following bits of info are returned as 64-bit signed integers --- */
diff --git a/src/emu/cpu/am29000/am29000.c b/src/emu/cpu/am29000/am29000.c
index b1455847595..6c896ae7de8 100644
--- a/src/emu/cpu/am29000/am29000.c
+++ b/src/emu/cpu/am29000/am29000.c
@@ -144,19 +144,18 @@ typedef struct _am29000_state
INLINE am29000_state *get_safe_token(running_device *device)
{
assert(device != NULL);
- assert(device->token != NULL);
- assert(device->type == CPU);
+ assert(device->type() == CPU);
assert(cpu_get_type(device) == CPU_AM29000);
- return (am29000_state *)device->token;
+ return (am29000_state *)downcast<cpu_device *>(device)->token();
}
static CPU_INIT( am29000 )
{
am29000_state *am29000 = get_safe_token(device);
- am29000->program = device->space(AS_PROGRAM);
- am29000->data = device->space(AS_DATA);
- am29000->io = device->space(AS_IO);
+ am29000->program = device_memory(device)->space(AS_PROGRAM);
+ am29000->data = device_memory(device)->space(AS_DATA);
+ am29000->io = device_memory(device)->space(AS_IO);
am29000->cfg = (PRL_AM29000 | PRL_REV_D) << CFG_PRL_SHIFT;
/* Register state for saving */
@@ -713,7 +712,7 @@ static CPU_SET_INFO( am29000 )
CPU_GET_INFO( am29000 )
{
- am29000_state *am29000 = (device != NULL && device->token != NULL) ? get_safe_token(device) : NULL;
+ am29000_state *am29000 = (device != NULL && downcast<cpu_device *>(device)->token() != NULL) ? get_safe_token(device) : NULL;
switch (state)
{
diff --git a/src/emu/cpu/apexc/apexc.c b/src/emu/cpu/apexc/apexc.c
index cb4cfdc3d8b..5a66f04c5b1 100644
--- a/src/emu/cpu/apexc/apexc.c
+++ b/src/emu/cpu/apexc/apexc.c
@@ -371,10 +371,9 @@ struct _apexc_state
INLINE apexc_state *get_safe_token(running_device *device)
{
assert(device != NULL);
- assert(device->token != NULL);
- assert(device->type == CPU);
+ assert(device->type() == CPU);
assert(cpu_get_type(device) == CPU_APEXC);
- return (apexc_state *)device->token;
+ return (apexc_state *)downcast<cpu_device *>(device)->token();
}
@@ -803,8 +802,8 @@ static CPU_INIT( apexc )
apexc_state *cpustate = get_safe_token(device);
cpustate->device = device;
- cpustate->program = device->space(AS_PROGRAM);
- cpustate->io = device->space(AS_IO);
+ cpustate->program = device_memory(device)->space(AS_PROGRAM);
+ cpustate->io = device_memory(device)->space(AS_IO);
state_save_register_device_item(device, 0, cpustate->a);
state_save_register_device_item(device, 0, cpustate->r);
@@ -890,7 +889,7 @@ static CPU_SET_INFO( apexc )
CPU_GET_INFO( apexc )
{
- apexc_state *cpustate = (device != NULL && device->token != NULL) ? get_safe_token(device) : NULL;
+ apexc_state *cpustate = (device != NULL && downcast<cpu_device *>(device)->token() != NULL) ? get_safe_token(device) : NULL;
switch (state)
{
diff --git a/src/emu/cpu/arm/arm.c b/src/emu/cpu/arm/arm.c
index d0aa838a6be..40bfcea293d 100644
--- a/src/emu/cpu/arm/arm.c
+++ b/src/emu/cpu/arm/arm.c
@@ -233,7 +233,7 @@ typedef struct
UINT32 coproRegister[16];
UINT8 pendingIrq;
UINT8 pendingFiq;
- cpu_irq_callback irq_callback;
+ device_irq_callback irq_callback;
running_device *device;
const address_space *program;
} ARM_REGS;
@@ -253,10 +253,9 @@ static void arm_check_irq_state(ARM_REGS* cpustate);
INLINE ARM_REGS *get_safe_token(running_device *device)
{
assert(device != NULL);
- assert(device->token != NULL);
- assert(device->type == CPU);
+ assert(device->type() == CPU);
assert(cpu_get_type(device) == CPU_ARM);
- return (ARM_REGS *)device->token;
+ return (ARM_REGS *)downcast<cpu_device *>(device)->token();
}
INLINE void cpu_write32( ARM_REGS* cpustate, int addr, UINT32 data )
@@ -312,11 +311,11 @@ static CPU_RESET( arm )
{
ARM_REGS *cpustate = get_safe_token(device);
- cpu_irq_callback save_irqcallback = cpustate->irq_callback;
+ device_irq_callback save_irqcallback = cpustate->irq_callback;
memset(cpustate, 0, sizeof(ARM_REGS));
cpustate->irq_callback = save_irqcallback;
cpustate->device = device;
- cpustate->program = device->space(AS_PROGRAM);
+ cpustate->program = device_memory(device)->space(AS_PROGRAM);
/* start up in SVC mode with interrupts disabled. */
R15 = eARM_MODE_SVC|I_MASK|F_MASK;
@@ -501,7 +500,7 @@ static CPU_INIT( arm )
cpustate->irq_callback = irqcallback;
cpustate->device = device;
- cpustate->program = device->space(AS_PROGRAM);
+ cpustate->program = device_memory(device)->space(AS_PROGRAM);
state_save_register_device_item_array(device, 0, cpustate->sArmRegister);
state_save_register_device_item_array(device, 0, cpustate->coproRegister);
@@ -1436,7 +1435,7 @@ static CPU_SET_INFO( arm )
CPU_GET_INFO( arm )
{
- ARM_REGS *cpustate = (device != NULL && device->token != NULL) ? get_safe_token(device) : NULL;
+ ARM_REGS *cpustate = (device != NULL && downcast<cpu_device *>(device)->token() != NULL) ? get_safe_token(device) : NULL;
switch (state)
{
diff --git a/src/emu/cpu/arm7/arm7.c b/src/emu/cpu/arm7/arm7.c
index a53cf2f2276..278b9a6606d 100644
--- a/src/emu/cpu/arm7/arm7.c
+++ b/src/emu/cpu/arm7/arm7.c
@@ -71,10 +71,9 @@ 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->token != NULL);
- assert(device->type == CPU);
+ assert(device->type() == CPU);
assert(cpu_get_type(device) == CPU_ARM7 || cpu_get_type(device) == CPU_ARM9 || cpu_get_type(device) == CPU_PXA255);
- return (arm_state *)device->token;
+ return (arm_state *)downcast<cpu_device *>(device)->token();
}
INLINE INT64 saturate_qbit_overflow(arm_state *cpustate, INT64 res)
@@ -191,7 +190,7 @@ INLINE UINT32 arm7_tlb_translate(arm_state *cpustate, UINT32 vaddr)
static CPU_TRANSLATE( arm7 )
{
- arm_state *cpustate = (device != NULL) ? (arm_state *)device->token : NULL;
+ arm_state *cpustate = (device != NULL) ? (arm_state *)downcast<cpu_device *>(device)->token() : NULL;
/* only applies to the program address space and only does something if the MMU's enabled */
if( space == ADDRESS_SPACE_PROGRAM && ( COPRO_CTRL & COPRO_CTRL_MMU_EN ) )
@@ -217,7 +216,7 @@ static CPU_INIT( arm7 )
cpustate->irq_callback = irqcallback;
cpustate->device = device;
- cpustate->program = device->space(AS_PROGRAM);
+ cpustate->program = device_memory(device)->space(AS_PROGRAM);
// setup co-proc callbacks
arm7_coproc_do_callback = arm7_do_callback;
@@ -385,7 +384,7 @@ static CPU_SET_INFO( arm7 )
CPU_GET_INFO( arm7 )
{
- arm_state *cpustate = (device != NULL && device->token != NULL) ? get_safe_token(device) : NULL;
+ arm_state *cpustate = (device != NULL && downcast<cpu_device *>(device)->token() != NULL) ? get_safe_token(device) : NULL;
switch (state)
{
diff --git a/src/emu/cpu/arm7/arm7core.c b/src/emu/cpu/arm7/arm7core.c
index 953e56a1668..ab73095cefc 100644
--- a/src/emu/cpu/arm7/arm7core.c
+++ b/src/emu/cpu/arm7/arm7core.c
@@ -547,12 +547,12 @@ static void arm7_core_reset(running_device *device)
{
arm_state *cpustate = get_safe_token(device);
- cpu_irq_callback save_irqcallback = cpustate->irq_callback;
+ device_irq_callback save_irqcallback = cpustate->irq_callback;
memset(cpustate, 0, sizeof(arm_state));
cpustate->irq_callback = save_irqcallback;
cpustate->device = device;
- cpustate->program = device->space(AS_PROGRAM);
+ cpustate->program = device_memory(device)->space(AS_PROGRAM);
/* start up in SVC mode with interrupts disabled. */
SwitchMode(cpustate, eARM7_MODE_SVC);
diff --git a/src/emu/cpu/arm7/arm7core.h b/src/emu/cpu/arm7/arm7core.h
index 67e9b918eed..8e0764f0944 100644
--- a/src/emu/cpu/arm7/arm7core.h
+++ b/src/emu/cpu/arm7/arm7core.h
@@ -160,7 +160,7 @@ enum
UINT8 pendingUnd; \
UINT8 pendingSwi; \
INT32 iCount; \
- cpu_irq_callback irq_callback; \
+ device_irq_callback irq_callback; \
running_device *device; \
const address_space *program;
diff --git a/src/emu/cpu/asap/asap.c b/src/emu/cpu/asap/asap.c
index ab9377a9e3a..4875d3d30d1 100644
--- a/src/emu/cpu/asap/asap.c
+++ b/src/emu/cpu/asap/asap.c
@@ -85,7 +85,7 @@ struct _asap_state
UINT32 nextpc;
UINT8 irq_state;
int icount;
- cpu_irq_callback irq_callback;
+ device_irq_callback irq_callback;
const address_space *program;
running_device *device;
@@ -271,10 +271,9 @@ static void (*const conditiontable[16])(asap_state *) =
INLINE asap_state *get_safe_token(running_device *device)
{
assert(device != NULL);
- assert(device->token != NULL);
- assert(device->type == CPU);
+ assert(device->type() == CPU);
assert(cpu_get_type(device) == CPU_ASAP);
- return (asap_state *)device->token;
+ return (asap_state *)downcast<cpu_device *>(device)->token();
}
@@ -447,7 +446,7 @@ static CPU_INIT( asap )
asap->src2val[i] = i;
asap->irq_callback = irqcallback;
asap->device = device;
- asap->program = device->space(AS_PROGRAM);
+ asap->program = device_memory(device)->space(AS_PROGRAM);
state_save_register_device_item(device, 0, asap->pc);
@@ -1728,7 +1727,7 @@ static CPU_SET_INFO( asap )
CPU_GET_INFO( asap )
{
- asap_state *asap = (device != NULL && device->token != NULL) ? get_safe_token(device) : NULL;
+ asap_state *asap = (device != NULL && downcast<cpu_device *>(device)->token() != NULL) ? get_safe_token(device) : NULL;
switch (state)
{
diff --git a/src/emu/cpu/avr8/avr8.c b/src/emu/cpu/avr8/avr8.c
index a651050b041..649b62c48ea 100644
--- a/src/emu/cpu/avr8/avr8.c
+++ b/src/emu/cpu/avr8/avr8.c
@@ -78,10 +78,9 @@ enum
INLINE avr8_state *get_safe_token(running_device *device)
{
assert(device != NULL);
- assert(device->token != NULL);
- assert(device->type == CPU);
+ assert(device->type() == CPU);
assert(cpu_get_type(device) == CPU_AVR8);
- return (avr8_state *)device->token;
+ return (avr8_state *)downcast<cpu_device *>(device)->token();
}
/*****************************************************************************/
@@ -190,8 +189,8 @@ static CPU_INIT( avr8 )
cpustate->pc = 0;
cpustate->device = device;
- cpustate->program = device->space(AS_PROGRAM);
- cpustate->io = device->space(AS_IO);
+ cpustate->program = device_memory(device)->space(AS_PROGRAM);
+ cpustate->io = device_memory(device)->space(AS_IO);
WRITE_IO_8(cpustate, AVR8_IO_SREG, 0);
@@ -1074,7 +1073,7 @@ static CPU_SET_INFO( avr8 )
CPU_GET_INFO( avr8 )
{
- avr8_state *cpustate = (device != NULL && device->token != NULL) ? get_safe_token(device) : NULL;
+ avr8_state *cpustate = (device != NULL && downcast<cpu_device *>(device)->token() != NULL) ? get_safe_token(device) : NULL;
switch(state)
{
diff --git a/src/emu/cpu/ccpu/ccpu.c b/src/emu/cpu/ccpu/ccpu.c
index c6d9c59b95e..a0a57c88ace 100644
--- a/src/emu/cpu/ccpu/ccpu.c
+++ b/src/emu/cpu/ccpu/ccpu.c
@@ -53,10 +53,9 @@ struct _ccpu_state
INLINE ccpu_state *get_safe_token(running_device *device)
{
assert(device != NULL);
- assert(device->token != NULL);
- assert(device->type == CPU);
+ assert(device->type() == CPU);
assert(cpu_get_type(device) == CPU_CCPU);
- return (ccpu_state *)device->token;
+ return (ccpu_state *)downcast<cpu_device *>(device)->token();
}
@@ -125,16 +124,16 @@ void ccpu_wdt_timer_trigger(running_device *device)
static CPU_INIT( ccpu )
{
- const ccpu_config *configdata = (const ccpu_config *)device->baseconfig().static_config;
+ const ccpu_config *configdata = (const ccpu_config *)device->baseconfig().static_config();
ccpu_state *cpustate = get_safe_token(device);
/* copy input params */
cpustate->external_input = configdata->external_input ? configdata->external_input : read_jmi;
cpustate->vector_callback = configdata->vector_callback;
cpustate->device = device;
- cpustate->program = device->space(AS_PROGRAM);
- cpustate->data = device->space(AS_DATA);
- cpustate->io = device->space(AS_IO);
+ cpustate->program = device_memory(device)->space(AS_PROGRAM);
+ cpustate->data = device_memory(device)->space(AS_DATA);
+ cpustate->io = device_memory(device)->space(AS_IO);
state_save_register_device_item(device, 0, cpustate->PC);
state_save_register_device_item(device, 0, cpustate->A);
@@ -731,7 +730,7 @@ static CPU_SET_INFO( ccpu )
CPU_GET_INFO( ccpu )
{
- ccpu_state *cpustate = (device != NULL && device->token != NULL) ? get_safe_token(device) : NULL;
+ ccpu_state *cpustate = (device != NULL && downcast<cpu_device *>(device)->token() != NULL) ? get_safe_token(device) : NULL;
switch (state)
{
diff --git a/src/emu/cpu/cdp1802/cdp1802.c b/src/emu/cpu/cdp1802/cdp1802.c
index 41a5293639b..46b247d4d39 100644
--- a/src/emu/cpu/cdp1802/cdp1802.c
+++ b/src/emu/cpu/cdp1802/cdp1802.c
@@ -45,6 +45,7 @@ struct _cdp1802_state
UINT8 t; /* temporary register */
int ie; /* interrupt enable */
int q; /* output flip-flop */
+ UINT8 flags; // used for I/O only
/* cpu state */
cdp1802_cpu_state state; /* processor state */
@@ -59,70 +60,19 @@ struct _cdp1802_state
int ef; /* external flags */
/* execution logic */
- UINT16 fake_pc; /* fake program counter */
int icount; /* instruction counter */
-
- cpu_state_table state_table;
};
/***************************************************************************
CPU STATE DESCRIPTION
***************************************************************************/
-#define CDP1802_STATE_ENTRY(_name, _format, _member, _datamask, _flags) \
- CPU_STATE_ENTRY(CDP1802_##_name, #_name, _format, cdp1802_state, _member, _datamask, ~0, _flags)
-
-static const cpu_state_entry state_array[] =
-{
- CDP1802_STATE_ENTRY(GENPC, "%04X", fake_pc, 0xffff, CPUSTATE_NOSHOW | CPUSTATE_IMPORT | CPUSTATE_EXPORT)
-
- CDP1802_STATE_ENTRY(P, "%01X", p, 0xf, 0)
- CDP1802_STATE_ENTRY(X, "%01X", x, 0xf, 0)
- CDP1802_STATE_ENTRY(D, "%02X", d, 0xff, 0)
- CDP1802_STATE_ENTRY(B, "%02X", b, 0xff, 0)
- CDP1802_STATE_ENTRY(T, "%02X", t, 0xff, 0)
-
- CDP1802_STATE_ENTRY(I, "%01X", i, 0xf, 0)
- CDP1802_STATE_ENTRY(N, "%01X", n, 0xf, 0)
-
- CDP1802_STATE_ENTRY(R0, "%04X", r[0], 0xffff, 0)
- CDP1802_STATE_ENTRY(R1, "%04X", r[1], 0xffff, 0)
- CDP1802_STATE_ENTRY(R2, "%04X", r[2], 0xffff, 0)
- CDP1802_STATE_ENTRY(R3, "%04X", r[3], 0xffff, 0)
- CDP1802_STATE_ENTRY(R4, "%04X", r[4], 0xffff, 0)
- CDP1802_STATE_ENTRY(R5, "%04X", r[5], 0xffff, 0)
- CDP1802_STATE_ENTRY(R6, "%04X", r[6], 0xffff, 0)
- CDP1802_STATE_ENTRY(R7, "%04X", r[7], 0xffff, 0)
- CDP1802_STATE_ENTRY(R8, "%04X", r[8], 0xffff, 0)
- CDP1802_STATE_ENTRY(R9, "%04X", r[9], 0xffff, 0)
- CDP1802_STATE_ENTRY(Ra, "%04X", r[10], 0xffff, 0)
- CDP1802_STATE_ENTRY(Rb, "%04X", r[11], 0xffff, 0)
- CDP1802_STATE_ENTRY(Rc, "%04X", r[12], 0xffff, 0)
- CDP1802_STATE_ENTRY(Rd, "%04X", r[13], 0xffff, 0)
- CDP1802_STATE_ENTRY(Re, "%04X", r[14], 0xffff, 0)
- CDP1802_STATE_ENTRY(Rf, "%04X", r[15], 0xffff, 0)
-
- CDP1802_STATE_ENTRY(SC, "%1u", state_code, 0x3, CPUSTATE_NOSHOW)
- CDP1802_STATE_ENTRY(DF, "%1u", df, 0x1, CPUSTATE_NOSHOW)
- CDP1802_STATE_ENTRY(IE, "%1u", ie, 0x1, CPUSTATE_NOSHOW)
- CDP1802_STATE_ENTRY(Q, "%1u", q, 0x1, CPUSTATE_NOSHOW)
-};
-
-static const cpu_state_table state_table_template =
-{
- NULL, /* pointer to the base of state (offsets are relative to this) */
- 0, /* subtype this table refers to */
- ARRAY_LENGTH(state_array), /* number of entries */
- state_array /* array of entries */
-};
-
INLINE cdp1802_state *get_safe_token(running_device *device)
{
assert(device != NULL);
- assert(device->token != NULL);
- assert(device->type == CPU);
+ assert(device->type() == CPU);
assert(cpu_get_type(device) == CPU_CDP1802);
- return (cdp1802_state *)device->token;
+ return (cdp1802_state *)downcast<cpu_device *>(device)->token();
}
#define OPCODE_R(addr) memory_decrypted_read_byte(cpustate->program, addr)
@@ -960,12 +910,55 @@ static CPU_RESET( cdp1802 )
cpustate->mode = CDP1802_MODE_RESET;
}
+static CPU_IMPORT_STATE( cdp1802 )
+{
+ cdp1802_state *cpustate = get_safe_token(device);
+
+ switch (entry.index())
+ {
+ case STATE_GENFLAGS:
+ cpustate->df = (cpustate->flags >> 1) & 1;
+ cpustate->ie = (cpustate->flags >> 1) & 1;
+ cpustate->q = (cpustate->flags >> 0) & 1;
+ break;
+ }
+}
+
+static CPU_EXPORT_STATE( cdp1802 )
+{
+ cdp1802_state *cpustate = get_safe_token(device);
+
+ switch (entry.index())
+ {
+ case STATE_GENFLAGS:
+ cpustate->flags = (cpustate->df ? 0x04 : 0x00) |
+ (cpustate->ie ? 0x02 : 0x00) |
+ (cpustate->q ? 0x01 : 0x00);
+ break;
+ }
+}
+
+static CPU_EXPORT_STRING( cdp1802 )
+{
+ cdp1802_state *cpustate = get_safe_token(device);
+
+ switch (entry.index())
+ {
+ case STATE_GENFLAGS:
+ string.printf("%c%c%c",
+ cpustate->df ? 'D' : '.',
+ cpustate->ie ? 'I' : '.',
+ cpustate->q ? 'Q' : '.');
+ break;
+ }
+}
+
static CPU_INIT( cdp1802 )
{
cdp1802_state *cpustate = get_safe_token(device);
int i;
- cpustate->intf = (cdp1802_interface *) device->baseconfig().static_config;
+ cpustate->intf = (cdp1802_interface *) device->baseconfig().static_config();
/* resolve callbacks */
devcb_resolve_write_line(&cpustate->out_q_func, &cpustate->intf->out_q_func, device);
@@ -973,13 +966,34 @@ static CPU_INIT( cdp1802 )
devcb_resolve_write8(&cpustate->out_dma_func, &cpustate->intf->out_dma_func, device);
/* set up the state table */
- cpustate->state_table = state_table_template;
- cpustate->state_table.baseptr = cpustate;
- cpustate->state_table.subtypemask = 1;
+ {
+ device_state_interface *state;
+ device->interface(state);
+ state->state_add(STATE_GENPC, "GENPC", R[P]).noshow();
+ state->state_add(STATE_GENFLAGS, "GENFLAGS", cpustate->flags).mask(0x7).callimport().callexport().noshow().formatstr("%3s");
+
+ state->state_add(CDP1802_P, "P", cpustate->p).mask(0xf);
+ state->state_add(CDP1802_X, "X", cpustate->x).mask(0xf);
+ state->state_add(CDP1802_D, "D", cpustate->d);
+ state->state_add(CDP1802_B, "B", cpustate->b);
+ state->state_add(CDP1802_T, "T", cpustate->t);
+
+ state->state_add(CDP1802_I, "I", cpustate->i).mask(0xf);
+ state->state_add(CDP1802_N, "N", cpustate->n).mask(0xf);
+
+ astring tempstr;
+ for (int regnum = 0; regnum < 16; regnum++)
+ state->state_add(CDP1802_R0 + regnum, tempstr.format("R%x", regnum), cpustate->r[regnum]);
+
+ state->state_add(CDP1802_SC, "SC", cpustate->state_code).mask(0x3).noshow();
+ state->state_add(CDP1802_DF, "DF", cpustate->df).mask(0x1).noshow();
+ state->state_add(CDP1802_IE, "IE", cpustate->ie).mask(0x1).noshow();
+ state->state_add(CDP1802_Q, "Q", cpustate->q).mask(0x1).noshow();
+ }
/* find address spaces */
- cpustate->program = device->space(AS_PROGRAM);
- cpustate->io = device->space(AS_IO);
+ cpustate->program = device_memory(device)->space(AS_PROGRAM);
+ cpustate->io = device_memory(device)->space(AS_IO);
/* set initial values */
cpustate->p = mame_rand(device->machine) & 0x0f;
@@ -1023,42 +1037,6 @@ static CPU_INIT( cdp1802 )
}
/**************************************************************************
- * STATE IMPORT/EXPORT
- **************************************************************************/
-
-static CPU_IMPORT_STATE( cdp1802 )
-{
- cdp1802_state *cpustate = get_safe_token(device);
-
- switch (entry->index)
- {
- case CDP1802_GENPC:
- R[P] = cpustate->fake_pc;
- break;
-
- default:
- fatalerror("CPU_IMPORT_STATE(cdp1802) called for unexpected value\n");
- break;
- }
-}
-
-static CPU_EXPORT_STATE( cdp1802 )
-{
- cdp1802_state *cpustate = get_safe_token(device);
-
- switch (entry->index)
- {
- case CDP1802_GENPC:
- cpustate->fake_pc = R[P];
- break;
-
- default:
- fatalerror("CPU_EXPORT_STATE(cdp1802) called for unexpected value\n");
- break;
- }
-}
-
-/**************************************************************************
* Generic set_info
**************************************************************************/
@@ -1080,7 +1058,7 @@ static CPU_SET_INFO( cdp1802 )
CPU_GET_INFO( cdp1802 )
{
- cdp1802_state *cpustate = (device != NULL && device->token != NULL) ? get_safe_token(device) : NULL;
+ cdp1802_state *cpustate = (device != NULL && downcast<cpu_device *>(device)->token() != NULL) ? get_safe_token(device) : NULL;
switch (state)
{
@@ -1116,12 +1094,12 @@ CPU_GET_INFO( cdp1802 )
case CPUINFO_FCT_RESET: info->reset = CPU_RESET_NAME(cdp1802); break;
case CPUINFO_FCT_EXECUTE: info->execute = CPU_EXECUTE_NAME(cdp1802); break;
case CPUINFO_FCT_DISASSEMBLE: info->disassemble = CPU_DISASSEMBLE_NAME(cdp1802); break;
- case CPUINFO_FCT_IMPORT_STATE: info->import_state = CPU_IMPORT_STATE_NAME(cdp1802);break;
- case CPUINFO_FCT_EXPORT_STATE: info->export_state = CPU_EXPORT_STATE_NAME(cdp1802);break;
+ case CPUINFO_FCT_IMPORT_STATE: info->import_state = CPU_IMPORT_STATE_NAME(cdp1802); break;
+ case CPUINFO_FCT_EXPORT_STATE: info->export_state = CPU_EXPORT_STATE_NAME(cdp1802); break;
+ case CPUINFO_FCT_EXPORT_STRING: info->export_string = CPU_EXPORT_STRING_NAME(cdp1802); break;
/* --- the following bits of info are returned as pointers --- */
case CPUINFO_PTR_INSTRUCTION_COUNTER: info->icount = &cpustate->icount; break;
- case CPUINFO_PTR_STATE_TABLE: info->state_table = &cpustate->state_table; break;
/* --- the following bits of info are returned as NULL-terminated strings --- */
case DEVINFO_STR_NAME: strcpy(info->s, "CDP1802"); break;
@@ -1129,11 +1107,5 @@ CPU_GET_INFO( cdp1802 )
case DEVINFO_STR_VERSION: strcpy(info->s, "1.0"); break;
case DEVINFO_STR_SOURCE_FILE: strcpy(info->s, __FILE__); break;
case DEVINFO_STR_CREDITS: strcpy(info->s, "Copyright Nicola Salmoria and the MAME Team"); break;
-
- case CPUINFO_STR_FLAGS: sprintf(info->s,
- "%c%c%c",
- cpustate->df ? 'D' : '.',
- cpustate->ie ? 'I' : '.',
- cpustate->q ? 'Q' : '.'); break;
}
}
diff --git a/src/emu/cpu/cdp1802/cdp1802.h b/src/emu/cpu/cdp1802/cdp1802.h
index 133191e75d7..c4a18d6bae8 100644
--- a/src/emu/cpu/cdp1802/cdp1802.h
+++ b/src/emu/cpu/cdp1802/cdp1802.h
@@ -56,7 +56,7 @@ enum
CDP1802_R0, CDP1802_R1, CDP1802_R2, CDP1802_R3, CDP1802_R4, CDP1802_R5, CDP1802_R6, CDP1802_R7,
CDP1802_R8, CDP1802_R9, CDP1802_Ra, CDP1802_Rb, CDP1802_Rc, CDP1802_Rd, CDP1802_Re, CDP1802_Rf,
CDP1802_DF, CDP1802_IE, CDP1802_Q, CDP1802_N, CDP1802_I, CDP1802_SC,
- CDP1802_GENPC = REG_GENPC
+ CDP1802_GENPC = STATE_GENPC
};
typedef cdp1802_control_mode (*cdp1802_mode_read_func)(running_device *device);
diff --git a/src/emu/cpu/cop400/cop400.c b/src/emu/cpu/cop400/cop400.c
index 27714cc3ab5..1ee6d92e953 100644
--- a/src/emu/cpu/cop400/cop400.c
+++ b/src/emu/cpu/cop400/cop400.c
@@ -92,6 +92,8 @@ struct _cop400_state
const address_space *program;
const address_space *data;
const address_space *io;
+
+ UINT8 featuremask;
/* registers */
UINT16 pc; /* 9/10/11-bit ROM address program counter */
@@ -108,6 +110,7 @@ struct _cop400_state
int skl; /* 1-bit latch for SK output */
UINT8 h; /* 4-bit general purpose I/O port (COP440 only) */
UINT8 r; /* 8-bit general purpose I/O port (COP440 only) */
+ UINT8 flags; // used for I/O only
/* counter */
UINT8 t; /* 8-bit timer */
@@ -136,7 +139,6 @@ struct _cop400_state
int LBIops[256];
int LBIops33[256];
int icount; /* instruction counter */
- cpu_state_table state_table; /* state table */
const cop400_opcode_map *opcode_map;
@@ -155,62 +157,6 @@ struct _cop400_opcode_map {
};
/***************************************************************************
- CPU STATE DESCRIPTION
-***************************************************************************/
-
-#define COP400_STATE_ENTRY(_name, _format, _member, _datamask, _featuremask, _flags) \
- CPU_STATE_ENTRY(COP400_##_name, #_name, _format, cop400_state, _member, _datamask, _featuremask, _flags)
-
-#define COP410_STATE_ENTRY(_name, _format, _member, _datamask, _flags) \
- COP400_STATE_ENTRY(_name, _format, _member, _datamask, COP410_FEATURE | COP420_FEATURE | COP444_FEATURE | COP440_FEATURE, _flags)
-
-#define COP420_STATE_ENTRY(_name, _format, _member, _datamask, _flags) \
- COP400_STATE_ENTRY(_name, _format, _member, _datamask, COP420_FEATURE | COP444_FEATURE | COP440_FEATURE, _flags)
-
-#define COP444_STATE_ENTRY(_name, _format, _member, _datamask, _flags) \
- COP400_STATE_ENTRY(_name, _format, _member, _datamask, COP444_FEATURE | COP440_FEATURE, _flags)
-
-#define COP440_STATE_ENTRY(_name, _format, _member, _datamask, _flags) \
- COP400_STATE_ENTRY(_name, _format, _member, _datamask, COP440_FEATURE, _flags)
-
-static const cpu_state_entry state_array[] =
-{
- COP410_STATE_ENTRY(GENPC, "%03X", pc, 0xfff, CPUSTATE_NOSHOW)
- COP410_STATE_ENTRY(GENPCBASE, "%03X", prevpc, 0xfff, CPUSTATE_NOSHOW)
- COP440_STATE_ENTRY(GENSP, "%01X", n, 0x3, CPUSTATE_NOSHOW)
-
- COP410_STATE_ENTRY(PC, "%03X", pc, 0xfff, 0)
-
- COP400_STATE_ENTRY(SA, "%03X", sa, 0xfff, COP410_FEATURE | COP420_FEATURE | COP444_FEATURE, 0)
- COP400_STATE_ENTRY(SB, "%03X", sb, 0xfff, COP410_FEATURE | COP420_FEATURE | COP444_FEATURE, 0)
- COP400_STATE_ENTRY(SC, "%03X", sc, 0xfff, COP420_FEATURE | COP444_FEATURE, 0)
- COP440_STATE_ENTRY(N, "%01X", n, 0x3, 0)
-
- COP410_STATE_ENTRY(A, "%01X", a, 0xf, 0)
- COP410_STATE_ENTRY(B, "%02X", b, 0xff, 0)
- COP410_STATE_ENTRY(C, "%1u", c, 0x1, 0)
-
- COP410_STATE_ENTRY(EN, "%01X", en, 0xf, 0)
- COP410_STATE_ENTRY(G, "%01X", g, 0xf, 0)
- COP440_STATE_ENTRY(H, "%01X", h, 0xf, 0)
- COP410_STATE_ENTRY(Q, "%02X", q, 0xff, 0)
- COP440_STATE_ENTRY(R, "%02X", r, 0xff, 0)
-
- COP410_STATE_ENTRY(SIO, "%01X", sio, 0xf, 0)
- COP410_STATE_ENTRY(SKL, "%1u", skl, 0x1, 0)
-
- COP420_STATE_ENTRY(T, "%02X", t, 0xff, 0)
-};
-
-static const cpu_state_table state_table_template =
-{
- NULL, /* pointer to the base of state (offsets are relative to this) */
- 0, /* subtype this table refers to */
- ARRAY_LENGTH(state_array), /* number of entries */
- state_array /* array of entries */
-};
-
-/***************************************************************************
MACROS
***************************************************************************/
@@ -256,8 +202,7 @@ static const cpu_state_table state_table_template =
INLINE cop400_state *get_safe_token(running_device *device)
{
assert(device != NULL);
- assert(device->token != NULL);
- assert(device->type == CPU);
+ assert(device->type() == CPU);
assert(cpu_get_type(device) == CPU_COP401 ||
cpu_get_type(device) == CPU_COP410 ||
cpu_get_type(device) == CPU_COP411 ||
@@ -271,12 +216,12 @@ INLINE cop400_state *get_safe_token(running_device *device)
cpu_get_type(device) == CPU_COP426 ||
cpu_get_type(device) == CPU_COP444 ||
cpu_get_type(device) == CPU_COP445);
- return (cop400_state *)device->token;
+ return (cop400_state *)downcast<cpu_device *>(device)->token();
}
INLINE void PUSH(cop400_state *cpustate, UINT16 data)
{
- if (cpustate->state_table.subtypemask != COP410_FEATURE)
+ if (cpustate->featuremask != COP410_FEATURE)
{
SC = SB;
}
@@ -290,7 +235,7 @@ INLINE void POP(cop400_state *cpustate)
PC = SA;
SA = SB;
- if (cpustate->state_table.subtypemask != COP410_FEATURE)
+ if (cpustate->featuremask != COP410_FEATURE)
{
SB = SC;
}
@@ -878,17 +823,59 @@ static TIMER_CALLBACK( microbus_tick )
INITIALIZATION
***************************************************************************/
+static void define_state_table(running_device *device)
+{
+ cop400_state *cpustate = get_safe_token(device);
+
+ device_state_interface *state;
+ device->interface(state);
+ state->state_add(STATE_GENPC, "GENPC", cpustate->pc).mask(0xfff).noshow();
+ state->state_add(STATE_GENPCBASE, "GENPCBASE", cpustate->prevpc).mask(0xfff).noshow();
+ state->state_add(STATE_GENSP, "GENSP", cpustate->n).mask(0x3).noshow();
+ state->state_add(STATE_GENFLAGS, "GENFLAGS", cpustate->flags).mask(0x3).callimport().callexport().noshow().formatstr("%2s");
+
+ state->state_add(COP400_PC, "PC", cpustate->pc).mask(0xfff);
+
+ if (cpustate->featuremask & (COP410_FEATURE | COP420_FEATURE | COP444_FEATURE))
+ {
+ state->state_add(COP400_SA, "SA", cpustate->sa).mask(0xfff);
+ state->state_add(COP400_SB, "SB", cpustate->sb).mask(0xfff);
+ if (cpustate->featuremask & (COP420_FEATURE | COP444_FEATURE))
+ state->state_add(COP400_SC, "SC", cpustate->sc).mask(0xfff);
+ }
+ if (cpustate->featuremask & COP440_FEATURE)
+ state->state_add(COP400_N, "N", cpustate->n).mask(0x3);
+
+ state->state_add(COP400_A, "A", cpustate->a).mask(0xf);
+ state->state_add(COP400_B, "B", cpustate->b);
+ state->state_add(COP400_C, "C", cpustate->c).mask(0x1);
+
+ state->state_add(COP400_EN, "EN", cpustate->en).mask(0xf);
+ state->state_add(COP400_G, "G", cpustate->g).mask(0xf);
+ if (cpustate->featuremask & COP440_FEATURE)
+ state->state_add(COP400_H, "H", cpustate->h).mask(0xf);
+ state->state_add(COP400_Q, "Q", cpustate->q);
+ if (cpustate->featuremask & COP440_FEATURE)
+ state->state_add(COP400_R, "R", cpustate->r);
+
+ state->state_add(COP400_SIO, "SIO", cpustate->sio).mask(0xf);
+ state->state_add(COP400_SKL, "SKL", cpustate->skl).mask(0x1);
+
+ if (cpustate->featuremask & (COP420_FEATURE | COP444_FEATURE | COP440_FEATURE))
+ state->state_add(COP400_T, "T", cpustate->t);
+}
+
static void cop400_init(running_device *device, UINT8 g_mask, UINT8 d_mask, UINT8 in_mask, int has_counter, int has_inil)
{
cop400_state *cpustate = get_safe_token(device);
- cpustate->intf = (cop400_interface *) device->baseconfig().static_config;
+ cpustate->intf = (cop400_interface *) device->baseconfig().static_config();
/* find address spaces */
- cpustate->program = device->space(AS_PROGRAM);
- cpustate->data = device->space(AS_DATA);
- cpustate->io = device->space(AS_IO);
+ cpustate->program = device_memory(device)->space(AS_PROGRAM);
+ cpustate->data = device_memory(device)->space(AS_DATA);
+ cpustate->io = device_memory(device)->space(AS_IO);
/* set output pin masks */
@@ -899,14 +886,14 @@ static void cop400_init(running_device *device, UINT8 g_mask, UINT8 d_mask, UINT
/* allocate serial timer */
cpustate->serial_timer = timer_alloc(device->machine, serial_tick, cpustate);
- timer_adjust_periodic(cpustate->serial_timer, attotime_zero, 0, ATTOTIME_IN_HZ(device->clock / 16));
+ timer_adjust_periodic(cpustate->serial_timer, attotime_zero, 0, ATTOTIME_IN_HZ(device->clock() / 16));
/* allocate counter timer */
if (has_counter)
{
cpustate->counter_timer = timer_alloc(device->machine, counter_tick, cpustate);
- timer_adjust_periodic(cpustate->counter_timer, attotime_zero, 0, ATTOTIME_IN_HZ(device->clock / 16 / 4));
+ timer_adjust_periodic(cpustate->counter_timer, attotime_zero, 0, ATTOTIME_IN_HZ(device->clock() / 16 / 4));
}
/* allocate IN latch timer */
@@ -914,7 +901,7 @@ static void cop400_init(running_device *device, UINT8 g_mask, UINT8 d_mask, UINT
if (has_inil)
{
cpustate->inil_timer = timer_alloc(device->machine, inil_tick, cpustate);
- timer_adjust_periodic(cpustate->inil_timer, attotime_zero, 0, ATTOTIME_IN_HZ(device->clock / 16));
+ timer_adjust_periodic(cpustate->inil_timer, attotime_zero, 0, ATTOTIME_IN_HZ(device->clock() / 16));
}
/* allocate Microbus timer */
@@ -922,7 +909,7 @@ static void cop400_init(running_device *device, UINT8 g_mask, UINT8 d_mask, UINT
if (cpustate->intf->microbus == COP400_MICROBUS_ENABLED)
{
cpustate->microbus_timer = timer_alloc(device->machine, microbus_tick, cpustate);
- timer_adjust_periodic(cpustate->microbus_timer, attotime_zero, 0, ATTOTIME_IN_HZ(device->clock / 16));
+ timer_adjust_periodic(cpustate->microbus_timer, attotime_zero, 0, ATTOTIME_IN_HZ(device->clock() / 16));
}
/* register for state saving */
@@ -962,9 +949,8 @@ static void cop410_init_opcodes(running_device *device)
/* set up the state table */
- cpustate->state_table = state_table_template;
- cpustate->state_table.baseptr = cpustate;
- cpustate->state_table.subtypemask = COP410_FEATURE;
+ cpustate->featuremask = COP410_FEATURE;
+ define_state_table(device);
/* initialize instruction length array */
@@ -993,9 +979,8 @@ static void cop420_init_opcodes(running_device *device)
/* set up the state table */
- cpustate->state_table = state_table_template;
- cpustate->state_table.baseptr = cpustate;
- cpustate->state_table.subtypemask = COP420_FEATURE;
+ cpustate->featuremask = COP420_FEATURE;
+ define_state_table(device);
/* initialize instruction length array */
@@ -1028,9 +1013,8 @@ static void cop444_init_opcodes(running_device *device)
/* set up the state table */
- cpustate->state_table = state_table_template;
- cpustate->state_table.baseptr = cpustate;
- cpustate->state_table.subtypemask = COP444_FEATURE;
+ cpustate->featuremask = COP444_FEATURE;
+ define_state_table(device);
/* initialize instruction length array */
@@ -1287,6 +1271,7 @@ ADDRESS_MAP_END
VALIDITY CHECKS
***************************************************************************/
+#if 0
static CPU_VALIDITY_CHECK( cop410 )
{
int error = FALSE;
@@ -1342,11 +1327,52 @@ static CPU_VALIDITY_CHECK( cop444 )
return error;
}
+#endif
/***************************************************************************
GENERAL CONTEXT ACCESS
***************************************************************************/
+static CPU_IMPORT_STATE( cop400 )
+{
+ cop400_state *cpustate = get_safe_token(device);
+
+ switch (entry.index())
+ {
+ case STATE_GENFLAGS:
+ cpustate->c = (cpustate->flags >> 1) & 1;
+ cpustate->skl = (cpustate->flags >> 0) & 1;
+ break;
+ }
+}
+
+static CPU_EXPORT_STATE( cop400 )
+{
+ cop400_state *cpustate = get_safe_token(device);
+
+ switch (entry.index())
+ {
+ case STATE_GENFLAGS:
+ cpustate->flags = (cpustate->c ? 0x02 : 0x00) |
+ (cpustate->skl ? 0x01 : 0x00);
+ break;
+ }
+}
+
+static CPU_EXPORT_STRING( cop400 )
+{
+ cop400_state *cpustate = get_safe_token(device);
+
+ switch (entry.index())
+ {
+ case STATE_GENFLAGS:
+ string.printf("%c%c",
+ cpustate->c ? 'C' : '.',
+ cpustate->skl ? 'S' : '.');
+ break;
+ }
+}
+
static CPU_SET_INFO( cop400 )
{
/* nothing to set */
@@ -1354,8 +1380,8 @@ static CPU_SET_INFO( cop400 )
static CPU_GET_INFO( cop400 )
{
- cop400_state *cpustate = (device != NULL && device->token != NULL) ? get_safe_token(device) : NULL;
- cop400_interface *intf = (devconfig->static_config != NULL) ? (cop400_interface *)devconfig->static_config : NULL;
+ cop400_state *cpustate = (device != NULL && downcast<cpu_device *>(device)->token() != NULL) ? get_safe_token(device) : NULL;
+ cop400_interface *intf = (devconfig->static_config() != NULL) ? (cop400_interface *)devconfig->static_config() : NULL;
switch (state)
{
@@ -1387,11 +1413,13 @@ static CPU_GET_INFO( cop400 )
case CPUINFO_FCT_RESET: info->reset = CPU_RESET_NAME(cop400); break;
case CPUINFO_FCT_EXECUTE: info->execute = CPU_EXECUTE_NAME(cop400); break;
case CPUINFO_FCT_DISASSEMBLE: /* set per-core */ break;
- case CPUINFO_FCT_VALIDITY_CHECK: /* set per-core */ break;
+// case CPUINFO_FCT_VALIDITY_CHECK: /* set per-core */ break;
+ case CPUINFO_FCT_IMPORT_STATE: info->import_state = CPU_IMPORT_STATE_NAME(cop400); break;
+ case CPUINFO_FCT_EXPORT_STATE: info->export_state = CPU_EXPORT_STATE_NAME(cop400); break;
+ case CPUINFO_FCT_EXPORT_STRING: info->export_string = CPU_EXPORT_STRING_NAME(cop400); break;
/* --- the following bits of info are returned as pointers --- */
case CPUINFO_PTR_INSTRUCTION_COUNTER: info->icount = &cpustate->icount; break;
- case CPUINFO_PTR_STATE_TABLE: info->state_table = &cpustate->state_table; break;
case DEVINFO_PTR_INTERNAL_MEMORY_MAP + ADDRESS_SPACE_PROGRAM: /* set per-core */ break;
case DEVINFO_PTR_INTERNAL_MEMORY_MAP + ADDRESS_SPACE_DATA: /* set per-core */ break;
@@ -1410,8 +1438,6 @@ static CPU_GET_INFO( cop400 )
CPU_GET_INFO( cop410 )
{
- cop400_state *cpustate = (device != NULL && device->token != NULL) ? get_safe_token(device) : NULL;
-
switch (state)
{
/* --- the following bits of info are returned as 64-bit signed integers --- */
@@ -1421,7 +1447,7 @@ CPU_GET_INFO( cop410 )
/* --- the following bits of info are returned as pointers to functions --- */
case CPUINFO_FCT_INIT: info->init = CPU_INIT_NAME(cop410); break;
case CPUINFO_FCT_DISASSEMBLE: info->disassemble = CPU_DISASSEMBLE_NAME(cop410); break;
- case CPUINFO_FCT_VALIDITY_CHECK: info->validity_check = CPU_VALIDITY_CHECK_NAME(cop410); break;
+// case CPUINFO_FCT_VALIDITY_CHECK: info->validity_check = CPU_VALIDITY_CHECK_NAME(cop410); break;
/* --- the following bits of info are returned as pointers --- */
case DEVINFO_PTR_INTERNAL_MEMORY_MAP + ADDRESS_SPACE_PROGRAM: info->internal_map8 = ADDRESS_MAP_NAME(program_512b); break;
@@ -1430,11 +1456,6 @@ CPU_GET_INFO( cop410 )
/* --- the following bits of info are returned as NULL-terminated strings --- */
case DEVINFO_STR_NAME: strcpy(info->s, "COP410"); break;
- case CPUINFO_STR_FLAGS: sprintf(info->s,
- "%c%c",
- cpustate->c ? 'C' : '.',
- cpustate->skl ? 'S' : '.'); break;
-
default: CPU_GET_INFO_CALL(cop400); break;
}
}
@@ -1473,7 +1494,7 @@ CPU_GET_INFO( cop401 )
CPU_GET_INFO( cop420 )
{
- cop400_state *cpustate = (device != NULL && device->token != NULL) ? get_safe_token(device) : NULL;
+ cop400_state *cpustate = (device != NULL && downcast<cpu_device *>(device)->token() != NULL) ? get_safe_token(device) : NULL;
switch (state)
{
@@ -1484,7 +1505,7 @@ CPU_GET_INFO( cop420 )
/* --- the following bits of info are returned as pointers to functions --- */
case CPUINFO_FCT_INIT: info->init = CPU_INIT_NAME(cop420); break;
case CPUINFO_FCT_DISASSEMBLE: info->disassemble = CPU_DISASSEMBLE_NAME(cop420); break;
- case CPUINFO_FCT_VALIDITY_CHECK: info->validity_check = CPU_VALIDITY_CHECK_NAME(cop420); break;
+// case CPUINFO_FCT_VALIDITY_CHECK: info->validity_check = CPU_VALIDITY_CHECK_NAME(cop420); break;
/* --- the following bits of info are returned as pointers --- */
case DEVINFO_PTR_INTERNAL_MEMORY_MAP + ADDRESS_SPACE_PROGRAM: info->internal_map8 = ADDRESS_MAP_NAME(program_1kb); break;
@@ -1511,7 +1532,7 @@ CPU_GET_INFO( cop421 )
{
/* --- the following bits of info are returned as pointers to data or functions --- */
case CPUINFO_FCT_INIT: info->init = CPU_INIT_NAME(cop421); break;
- case CPUINFO_FCT_VALIDITY_CHECK: info->validity_check = CPU_VALIDITY_CHECK_NAME(cop421); break;
+// case CPUINFO_FCT_VALIDITY_CHECK: info->validity_check = CPU_VALIDITY_CHECK_NAME(cop421); break;
/* --- the following bits of info are returned as NULL-terminated strings --- */
case DEVINFO_STR_NAME: strcpy(info->s, "COP421"); break;
@@ -1554,7 +1575,7 @@ CPU_GET_INFO( cop402 )
CPU_GET_INFO( cop444 )
{
- cop400_state *cpustate = (device != NULL && device->token != NULL) ? get_safe_token(device) : NULL;
+ cop400_state *cpustate = (device != NULL && downcast<cpu_device *>(device)->token() != NULL) ? get_safe_token(device) : NULL;
switch (state)
{
@@ -1565,7 +1586,7 @@ CPU_GET_INFO( cop444 )
/* --- the following bits of info are returned as pointers to functions --- */
case CPUINFO_FCT_INIT: info->init = CPU_INIT_NAME(cop444); break;
case CPUINFO_FCT_DISASSEMBLE: info->disassemble = CPU_DISASSEMBLE_NAME(cop444); break;
- case CPUINFO_FCT_VALIDITY_CHECK: info->validity_check = CPU_VALIDITY_CHECK_NAME(cop444); break;
+// case CPUINFO_FCT_VALIDITY_CHECK: info->validity_check = CPU_VALIDITY_CHECK_NAME(cop444); break;
/* --- the following bits of info are returned as pointers --- */
case DEVINFO_PTR_INTERNAL_MEMORY_MAP + ADDRESS_SPACE_PROGRAM: info->internal_map8 = ADDRESS_MAP_NAME(program_2kb); break;
diff --git a/src/emu/cpu/cop400/cop400.h b/src/emu/cpu/cop400/cop400.h
index 7d9fadc5dec..b1fd37b1331 100644
--- a/src/emu/cpu/cop400/cop400.h
+++ b/src/emu/cpu/cop400/cop400.h
@@ -37,9 +37,9 @@ enum
COP400_SIO,
COP400_SKL,
COP400_T,
- COP400_GENPC = REG_GENPC,
- COP400_GENPCBASE = REG_GENPCBASE,
- COP400_GENSP = REG_GENSP
+ COP400_GENPC = STATE_GENPC,
+ COP400_GENPCBASE = STATE_GENPCBASE,
+ COP400_GENSP = STATE_GENSP
};
/* special I/O space ports */
diff --git a/src/emu/cpu/cp1610/cp1610.c b/src/emu/cpu/cp1610/cp1610.c
index d6bef729de0..d74afc947ee 100644
--- a/src/emu/cpu/cp1610/cp1610.c
+++ b/src/emu/cpu/cp1610/cp1610.c
@@ -37,7 +37,7 @@ struct _cp1610_state
UINT8 flags; /* flags */
int intr_enabled;
//int (*reset_callback)(cp1610_state *cpustate);
- cpu_irq_callback irq_callback;
+ device_irq_callback irq_callback;
UINT16 intr_vector;
int reset_state;
int intr_state;
@@ -54,10 +54,9 @@ struct _cp1610_state
INLINE cp1610_state *get_safe_token(running_device *device)
{
assert(device != NULL);
- assert(device->token != NULL);
- assert(device->type == CPU);
+ assert(device->type() == CPU);
assert(cpu_get_type(device) == CPU_CP1610);
- return (cp1610_state *)device->token;
+ return (cp1610_state *)downcast<cpu_device *>(device)->token();
}
#define cp1610_readop(A) memory_read_word_16be(cpustate->program, (A)<<1)
@@ -3395,7 +3394,7 @@ static CPU_INIT( cp1610 )
cpustate->intrm_pending = 0;
cpustate->irq_callback = irqcallback;
cpustate->device = device;
- cpustate->program = device->space(AS_PROGRAM);
+ cpustate->program = device_memory(device)->space(AS_PROGRAM);
state_save_register_device_item_array(device, 0, cpustate->r);
state_save_register_device_item(device, 0, cpustate->flags);
@@ -3460,7 +3459,7 @@ static CPU_SET_INFO( cp1610 )
CPU_GET_INFO( cp1610 )
{
- cp1610_state *cpustate = (device != NULL && device->token != NULL) ? get_safe_token(device) : NULL;
+ cp1610_state *cpustate = (device != NULL && downcast<cpu_device *>(device)->token() != NULL) ? get_safe_token(device) : NULL;
switch (state)
{
/* --- the following bits of info are returned as 64-bit signed integers --- */
diff --git a/src/emu/cpu/cubeqcpu/cubeqcpu.c b/src/emu/cpu/cubeqcpu/cubeqcpu.c
index f6c07541683..ac3d21d14ea 100644
--- a/src/emu/cpu/cubeqcpu/cubeqcpu.c
+++ b/src/emu/cpu/cubeqcpu/cubeqcpu.c
@@ -196,28 +196,25 @@ typedef struct
INLINE cquestsnd_state *get_safe_token_snd(running_device *device)
{
assert(device != NULL);
- assert(device->token != NULL);
- assert(device->type == CPU);
+ assert(device->type() == CPU);
assert(cpu_get_type(device) == CPU_CQUESTSND);
- return (cquestsnd_state *)device->token;
+ return (cquestsnd_state *)downcast<cpu_device *>(device)->token();
}
INLINE cquestrot_state *get_safe_token_rot(running_device *device)
{
assert(device != NULL);
- assert(device->token != NULL);
- assert(device->type == CPU);
+ assert(device->type() == CPU);
assert(cpu_get_type(device) == CPU_CQUESTROT);
- return (cquestrot_state *)device->token;
+ return (cquestrot_state *)downcast<cpu_device *>(device)->token();
}
INLINE cquestlin_state *get_safe_token_lin(running_device *device)
{
assert(device != NULL);
- assert(device->token != NULL);
- assert(device->type == CPU);
+ assert(device->type() == CPU);
assert(cpu_get_type(device) == CPU_CQUESTLIN);
- return (cquestlin_state *)device->token;
+ return (cquestlin_state *)downcast<cpu_device *>(device)->token();
}
/***************************************************************************
@@ -284,7 +281,7 @@ static void cquestsnd_state_register(running_device *device)
static CPU_INIT( cquestsnd )
{
cquestsnd_state *cpustate = get_safe_token_snd(device);
- cubeqst_snd_config* _config = (cubeqst_snd_config*)device->baseconfig().static_config;
+ cubeqst_snd_config* _config = (cubeqst_snd_config*)device->baseconfig().static_config();
memset(cpustate, 0, sizeof(*cpustate));
@@ -292,7 +289,7 @@ static CPU_INIT( cquestsnd )
cpustate->sound_data = (UINT16*)memory_region(device->machine, _config->sound_data_region);
cpustate->device = device;
- cpustate->program = device->space(AS_PROGRAM);
+ cpustate->program = device_memory(device)->space(AS_PROGRAM);
/* Allocate RAM shared with 68000 */
cpustate->sram = auto_alloc_array(device->machine, UINT16, 4096/2);
@@ -356,7 +353,7 @@ static void cquestrot_state_register(running_device *device)
static CPU_INIT( cquestrot )
{
- const cubeqst_rot_config *rotconfig = (const cubeqst_rot_config *)device->baseconfig().static_config;
+ const cubeqst_rot_config *rotconfig = (const cubeqst_rot_config *)device->baseconfig().static_config();
cquestrot_state *cpustate = get_safe_token_rot(device);
memset(cpustate, 0, sizeof(*cpustate));
@@ -366,7 +363,7 @@ static CPU_INIT( cquestrot )
cpustate->device = device;
cpustate->lindevice = device->machine->device(rotconfig->lin_cpu_tag);
- cpustate->program = device->space(AS_PROGRAM);
+ cpustate->program = device_memory(device)->space(AS_PROGRAM);
cquestrot_state_register(device);
}
@@ -439,7 +436,7 @@ static void cquestlin_state_register(running_device *device)
static CPU_INIT( cquestlin )
{
- const cubeqst_lin_config *linconfig = (const cubeqst_lin_config *)device->baseconfig().static_config;
+ const cubeqst_lin_config *linconfig = (const cubeqst_lin_config *)device->baseconfig().static_config();
cquestlin_state *cpustate = get_safe_token_lin(device);
memset(cpustate, 0, sizeof(*cpustate));
@@ -451,7 +448,7 @@ static CPU_INIT( cquestlin )
cpustate->device = device;
cpustate->rotdevice = device->machine->device(linconfig->rot_cpu_tag);
- cpustate->program = device->space(AS_PROGRAM);
+ cpustate->program = device_memory(device)->space(AS_PROGRAM);
cquestlin_state_register(device);
}
@@ -1600,7 +1597,7 @@ static CPU_SET_INFO( cquestsnd )
CPU_GET_INFO( cquestsnd )
{
- cquestsnd_state *cpustate = (device != NULL && device->token != NULL) ? get_safe_token_snd(device) : NULL;
+ cquestsnd_state *cpustate = (device != NULL && downcast<cpu_device *>(device)->token() != NULL) ? get_safe_token_snd(device) : NULL;
switch (state)
{
/* --- the following bits of info are returned as 64-bit signed integers --- */
@@ -1718,7 +1715,7 @@ static CPU_SET_INFO( cquestrot )
CPU_GET_INFO( cquestrot )
{
- cquestrot_state *cpustate = (device != NULL && device->token != NULL) ? get_safe_token_rot(device) : NULL;
+ cquestrot_state *cpustate = (device != NULL && downcast<cpu_device *>(device)->token() != NULL) ? get_safe_token_rot(device) : NULL;
switch (state)
{
/* --- the following bits of info are returned as 64-bit signed integers --- */
@@ -1836,7 +1833,7 @@ static CPU_SET_INFO( cquestlin )
CPU_GET_INFO( cquestlin )
{
- cquestlin_state *cpustate = (device != NULL && device->token != NULL) ? get_safe_token_lin(device) : NULL;
+ cquestlin_state *cpustate = (device != NULL && downcast<cpu_device *>(device)->token() != NULL) ? get_safe_token_lin(device) : NULL;
switch (state)
{
/* --- the following bits of info are returned as 64-bit signed integers --- */
diff --git a/src/emu/cpu/drcbec.c b/src/emu/cpu/drcbec.c
index cfae7a70918..f8d43a354bf 100644
--- a/src/emu/cpu/drcbec.c
+++ b/src/emu/cpu/drcbec.c
@@ -353,7 +353,7 @@ static drcbe_state *drcbec_alloc(drcuml_state *drcuml, drccache *cache, running_
/* remember our pointers */
drcbe->device = device;
for (spacenum = 0; spacenum < ARRAY_LENGTH(drcbe->space); spacenum++)
- drcbe->space[spacenum] = device->space(spacenum);
+ drcbe->space[spacenum] = device_memory(device)->space(spacenum);
drcbe->drcuml = drcuml;
drcbe->cache = cache;
diff --git a/src/emu/cpu/drcbex64.c b/src/emu/cpu/drcbex64.c
index cd9c97524a4..9753c7d8080 100644
--- a/src/emu/cpu/drcbex64.c
+++ b/src/emu/cpu/drcbex64.c
@@ -714,7 +714,7 @@ static drcbe_state *drcbex64_alloc(drcuml_state *drcuml, drccache *cache, runnin
/* get address spaces and accessors */
for (spacenum = 0; spacenum < ADDRESS_SPACES; spacenum++)
{
- drcbe->space[spacenum] = device->space(spacenum);
+ drcbe->space[spacenum] = device_memory(device)->space(spacenum);
if (drcbe->space[spacenum] != NULL)
drcbe->accessors[spacenum] = drcbe->space[spacenum]->accessors;
}
diff --git a/src/emu/cpu/drcbex86.c b/src/emu/cpu/drcbex86.c
index 5fbce56fb2b..61b3e74ac92 100644
--- a/src/emu/cpu/drcbex86.c
+++ b/src/emu/cpu/drcbex86.c
@@ -631,7 +631,7 @@ static drcbe_state *drcbex86_alloc(drcuml_state *drcuml, drccache *cache, runnin
/* get address spaces */
for (spacenum = 0; spacenum < ADDRESS_SPACES; spacenum++)
- drcbe->space[spacenum] = device->space(spacenum);
+ drcbe->space[spacenum] = device_memory(device)->space(spacenum);
/* allocate hash tables */
drcbe->hash = drchash_alloc(cache, modes, addrbits, ignorebits);
diff --git a/src/emu/cpu/drcfe.c b/src/emu/cpu/drcfe.c
index f1ab974d6bd..43b73f089c6 100644
--- a/src/emu/cpu/drcfe.c
+++ b/src/emu/cpu/drcfe.c
@@ -54,10 +54,9 @@ struct _drcfe_state
void * param; /* parameter for the callback */
/* CPU parameters */
- running_device *device; /* CPU device object */
+ cpu_device * cpudevice; /* CPU device object */
const address_space *program; /* program address space for this CPU */
offs_t pageshift; /* shift to convert address to a page index */
- cpu_translate_func translate; /* pointer to translation function */
/* opcode descriptor arrays */
opcode_desc * desc_live_list; /* head of list of live descriptions */
@@ -95,7 +94,7 @@ INLINE opcode_desc *desc_alloc(drcfe_state *drcfe)
if (desc != NULL)
drcfe->desc_free_list = desc->next;
else
- desc = auto_alloc(drcfe->device->machine, opcode_desc);
+ desc = auto_alloc(drcfe->cpudevice->machine, opcode_desc);
return desc;
}
@@ -139,10 +138,9 @@ drcfe_state *drcfe_init(running_device *cpu, const drcfe_config *config, void *p
drcfe->param = param;
/* initialize the state */
- drcfe->device = cpu;
- drcfe->program = cpu->space(AS_PROGRAM);
- drcfe->pageshift = cpu_get_page_shift(cpu, ADDRESS_SPACE_PROGRAM);
- drcfe->translate = (cpu_translate_func)cpu->get_config_fct(CPUINFO_FCT_TRANSLATE);
+ drcfe->cpudevice = downcast<cpu_device *>(cpu);
+ drcfe->program = device_memory(cpu)->space(AS_PROGRAM);
+ drcfe->pageshift = device_memory(cpu)->space_config(AS_PROGRAM)->m_page_shift;
return drcfe;
}
@@ -162,14 +160,14 @@ void drcfe_exit(drcfe_state *drcfe)
{
opcode_desc *freeme = drcfe->desc_free_list;
drcfe->desc_free_list = drcfe->desc_free_list->next;
- auto_free(drcfe->device->machine, freeme);
+ auto_free(drcfe->cpudevice->machine, freeme);
}
/* free the description array */
- auto_free(drcfe->device->machine, drcfe->desc_array);
+ auto_free(drcfe->cpudevice->machine, drcfe->desc_array);
/* free the object itself */
- auto_free(drcfe->device->machine, drcfe);
+ auto_free(drcfe->cpudevice->machine, drcfe);
}
diff --git a/src/emu/cpu/drcuml.c b/src/emu/cpu/drcuml.c
index ca466e16371..7d38967cb15 100644
--- a/src/emu/cpu/drcuml.c
+++ b/src/emu/cpu/drcuml.c
@@ -1134,6 +1134,7 @@ void drcuml_disasm(const drcuml_instruction *inst, char *buffer, drcuml_state *d
static const char *const pound_size[] = { "?", "?", "?", "?", "s", "?", "?", "?", "d" };
static const char *const bang_size[] = { "?", "b", "h", "?", "", "?", "?", "?", "d" };
static const char *const fmods[] = { "trunc", "round", "ceil", "floor", "default" };
+ static const char *const spaces[] = { "program", "data", "io", "3", "4", "5", "6", "7" };
static const char *const sizes[] = { "byte", "word", "dword", "qword" };
const drcuml_opcode_info *opinfo = opcode_info_table[inst->opcode];
char *dest = buffer;
@@ -1179,11 +1180,11 @@ void drcuml_disasm(const drcuml_instruction *inst, char *buffer, drcuml_state *d
/* address space immediate */
else if (typemask == PTYPES_SPACE)
- dest += sprintf(dest, "%s", address_space_names[param->value]);
+ dest += sprintf(dest, "%s", spaces[param->value]);
/* size + address space immediate */
else if (typemask == PTYPES_SPSZ)
- dest += sprintf(dest, "%s_%s", address_space_names[param->value / 16], sizes[param->value % 16]);
+ dest += sprintf(dest, "%s_%s", spaces[param->value / 16], sizes[param->value % 16]);
/* size + scale immediate */
else if (typemask == PTYPES_SCSZ)
diff --git a/src/emu/cpu/dsp32/dsp32.c b/src/emu/cpu/dsp32/dsp32.c
index e5c064034b4..bef89c8b92e 100644
--- a/src/emu/cpu/dsp32/dsp32.c
+++ b/src/emu/cpu/dsp32/dsp32.c
@@ -205,10 +205,9 @@ static CPU_RESET( dsp32c );
INLINE dsp32_state *get_safe_token(running_device *device)
{
assert(device != NULL);
- assert(device->token != NULL);
- assert(device->type == CPU);
+ assert(device->type() == CPU);
assert(cpu_get_type(device) == CPU_DSP32C);
- return (dsp32_state *)device->token;
+ return (dsp32_state *)downcast<cpu_device *>(device)->token();
}
@@ -352,7 +351,7 @@ static void dsp32_register_save( running_device *device )
static CPU_INIT( dsp32c )
{
- const dsp32_config *configdata = (const dsp32_config *)device->baseconfig().static_config;
+ const dsp32_config *configdata = (const dsp32_config *)device->baseconfig().static_config();
dsp32_state *cpustate = get_safe_token(device);
/* copy in config data */
@@ -360,7 +359,7 @@ static CPU_INIT( dsp32c )
cpustate->output_pins_changed = configdata->output_pins_changed;
cpustate->device = device;
- cpustate->program = device->space(AS_PROGRAM);
+ cpustate->program = device_memory(device)->space(AS_PROGRAM);
dsp32_register_save(device);
}
@@ -766,7 +765,7 @@ static CPU_SET_INFO( dsp32c )
CPU_GET_INFO( dsp32c )
{
- dsp32_state *cpustate = (device != NULL && device->token != NULL) ? get_safe_token(device) : NULL;
+ dsp32_state *cpustate = (device != NULL && downcast<cpu_device *>(device)->token() != NULL) ? get_safe_token(device) : NULL;
switch (state)
{
/* --- the following bits of info are returned as 64-bit signed integers --- */
diff --git a/src/emu/cpu/dsp56k/dsp56def.h b/src/emu/cpu/dsp56k/dsp56def.h
index 899e94d6f5a..213d9669e94 100644
--- a/src/emu/cpu/dsp56k/dsp56def.h
+++ b/src/emu/cpu/dsp56k/dsp56def.h
@@ -415,8 +415,7 @@ static void PCD_set(dsp56k_core* cpustate, UINT16 value);
INLINE dsp56k_core *get_safe_token(running_device *device)
{
assert(device != NULL);
- assert(device->token != NULL);
- assert(device->type == CPU);
+ assert(device->type() == CPU);
assert(cpu_get_type(device) == CPU_DSP56156);
- return (dsp56k_core *)device->token;
+ return (dsp56k_core *)downcast<cpu_device *>(device)->token();
}
diff --git a/src/emu/cpu/dsp56k/dsp56k.c b/src/emu/cpu/dsp56k/dsp56k.c
index a5c03177b67..15215a1b464 100644
--- a/src/emu/cpu/dsp56k/dsp56k.c
+++ b/src/emu/cpu/dsp56k/dsp56k.c
@@ -232,11 +232,11 @@ static CPU_INIT( dsp56k )
state_save_register_device_item(device, 0, cpustate->HI.trxl);
state_save_register_device_item(device, 0, cpustate->HI.bootstrap_offset);
- //cpustate->config = device->baseconfig().static_config;
+ //cpustate->config = device->baseconfig().static_config();
//cpustate->irq_callback = irqcallback;
cpustate->device = device;
- cpustate->program = device->space(AS_PROGRAM);
- cpustate->data = device->space(AS_DATA);
+ cpustate->program = device_memory(device)->space(AS_PROGRAM);
+ cpustate->data = device_memory(device)->space(AS_DATA);
/* Setup the direct memory handler for this CPU */
/* NOTE: Be sure to grab this guy and call him if you ever install another direct_update_hander in a driver! */
@@ -436,7 +436,7 @@ static CPU_SET_INFO( dsp56k )
CPU_GET_INFO( dsp56k )
{
- dsp56k_core* cpustate = (device != NULL && device->token != NULL) ? get_safe_token(device) : NULL;
+ dsp56k_core* cpustate = (device != NULL && downcast<cpu_device *>(device)->token() != NULL) ? get_safe_token(device) : NULL;
switch (state)
{
diff --git a/src/emu/cpu/dsp56k/dsp56mem.c b/src/emu/cpu/dsp56k/dsp56mem.c
index a8ef6455611..c25f746c1cd 100644
--- a/src/emu/cpu/dsp56k/dsp56mem.c
+++ b/src/emu/cpu/dsp56k/dsp56mem.c
@@ -31,7 +31,7 @@ static void mem_reset(dsp56k_core* cpustate)
/* Work */
static READ16_HANDLER( peripheral_register_r )
{
- dsp56k_core* cpustate = (dsp56k_core*)space->cpu->token;
+ dsp56k_core* cpustate = get_safe_token(space->cpu);
// (printf) logerror("Peripheral read 0x%04x\n", O2A(offset));
switch (O2A(offset))
@@ -166,7 +166,7 @@ static READ16_HANDLER( peripheral_register_r )
static WRITE16_HANDLER( peripheral_register_w )
{
- dsp56k_core* cpustate = (dsp56k_core*)space->cpu->token;
+ dsp56k_core* cpustate = get_safe_token(space->cpu);
// Its primary behavior is RAM
// COMBINE_DATA(&dsp56k_peripheral_ram[offset]);
diff --git a/src/emu/cpu/e132xs/e132xs.c b/src/emu/cpu/e132xs/e132xs.c
index c48cb1ca1fe..b6292c81caf 100644
--- a/src/emu/cpu/e132xs/e132xs.c
+++ b/src/emu/cpu/e132xs/e132xs.c
@@ -318,7 +318,7 @@ struct _hyperstone_state
struct _delay delay;
- cpu_irq_callback irq_callback;
+ device_irq_callback irq_callback;
running_device *device;
const address_space *program;
const address_space *io;
@@ -416,8 +416,7 @@ ADDRESS_MAP_END
INLINE hyperstone_state *get_safe_token(running_device *device)
{
assert(device != NULL);
- assert(device->token != NULL);
- assert(device->type == CPU);
+ assert(device->type() == CPU);
assert(cpu_get_type(device) == CPU_E116T ||
cpu_get_type(device) == CPU_E116XT ||
cpu_get_type(device) == CPU_E116XS ||
@@ -432,7 +431,7 @@ INLINE hyperstone_state *get_safe_token(running_device *device)
cpu_get_type(device) == CPU_GMS30C2132 ||
cpu_get_type(device) == CPU_GMS30C2216 ||
cpu_get_type(device) == CPU_GMS30C2232);
- return (hyperstone_state *)device->token;
+ return (hyperstone_state *)downcast<cpu_device *>(device)->token();
}
/* Return the entry point for a determinated trap */
@@ -1528,7 +1527,7 @@ static void set_irq_line(hyperstone_state *cpustate, int irqline, int state)
ISR &= ~(1 << irqline);
}
-static void hyperstone_init(running_device *device, cpu_irq_callback irqcallback, int scale_mask)
+static void hyperstone_init(running_device *device, device_irq_callback irqcallback, int scale_mask)
{
hyperstone_state *cpustate = get_safe_token(device);
@@ -1544,13 +1543,13 @@ static void hyperstone_init(running_device *device, cpu_irq_callback irqcallback
cpustate->irq_callback = irqcallback;
cpustate->device = device;
- cpustate->program = device->space(AS_PROGRAM);
- cpustate->io = device->space(AS_IO);
+ cpustate->program = device_memory(device)->space(AS_PROGRAM);
+ cpustate->io = device_memory(device)->space(AS_IO);
cpustate->timer = timer_alloc(device->machine, e132xs_timer_callback, (void *)device);
cpustate->clock_scale_mask = scale_mask;
}
-static void e116_init(running_device *device, cpu_irq_callback irqcallback, int scale_mask)
+static void e116_init(running_device *device, device_irq_callback irqcallback, int scale_mask)
{
hyperstone_state *cpustate = get_safe_token(device);
hyperstone_init(device, irqcallback, scale_mask);
@@ -1587,7 +1586,7 @@ static CPU_INIT( gms30c2216 )
e116_init(device, irqcallback, 0);
}
-static void e132_init(running_device *device, cpu_irq_callback irqcallback, int scale_mask)
+static void e132_init(running_device *device, device_irq_callback irqcallback, int scale_mask)
{
hyperstone_state *cpustate = get_safe_token(device);
hyperstone_init(device, irqcallback, scale_mask);
@@ -1641,7 +1640,7 @@ static CPU_RESET( hyperstone )
//TODO: Add different reset initializations for BCR, MCR, FCR, TPR
emu_timer *save_timer;
- cpu_irq_callback save_irqcallback;
+ device_irq_callback save_irqcallback;
UINT32 save_opcodexor;
save_timer = cpustate->timer;
@@ -1651,8 +1650,8 @@ static CPU_RESET( hyperstone )
cpustate->irq_callback = save_irqcallback;
cpustate->opcodexor = save_opcodexor;
cpustate->device = device;
- cpustate->program = device->space(AS_PROGRAM);
- cpustate->io = device->space(AS_IO);
+ cpustate->program = device_memory(device)->space(AS_PROGRAM);
+ cpustate->io = device_memory(device)->space(AS_IO);
cpustate->timer = save_timer;
cpustate->tr_clocks_per_tick = 2;
@@ -4844,7 +4843,7 @@ static CPU_SET_INFO( hyperstone )
static CPU_GET_INFO( hyperstone )
{
- hyperstone_state *cpustate = (device != NULL && device->token != NULL) ? get_safe_token(device) : NULL;
+ hyperstone_state *cpustate = (device != NULL && downcast<cpu_device *>(device)->token() != NULL) ? get_safe_token(device) : NULL;
switch (state)
{
/* --- the following bits of info are returned as 64-bit signed integers --- */
diff --git a/src/emu/cpu/esrip/esrip.c b/src/emu/cpu/esrip/esrip.c
index 7c1142cef4e..b3c78476098 100644
--- a/src/emu/cpu/esrip/esrip.c
+++ b/src/emu/cpu/esrip/esrip.c
@@ -123,10 +123,9 @@ typedef struct
INLINE esrip_state *get_safe_token(running_device *device)
{
assert(device != NULL);
- assert(device->token != NULL);
- assert(device->type == CPU);
+ assert(device->type() == CPU);
assert(cpu_get_type(device) == CPU_ESRIP);
- return (esrip_state *)device->token;
+ return (esrip_state *)downcast<cpu_device *>(device)->token();
}
@@ -250,7 +249,7 @@ static void make_ops(esrip_state *cpustate)
static CPU_INIT( esrip )
{
esrip_state *cpustate = get_safe_token(device);
- esrip_config* _config = (esrip_config*)device->baseconfig().static_config;
+ esrip_config* _config = (esrip_config*)device->baseconfig().static_config();
memset(cpustate, 0, sizeof(cpustate));
@@ -265,7 +264,7 @@ static CPU_INIT( esrip )
cpustate->ipt_ram = auto_alloc_array(device->machine, UINT16, IPT_RAM_SIZE/2);
cpustate->device = device;
- cpustate->program = device->space(AS_PROGRAM);
+ cpustate->program = device_memory(device)->space(AS_PROGRAM);
/* Create the instruction decode lookup table */
cpustate->optable = auto_alloc_array(device->machine, UINT8, 65536);
@@ -356,7 +355,7 @@ static CPU_EXIT( esrip )
static int get_hblank(running_machine *machine)
{
- return video_screen_get_hblank(machine->primary_screen);
+ return machine->primary_screen->hblank();
}
/* Return the state of the LBRM line (Y-scaling related) */
@@ -1891,7 +1890,7 @@ static CPU_SET_INFO( esrip )
CPU_GET_INFO( esrip )
{
- esrip_state *cpustate = (device != NULL && device->token != NULL) ? get_safe_token(device) : NULL;
+ esrip_state *cpustate = (device != NULL && downcast<cpu_device *>(device)->token() != NULL) ? get_safe_token(device) : NULL;
switch (state)
{
diff --git a/src/emu/cpu/f8/f8.c b/src/emu/cpu/f8/f8.c
index 95079a45723..c6ff2362bfa 100644
--- a/src/emu/cpu/f8/f8.c
+++ b/src/emu/cpu/f8/f8.c
@@ -52,7 +52,7 @@ struct _f8_Regs
UINT8 dbus; /* data bus value */
UINT16 io; /* last I/O address */
UINT16 irq_vector;
- cpu_irq_callback irq_callback;
+ device_irq_callback irq_callback;
running_device *device;
const address_space *program;
const address_space *iospace;
@@ -64,10 +64,9 @@ struct _f8_Regs
INLINE f8_Regs *get_safe_token(running_device *device)
{
assert(device != NULL);
- assert(device->token != NULL);
- assert(device->type == CPU);
+ assert(device->type() == CPU);
assert(cpu_get_type(device) == CPU_F8);
- return (f8_Regs *)device->token;
+ return (f8_Regs *)downcast<cpu_device *>(device)->token();
}
/* timer shifter polynome values (will be used for timer interrupts) */
@@ -1546,14 +1545,14 @@ static CPU_RESET( f8 )
f8_Regs *cpustate = get_safe_token(device);
UINT8 data;
int i;
- cpu_irq_callback save_callback;
+ device_irq_callback save_callback;
save_callback = cpustate->irq_callback;
memset(cpustate, 0, sizeof(f8_Regs));
cpustate->irq_callback = save_callback;
cpustate->device = device;
- cpustate->program = device->space(AS_PROGRAM);
- cpustate->iospace = device->space(AS_IO);
+ cpustate->program = device_memory(device)->space(AS_PROGRAM);
+ cpustate->iospace = device_memory(device)->space(AS_IO);
cpustate->w&=~I;
/* save PC0 to PC1 and reset PC0 */
@@ -1902,8 +1901,8 @@ static CPU_INIT( f8 )
f8_Regs *cpustate = get_safe_token(device);
cpustate->irq_callback = irqcallback;
cpustate->device = device;
- cpustate->program = device->space(AS_PROGRAM);
- cpustate->iospace = device->space(AS_IO);
+ cpustate->program = device_memory(device)->space(AS_PROGRAM);
+ cpustate->iospace = device_memory(device)->space(AS_IO);
state_save_register_device_item(device, 0, cpustate->pc0);
state_save_register_device_item(device, 0, cpustate->pc1);
@@ -2020,7 +2019,7 @@ static CPU_SET_INFO( f8 )
CPU_GET_INFO( f8 )
{
- f8_Regs *cpustate = (device != NULL && device->token != NULL) ? get_safe_token(device) : NULL;
+ f8_Regs *cpustate = (device != NULL && downcast<cpu_device *>(device)->token() != NULL) ? get_safe_token(device) : NULL;
switch (state)
{
diff --git a/src/emu/cpu/g65816/g65816.c b/src/emu/cpu/g65816/g65816.c
index 953dd27c0b1..b238aa92ac3 100644
--- a/src/emu/cpu/g65816/g65816.c
+++ b/src/emu/cpu/g65816/g65816.c
@@ -98,10 +98,9 @@ TODO general:
INLINE g65816i_cpu_struct *get_safe_token(running_device *device)
{
assert(device != NULL);
- assert(device->token != NULL);
- assert(device->type == CPU);
+ assert(device->type() == CPU);
assert(cpu_get_type(device) == CPU_G65816 || cpu_get_type(device) == CPU_5A22);
- return (g65816i_cpu_struct *)device->token;
+ return (g65816i_cpu_struct *)downcast<cpu_device *>(device)->token();
}
/* Temporary Variables */
@@ -303,7 +302,7 @@ static void g65816_set_irq_line(g65816i_cpu_struct *cpustate, int line, int stat
}
/* Set the callback that is called when servicing an interrupt */
-static void g65816_set_irq_callback(g65816i_cpu_struct *cpustate, cpu_irq_callback callback)
+static void g65816_set_irq_callback(g65816i_cpu_struct *cpustate, device_irq_callback callback)
{
INT_ACK = callback;
}
@@ -338,7 +337,7 @@ static CPU_INIT( g65816 )
g65816_set_irq_callback(cpustate, irqcallback);
cpustate->device = device;
- cpustate->program = device->space(AS_PROGRAM);
+ cpustate->program = device_memory(device)->space(AS_PROGRAM);
cpustate->cpu_type = CPU_TYPE_G65816;
state_save_register_device_item(device, 0, cpustate->a);
@@ -419,7 +418,7 @@ void g65816_set_read_vector_callback(running_device *device, read8_space_func re
CPU_GET_INFO( g65816 )
{
- g65816i_cpu_struct *cpustate = (device != NULL && device->token != NULL) ? get_safe_token(device) : NULL;
+ g65816i_cpu_struct *cpustate = (device != NULL && downcast<cpu_device *>(device)->token() != NULL) ? get_safe_token(device) : NULL;
switch (state)
{
diff --git a/src/emu/cpu/g65816/g65816cm.h b/src/emu/cpu/g65816/g65816cm.h
index b1743d4ebda..c463a3c6002 100644
--- a/src/emu/cpu/g65816/g65816cm.h
+++ b/src/emu/cpu/g65816/g65816cm.h
@@ -93,7 +93,7 @@ struct _g65816i_cpu_struct
uint line_nmi; /* Status of the NMI line */
uint ir; /* Instruction Register */
uint irq_delay; /* delay 1 instruction before checking irq */
- cpu_irq_callback int_ack; /* Interrupt Acknowledge */
+ device_irq_callback int_ack; /* Interrupt Acknowledge */
running_device *device;
const address_space *program;
read8_space_func read_vector; /* Read vector override */
diff --git a/src/emu/cpu/g65816/g65816op.h b/src/emu/cpu/g65816/g65816op.h
index 6c281125129..9495214205f 100644
--- a/src/emu/cpu/g65816/g65816op.h
+++ b/src/emu/cpu/g65816/g65816op.h
@@ -2288,9 +2288,9 @@ TABLE_FUNCTION(uint, get_reg, (g65816i_cpu_struct *cpustate, int regnum))
case G65816_A: return REGISTER_B | REGISTER_A;
case G65816_X: return REGISTER_X;
case G65816_Y: return REGISTER_Y;
- case REG_GENSP: return REGISTER_S;
+ case STATE_GENSP: return REGISTER_S;
case G65816_S: return REGISTER_S;
- case REG_GENPC: return REGISTER_PC;
+ case STATE_GENPC: return REGISTER_PC;
case G65816_PC: return REGISTER_PC;
case G65816_PB: return REGISTER_PB >> 16;
case G65816_DB: return REGISTER_DB >> 16;
@@ -2298,7 +2298,7 @@ TABLE_FUNCTION(uint, get_reg, (g65816i_cpu_struct *cpustate, int regnum))
case G65816_P: return g65816i_get_reg_p(cpustate);
case G65816_NMI_STATE: return LINE_NMI;
case G65816_IRQ_STATE: return LINE_IRQ;
- case REG_GENPCBASE: return REGISTER_PPC;
+ case STATE_GENPCBASE: return REGISTER_PPC;
}
return 0;
}
@@ -2309,11 +2309,11 @@ TABLE_FUNCTION(void, set_reg, (g65816i_cpu_struct *cpustate, int regnum, uint va
{
switch(regnum)
{
- case REG_GENPC: case G65816_PC: REGISTER_PC = MAKE_UINT_16(val); break;
+ case STATE_GENPC: case G65816_PC: REGISTER_PC = MAKE_UINT_16(val); break;
#if FLAG_SET_E
- case REG_GENSP: case G65816_S: REGISTER_S = MAKE_UINT_8(val) | 0x100; break;
+ case STATE_GENSP: case G65816_S: REGISTER_S = MAKE_UINT_8(val) | 0x100; break;
#else
- case REG_GENSP: case G65816_S: REGISTER_S = MAKE_UINT_16(val); break;
+ case STATE_GENSP: case G65816_S: REGISTER_S = MAKE_UINT_16(val); break;
#endif
case G65816_P: g65816i_set_reg_p(cpustate, val); break;
#if FLAG_SET_M
diff --git a/src/emu/cpu/h6280/h6280.c b/src/emu/cpu/h6280/h6280.c
index 496caad3c01..03077fb098d 100644
--- a/src/emu/cpu/h6280/h6280.c
+++ b/src/emu/cpu/h6280/h6280.c
@@ -120,10 +120,9 @@ 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->token != NULL);
- assert(device->type == CPU);
+ assert(device->type() == CPU);
assert(cpu_get_type(device) == CPU_H6280);
- return (h6280_Regs *)device->token;
+ return (h6280_Regs *)downcast<cpu_device *>(device)->token();
}
/* include the opcode macros, functions and function pointer tables */
@@ -163,15 +162,15 @@ static CPU_INIT( h6280 )
cpustate->irq_callback = irqcallback;
cpustate->device = device;
- cpustate->program = device->space(AS_PROGRAM);
- cpustate->io = device->space(AS_IO);
+ cpustate->program = device_memory(device)->space(AS_PROGRAM);
+ cpustate->io = device_memory(device)->space(AS_IO);
}
static CPU_RESET( h6280 )
{
h6280_Regs* cpustate = get_safe_token(device);
- cpu_irq_callback save_irqcallback;
+ device_irq_callback save_irqcallback;
int i;
/* wipe out the h6280 structure */
@@ -179,8 +178,8 @@ static CPU_RESET( h6280 )
memset(cpustate, 0, sizeof(h6280_Regs));
cpustate->irq_callback = save_irqcallback;
cpustate->device = device;
- cpustate->program = device->space(AS_PROGRAM);
- cpustate->io = device->space(AS_IO);
+ cpustate->program = device_memory(device)->space(AS_PROGRAM);
+ cpustate->io = device_memory(device)->space(AS_IO);
/* set I and B flags */
P = _fI | _fB;
@@ -292,7 +291,7 @@ static void set_irq_line(h6280_Regs* cpustate, int irqline, int state)
READ8_HANDLER( h6280_irq_status_r )
{
int status;
- h6280_Regs *cpustate = (h6280_Regs*)space->cpu->token;
+ h6280_Regs *cpustate = get_safe_token(space->cpu);
switch (offset&3)
{
@@ -311,7 +310,7 @@ READ8_HANDLER( h6280_irq_status_r )
WRITE8_HANDLER( h6280_irq_status_w )
{
- h6280_Regs *cpustate = (h6280_Regs*)space->cpu->token;
+ h6280_Regs *cpustate = get_safe_token(space->cpu);
cpustate->io_buffer=data;
switch (offset&3)
{
@@ -330,13 +329,13 @@ WRITE8_HANDLER( h6280_irq_status_w )
READ8_HANDLER( h6280_timer_r )
{
/* only returns countdown */
- h6280_Regs *cpustate = (h6280_Regs*)space->cpu->token;
+ h6280_Regs *cpustate = get_safe_token(space->cpu);
return ((cpustate->timer_value/1024)&0x7F)|(cpustate->io_buffer&0x80);
}
WRITE8_HANDLER( h6280_timer_w )
{
- h6280_Regs *cpustate = (h6280_Regs*)space->cpu->token;
+ h6280_Regs *cpustate = get_safe_token(space->cpu);
cpustate->io_buffer=data;
switch (offset) {
case 0: /* Counter preload */
@@ -426,7 +425,7 @@ static CPU_SET_INFO( h6280 )
CPU_GET_INFO( h6280 )
{
- h6280_Regs* cpustate = (device != NULL && device->token != NULL) ? get_safe_token(device) : NULL;
+ h6280_Regs* cpustate = (device != NULL && downcast<cpu_device *>(device)->token() != NULL) ? get_safe_token(device) : NULL;
switch (state)
{
diff --git a/src/emu/cpu/h6280/h6280.h b/src/emu/cpu/h6280/h6280.h
index 6f5e57dc23a..fc652f94289 100644
--- a/src/emu/cpu/h6280/h6280.h
+++ b/src/emu/cpu/h6280/h6280.h
@@ -60,7 +60,7 @@ typedef struct
UINT8 nmi_state;
UINT8 irq_state[3];
UINT8 irq_pending;
- cpu_irq_callback irq_callback;
+ device_irq_callback irq_callback;
running_device *device;
const address_space *program;
const address_space *io;
diff --git a/src/emu/cpu/h83002/h8_16.c b/src/emu/cpu/h83002/h8_16.c
index 7ea9044dd50..c637afccf3c 100644
--- a/src/emu/cpu/h83002/h8_16.c
+++ b/src/emu/cpu/h83002/h8_16.c
@@ -220,8 +220,8 @@ static CPU_INIT(h8)
h8->mode_8bit = 0;
- h8->program = device->space(AS_PROGRAM);
- h8->io = device->space(AS_IO);
+ h8->program = device_memory(device)->space(AS_PROGRAM);
+ h8->io = device_memory(device)->space(AS_IO);
state_save_register_device_item(device, 0, h8->h8err);
state_save_register_device_item_array(device, 0, h8->regs);
@@ -429,7 +429,7 @@ static CPU_SET_INFO( h8 )
static READ16_HANDLER( h8_itu_r )
{
- h83xx_state *h8 = (h83xx_state *)space->cpu->token;
+ h83xx_state *h8 = get_safe_token(space->cpu);
if (mem_mask == 0xffff)
{
@@ -450,7 +450,7 @@ static READ16_HANDLER( h8_itu_r )
static WRITE16_HANDLER( h8_itu_w )
{
- h83xx_state *h8 = (h83xx_state *)space->cpu->token;
+ h83xx_state *h8 = get_safe_token(space->cpu);
if (mem_mask == 0xffff)
{
@@ -470,7 +470,7 @@ static WRITE16_HANDLER( h8_itu_w )
static READ16_HANDLER( h8_3007_itu_r )
{
- h83xx_state *h8 = (h83xx_state *)space->cpu->token;
+ h83xx_state *h8 = get_safe_token(space->cpu);
if (mem_mask == 0xffff)
{
@@ -490,7 +490,7 @@ static READ16_HANDLER( h8_3007_itu_r )
}
static WRITE16_HANDLER( h8_3007_itu_w )
{
- h83xx_state *h8 = (h83xx_state *)space->cpu->token;
+ h83xx_state *h8 = get_safe_token(space->cpu);
if (mem_mask == 0xffff)
{
@@ -510,7 +510,7 @@ static WRITE16_HANDLER( h8_3007_itu_w )
static READ16_HANDLER( h8_3007_itu1_r )
{
- h83xx_state *h8 = (h83xx_state *)space->cpu->token;
+ h83xx_state *h8 = get_safe_token(space->cpu);
if (mem_mask == 0xffff)
{
@@ -530,7 +530,7 @@ static READ16_HANDLER( h8_3007_itu1_r )
}
static WRITE16_HANDLER( h8_3007_itu1_w )
{
- h83xx_state *h8 = (h83xx_state *)space->cpu->token;
+ h83xx_state *h8 = get_safe_token(space->cpu);
if (mem_mask == 0xffff)
{
@@ -570,7 +570,7 @@ ADDRESS_MAP_END
CPU_GET_INFO( h8_3002 )
{
- h83xx_state *h8 = (device != NULL && device->token != NULL) ? get_safe_token(device) : NULL;
+ h83xx_state *h8 = (device != NULL && downcast<cpu_device *>(device)->token() != NULL) ? get_safe_token(device) : NULL;
switch(state) {
// Interface functions and variables
diff --git a/src/emu/cpu/h83002/h8_8.c b/src/emu/cpu/h83002/h8_8.c
index c77841b7691..da8618fc0e9 100644
--- a/src/emu/cpu/h83002/h8_8.c
+++ b/src/emu/cpu/h83002/h8_8.c
@@ -237,8 +237,8 @@ static CPU_INIT(h8bit)
h8->mode_8bit = 1;
- h8->program = device->space(AS_PROGRAM);
- h8->io = device->space(AS_IO);
+ h8->program = device_memory(device)->space(AS_PROGRAM);
+ h8->io = device_memory(device)->space(AS_IO);
h8->timer[0] = timer_alloc(h8->device->machine, h8_timer_0_cb, h8);
h8->timer[1] = timer_alloc(h8->device->machine, h8_timer_1_cb, h8);
@@ -515,7 +515,7 @@ static READ8_HANDLER( h8330_itu_r )
UINT8 reg;
UINT64 frc;
static const UINT64 divider[4] = { 2, 8, 32, 1 };
- h83xx_state *h8 = (h83xx_state *)space->cpu->token;
+ h83xx_state *h8 = get_safe_token(space->cpu);
reg = (offset + 0x88) & 0xff;
@@ -603,7 +603,7 @@ static READ8_HANDLER( h8330_itu_r )
static WRITE8_HANDLER( h8330_itu_w )
{
UINT8 reg;
- h83xx_state *h8 = (h83xx_state *)space->cpu->token;
+ h83xx_state *h8 = get_safe_token(space->cpu);
reg = (offset + 0x88) & 0xff;
@@ -751,7 +751,7 @@ ADDRESS_MAP_END
CPU_GET_INFO( h8_3334 )
{
- h83xx_state *h8 = (device != NULL && device->token != NULL) ? get_safe_token(device) : NULL;
+ h83xx_state *h8 = (device != NULL && downcast<cpu_device *>(device)->token() != NULL) ? get_safe_token(device) : NULL;
switch(state) {
// Interface functions and variables
diff --git a/src/emu/cpu/h83002/h8priv.h b/src/emu/cpu/h83002/h8priv.h
index 87bfd64aa86..5f9091b3555 100644
--- a/src/emu/cpu/h83002/h8priv.h
+++ b/src/emu/cpu/h83002/h8priv.h
@@ -25,7 +25,7 @@ struct _h83xx_state
UINT8 h8uflag, h8uiflag;
UINT8 incheckirqs;
- cpu_irq_callback irq_cb;
+ device_irq_callback irq_cb;
running_device *device;
const address_space *program;
@@ -50,13 +50,12 @@ extern h83xx_state h8;
INLINE h83xx_state *get_safe_token(running_device *device)
{
assert(device != NULL);
- assert(device->token != NULL);
- assert(device->type == CPU);
+ 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);
- return (h83xx_state *)device->token;
+ return (h83xx_state *)downcast<cpu_device *>(device)->token();
}
UINT8 h8_register_read8(h83xx_state *h8, UINT32 address);
diff --git a/src/emu/cpu/hd6309/hd6309.c b/src/emu/cpu/hd6309/hd6309.c
index f14775c6d3e..7ac0dc1cfe1 100644
--- a/src/emu/cpu/hd6309/hd6309.c
+++ b/src/emu/cpu/hd6309/hd6309.c
@@ -131,7 +131,7 @@ struct _m68_state_t
UINT8 irq_state[2];
int extra_cycles; /* cycles used up by interrupts */
- cpu_irq_callback irq_callback;
+ device_irq_callback irq_callback;
running_device *device;
int icount;
PAIR ea; /* effective address */
@@ -154,10 +154,9 @@ struct _m68_state_t
INLINE m68_state_t *get_safe_token(running_device *device)
{
assert(device != NULL);
- assert(device->token != NULL);
- assert(device->type == CPU);
+ assert(device->type() == CPU);
assert(cpu_get_type(device) == CPU_HD6309);
- return (m68_state_t *)device->token;
+ return (m68_state_t *)downcast<cpu_device *>(device)->token();
}
static void check_irq_lines( m68_state_t *m68_state );
@@ -523,7 +522,7 @@ static CPU_INIT( hd6309 )
m68_state->irq_callback = irqcallback;
m68_state->device = device;
- m68_state->program = device->space(AS_PROGRAM);
+ m68_state->program = device_memory(device)->space(AS_PROGRAM);
/* setup regtable */
@@ -1259,7 +1258,7 @@ static CPU_SET_INFO( hd6309 )
CPU_GET_INFO( hd6309 )
{
- m68_state_t *m68_state = (device != NULL && device->token != NULL) ? get_safe_token(device) : NULL;
+ m68_state_t *m68_state = (device != NULL && downcast<cpu_device *>(device)->token() != NULL) ? get_safe_token(device) : NULL;
switch (state)
{
diff --git a/src/emu/cpu/i386/i386.c b/src/emu/cpu/i386/i386.c
index 5518e7bedaa..0b5686e1485 100644
--- a/src/emu/cpu/i386/i386.c
+++ b/src/emu/cpu/i386/i386.c
@@ -548,8 +548,8 @@ static CPU_INIT( i386 )
cpustate->irq_callback = irqcallback;
cpustate->device = device;
- cpustate->program = device->space(AS_PROGRAM);
- cpustate->io = device->space(AS_IO);
+ cpustate->program = device_memory(device)->space(AS_PROGRAM);
+ cpustate->io = device_memory(device)->space(AS_IO);
state_save_register_device_item_array(device, 0, cpustate->reg.d);
state_save_register_device_item(device, 0, cpustate->sreg[ES].selector);
@@ -641,14 +641,14 @@ static void build_opcode_table(i386_state *cpustate, UINT32 features)
static CPU_RESET( i386 )
{
i386_state *cpustate = get_safe_token(device);
- cpu_irq_callback save_irqcallback;
+ device_irq_callback save_irqcallback;
save_irqcallback = cpustate->irq_callback;
memset( cpustate, 0, sizeof(*cpustate) );
cpustate->irq_callback = save_irqcallback;
cpustate->device = device;
- cpustate->program = device->space(AS_PROGRAM);
- cpustate->io = device->space(AS_IO);
+ cpustate->program = device_memory(device)->space(AS_PROGRAM);
+ cpustate->io = device_memory(device)->space(AS_IO);
cpustate->sreg[CS].selector = 0xf000;
cpustate->sreg[CS].base = 0xffff0000;
@@ -870,7 +870,7 @@ static CPU_SET_INFO( i386 )
CPU_GET_INFO( i386 )
{
- i386_state *cpustate = (device != NULL && device->token != NULL) ? get_safe_token(device) : NULL;
+ i386_state *cpustate = (device != NULL && downcast<cpu_device *>(device)->token() != NULL) ? get_safe_token(device) : NULL;
switch (state)
{
@@ -1097,14 +1097,14 @@ static CPU_INIT( i486 )
static CPU_RESET( i486 )
{
i386_state *cpustate = get_safe_token(device);
- cpu_irq_callback save_irqcallback;
+ device_irq_callback save_irqcallback;
save_irqcallback = cpustate->irq_callback;
memset( cpustate, 0, sizeof(*cpustate) );
cpustate->irq_callback = save_irqcallback;
cpustate->device = device;
- cpustate->program = device->space(AS_PROGRAM);
- cpustate->io = device->space(AS_IO);
+ cpustate->program = device_memory(device)->space(AS_PROGRAM);
+ cpustate->io = device_memory(device)->space(AS_IO);
cpustate->sreg[CS].selector = 0xf000;
cpustate->sreg[CS].base = 0xffff0000;
@@ -1165,7 +1165,7 @@ static CPU_SET_INFO( i486 )
CPU_GET_INFO( i486 )
{
- i386_state *cpustate = (device != NULL && device->token != NULL) ? get_safe_token(device) : NULL;
+ i386_state *cpustate = (device != NULL && downcast<cpu_device *>(device)->token() != NULL) ? get_safe_token(device) : NULL;
switch (state)
{
case CPUINFO_FCT_SET_INFO: info->setinfo = CPU_SET_INFO_NAME(i486);break;
@@ -1213,14 +1213,14 @@ static CPU_INIT( pentium )
static CPU_RESET( pentium )
{
i386_state *cpustate = get_safe_token(device);
- cpu_irq_callback save_irqcallback;
+ device_irq_callback save_irqcallback;
save_irqcallback = cpustate->irq_callback;
memset( cpustate, 0, sizeof(*cpustate) );
cpustate->irq_callback = save_irqcallback;
cpustate->device = device;
- cpustate->program = device->space(AS_PROGRAM);
- cpustate->io = device->space(AS_IO);
+ cpustate->program = device_memory(device)->space(AS_PROGRAM);
+ cpustate->io = device_memory(device)->space(AS_IO);
cpustate->sreg[CS].selector = 0xf000;
cpustate->sreg[CS].base = 0xffff0000;
@@ -1296,7 +1296,7 @@ static CPU_SET_INFO( pentium )
CPU_GET_INFO( pentium )
{
- i386_state *cpustate = (device != NULL && device->token != NULL) ? get_safe_token(device) : NULL;
+ i386_state *cpustate = (device != NULL && downcast<cpu_device *>(device)->token() != NULL) ? get_safe_token(device) : NULL;
switch (state)
{
case CPUINFO_FCT_SET_INFO: info->setinfo = CPU_SET_INFO_NAME(pentium); break;
@@ -1344,14 +1344,14 @@ static CPU_INIT( mediagx )
static CPU_RESET( mediagx )
{
i386_state *cpustate = get_safe_token(device);
- cpu_irq_callback save_irqcallback;
+ device_irq_callback save_irqcallback;
save_irqcallback = cpustate->irq_callback;
memset( cpustate, 0, sizeof(*cpustate) );
cpustate->irq_callback = save_irqcallback;
cpustate->device = device;
- cpustate->program = device->space(AS_PROGRAM);
- cpustate->io = device->space(AS_IO);
+ cpustate->program = device_memory(device)->space(AS_PROGRAM);
+ cpustate->io = device_memory(device)->space(AS_IO);
cpustate->sreg[CS].selector = 0xf000;
cpustate->sreg[CS].base = 0xffff0000;
@@ -1422,7 +1422,7 @@ static CPU_SET_INFO( mediagx )
CPU_GET_INFO( mediagx )
{
- i386_state *cpustate = (device != NULL && device->token != NULL) ? get_safe_token(device) : NULL;
+ i386_state *cpustate = (device != NULL && downcast<cpu_device *>(device)->token() != NULL) ? get_safe_token(device) : NULL;
switch (state)
{
case CPUINFO_FCT_SET_INFO: info->setinfo = CPU_SET_INFO_NAME(mediagx); break;
diff --git a/src/emu/cpu/i386/i386priv.h b/src/emu/cpu/i386/i386priv.h
index 98de137ce55..48c27d0a9ed 100644
--- a/src/emu/cpu/i386/i386priv.h
+++ b/src/emu/cpu/i386/i386priv.h
@@ -226,7 +226,7 @@ struct _i386_state
UINT8 opcode;
UINT8 irq_state;
- cpu_irq_callback irq_callback;
+ device_irq_callback irq_callback;
running_device *device;
const address_space *program;
const address_space *io;
@@ -260,13 +260,12 @@ struct _i386_state
INLINE i386_state *get_safe_token(running_device *device)
{
assert(device != NULL);
- assert(device->token != NULL);
- assert(device->type == CPU);
+ 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);
- return (i386_state *)device->token;
+ return (i386_state *)downcast<cpu_device *>(device)->token();
}
extern int i386_parity_table[256];
diff --git a/src/emu/cpu/i4004/i4004.c b/src/emu/cpu/i4004/i4004.c
index 1d046d36ceb..8d74e4ecef8 100644
--- a/src/emu/cpu/i4004/i4004.c
+++ b/src/emu/cpu/i4004/i4004.c
@@ -31,12 +31,12 @@ struct _i4004_state
UINT8 C; // Carry flag
UINT8 TEST; // Test PIN status
PAIR PC; // It is in fact one of ADDR regs
+ UINT8 flags; // used for I/O only
running_device *device;
const address_space *program;
const address_space *data;
const address_space *io;
- cpu_state_table state;
int icount;
int pc_pos; // PC possition in ADDR
int addr_mask;
@@ -48,51 +48,15 @@ struct _i4004_state
#define GET_PC (cpustate->ADDR[cpustate->pc_pos])
/***************************************************************************
- CPU STATE DESCRIPTION
-***************************************************************************/
-
-#define I4004_STATE_ENTRY(_name, _format, _member, _datamask, _flags) \
- CPU_STATE_ENTRY(I4004_##_name, #_name, _format, i4004_state, _member, _datamask, ~0, _flags)
-
-static const cpu_state_entry state_array[] =
-{
- I4004_STATE_ENTRY(PC, "%03X", PC.w.l, 0x0fff, 0)
- I4004_STATE_ENTRY(GENPC,"%03X", PC.w.l, 0x0fff, CPUSTATE_NOSHOW)
- I4004_STATE_ENTRY(A, "%01X", A, 0x0f, 0)
- I4004_STATE_ENTRY(R01, "%02X", R[0], 0xff, 0)
- I4004_STATE_ENTRY(R23, "%02X", R[1], 0xff, 0)
- I4004_STATE_ENTRY(R45, "%02X", R[2], 0xff, 0)
- I4004_STATE_ENTRY(R67, "%02X", R[3], 0xff, 0)
- I4004_STATE_ENTRY(R89, "%02X", R[4], 0xff, 0)
- I4004_STATE_ENTRY(RAB, "%02X", R[5], 0xff, 0)
- I4004_STATE_ENTRY(RCD, "%02X", R[6], 0xff, 0)
- I4004_STATE_ENTRY(REF, "%02X", R[7], 0xff, 0)
- I4004_STATE_ENTRY(ADDR1, "%03X", ADDR[0].w.l, 0x0fff, 0)
- I4004_STATE_ENTRY(ADDR2, "%03X", ADDR[1].w.l, 0x0fff, 0)
- I4004_STATE_ENTRY(ADDR3, "%03X", ADDR[2].w.l, 0x0fff, 0)
- I4004_STATE_ENTRY(ADDR4, "%03X", ADDR[3].w.l, 0x0fff, 0)
- I4004_STATE_ENTRY(RAM, "%03X", RAM.w.l, 0x0fff, 0)
-};
-
-static const cpu_state_table state_table_template =
-{
- NULL, /* pointer to the base of state (offsets are relative to this) */
- 0, /* subtype this table refers to */
- ARRAY_LENGTH(state_array), /* number of entries */
- state_array /* array of entries */
-};
-
-/***************************************************************************
INLINE FUNCTIONS
***************************************************************************/
INLINE i4004_state *get_safe_token(running_device *device)
{
assert(device != NULL);
- assert(device->token != NULL);
- assert(device->type == CPU);
+ assert(device->type() == CPU);
assert(cpu_get_type(device) == CPU_I4004);
- return (i4004_state *)device->token;
+ return (i4004_state *)downcast<cpu_device *>(device)->token();
}
INLINE UINT8 ROP(i4004_state *cpustate)
@@ -484,15 +448,29 @@ static CPU_INIT( i4004 )
i4004_state *cpustate = get_safe_token(device);
/* set up the state table */
- cpustate->state = state_table_template;
- cpustate->state.baseptr = cpustate;
- cpustate->state.subtypemask = 1;
+ {
+ device_state_interface *state;
+ device->interface(state);
+ state->state_add(I4004_PC, "PC", cpustate->PC.w.l).mask(0x0fff);
+ state->state_add(STATE_GENPC, "GENPC", cpustate->PC.w.l).mask(0x0fff).noshow();
+ state->state_add(STATE_GENFLAGS, "GENFLAGS", cpustate->flags).mask(0x0f).callimport().callexport().noshow().formatstr("%4s");
+ state->state_add(I4004_A, "A", cpustate->A).mask(0x0f);
+
+ astring tempstr;
+ for (int regnum = 0; regnum < 8; regnum++)
+ state->state_add(I4004_R01 + regnum, tempstr.format("R%X%X", regnum*2, regnum*2+1), cpustate->R[regnum]);
+
+ for (int addrnum = 0; addrnum < 4; addrnum++)
+ state->state_add(I4004_ADDR1 + addrnum, tempstr.format("ADDR%d", addrnum + 1), cpustate->ADDR[addrnum].w.l).mask(0xfff);
+
+ state->state_add(I4004_RAM, "RAM", cpustate->RAM.w.l).mask(0x0fff);
+ }
cpustate->device = device;
- cpustate->program = device->space(AS_PROGRAM);
- cpustate->data = device->space(AS_DATA);
- cpustate->io = device->space(AS_IO);
+ cpustate->program = device_memory(device)->space(AS_PROGRAM);
+ cpustate->data = device_memory(device)->space(AS_DATA);
+ cpustate->io = device_memory(device)->space(AS_IO);
state_save_register_device_item(device, 0, cpustate->PC);
state_save_register_device_item(device, 0, cpustate->A);
@@ -543,10 +521,44 @@ static CPU_RESET( i4004 )
static CPU_IMPORT_STATE( i4004 )
{
+ i4004_state *cpustate = get_safe_token(device);
+
+ switch (entry.index())
+ {
+ case STATE_GENFLAGS:
+ cpustate->C = (cpustate->flags >> 1) & 1;
+ cpustate->TEST = (cpustate->flags >> 0) & 1;
+ break;
+ }
}
static CPU_EXPORT_STATE( i4004 )
{
+ i4004_state *cpustate = get_safe_token(device);
+
+ switch (entry.index())
+ {
+ case STATE_GENFLAGS:
+ cpustate->flags = ((cpustate->A == 0) ? 0x04 : 0x00) |
+ (cpustate->C ? 0x02 : 0x00) |
+ (cpustate->TEST ? 0x01 : 0x00);
+ break;
+ }
+}
+
+static CPU_EXPORT_STRING( i4004 )
+{
+ i4004_state *cpustate = get_safe_token(device);
+
+ switch (entry.index())
+ {
+ case STATE_GENFLAGS:
+ string.printf(".%c%c%c",
+ (cpustate->A==0) ? 'Z':'.',
+ cpustate->C ? 'C':'.',
+ cpustate->TEST ? 'T':'.');
+ break;
+ }
}
/***************************************************************************
@@ -562,7 +574,7 @@ static CPU_SET_INFO( i4004 )
CPU_GET_INFO( i4004 )
{
- i4004_state *cpustate = (device != NULL && device->token != NULL) ? get_safe_token(device) : NULL;
+ i4004_state *cpustate = (device != NULL && downcast<cpu_device *>(device)->token() != NULL) ? get_safe_token(device) : NULL;
switch (state)
{
/* --- the following bits of info are returned as 64-bit signed integers --- */
@@ -597,10 +609,10 @@ CPU_GET_INFO( i4004 )
case CPUINFO_FCT_DISASSEMBLE: info->disassemble = CPU_DISASSEMBLE_NAME(i4004); break;
case CPUINFO_FCT_IMPORT_STATE: info->import_state = CPU_IMPORT_STATE_NAME(i4004); break;
case CPUINFO_FCT_EXPORT_STATE: info->export_state = CPU_EXPORT_STATE_NAME(i4004); break;
+ case CPUINFO_FCT_EXPORT_STRING: info->export_string = CPU_EXPORT_STRING_NAME(i4004); break;
/* --- the following bits of info are returned as pointers --- */
case CPUINFO_PTR_INSTRUCTION_COUNTER: info->icount = &cpustate->icount; break;
- case CPUINFO_PTR_STATE_TABLE: info->state_table = &cpustate->state; break;
/* --- the following bits of info are returned as NULL-terminated strings --- */
case DEVINFO_STR_NAME: strcpy(info->s, "4004"); break;
@@ -608,12 +620,5 @@ CPU_GET_INFO( i4004 )
case DEVINFO_STR_VERSION: strcpy(info->s, "1.0"); break;
case DEVINFO_STR_SOURCE_FILE: strcpy(info->s, __FILE__); break;
case DEVINFO_STR_CREDITS: strcpy(info->s, "Copyright Miodrag Milanovic"); break;
-
- case CPUINFO_STR_FLAGS:
- sprintf(info->s, ".%c%c%c",
- (cpustate->A==0) ? 'Z':'.',
- cpustate->C ? 'C':'.',
- cpustate->TEST ? 'T':'.');
- break;
}
}
diff --git a/src/emu/cpu/i4004/i4004.h b/src/emu/cpu/i4004/i4004.h
index c0a90116823..de76710d4ed 100644
--- a/src/emu/cpu/i4004/i4004.h
+++ b/src/emu/cpu/i4004/i4004.h
@@ -13,9 +13,9 @@ enum
I4004_A,
I4004_R01, I4004_R23, I4004_R45, I4004_R67, I4004_R89, I4004_RAB, I4004_RCD, I4004_REF,
I4004_ADDR1,I4004_ADDR2,I4004_ADDR3,I4004_ADDR4,I4004_RAM,
- I4004_GENPC = REG_GENPC,
- I4004_GENSP = REG_GENSP,
- I4004_GENPCBASE = REG_GENPCBASE
+ I4004_GENPC = STATE_GENPC,
+ I4004_GENSP = STATE_GENSP,
+ I4004_GENPCBASE = STATE_GENPCBASE
};
/***************************************************************************
diff --git a/src/emu/cpu/i8008/i8008.c b/src/emu/cpu/i8008/i8008.c
index 2cab3c57d04..4eddffe9034 100644
--- a/src/emu/cpu/i8008/i8008.c
+++ b/src/emu/cpu/i8008/i8008.c
@@ -32,14 +32,14 @@ struct _i8008_state
UINT8 SF; // Sign flag
UINT8 PF; // Parity flag
UINT8 HALT;
+ UINT8 flags; // temporary I/O only
running_device *device;
const address_space *program;
const address_space *io;
- cpu_state_table state;
int icount;
int pc_pos; // PC possition in ADDR
- cpu_irq_callback irq_callback;
+ device_irq_callback irq_callback;
UINT8 irq_state;
};
@@ -51,52 +51,15 @@ struct _i8008_state
#define GET_PC (cpustate->ADDR[cpustate->pc_pos])
/***************************************************************************
- CPU STATE DESCRIPTION
-***************************************************************************/
-
-#define I8008_STATE_ENTRY(_name, _format, _member, _datamask, _flags) \
- CPU_STATE_ENTRY(I8008_##_name, #_name, _format, i8008_state, _member, _datamask, ~0, _flags)
-
-static const cpu_state_entry state_array[] =
-{
- I8008_STATE_ENTRY(PC, "%04X", PC.w.l, 0x3fff, 0)
- I8008_STATE_ENTRY(GENPC,"%04X", PC.w.l, 0x3fff, CPUSTATE_NOSHOW)
- I8008_STATE_ENTRY(A, "%02X", A, 0xff, 0)
- I8008_STATE_ENTRY(B, "%02X", B, 0xff, 0)
- I8008_STATE_ENTRY(C, "%02X", C, 0xff, 0)
- I8008_STATE_ENTRY(D, "%02X", D, 0xff, 0)
- I8008_STATE_ENTRY(E, "%02X", E, 0xff, 0)
- I8008_STATE_ENTRY(H, "%02X", H, 0xff, 0)
- I8008_STATE_ENTRY(L, "%02X", L, 0xff, 0)
- I8008_STATE_ENTRY(ADDR1, "%04X", ADDR[0].w.l, 0x0fff, 0)
- I8008_STATE_ENTRY(ADDR2, "%04X", ADDR[1].w.l, 0x0fff, 0)
- I8008_STATE_ENTRY(ADDR3, "%04X", ADDR[2].w.l, 0x0fff, 0)
- I8008_STATE_ENTRY(ADDR4, "%04X", ADDR[3].w.l, 0x0fff, 0)
- I8008_STATE_ENTRY(ADDR5, "%04X", ADDR[4].w.l, 0x0fff, 0)
- I8008_STATE_ENTRY(ADDR6, "%04X", ADDR[5].w.l, 0x0fff, 0)
- I8008_STATE_ENTRY(ADDR7, "%04X", ADDR[6].w.l, 0x0fff, 0)
- I8008_STATE_ENTRY(ADDR8, "%04X", ADDR[7].w.l, 0x0fff, 0)
-};
-
-static const cpu_state_table state_table_template =
-{
- NULL, /* pointer to the base of state (offsets are relative to this) */
- 0, /* subtype this table refers to */
- ARRAY_LENGTH(state_array), /* number of entries */
- state_array /* array of entries */
-};
-
-/***************************************************************************
INLINE FUNCTIONS
***************************************************************************/
INLINE i8008_state *get_safe_token(running_device *device)
{
assert(device != NULL);
- assert(device->token != NULL);
- assert(device->type == CPU);
+ assert(device->type() == CPU);
assert(cpu_get_type(device) == CPU_I8008);
- return (i8008_state *)device->token;
+ return (i8008_state *)downcast<cpu_device *>(device)->token();
}
INLINE void PUSH_STACK(i8008_state *cpustate)
@@ -563,14 +526,29 @@ static CPU_INIT( i8008 )
i8008_state *cpustate = get_safe_token(device);
/* set up the state table */
- cpustate->state = state_table_template;
- cpustate->state.baseptr = cpustate;
- cpustate->state.subtypemask = 1;
+ {
+ device_state_interface *state;
+ device->interface(state);
+ state->state_add(I8008_PC, "PC", cpustate->PC.w.l).mask(0x3fff);
+ state->state_add(STATE_GENPC, "GENPC", cpustate->PC.w.l).mask(0x3fff).noshow();
+ state->state_add(STATE_GENFLAGS, "GENFLAGS", cpustate->flags).mask(0x0f).callimport().callexport().noshow().formatstr("%4s");
+ state->state_add(I8008_A, "A", cpustate->A);
+ state->state_add(I8008_B, "B", cpustate->B);
+ state->state_add(I8008_C, "C", cpustate->C);
+ state->state_add(I8008_D, "D", cpustate->D);
+ state->state_add(I8008_E, "E", cpustate->E);
+ state->state_add(I8008_H, "H", cpustate->H);
+ state->state_add(I8008_L, "L", cpustate->L);
+
+ astring tempstr;
+ for (int addrnum = 0; addrnum < 8; addrnum++)
+ state->state_add(I8008_ADDR1 + addrnum, tempstr.format("ADDR%d", addrnum + 1), cpustate->ADDR[addrnum].w.l).mask(0xfff);
+ }
cpustate->device = device;
- cpustate->program = device->space(AS_PROGRAM);
- cpustate->io = device->space(AS_IO);
+ cpustate->program = device_memory(device)->space(AS_PROGRAM);
+ cpustate->io = device_memory(device)->space(AS_IO);
cpustate->irq_callback = irqcallback;
@@ -635,10 +613,48 @@ static void set_irq_line(i8008_state *cpustate, int irqline, int state)
static CPU_IMPORT_STATE( i8008 )
{
+ i8008_state *cpustate = get_safe_token(device);
+
+ switch (entry.index())
+ {
+ case STATE_GENFLAGS:
+ cpustate->CF = (cpustate->flags >> 3) & 1;
+ cpustate->ZF = (cpustate->flags >> 2) & 1;
+ cpustate->SF = (cpustate->flags >> 1) & 1;
+ cpustate->PF = (cpustate->flags >> 0) & 1;
+ break;
+ }
}
static CPU_EXPORT_STATE( i8008 )
{
+ i8008_state *cpustate = get_safe_token(device);
+
+ switch (entry.index())
+ {
+ case STATE_GENFLAGS:
+ cpustate->flags = (cpustate->CF ? 0x08 : 0x00) |
+ (cpustate->ZF ? 0x04 : 0x00) |
+ (cpustate->SF ? 0x02 : 0x00) |
+ (cpustate->PF ? 0x01 : 0x00);
+ break;
+ }
+}
+
+static CPU_EXPORT_STRING( i8008 )
+{
+ i8008_state *cpustate = get_safe_token(device);
+
+ switch (entry.index())
+ {
+ case STATE_GENFLAGS:
+ string.printf("%c%c%c%c",
+ cpustate->CF ? 'C':'.',
+ cpustate->ZF ? 'Z':'.',
+ cpustate->SF ? 'S':'.',
+ cpustate->PF ? 'P':'.');
+ break;
+ }
}
/***************************************************************************
@@ -660,7 +676,7 @@ static CPU_SET_INFO( i8008 )
CPU_GET_INFO( i8008 )
{
- i8008_state *cpustate = (device != NULL && device->token != NULL) ? get_safe_token(device) : NULL;
+ i8008_state *cpustate = (device != NULL && downcast<cpu_device *>(device)->token() != NULL) ? get_safe_token(device) : NULL;
switch (state)
{
/* --- the following bits of info are returned as 64-bit signed integers --- */
@@ -695,10 +711,10 @@ CPU_GET_INFO( i8008 )
case CPUINFO_FCT_DISASSEMBLE: info->disassemble = CPU_DISASSEMBLE_NAME(i8008); break;
case CPUINFO_FCT_IMPORT_STATE: info->import_state = CPU_IMPORT_STATE_NAME(i8008); break;
case CPUINFO_FCT_EXPORT_STATE: info->export_state = CPU_EXPORT_STATE_NAME(i8008); break;
+ case CPUINFO_FCT_EXPORT_STRING: info->export_string = CPU_EXPORT_STRING_NAME(i8008); break;
/* --- the following bits of info are returned as pointers --- */
case CPUINFO_PTR_INSTRUCTION_COUNTER: info->icount = &cpustate->icount; break;
- case CPUINFO_PTR_STATE_TABLE: info->state_table = &cpustate->state; break;
/* --- the following bits of info are returned as NULL-terminated strings --- */
case DEVINFO_STR_NAME: strcpy(info->s, "8008"); break;
@@ -706,13 +722,5 @@ CPU_GET_INFO( i8008 )
case DEVINFO_STR_VERSION: strcpy(info->s, "1.0"); break;
case DEVINFO_STR_SOURCE_FILE: strcpy(info->s, __FILE__); break;
case DEVINFO_STR_CREDITS: strcpy(info->s, "Copyright Miodrag Milanovic"); break;
-
- case CPUINFO_STR_FLAGS:
- sprintf(info->s, "%c%c%c%c",
- cpustate->CF ? 'C':'.',
- cpustate->ZF ? 'Z':'.',
- cpustate->SF ? 'S':'.',
- cpustate->PF ? 'P':'.');
- break;
}
}
diff --git a/src/emu/cpu/i8008/i8008.h b/src/emu/cpu/i8008/i8008.h
index 81083179fc8..78f06d2b71b 100644
--- a/src/emu/cpu/i8008/i8008.h
+++ b/src/emu/cpu/i8008/i8008.h
@@ -12,9 +12,9 @@ enum
I8008_PC,
I8008_A,I8008_B,I8008_C,I8008_D,I8008_E,I8008_H,I8008_L,
I8008_ADDR1,I8008_ADDR2,I8008_ADDR3,I8008_ADDR4,I8008_ADDR5,I8008_ADDR6,I8008_ADDR7,I8008_ADDR8,
- I8008_GENPC = REG_GENPC,
- I8008_GENSP = REG_GENSP,
- I8008_GENPCBASE = REG_GENPCBASE
+ I8008_GENPC = STATE_GENPC,
+ I8008_GENSP = STATE_GENSP,
+ I8008_GENPCBASE = STATE_GENPCBASE
};
/***************************************************************************
diff --git a/src/emu/cpu/i8085/i8085.c b/src/emu/cpu/i8085/i8085.c
index 707470bdbab..e36aa7c7662 100644
--- a/src/emu/cpu/i8085/i8085.c
+++ b/src/emu/cpu/i8085/i8085.c
@@ -182,63 +182,16 @@ struct _i8085_state
UINT8 ietemp; /* import/export temp space */
- cpu_irq_callback irq_callback;
+ device_irq_callback irq_callback;
running_device *device;
const address_space *program;
const address_space *io;
- cpu_state_table state;
int icount;
};
/***************************************************************************
- CPU STATE DESCRIPTION
-***************************************************************************/
-
-#define I8085_STATE_ENTRY(_name, _format, _member, _datamask, _flags) \
- CPU_STATE_ENTRY(I8085_##_name, #_name, _format, i8085_state, _member, _datamask, ~0, _flags)
-
-static const cpu_state_entry state_array[] =
-{
- I8085_STATE_ENTRY(PC, "%04X", PC.w.l, 0xffff, 0)
- I8085_STATE_ENTRY(GENPC, "%04X", PC.w.l, 0xffff, CPUSTATE_NOSHOW)
-// I8085_STATE_ENTRY(GENPCBASE, "%04X", prvpc.w.l, 0xffff, CPUSTATE_NOSHOW)
-
- I8085_STATE_ENTRY(SP, "%04X", SP.w.l, 0xffff, 0)
- I8085_STATE_ENTRY(GENSP, "%04X", SP.w.l, 0xffff, CPUSTATE_NOSHOW)
-
- I8085_STATE_ENTRY(A, "%02X", AF.b.h, 0xff, CPUSTATE_NOSHOW)
- I8085_STATE_ENTRY(B, "%02X", BC.b.h, 0xff, CPUSTATE_NOSHOW)
- I8085_STATE_ENTRY(C, "%02X", BC.b.l, 0xff, CPUSTATE_NOSHOW)
- I8085_STATE_ENTRY(D, "%02X", DE.b.h, 0xff, CPUSTATE_NOSHOW)
- I8085_STATE_ENTRY(E, "%02X", DE.b.l, 0xff, CPUSTATE_NOSHOW)
- I8085_STATE_ENTRY(F, "%02X", AF.b.l, 0xff, CPUSTATE_NOSHOW)
- I8085_STATE_ENTRY(H, "%02X", HL.b.h, 0xff, CPUSTATE_NOSHOW)
- I8085_STATE_ENTRY(L, "%02X", HL.b.l, 0xff, CPUSTATE_NOSHOW)
-
- I8085_STATE_ENTRY(AF, "%04X", AF.w.l, 0xffff, 0)
- I8085_STATE_ENTRY(BC, "%04X", BC.w.l, 0xffff, 0)
- I8085_STATE_ENTRY(DE, "%04X", DE.w.l, 0xffff, 0)
- I8085_STATE_ENTRY(HL, "%04X", HL.w.l, 0xffff, 0)
-
- I8085_STATE_ENTRY(STATUS, "%02X", STATUS, 0xff, 0)
- I8085_STATE_ENTRY(SOD, "%1u", sod_state, 0x1, 0)
- I8085_STATE_ENTRY(SID, "%1u", ietemp, 0x1, CPUSTATE_EXPORT | CPUSTATE_IMPORT)
- I8085_STATE_ENTRY(INTE, "%1u", ietemp, 0x1, CPUSTATE_EXPORT | CPUSTATE_IMPORT)
-};
-
-static const cpu_state_table state_table_template =
-{
- NULL, /* pointer to the base of state (offsets are relative to this) */
- 0, /* subtype this table refers to */
- ARRAY_LENGTH(state_array), /* number of entries */
- state_array /* array of entries */
-};
-
-
-
-/***************************************************************************
MACROS
***************************************************************************/
@@ -322,11 +275,10 @@ static void execute_one(i8085_state *cpustate, int opcode);
INLINE i8085_state *get_safe_token(running_device *device)
{
assert(device != NULL);
- assert(device->token != NULL);
- assert(device->type == CPU);
+ assert(device->type() == CPU);
assert(cpu_get_type(device) == CPU_8080 ||
cpu_get_type(device) == CPU_8085A);
- return (i8085_state *)device->token;
+ return (i8085_state *)downcast<cpu_device *>(device)->token();
}
INLINE void set_sod(i8085_state *cpustate, int state)
@@ -1019,25 +971,47 @@ static void init_tables (int type)
}
-static void init_808x_common(running_device *device, cpu_irq_callback irqcallback, int type)
+static void init_808x_common(running_device *device, device_irq_callback irqcallback, int type)
{
i8085_state *cpustate = get_safe_token(device);
init_tables(type);
/* set up the state table */
- cpustate->state = state_table_template;
- cpustate->state.baseptr = cpustate;
- cpustate->state.subtypemask = 1 << type;
+ {
+ device_state_interface *state;
+ device->interface(state);
+ state->state_add(I8085_PC, "PC", cpustate->PC.w.l);
+ state->state_add(STATE_GENPC, "GENPC", cpustate->PC.w.l).noshow();
+ state->state_add(I8085_SP, "SP", cpustate->SP.w.l);
+ state->state_add(STATE_GENSP, "GENSP", cpustate->SP.w.l).noshow();
+ state->state_add(STATE_GENFLAGS, "GENFLAGS", cpustate->AF.b.l).noshow().formatstr("%8s");
+ state->state_add(I8085_A, "A", cpustate->AF.b.l).noshow();
+ state->state_add(I8085_B, "B", cpustate->BC.b.h).noshow();
+ state->state_add(I8085_C, "C", cpustate->BC.b.l).noshow();
+ state->state_add(I8085_D, "D", cpustate->DE.b.h).noshow();
+ state->state_add(I8085_E, "E", cpustate->DE.b.l).noshow();
+ state->state_add(I8085_F, "F", cpustate->AF.b.l).noshow();
+ state->state_add(I8085_H, "H", cpustate->HL.b.h).noshow();
+ state->state_add(I8085_L, "L", cpustate->HL.b.l).noshow();
+ state->state_add(I8085_AF, "AF", cpustate->AF.w.l);
+ state->state_add(I8085_BC, "BC", cpustate->BC.w.l);
+ state->state_add(I8085_DE, "DE", cpustate->DE.w.l);
+ state->state_add(I8085_HL, "HL", cpustate->HL.w.l);
+ state->state_add(I8085_STATUS, "STATUS", cpustate->STATUS);
+ state->state_add(I8085_SOD, "SOD", cpustate->sod_state).mask(0x1);
+ state->state_add(I8085_SID, "SID", cpustate->ietemp).mask(0x1).callimport().callexport();
+ state->state_add(I8085_INTE, "INTE", cpustate->ietemp).mask(0x1).callimport().callexport();
+ }
- if (device->baseconfig().static_config != NULL)
- cpustate->config = *(i8085_config *)device->baseconfig().static_config;
+ if (device->baseconfig().static_config() != NULL)
+ cpustate->config = *(i8085_config *)device->baseconfig().static_config();
cpustate->cputype = type;
cpustate->irq_callback = irqcallback;
cpustate->device = device;
- cpustate->program = device->space(AS_PROGRAM);
- cpustate->io = device->space(AS_IO);
+ cpustate->program = device_memory(device)->space(AS_PROGRAM);
+ cpustate->io = device_memory(device)->space(AS_IO);
/* resolve callbacks */
devcb_resolve_write8(&cpustate->out_status_func, &cpustate->config.out_status_func, device);
@@ -1104,7 +1078,7 @@ static CPU_IMPORT_STATE( i808x )
{
i8085_state *cpustate = get_safe_token(device);
- switch (entry->index)
+ switch (entry.index())
{
case I8085_SID:
if (cpustate->ietemp)
@@ -1131,7 +1105,7 @@ static CPU_EXPORT_STATE( i808x )
{
i8085_state *cpustate = get_safe_token(device);
- switch (entry->index)
+ switch (entry.index())
{
case I8085_SID:
{
@@ -1152,6 +1126,26 @@ static CPU_EXPORT_STATE( i808x )
}
}
+static CPU_EXPORT_STRING( i808x )
+{
+ i8085_state *cpustate = get_safe_token(device);
+
+ switch (entry.index())
+ {
+ case STATE_GENFLAGS:
+ string.printf("%c%c%c%c%c%c%c%c",
+ cpustate->AF.b.l & 0x80 ? 'S':'.',
+ cpustate->AF.b.l & 0x40 ? 'Z':'.',
+ cpustate->AF.b.l & 0x20 ? 'X':'.', // X5
+ cpustate->AF.b.l & 0x10 ? 'H':'.',
+ cpustate->AF.b.l & 0x08 ? '?':'.',
+ cpustate->AF.b.l & 0x04 ? 'P':'.',
+ cpustate->AF.b.l & 0x02 ? 'V':'.',
+ cpustate->AF.b.l & 0x01 ? 'C':'.');
+ break;
+ }
+}
+
/***************************************************************************
@@ -1208,7 +1202,7 @@ static CPU_SET_INFO( i808x )
CPU_GET_INFO( i8085 )
{
- i8085_state *cpustate = (device != NULL && device->token != NULL) ? get_safe_token(device) : NULL;
+ i8085_state *cpustate = (device != NULL && downcast<cpu_device *>(device)->token() != NULL) ? get_safe_token(device) : NULL;
switch (state)
{
/* --- the following bits of info are returned as 64-bit signed integers --- */
@@ -1238,10 +1232,10 @@ CPU_GET_INFO( i8085 )
case CPUINFO_FCT_DISASSEMBLE: info->disassemble = CPU_DISASSEMBLE_NAME(i8085); break;
case CPUINFO_FCT_IMPORT_STATE: info->import_state = CPU_IMPORT_STATE_NAME(i808x); break;
case CPUINFO_FCT_EXPORT_STATE: info->export_state = CPU_EXPORT_STATE_NAME(i808x); break;
+ case CPUINFO_FCT_EXPORT_STRING: info->export_string = CPU_EXPORT_STRING_NAME(i808x); break;
/* --- the following bits of info are returned as pointers --- */
case CPUINFO_PTR_INSTRUCTION_COUNTER: info->icount = &cpustate->icount; break;
- case CPUINFO_PTR_STATE_TABLE: info->state_table = &cpustate->state; break;
/* --- the following bits of info are returned as NULL-terminated strings --- */
case DEVINFO_STR_NAME: strcpy(info->s, "8085A"); break;
@@ -1249,17 +1243,6 @@ CPU_GET_INFO( i8085 )
case DEVINFO_STR_VERSION: strcpy(info->s, "1.1"); break;
case DEVINFO_STR_SOURCE_FILE: strcpy(info->s, __FILE__); break;
case DEVINFO_STR_CREDITS: strcpy(info->s, "Copyright Juergen Buchmueller, all rights reserved."); break;
-
- case CPUINFO_STR_FLAGS:
- sprintf(info->s, "%c%c%c%c%c%c%c%c",
- cpustate->AF.b.l & 0x80 ? 'S':'.',
- cpustate->AF.b.l & 0x40 ? 'Z':'.',
- cpustate->AF.b.l & 0x20 ? 'X':'.', // X5
- cpustate->AF.b.l & 0x10 ? 'H':'.',
- cpustate->AF.b.l & 0x08 ? '?':'.',
- cpustate->AF.b.l & 0x04 ? 'P':'.',
- cpustate->AF.b.l & 0x02 ? 'V':'.',
- cpustate->AF.b.l & 0x01 ? 'C':'.');
break;
}
}
diff --git a/src/emu/cpu/i8085/i8085.h b/src/emu/cpu/i8085/i8085.h
index e975b145ba8..0c18f6a67e6 100644
--- a/src/emu/cpu/i8085/i8085.h
+++ b/src/emu/cpu/i8085/i8085.h
@@ -13,9 +13,9 @@ enum
I8085_STATUS, I8085_SOD, I8085_SID, I8085_INTE,
I8085_HALT, I8085_IM,
- I8085_GENPC = REG_GENPC,
- I8085_GENSP = REG_GENSP,
- I8085_GENPCBASE = REG_GENPCBASE
+ I8085_GENPC = STATE_GENPC,
+ I8085_GENSP = STATE_GENSP,
+ I8085_GENPCBASE = STATE_GENPCBASE
};
#define I8085_INTR_LINE 0
diff --git a/src/emu/cpu/i86/i286.c b/src/emu/cpu/i86/i286.c
index 540a6b91b9a..0ff4ed2593b 100644
--- a/src/emu/cpu/i86/i286.c
+++ b/src/emu/cpu/i86/i286.c
@@ -57,7 +57,7 @@ struct _i80286_state
UINT16 limit;
UINT8 rights;
} ldtr, tr;
- cpu_irq_callback irq_callback;
+ device_irq_callback irq_callback;
running_device *device;
const address_space *program;
const address_space *io;
@@ -84,10 +84,9 @@ struct _i80286_state
INLINE i80286_state *get_safe_token(running_device *device)
{
assert(device != NULL);
- assert(device->token != NULL);
- assert(device->type == CPU);
+ assert(device->type() == CPU);
assert(cpu_get_type(device) == CPU_I80286);
- return (i80286_state *)device->token;
+ return (i80286_state *)downcast<cpu_device *>(device)->token();
}
#define INT_IRQ 0x01
@@ -294,12 +293,12 @@ static CPU_INIT( i80286 )
cpustate->irq_callback = irqcallback;
cpustate->device = device;
- cpustate->program = device->space(AS_PROGRAM);
- cpustate->io = device->space(AS_IO);
+ cpustate->program = device_memory(device)->space(AS_PROGRAM);
+ cpustate->io = device_memory(device)->space(AS_IO);
/* If a reset parameter is given, take it as pointer to an address mask */
- if( device->baseconfig().static_config )
- cpustate->amask = *(unsigned*)device->baseconfig().static_config;
+ if( device->baseconfig().static_config() )
+ cpustate->amask = *(unsigned*)device->baseconfig().static_config();
else
cpustate->amask = 0x00ffff;
@@ -389,7 +388,7 @@ static CPU_SET_INFO( i80286 )
CPU_GET_INFO( i80286 )
{
- i80286_state *cpustate = (device != NULL && device->token != NULL) ? get_safe_token(device) : NULL;
+ i80286_state *cpustate = (device != NULL && downcast<cpu_device *>(device)->token() != NULL) ? get_safe_token(device) : NULL;
switch (state)
{
diff --git a/src/emu/cpu/i86/i86.c b/src/emu/cpu/i86/i86.c
index 331f093c50b..08fc3b90986 100644
--- a/src/emu/cpu/i86/i86.c
+++ b/src/emu/cpu/i86/i86.c
@@ -40,7 +40,7 @@ struct _i8086_state
UINT32 base[4];
UINT16 sregs[4];
UINT16 flags;
- cpu_irq_callback irq_callback;
+ device_irq_callback irq_callback;
INT32 AuxVal, OverVal, SignVal, ZeroVal, CarryVal, DirVal; /* 0 or non-0 valued flags */
UINT8 ParityVal;
UINT8 TF, IF; /* 0 or 1 valued flags */
@@ -63,7 +63,6 @@ struct _i8086_state
const address_space *program;
const address_space *io;
int icount;
- cpu_state_table state;
unsigned prefix_base; /* base address of the latest prefix segment */
char seg_prefix; /* prefix segment indicator */
@@ -74,64 +73,14 @@ struct _i8086_state
INLINE i8086_state *get_safe_token(running_device *device)
{
assert(device != NULL);
- assert(device->token != NULL);
- assert(device->type == CPU);
+ 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);
- return (i8086_state *)device->token;
+ return (i8086_state *)downcast<cpu_device *>(device)->token();
}
-/***************************************************************************
- CPU STATE DESCRIPTION
-***************************************************************************/
-
-#define I86_STATE_ENTRY(_name, _format, _member, _datamask, _flags) \
- CPU_STATE_ENTRY(I8086_##_name, #_name, _format, i8086_state, _member, _datamask, ~0, _flags)
-
-static const cpu_state_entry state_array[] =
-{
- I86_STATE_ENTRY(GENPC, "%9s", pc, 0xfffff, CPUSTATE_IMPORT)
- I86_STATE_ENTRY(GENPCBASE, "%08X", pc, 0xfffff, CPUSTATE_NOSHOW) /* not implemented */
- I86_STATE_ENTRY(IP, "%04X", ip, 0xffff, CPUSTATE_IMPORT | CPUSTATE_EXPORT)
-
- I86_STATE_ENTRY(FLAGS, "%04X", flags, 0xffff, CPUSTATE_NOSHOW | CPUSTATE_IMPORT | CPUSTATE_EXPORT)
-
- I86_STATE_ENTRY(AX, "%04X", regs.w[AX], 0xffff, 0)
- I86_STATE_ENTRY(BX, "%04X", regs.w[BX], 0xffff, 0)
- I86_STATE_ENTRY(CX, "%04X", regs.w[CX], 0xffff, 0)
- I86_STATE_ENTRY(DX, "%04X", regs.w[DX], 0xffff, 0)
- I86_STATE_ENTRY(SI, "%04X", regs.w[SI], 0xffff, 0)
- I86_STATE_ENTRY(DI, "%04X", regs.w[DI], 0xffff, 0)
- I86_STATE_ENTRY(BP, "%04X", regs.w[BP], 0xffff, 0)
- I86_STATE_ENTRY(SP, "%04X", regs.w[SP], 0xffff, 0)
- I86_STATE_ENTRY(GENSP, "%9s", sp, 0xfffff, CPUSTATE_IMPORT | CPUSTATE_EXPORT)
-
- I86_STATE_ENTRY(AL, "%02X", regs.b[AL], 0xff, CPUSTATE_NOSHOW)
- I86_STATE_ENTRY(BL, "%02X", regs.b[BL], 0xff, CPUSTATE_NOSHOW)
- I86_STATE_ENTRY(CL, "%02X", regs.b[CL], 0xff, CPUSTATE_NOSHOW)
- I86_STATE_ENTRY(DL, "%02X", regs.b[DL], 0xff, CPUSTATE_NOSHOW)
- I86_STATE_ENTRY(AH, "%02X", regs.b[AH], 0xff, CPUSTATE_NOSHOW)
- I86_STATE_ENTRY(BH, "%02X", regs.b[BH], 0xff, CPUSTATE_NOSHOW)
- I86_STATE_ENTRY(CH, "%02X", regs.b[CH], 0xff, CPUSTATE_NOSHOW)
- I86_STATE_ENTRY(DH, "%02X", regs.b[DH], 0xff, CPUSTATE_NOSHOW)
-
- I86_STATE_ENTRY(CS, "%04X", sregs[CS], 0xffff, CPUSTATE_IMPORT)
- I86_STATE_ENTRY(DS, "%04X", sregs[DS], 0xffff, CPUSTATE_IMPORT)
- I86_STATE_ENTRY(ES, "%04X", sregs[ES], 0xffff, CPUSTATE_IMPORT)
- I86_STATE_ENTRY(SS, "%04X", sregs[SS], 0xffff, CPUSTATE_IMPORT)
-};
-
-static const cpu_state_table state_table_template =
-{
- NULL, /* pointer to the base of state (offsets are relative to this) */
- 0, /* subtype this table refers to */
- ARRAY_LENGTH(state_array), /* number of entries */
- state_array /* array of entries */
-};
-
-
#include "i86time.c"
@@ -218,13 +167,39 @@ static CPU_INIT( i8086 )
cpustate->irq_callback = irqcallback;
cpustate->device = device;
- cpustate->program = device->space(AS_PROGRAM);
- cpustate->io = device->space(AS_IO);
+ cpustate->program = device_memory(device)->space(AS_PROGRAM);
+ cpustate->io = device_memory(device)->space(AS_IO);
/* set up the state table */
- cpustate->state = state_table_template;
- cpustate->state.baseptr = cpustate;
- cpustate->state.subtypemask = 1;
+ {
+ device_state_interface *state;
+ device->interface(state);
+ state->state_add(STATE_GENPC, "GENPC", cpustate->pc).mask(0xfffff).formatstr("%9s").callimport();
+ state->state_add(I8086_IP, "IP", cpustate->ip).callimport().callexport();
+ state->state_add(I8086_FLAGS, "FLAGS", cpustate->flags).callimport().callexport().noshow();
+ state->state_add(STATE_GENFLAGS, "GENFLAGS", cpustate->flags).callimport().callexport().noshow().formatstr("%16s");
+ state->state_add(I8086_AX, "AX", cpustate->regs.w[AX]);
+ state->state_add(I8086_BX, "BX", cpustate->regs.w[BX]);
+ state->state_add(I8086_CX, "CX", cpustate->regs.w[CX]);
+ state->state_add(I8086_DX, "DX", cpustate->regs.w[DX]);
+ state->state_add(I8086_SI, "SI", cpustate->regs.w[SI]);
+ state->state_add(I8086_DI, "DI", cpustate->regs.w[DI]);
+ state->state_add(I8086_BP, "BP", cpustate->regs.w[BP]);
+ state->state_add(I8086_SP, "SP", cpustate->regs.w[SP]);
+ state->state_add(STATE_GENSP, "GENSP", cpustate->sp).mask(0xfffff).formatstr("%9s").callimport().callexport();
+ state->state_add(I8086_AL, "AL", cpustate->regs.b[AL]).noshow();
+ state->state_add(I8086_BL, "BL", cpustate->regs.b[BL]).noshow();
+ state->state_add(I8086_CL, "CL", cpustate->regs.b[CL]).noshow();
+ state->state_add(I8086_DL, "DL", cpustate->regs.b[DL]).noshow();
+ state->state_add(I8086_AH, "AH", cpustate->regs.b[AH]).noshow();
+ state->state_add(I8086_BH, "BH", cpustate->regs.b[BH]).noshow();
+ state->state_add(I8086_CH, "CH", cpustate->regs.b[CH]).noshow();
+ state->state_add(I8086_DH, "DH", cpustate->regs.b[DH]).noshow();
+ state->state_add(I8086_CS, "CS", cpustate->sregs[CS]).callimport();
+ state->state_add(I8086_DS, "DS", cpustate->sregs[DS]).callimport();
+ state->state_add(I8086_ES, "ES", cpustate->sregs[ES]).callimport();
+ state->state_add(I8086_SS, "SS", cpustate->sregs[SS]).callimport();
+ }
i8086_state_register(device);
configure_memory_16bit(cpustate);
@@ -240,20 +215,17 @@ static CPU_INIT( i8088 )
static CPU_RESET( i8086 )
{
i8086_state *cpustate = get_safe_token(device);
- cpu_irq_callback save_irqcallback;
+ device_irq_callback save_irqcallback;
memory_interface save_mem;
- cpu_state_table save_state;
save_irqcallback = cpustate->irq_callback;
save_mem = cpustate->mem;
- save_state = cpustate->state;
memset(cpustate, 0, sizeof(*cpustate));
cpustate->irq_callback = save_irqcallback;
cpustate->mem = save_mem;
- cpustate->state = save_state;
cpustate->device = device;
- cpustate->program = device->space(AS_PROGRAM);
- cpustate->io = device->space(AS_IO);
+ cpustate->program = device_memory(device)->space(AS_PROGRAM);
+ cpustate->io = device_memory(device)->space(AS_IO);
cpustate->sregs[CS] = 0xf000;
cpustate->base[CS] = SegBase(CS);
@@ -407,7 +379,7 @@ static CPU_IMPORT_STATE( i8086 )
{
i8086_state *cpustate = get_safe_token(device);
- switch (entry->index)
+ switch (entry.index())
{
case I8086_GENPC:
if (cpustate->pc - cpustate->base[CS] >= 0x10000)
@@ -431,6 +403,7 @@ static CPU_IMPORT_STATE( i8086 )
break;
case I8086_FLAGS:
+ case STATE_GENFLAGS:
ExpandFlags(cpustate->flags);
break;
@@ -461,13 +434,14 @@ static CPU_EXPORT_STATE( i8086 )
{
i8086_state *cpustate = get_safe_token(device);
- switch (entry->index)
+ switch (entry.index())
{
case I8086_IP:
cpustate->ip = cpustate->pc - cpustate->base[CS];
break;
case I8086_FLAGS:
+ case STATE_GENFLAGS:
cpustate->flags = CompressFlags();
break;
@@ -486,14 +460,35 @@ static CPU_EXPORT_STRING( i8086 )
{
i8086_state *cpustate = get_safe_token(device);
- switch (entry->index)
+ switch (entry.index())
{
case I8086_GENPC:
- sprintf(string, "%04X:%04X", cpustate->sregs[CS] & 0xffff, (cpustate->pc - cpustate->base[CS]) & 0xffff);
+ string.printf("%04X:%04X", cpustate->sregs[CS] & 0xffff, (cpustate->pc - cpustate->base[CS]) & 0xffff);
break;
case I8086_GENSP:
- sprintf(string, "%04X:%04X", cpustate->sregs[SS] & 0xffff, cpustate->regs.w[SP] & 0xffff);
+ string.printf("%04X:%04X", cpustate->sregs[SS] & 0xffff, cpustate->regs.w[SP] & 0xffff);
+ break;
+
+ case STATE_GENFLAGS:
+ cpustate->flags = CompressFlags();
+ string.printf("%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c",
+ cpustate->flags & 0x8000 ? '?' : '.',
+ cpustate->flags & 0x4000 ? '?' : '.',
+ cpustate->flags & 0x2000 ? '?' : '.',
+ cpustate->flags & 0x1000 ? '?' : '.',
+ cpustate->flags & 0x0800 ? 'O' : '.',
+ cpustate->flags & 0x0400 ? 'D' : '.',
+ cpustate->flags & 0x0200 ? 'I' : '.',
+ cpustate->flags & 0x0100 ? 'T' : '.',
+ cpustate->flags & 0x0080 ? 'S' : '.',
+ cpustate->flags & 0x0040 ? 'Z' : '.',
+ cpustate->flags & 0x0020 ? '?' : '.',
+ cpustate->flags & 0x0010 ? 'A' : '.',
+ cpustate->flags & 0x0008 ? '?' : '.',
+ cpustate->flags & 0x0004 ? 'P' : '.',
+ cpustate->flags & 0x0002 ? 'N' : '.',
+ cpustate->flags & 0x0001 ? 'C' : '.');
break;
default:
@@ -528,7 +523,7 @@ static CPU_SET_INFO( i8086 )
CPU_GET_INFO( i8086 )
{
- i8086_state *cpustate = (device != NULL && device->token != NULL) ? get_safe_token(device) : NULL;
+ i8086_state *cpustate = (device != NULL && downcast<cpu_device *>(device)->token() != NULL) ? get_safe_token(device) : NULL;
switch (state)
{
@@ -570,7 +565,6 @@ CPU_GET_INFO( i8086 )
case CPUINFO_FCT_BURN: info->burn = NULL; break;
case CPUINFO_FCT_DISASSEMBLE: info->disassemble = CPU_DISASSEMBLE_NAME(i8086); break;
case CPUINFO_PTR_INSTRUCTION_COUNTER: info->icount = &cpustate->icount; break;
- case CPUINFO_PTR_STATE_TABLE: info->state_table = &cpustate->state; break;
case CPUINFO_FCT_IMPORT_STATE: info->import_state = CPU_IMPORT_STATE_NAME(i8086); break;
case CPUINFO_FCT_EXPORT_STATE: info->export_state = CPU_EXPORT_STATE_NAME(i8086); break;
case CPUINFO_FCT_EXPORT_STRING: info->export_string = CPU_EXPORT_STRING_NAME(i8086);break;
@@ -581,27 +575,6 @@ CPU_GET_INFO( i8086 )
case DEVINFO_STR_VERSION: strcpy(info->s, "1.4"); break;
case DEVINFO_STR_SOURCE_FILE: strcpy(info->s, __FILE__); break;
case DEVINFO_STR_CREDITS: strcpy(info->s, "Real mode i286 emulator v1.4 by Fabrice Frances\n(initial work cpustate->based on David Hedley's pcemu)"); break;
-
- case CPUINFO_STR_FLAGS:
- cpustate->flags = CompressFlags();
- sprintf(info->s, "%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c",
- cpustate->flags & 0x8000 ? '?' : '.',
- cpustate->flags & 0x4000 ? '?' : '.',
- cpustate->flags & 0x2000 ? '?' : '.',
- cpustate->flags & 0x1000 ? '?' : '.',
- cpustate->flags & 0x0800 ? 'O' : '.',
- cpustate->flags & 0x0400 ? 'D' : '.',
- cpustate->flags & 0x0200 ? 'I' : '.',
- cpustate->flags & 0x0100 ? 'T' : '.',
- cpustate->flags & 0x0080 ? 'S' : '.',
- cpustate->flags & 0x0040 ? 'Z' : '.',
- cpustate->flags & 0x0020 ? '?' : '.',
- cpustate->flags & 0x0010 ? 'A' : '.',
- cpustate->flags & 0x0008 ? '?' : '.',
- cpustate->flags & 0x0004 ? 'P' : '.',
- cpustate->flags & 0x0002 ? 'N' : '.',
- cpustate->flags & 0x0001 ? 'C' : '.');
- break;
}
}
diff --git a/src/emu/cpu/i86/i86.h b/src/emu/cpu/i86/i86.h
index 4b7ac5a6834..358cc3723f5 100644
--- a/src/emu/cpu/i86/i86.h
+++ b/src/emu/cpu/i86/i86.h
@@ -33,9 +33,9 @@ enum
I8086_DS,
I8086_VECTOR,
- I8086_GENPC = REG_GENPC,
- I8086_GENSP = REG_GENSP,
- I8086_GENPCBASE = REG_GENPCBASE
+ I8086_GENPC = STATE_GENPC,
+ I8086_GENSP = STATE_GENSP,
+ I8086_GENPCBASE = STATE_GENPCBASE
};
/* Public functions */
diff --git a/src/emu/cpu/i860/i860.c b/src/emu/cpu/i860/i860.c
index 7cd02812f59..75e0f475850 100644
--- a/src/emu/cpu/i860/i860.c
+++ b/src/emu/cpu/i860/i860.c
@@ -30,7 +30,7 @@ static CPU_INIT( i860 )
{
i860_state_t *cpustate = get_safe_token(device);
cpustate->device = device;
- cpustate->program = device->space(AS_PROGRAM);
+ cpustate->program = device_memory(device)->space(AS_PROGRAM);
reset_i860(cpustate);
i860_set_pin(device, DEC_PIN_BUS_HOLD, 0);
i860_set_pin(device, DEC_PIN_RESET, 0);
@@ -176,7 +176,7 @@ static CPU_SET_INFO( i860 )
CPU_GET_INFO( i860 )
{
- i860_state_t *cpustate = (device != NULL && device->token != NULL) ? get_safe_token(device) : NULL;
+ i860_state_t *cpustate = (device != NULL && downcast<cpu_device *>(device)->token() != NULL) ? get_safe_token(device) : NULL;
switch (state)
{
diff --git a/src/emu/cpu/i860/i860.h b/src/emu/cpu/i860/i860.h
index 0a322a974c3..f9149a6d99e 100644
--- a/src/emu/cpu/i860/i860.h
+++ b/src/emu/cpu/i860/i860.h
@@ -179,10 +179,9 @@ typedef struct {
INLINE i860_state_t *get_safe_token(running_device *device)
{
assert(device != NULL);
- assert(device->token != NULL);
- assert(device->type == CPU);
+ assert(device->type() == CPU);
assert(cpu_get_type(device) == CPU_I860);
- return (i860_state_t *)device->token;
+ return (i860_state_t *)downcast<cpu_device *>(device)->token();
}
diff --git a/src/emu/cpu/i960/i960.c b/src/emu/cpu/i960/i960.c
index 4e3ed211672..43878fe6535 100644
--- a/src/emu/cpu/i960/i960.c
+++ b/src/emu/cpu/i960/i960.c
@@ -33,7 +33,7 @@ struct _i960_state_t {
int immediate_irq, immediate_vector, immediate_pri;
- cpu_irq_callback irq_cb;
+ device_irq_callback irq_cb;
running_device *device;
const address_space *program;
@@ -43,10 +43,9 @@ struct _i960_state_t {
INLINE i960_state_t *get_safe_token(running_device *device)
{
assert(device != NULL);
- assert(device->token != NULL);
- assert(device->type == CPU);
+ assert(device->type() == CPU);
assert(cpu_get_type(device) == CPU_I960);
- return (i960_state_t *)device->token;
+ return (i960_state_t *)downcast<cpu_device *>(device)->token();
}
static void do_call(i960_state_t *i960, UINT32 adr, int type, UINT32 stack);
@@ -2071,7 +2070,7 @@ static CPU_INIT( i960 )
i960->irq_cb = irqcallback;
i960->device = device;
- i960->program = device->space(AS_PROGRAM);
+ i960->program = device_memory(device)->space(AS_PROGRAM);
state_save_register_device_item(device, 0, i960->PIP);
state_save_register_device_item(device, 0, i960->SAT);
@@ -2108,7 +2107,7 @@ static CPU_RESET( i960 )
CPU_GET_INFO( i960 )
{
- i960_state_t *i960 = (device != NULL && device->token != NULL) ? get_safe_token(device) : NULL;
+ i960_state_t *i960 = (device != NULL && downcast<cpu_device *>(device)->token() != NULL) ? get_safe_token(device) : NULL;
if(state >= CPUINFO_INT_REGISTER+I960_R0 && state <= CPUINFO_INT_REGISTER + I960_G15) {
info->i = i960->r[state - (CPUINFO_INT_REGISTER + I960_R0)];
diff --git a/src/emu/cpu/jaguar/jaguar.c b/src/emu/cpu/jaguar/jaguar.c
index 81926a57253..874642ed0c9 100644
--- a/src/emu/cpu/jaguar/jaguar.c
+++ b/src/emu/cpu/jaguar/jaguar.c
@@ -98,7 +98,7 @@ struct _jaguar_state
int icount;
int bankswitch_icount;
void (*const *table)(jaguar_state *jaguar, UINT16 op);
- cpu_irq_callback irq_callback;
+ device_irq_callback irq_callback;
jaguar_int_func cpu_interrupt;
running_device *device;
const address_space *program;
@@ -251,11 +251,10 @@ 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->token != NULL);
- assert(device->type == CPU);
+ assert(device->type() == CPU);
assert(cpu_get_type(device) == CPU_JAGUARGPU ||
cpu_get_type(device) == CPU_JAGUARDSP);
- return (jaguar_state *)device->token;
+ return (jaguar_state *)downcast<cpu_device *>(device)->token();
}
INLINE void update_register_banks(jaguar_state *jaguar)
@@ -410,9 +409,9 @@ static STATE_POSTLOAD( jaguar_postload )
}
-static void init_common(int isdsp, running_device *device, cpu_irq_callback irqcallback)
+static void init_common(int isdsp, running_device *device, device_irq_callback irqcallback)
{
- const jaguar_cpu_config *configdata = (const jaguar_cpu_config *)device->baseconfig().static_config;
+ const jaguar_cpu_config *configdata = (const jaguar_cpu_config *)device->baseconfig().static_config();
jaguar_state *jaguar = get_safe_token(device);
init_tables();
@@ -422,7 +421,7 @@ static void init_common(int isdsp, running_device *device, cpu_irq_callback irqc
jaguar->irq_callback = irqcallback;
jaguar->device = device;
- jaguar->program = device->space(AS_PROGRAM);
+ jaguar->program = device_memory(device)->space(AS_PROGRAM);
if (configdata != NULL)
jaguar->cpu_interrupt = configdata->cpu_int_callback;
@@ -1496,7 +1495,7 @@ static CPU_SET_INFO( jaguargpu )
CPU_GET_INFO( jaguargpu )
{
- jaguar_state *jaguar = (device != NULL && device->token != NULL) ? get_safe_token(device) : NULL;
+ jaguar_state *jaguar = (device != NULL && downcast<cpu_device *>(device)->token() != NULL) ? get_safe_token(device) : NULL;
switch (state)
{
/* --- the following bits of info are returned as 64-bit signed integers --- */
@@ -1649,7 +1648,7 @@ static CPU_SET_INFO( jaguardsp )
CPU_GET_INFO( jaguardsp )
{
- jaguar_state *jaguar = (device != NULL && device->token != NULL) ? get_safe_token(device) : NULL;
+ jaguar_state *jaguar = (device != NULL && downcast<cpu_device *>(device)->token() != NULL) ? get_safe_token(device) : NULL;
switch (state)
{
/* --- the following bits of info are returned as 64-bit signed integers --- */
diff --git a/src/emu/cpu/konami/konami.c b/src/emu/cpu/konami/konami.c
index eb2bb8c4d02..cabd2a9f52b 100644
--- a/src/emu/cpu/konami/konami.c
+++ b/src/emu/cpu/konami/konami.c
@@ -56,7 +56,7 @@ struct _konami_state
UINT8 cc;
UINT8 ireg;
UINT8 irq_state[2];
- cpu_irq_callback irq_callback;
+ device_irq_callback irq_callback;
UINT8 int_state; /* SYNC and CWAI flags */
UINT8 nmi_state;
UINT8 nmi_pending;
@@ -69,10 +69,9 @@ struct _konami_state
INLINE konami_state *get_safe_token(running_device *device)
{
assert(device != NULL);
- assert(device->token != NULL);
- assert(device->type == CPU);
+ assert(device->type() == CPU);
assert(cpu_get_type(device) == CPU_KONAMI);
- return (konami_state *)device->token;
+ return (konami_state *)downcast<cpu_device *>(device)->token();
}
/* flag bits in the cc register */
@@ -405,7 +404,7 @@ static CPU_INIT( konami )
cpustate->irq_callback = irqcallback;
cpustate->device = device;
- cpustate->program = device->space(AS_PROGRAM);
+ cpustate->program = device_memory(device)->space(AS_PROGRAM);
state_save_register_device_item(device, 0, PC);
state_save_register_device_item(device, 0, U);
@@ -548,7 +547,7 @@ static CPU_SET_INFO( konami )
CPU_GET_INFO( konami )
{
- konami_state *cpustate = (device != NULL && device->token != NULL) ? get_safe_token(device) : NULL;
+ konami_state *cpustate = (device != NULL && downcast<cpu_device *>(device)->token() != NULL) ? get_safe_token(device) : NULL;
switch (state)
{
/* --- the following bits of info are returned as 64-bit signed integers --- */
diff --git a/src/emu/cpu/lh5801/lh5801.c b/src/emu/cpu/lh5801/lh5801.c
index 012c714c9d7..0d8385d9b53 100644
--- a/src/emu/cpu/lh5801/lh5801.c
+++ b/src/emu/cpu/lh5801/lh5801.c
@@ -71,10 +71,9 @@ struct _lh5810_state
INLINE lh5801_state *get_safe_token(running_device *device)
{
assert(device != NULL);
- assert(device->token != NULL);
- assert(device->type == CPU);
+ assert(device->type() == CPU);
assert(cpu_get_type(device) == CPU_LH5801);
- return (lh5801_state *)device->token;
+ return (lh5801_state *)downcast<cpu_device *>(device)->token();
}
#define P cpustate->p.w.l
@@ -105,9 +104,9 @@ static CPU_INIT( lh5801 )
lh5801_state *cpustate = get_safe_token(device);
memset(cpustate, 0, sizeof(*cpustate));
- cpustate->config = (const lh5801_cpu_core *) device->baseconfig().static_config;
+ cpustate->config = (const lh5801_cpu_core *) device->baseconfig().static_config();
cpustate->device = device;
- cpustate->program = device->space(AS_PROGRAM);
+ cpustate->program = device_memory(device)->space(AS_PROGRAM);
}
static CPU_RESET( lh5801 )
@@ -184,7 +183,7 @@ static CPU_SET_INFO( lh5801 )
CPU_GET_INFO( lh5801 )
{
- lh5801_state *cpustate = (device != NULL && device->token != NULL) ? get_safe_token(device) : NULL;
+ lh5801_state *cpustate = (device != NULL && downcast<cpu_device *>(device)->token() != NULL) ? get_safe_token(device) : NULL;
switch (state)
{
diff --git a/src/emu/cpu/lr35902/lr35902.c b/src/emu/cpu/lr35902/lr35902.c
index 50f30fa0028..90250e91507 100644
--- a/src/emu/cpu/lr35902/lr35902.c
+++ b/src/emu/cpu/lr35902/lr35902.c
@@ -64,7 +64,7 @@ typedef struct {
UINT8 IF;
int irq_state;
int ei_delay;
- cpu_irq_callback irq_callback;
+ device_irq_callback irq_callback;
running_device *device;
const address_space *program;
int icount;
@@ -116,10 +116,9 @@ union _lr35902_state {
INLINE lr35902_state *get_safe_token(running_device *device)
{
assert(device != NULL);
- assert(device->token != NULL);
- assert(device->type == CPU);
+ assert(device->type() == CPU);
assert(cpu_get_type(device) == CPU_LR35902);
- return (lr35902_state *)device->token;
+ return (lr35902_state *)downcast<cpu_device *>(device)->token();
}
typedef int (*OpcodeEmulator) (lr35902_state *cpustate);
@@ -191,10 +190,10 @@ static CPU_INIT( lr35902 )
{
lr35902_state *cpustate = get_safe_token(device);
- cpustate->w.config = (const lr35902_cpu_core *) device->baseconfig().static_config;
+ cpustate->w.config = (const lr35902_cpu_core *) device->baseconfig().static_config();
cpustate->w.irq_callback = irqcallback;
cpustate->w.device = device;
- cpustate->w.program = device->space(AS_PROGRAM);
+ cpustate->w.program = device_memory(device)->space(AS_PROGRAM);
}
/*** Reset lr353902 registers: ******************************/
@@ -411,7 +410,7 @@ static CPU_SET_INFO( lr35902 )
CPU_GET_INFO( lr35902 )
{
- lr35902_state *cpustate = (device != NULL && device->token != NULL) ? get_safe_token(device) : NULL;
+ lr35902_state *cpustate = (device != NULL && downcast<cpu_device *>(device)->token() != NULL) ? get_safe_token(device) : NULL;
switch (state)
{
diff --git a/src/emu/cpu/m37710/m37710.c b/src/emu/cpu/m37710/m37710.c
index 3dd3b5150af..3fc6d67c7dd 100644
--- a/src/emu/cpu/m37710/m37710.c
+++ b/src/emu/cpu/m37710/m37710.c
@@ -527,7 +527,7 @@ static void m37710_internal_w(m37710i_cpu_struct *cpustate, int offset, UINT8 da
static READ16_HANDLER( m37710_internal_word_r )
{
- m37710i_cpu_struct *cpustate = (m37710i_cpu_struct *)space->cpu->token;
+ m37710i_cpu_struct *cpustate = get_safe_token(space->cpu);
if (mem_mask == 0xffff)
{
@@ -547,7 +547,7 @@ static READ16_HANDLER( m37710_internal_word_r )
static WRITE16_HANDLER( m37710_internal_word_w )
{
- m37710i_cpu_struct *cpustate = (m37710i_cpu_struct *)space->cpu->token;
+ m37710i_cpu_struct *cpustate = get_safe_token(space->cpu);
if (mem_mask == 0xffff)
{
@@ -860,7 +860,7 @@ static void m37710_set_irq_line(m37710i_cpu_struct *cpustate, int line, int stat
/* Set the callback that is called when servicing an interrupt */
#ifdef UNUSED_FUNCTION
-void m37710_set_irq_callback(cpu_irq_callback callback)
+void m37710_set_irq_callback(device_irq_callback callback)
{
INT_ACK = callback;
}
@@ -896,8 +896,8 @@ static CPU_INIT( m37710 )
INT_ACK = irqcallback;
cpustate->device = device;
- cpustate->program = device->space(AS_PROGRAM);
- cpustate->io = device->space(AS_IO);
+ cpustate->program = device_memory(device)->space(AS_PROGRAM);
+ cpustate->io = device_memory(device)->space(AS_IO);
cpustate->ICount = 0;
@@ -1014,7 +1014,7 @@ ADDRESS_MAP_END
CPU_GET_INFO( m37710 )
{
- m37710i_cpu_struct *cpustate = (device != NULL && device->token != NULL) ? get_safe_token(device) : NULL;
+ m37710i_cpu_struct *cpustate = (device != NULL && downcast<cpu_device *>(device)->token() != NULL) ? get_safe_token(device) : NULL;
switch (state)
{
diff --git a/src/emu/cpu/m37710/m37710cm.h b/src/emu/cpu/m37710/m37710cm.h
index 3a3a0f033fa..95b4631bf6a 100644
--- a/src/emu/cpu/m37710/m37710cm.h
+++ b/src/emu/cpu/m37710/m37710cm.h
@@ -108,7 +108,7 @@ struct _m37710i_cpu_struct
int ICount; /* cycle count */
uint source; /* temp register */
uint destination; /* temp register */
- cpu_irq_callback int_ack;
+ device_irq_callback int_ack;
running_device *device;
const address_space *program;
const address_space *io;
@@ -130,11 +130,10 @@ struct _m37710i_cpu_struct
INLINE m37710i_cpu_struct *get_safe_token(running_device *device)
{
assert(device != NULL);
- assert(device->token != NULL);
- assert(device->type == CPU);
+ assert(device->type() == CPU);
assert(cpu_get_type(device) == CPU_M37710 ||
cpu_get_type(device) == CPU_M37702);
- return (m37710i_cpu_struct *)device->token;
+ return (m37710i_cpu_struct *)downcast<cpu_device *>(device)->token();
}
extern uint m37710i_adc_tbl[];
diff --git a/src/emu/cpu/m37710/m37710op.h b/src/emu/cpu/m37710/m37710op.h
index 2155b6d37a9..1ae9cbc0b56 100644
--- a/src/emu/cpu/m37710/m37710op.h
+++ b/src/emu/cpu/m37710/m37710op.h
@@ -2905,7 +2905,7 @@ TABLE_FUNCTION(uint, get_reg, (m37710i_cpu_struct *cpustate, int regnum))
case M37710_D: return REG_D;
case M37710_P: return m37710i_get_reg_p(cpustate);
case M37710_IRQ_STATE: return LINE_IRQ;
- case REG_GENPCBASE: return REG_PPC;
+ case STATE_GENPCBASE: return REG_PPC;
}
return 0;
}
diff --git a/src/emu/cpu/m6502/m4510.c b/src/emu/cpu/m6502/m4510.c
index 6f2d7fabbcc..6a3da6e51db 100644
--- a/src/emu/cpu/m6502/m4510.c
+++ b/src/emu/cpu/m6502/m4510.c
@@ -142,7 +142,7 @@ struct _m4510_Regs {
UINT16 low, high;
UINT32 mem[8];
- cpu_irq_callback irq_callback;
+ device_irq_callback irq_callback;
running_device *device;
const address_space *space;
int icount;
@@ -159,10 +159,9 @@ struct _m4510_Regs {
INLINE m4510_Regs *get_safe_token(running_device *device)
{
assert(device != NULL);
- assert(device->token != NULL);
- assert(device->type == CPU);
+ assert(device->type() == CPU);
assert(cpu_get_type(device) == CPU_M4510);
- return (m4510_Regs *)device->token;
+ return (m4510_Regs *)downcast<cpu_device *>(device)->token();
}
/***************************************************************
@@ -198,7 +197,7 @@ static void default_wrmem_id(const address_space *space, offs_t address, UINT8 d
static CPU_INIT( m4510 )
{
m4510_Regs *cpustate = get_safe_token(device);
- const m6502_interface *intf = (const m6502_interface *)device->baseconfig().static_config;
+ const m6502_interface *intf = (const m6502_interface *)device->baseconfig().static_config();
cpustate->interrupt_inhibit = 0;
cpustate->rdmem_id = default_rdmem_id;
@@ -207,7 +206,7 @@ static CPU_INIT( m4510 )
cpustate->port_write = NULL;
cpustate->irq_callback = irqcallback;
cpustate->device = device;
- cpustate->space = device->space(AS_PROGRAM);
+ cpustate->space = device_memory(device)->space(AS_PROGRAM);
if ( intf )
{
@@ -456,7 +455,7 @@ static CPU_SET_INFO( m4510 )
CPU_GET_INFO( m4510 )
{
- m4510_Regs *cpustate = (device != NULL && device->token != NULL) ? get_safe_token(device) : NULL;
+ m4510_Regs *cpustate = (device != NULL && downcast<cpu_device *>(device)->token() != NULL) ? get_safe_token(device) : NULL;
switch (state)
{
diff --git a/src/emu/cpu/m6502/m6502.c b/src/emu/cpu/m6502/m6502.c
index 7c7796b7eaa..b28ae872fc6 100644
--- a/src/emu/cpu/m6502/m6502.c
+++ b/src/emu/cpu/m6502/m6502.c
@@ -68,7 +68,7 @@ struct _m6502_Regs
UINT8 irq_state;
UINT8 so_state;
- cpu_irq_callback irq_callback;
+ device_irq_callback irq_callback;
running_device *device;
const address_space *space;
const address_space *io;
@@ -87,8 +87,7 @@ struct _m6502_Regs
INLINE m6502_Regs *get_safe_token(running_device *device)
{
assert(device != NULL);
- assert(device->token != NULL);
- assert(device->type == CPU);
+ assert(device->type() == CPU);
assert(cpu_get_type(device) == CPU_M6502 ||
cpu_get_type(device) == CPU_M6510 ||
cpu_get_type(device) == CPU_M6510T ||
@@ -98,7 +97,7 @@ INLINE m6502_Regs *get_safe_token(running_device *device)
cpu_get_type(device) == CPU_M65C02 ||
cpu_get_type(device) == CPU_M65SC02 ||
cpu_get_type(device) == CPU_DECO16);
- return (m6502_Regs *)device->token;
+ return (m6502_Regs *)downcast<cpu_device *>(device)->token();
}
static UINT8 default_rdmem_id(const address_space *space, offs_t offset) { return memory_read_byte_8le(space, offset); }
@@ -129,14 +128,14 @@ static void default_wdmem_id(const address_space *space, offs_t offset, UINT8 da
*
*****************************************************************************/
-static void m6502_common_init(running_device *device, cpu_irq_callback irqcallback, UINT8 subtype, void (*const *insn)(m6502_Regs *cpustate), const char *type)
+static void m6502_common_init(running_device *device, device_irq_callback irqcallback, UINT8 subtype, void (*const *insn)(m6502_Regs *cpustate), const char *type)
{
m6502_Regs *cpustate = get_safe_token(device);
- const m6502_interface *intf = (const m6502_interface *)device->baseconfig().static_config;
+ const m6502_interface *intf = (const m6502_interface *)device->baseconfig().static_config();
cpustate->irq_callback = irqcallback;
cpustate->device = device;
- cpustate->space = device->space(AS_PROGRAM);
+ cpustate->space = device_memory(device)->space(AS_PROGRAM);
cpustate->subtype = subtype;
cpustate->insn = insn;
cpustate->rdmem_id = default_rdmem_id;
@@ -529,7 +528,7 @@ static CPU_INIT( deco16 )
{
m6502_Regs *cpustate = get_safe_token(device);
m6502_common_init(device, irqcallback, SUBTYPE_DECO16, insndeco16, "deco16");
- cpustate->io = device->space(AS_IO);
+ cpustate->io = device_memory(device)->space(AS_IO);
}
@@ -692,7 +691,7 @@ static CPU_SET_INFO( m6502 )
CPU_GET_INFO( m6502 )
{
- m6502_Regs *cpustate = (device != NULL && device->token != NULL) ? get_safe_token(device) : NULL;
+ m6502_Regs *cpustate = (device != NULL && downcast<cpu_device *>(device)->token() != NULL) ? get_safe_token(device) : NULL;
switch (state)
{
@@ -810,7 +809,7 @@ static CPU_SET_INFO( m6510 )
CPU_GET_INFO( m6510 )
{
- m6502_Regs *cpustate = (device != NULL && device->token != NULL) ? get_safe_token(device) : NULL;
+ m6502_Regs *cpustate = (device != NULL && downcast<cpu_device *>(device)->token() != NULL) ? get_safe_token(device) : NULL;
switch (state)
{
diff --git a/src/emu/cpu/m6502/m6509.c b/src/emu/cpu/m6502/m6509.c
index 258ea184767..0e6977ef869 100644
--- a/src/emu/cpu/m6502/m6509.c
+++ b/src/emu/cpu/m6502/m6509.c
@@ -77,7 +77,7 @@ struct _m6509_Regs {
UINT8 nmi_state;
UINT8 irq_state;
UINT8 so_state;
- cpu_irq_callback irq_callback;
+ device_irq_callback irq_callback;
running_device *device;
const address_space *space;
@@ -90,10 +90,9 @@ struct _m6509_Regs {
INLINE m6509_Regs *get_safe_token(running_device *device)
{
assert(device != NULL);
- assert(device->token != NULL);
- assert(device->type == CPU);
+ assert(device->type() == CPU);
assert(cpu_get_type(device) == CPU_M6509);
- return (m6509_Regs *)device->token;
+ return (m6509_Regs *)downcast<cpu_device *>(device)->token();
}
/***************************************************************
@@ -104,21 +103,21 @@ INLINE m6509_Regs *get_safe_token(running_device *device)
static READ8_HANDLER( m6509_read_00000 )
{
- m6509_Regs *cpustate = (m6509_Regs *)space->cpu->token;
+ m6509_Regs *cpustate = get_safe_token(space->cpu);
return cpustate->pc_bank.b.h2;
}
static READ8_HANDLER( m6509_read_00001 )
{
- m6509_Regs *cpustate = (m6509_Regs *)space->cpu->token;
+ m6509_Regs *cpustate = get_safe_token(space->cpu);
return cpustate->ind_bank.b.h2;
}
static WRITE8_HANDLER( m6509_write_00000 )
{
- m6509_Regs *cpustate = (m6509_Regs *)space->cpu->token;
+ m6509_Regs *cpustate = get_safe_token(space->cpu);
cpustate->pc_bank.b.h2=data&0xf;
cpustate->pc.w.h=cpustate->pc_bank.w.h;
@@ -126,7 +125,7 @@ static WRITE8_HANDLER( m6509_write_00000 )
static WRITE8_HANDLER( m6509_write_00001 )
{
- m6509_Regs *cpustate = (m6509_Regs *)space->cpu->token;
+ m6509_Regs *cpustate = get_safe_token(space->cpu);
cpustate->ind_bank.b.h2=data&0xf;
}
@@ -142,13 +141,13 @@ static void default_wdmem_id(const address_space *space, offs_t address, UINT8 d
static CPU_INIT( m6509 )
{
m6509_Regs *cpustate = get_safe_token(device);
- const m6502_interface *intf = (const m6502_interface *)device->baseconfig().static_config;
+ const m6502_interface *intf = (const m6502_interface *)device->baseconfig().static_config();
cpustate->rdmem_id = default_rdmem_id;
cpustate->wrmem_id = default_wdmem_id;
cpustate->irq_callback = irqcallback;
cpustate->device = device;
- cpustate->space = device->space(AS_PROGRAM);
+ cpustate->space = device_memory(device)->space(AS_PROGRAM);
if ( intf )
{
@@ -331,7 +330,7 @@ static CPU_SET_INFO( m6509 )
CPU_GET_INFO( m6509 )
{
- m6509_Regs *cpustate = (device != NULL && device->token != NULL) ? get_safe_token(device) : NULL;
+ m6509_Regs *cpustate = (device != NULL && downcast<cpu_device *>(device)->token() != NULL) ? get_safe_token(device) : NULL;
switch (state)
{
diff --git a/src/emu/cpu/m6502/m65ce02.c b/src/emu/cpu/m6502/m65ce02.c
index 14a933900a6..bdc0179ae73 100644
--- a/src/emu/cpu/m6502/m65ce02.c
+++ b/src/emu/cpu/m6502/m65ce02.c
@@ -74,7 +74,7 @@ struct _m65ce02_Regs {
UINT8 nmi_state;
UINT8 irq_state;
int icount;
- cpu_irq_callback irq_callback;
+ device_irq_callback irq_callback;
running_device *device;
const address_space *space;
read8_space_func rdmem_id; /* readmem callback for indexed instructions */
@@ -84,10 +84,9 @@ struct _m65ce02_Regs {
INLINE m65ce02_Regs *get_safe_token(running_device *device)
{
assert(device != NULL);
- assert(device->token != NULL);
- assert(device->type == CPU);
+ assert(device->type() == CPU);
assert(cpu_get_type(device) == CPU_M65CE02);
- return (m65ce02_Regs *)device->token;
+ return (m65ce02_Regs *)downcast<cpu_device *>(device)->token();
}
/***************************************************************
@@ -102,13 +101,13 @@ static void default_wdmem_id(const address_space *space, offs_t address, UINT8 d
static CPU_INIT( m65ce02 )
{
m65ce02_Regs *cpustate = get_safe_token(device);
- const m6502_interface *intf = (const m6502_interface *)device->baseconfig().static_config;
+ const m6502_interface *intf = (const m6502_interface *)device->baseconfig().static_config();
cpustate->rdmem_id = default_rdmem_id;
cpustate->wrmem_id = default_wdmem_id;
cpustate->irq_callback = irqcallback;
cpustate->device = device;
- cpustate->space = device->space(AS_PROGRAM);
+ cpustate->space = device_memory(device)->space(AS_PROGRAM);
if ( intf )
{
@@ -276,7 +275,7 @@ static CPU_SET_INFO( m65ce02 )
CPU_GET_INFO( m65ce02 )
{
- m65ce02_Regs *cpustate = (device != NULL && device->token != NULL) ? get_safe_token(device) : NULL;
+ m65ce02_Regs *cpustate = (device != NULL && downcast<cpu_device *>(device)->token() != NULL) ? get_safe_token(device) : NULL;
switch( state )
{
diff --git a/src/emu/cpu/m6800/m6800.c b/src/emu/cpu/m6800/m6800.c
index d8e1820619e..28e3664c17b 100644
--- a/src/emu/cpu/m6800/m6800.c
+++ b/src/emu/cpu/m6800/m6800.c
@@ -112,7 +112,7 @@ struct _m6800_state
UINT8 irq_state[2]; /* IRQ line state [IRQ1,TIN] */
UINT8 ic_eddge; /* InputCapture eddge , b.0=fall,b.1=raise */
- cpu_irq_callback irq_callback;
+ device_irq_callback irq_callback;
running_device *device;
/* Memory spaces */
@@ -156,8 +156,7 @@ struct _m6800_state
INLINE m6800_state *get_safe_token(running_device *device)
{
assert(device != NULL);
- assert(device->token != NULL);
- assert(device->type == CPU);
+ assert(device->type() == CPU);
assert(cpu_get_type(device) == CPU_M6800 ||
cpu_get_type(device) == CPU_M6801 ||
cpu_get_type(device) == CPU_M6802 ||
@@ -165,7 +164,7 @@ INLINE m6800_state *get_safe_token(running_device *device)
cpu_get_type(device) == CPU_M6808 ||
cpu_get_type(device) == CPU_HD63701 ||
cpu_get_type(device) == CPU_NSC8105);
- return (m6800_state *)device->token;
+ return (m6800_state *)downcast<cpu_device *>(device)->token();
}
#if 0
@@ -898,9 +897,9 @@ static CPU_INIT( m6800 )
{
m6800_state *cpustate = get_safe_token(device);
- cpustate->program = device->space(AS_PROGRAM);
- cpustate->data = device->space(AS_DATA);
- cpustate->io = device->space(AS_IO);
+ cpustate->program = device_memory(device)->space(AS_PROGRAM);
+ cpustate->data = device_memory(device)->space(AS_DATA);
+ cpustate->io = device_memory(device)->space(AS_IO);
// cpustate->subtype = SUBTYPE_M6800;
cpustate->insn = m6800_insn;
@@ -1294,11 +1293,11 @@ static CPU_INIT( m6801 )
cpustate->irq_callback = irqcallback;
cpustate->device = device;
- cpustate->program = device->space(AS_PROGRAM);
- cpustate->data = device->space(AS_DATA);
- cpustate->io = device->space(AS_IO);
+ cpustate->program = device_memory(device)->space(AS_PROGRAM);
+ cpustate->data = device_memory(device)->space(AS_DATA);
+ cpustate->io = device_memory(device)->space(AS_IO);
- cpustate->clock = device->clock / 4;
+ cpustate->clock = device->clock() / 4;
cpustate->m6800_rx_timer = timer_alloc(device->machine, m6800_rx_tick, cpustate);
cpustate->m6800_tx_timer = timer_alloc(device->machine, m6800_tx_tick, cpustate);
@@ -1317,9 +1316,9 @@ static CPU_INIT( m6802 )
cpustate->irq_callback = irqcallback;
cpustate->device = device;
- cpustate->program = device->space(AS_PROGRAM);
- cpustate->data = device->space(AS_DATA);
- cpustate->io = device->space(AS_IO);
+ cpustate->program = device_memory(device)->space(AS_PROGRAM);
+ cpustate->data = device_memory(device)->space(AS_DATA);
+ cpustate->io = device_memory(device)->space(AS_IO);
state_register(cpustate, "m6802");
}
@@ -1336,11 +1335,11 @@ static CPU_INIT( m6803 )
cpustate->irq_callback = irqcallback;
cpustate->device = device;
- cpustate->program = device->space(AS_PROGRAM);
- cpustate->data = device->space(AS_DATA);
- cpustate->io = device->space(AS_IO);
+ cpustate->program = device_memory(device)->space(AS_PROGRAM);
+ cpustate->data = device_memory(device)->space(AS_DATA);
+ cpustate->io = device_memory(device)->space(AS_IO);
- cpustate->clock = device->clock / 4;
+ cpustate->clock = device->clock() / 4;
cpustate->m6800_rx_timer = timer_alloc(device->machine, m6800_rx_tick, cpustate);
cpustate->m6800_tx_timer = timer_alloc(device->machine, m6800_tx_tick, cpustate);
@@ -1670,9 +1669,9 @@ static CPU_INIT( m6808 )
cpustate->irq_callback = irqcallback;
cpustate->device = device;
- cpustate->program = device->space(AS_PROGRAM);
- cpustate->data = device->space(AS_DATA);
- cpustate->io = device->space(AS_IO);
+ cpustate->program = device_memory(device)->space(AS_PROGRAM);
+ cpustate->data = device_memory(device)->space(AS_DATA);
+ cpustate->io = device_memory(device)->space(AS_IO);
state_register(cpustate, "m6808");
}
@@ -1690,11 +1689,11 @@ static CPU_INIT( hd63701 )
cpustate->irq_callback = irqcallback;
cpustate->device = device;
- cpustate->program = device->space(AS_PROGRAM);
- cpustate->data = device->space(AS_DATA);
- cpustate->io = device->space(AS_IO);
+ cpustate->program = device_memory(device)->space(AS_PROGRAM);
+ cpustate->data = device_memory(device)->space(AS_DATA);
+ cpustate->io = device_memory(device)->space(AS_IO);
- cpustate->clock = device->clock / 4;
+ cpustate->clock = device->clock() / 4;
cpustate->m6800_rx_timer = timer_alloc(device->machine, m6800_rx_tick, cpustate);
cpustate->m6800_tx_timer = timer_alloc(device->machine, m6800_tx_tick, cpustate);
@@ -2038,9 +2037,9 @@ static CPU_INIT( nsc8105 )
// cpustate->subtype = SUBTYPE_NSC8105;
cpustate->device = device;
- cpustate->program = device->space(AS_PROGRAM);
- cpustate->data = device->space(AS_DATA);
- cpustate->io = device->space(AS_IO);
+ cpustate->program = device_memory(device)->space(AS_PROGRAM);
+ cpustate->data = device_memory(device)->space(AS_DATA);
+ cpustate->io = device_memory(device)->space(AS_IO);
cpustate->insn = nsc8105_insn;
cpustate->cycles = cycles_nsc8105;
@@ -2672,7 +2671,7 @@ static CPU_SET_INFO( m6800 )
CPU_GET_INFO( m6800 )
{
- m6800_state *cpustate = (device != NULL && device->token != NULL) ? get_safe_token(device) : NULL;
+ m6800_state *cpustate = (device != NULL && downcast<cpu_device *>(device)->token() != NULL) ? get_safe_token(device) : NULL;
switch (state)
{
/* --- the following bits of info are returned as 64-bit signed integers --- */
diff --git a/src/emu/cpu/m68000/m68000.h b/src/emu/cpu/m68000/m68000.h
index 6edebb328a1..eb5aece8132 100644
--- a/src/emu/cpu/m68000/m68000.h
+++ b/src/emu/cpu/m68000/m68000.h
@@ -61,9 +61,9 @@ enum
M68K_FP0, M68K_FP1, M68K_FP2, M68K_FP3, M68K_FP4, M68K_FP5, M68K_FP6, M68K_FP7,
M68K_FPSR, M68K_FPCR,
- M68K_GENPC = REG_GENPC,
- M68K_GENSP = REG_GENSP,
- M68K_GENPCBASE = REG_GENPCBASE
+ M68K_GENPC = STATE_GENPC,
+ M68K_GENSP = STATE_GENSP,
+ M68K_GENPCBASE = STATE_GENPCBASE
};
typedef void (*m68k_bkpt_ack_func)(running_device *device, UINT32 data);
diff --git a/src/emu/cpu/m68000/m68kcpu.c b/src/emu/cpu/m68000/m68kcpu.c
index bc2a6c6be5d..f07eed4531f 100644
--- a/src/emu/cpu/m68000/m68kcpu.c
+++ b/src/emu/cpu/m68000/m68kcpu.c
@@ -492,82 +492,11 @@ const UINT8 m68ki_ea_idx_cycle_table[64] =
#define MASK_030_OR_LATER (CPU_TYPE_030 | CPU_TYPE_EC030 | CPU_TYPE_040 | CPU_TYPE_EC040)
#define MASK_040_OR_LATER (CPU_TYPE_040 | CPU_TYPE_EC040)
-#define M68K_STATE_ENTRY(_name, _format, _member, _datamask, _flags, _mask) \
- CPU_STATE_ENTRY(M68K_##_name, #_name, _format, m68ki_cpu_core, _member, _datamask, _mask, _flags)
-
-static const cpu_state_entry state_array[] =
-{
- M68K_STATE_ENTRY(PC, "%06X", pc, 0xffffff, 0, MASK_24BIT_SPACE)
- M68K_STATE_ENTRY(PC, "%08X", pc, 0xffffffff, 0, MASK_32BIT_SPACE)
- M68K_STATE_ENTRY(GENPC, "%06X", pc, 0xffffff, CPUSTATE_NOSHOW, MASK_24BIT_SPACE)
- M68K_STATE_ENTRY(GENPC, "%08X", pc, 0xffffffff, CPUSTATE_NOSHOW, MASK_32BIT_SPACE)
- M68K_STATE_ENTRY(GENPCBASE, "%06X", ppc, 0xffffff, CPUSTATE_NOSHOW, MASK_24BIT_SPACE)
- M68K_STATE_ENTRY(GENPCBASE, "%08X", ppc, 0xffffffff, CPUSTATE_NOSHOW, MASK_32BIT_SPACE)
-
- M68K_STATE_ENTRY(SP, "%08X", dar[15], 0xffffffff, 0, MASK_ALL)
- M68K_STATE_ENTRY(GENSP, "%08X", dar[15], 0xffffffff, CPUSTATE_NOSHOW, MASK_ALL)
-
- M68K_STATE_ENTRY(ISP, "%08X", iotemp, 0xffffffff, CPUSTATE_IMPORT | CPUSTATE_EXPORT, MASK_ALL)
- M68K_STATE_ENTRY(USP, "%08X", iotemp, 0xffffffff, CPUSTATE_IMPORT | CPUSTATE_EXPORT, MASK_ALL)
- M68K_STATE_ENTRY(MSP, "%08X", iotemp, 0xffffffff, CPUSTATE_IMPORT | CPUSTATE_EXPORT, MASK_020_OR_LATER)
- M68K_STATE_ENTRY(SR, "%04X", iotemp, 0xffff, CPUSTATE_IMPORT | CPUSTATE_EXPORT, MASK_ALL)
-
- M68K_STATE_ENTRY(D0, "%08X", dar[0], 0xffffffff, 0, MASK_ALL)
- M68K_STATE_ENTRY(D1, "%08X", dar[1], 0xffffffff, 0, MASK_ALL)
- M68K_STATE_ENTRY(D2, "%08X", dar[2], 0xffffffff, 0, MASK_ALL)
- M68K_STATE_ENTRY(D3, "%08X", dar[3], 0xffffffff, 0, MASK_ALL)
- M68K_STATE_ENTRY(D4, "%08X", dar[4], 0xffffffff, 0, MASK_ALL)
- M68K_STATE_ENTRY(D5, "%08X", dar[5], 0xffffffff, 0, MASK_ALL)
- M68K_STATE_ENTRY(D6, "%08X", dar[6], 0xffffffff, 0, MASK_ALL)
- M68K_STATE_ENTRY(D7, "%08X", dar[7], 0xffffffff, 0, MASK_ALL)
-
- M68K_STATE_ENTRY(A0, "%08X", dar[8], 0xffffffff, 0, MASK_ALL)
- M68K_STATE_ENTRY(A1, "%08X", dar[9], 0xffffffff, 0, MASK_ALL)
- M68K_STATE_ENTRY(A2, "%08X", dar[10], 0xffffffff, 0, MASK_ALL)
- M68K_STATE_ENTRY(A3, "%08X", dar[11], 0xffffffff, 0, MASK_ALL)
- M68K_STATE_ENTRY(A4, "%08X", dar[12], 0xffffffff, 0, MASK_ALL)
- M68K_STATE_ENTRY(A5, "%08X", dar[13], 0xffffffff, 0, MASK_ALL)
- M68K_STATE_ENTRY(A6, "%08X", dar[14], 0xffffffff, 0, MASK_ALL)
- M68K_STATE_ENTRY(A7, "%08X", dar[15], 0xffffffff, 0, MASK_ALL)
-
- M68K_STATE_ENTRY(PREF_ADDR, "%06X", pref_addr, 0xffffff, 0, MASK_24BIT_SPACE)
- M68K_STATE_ENTRY(PREF_ADDR, "%08X", pref_addr, 0xffffffff, 0, MASK_32BIT_SPACE)
- M68K_STATE_ENTRY(PREF_DATA, "%08X", pref_data, 0xffffffff, 0, MASK_ALL)
-
- M68K_STATE_ENTRY(SFC, "%01X", sfc, 0x7, 0, MASK_010_OR_LATER)
- M68K_STATE_ENTRY(DFC, "%01X", dfc, 0x7, 0, MASK_010_OR_LATER)
- M68K_STATE_ENTRY(VBR, "%08X", vbr, 0xffffffff, 0, MASK_010_OR_LATER)
-
- M68K_STATE_ENTRY(CACR, "%08X", cacr, 0xffffffff, 0, MASK_020_OR_LATER)
- M68K_STATE_ENTRY(CAAR, "%08X", caar, 0xffffffff, 0, MASK_020_OR_LATER)
-
- M68K_STATE_ENTRY(FP0, "%s", iotemp, 0xffffffff, CPUSTATE_EXPORT, MASK_030_OR_LATER)
- M68K_STATE_ENTRY(FP1, "%s", iotemp, 0xffffffff, CPUSTATE_EXPORT, MASK_030_OR_LATER)
- M68K_STATE_ENTRY(FP2, "%s", iotemp, 0xffffffff, CPUSTATE_EXPORT, MASK_030_OR_LATER)
- M68K_STATE_ENTRY(FP3, "%s", iotemp, 0xffffffff, CPUSTATE_EXPORT, MASK_030_OR_LATER)
- M68K_STATE_ENTRY(FP4, "%s", iotemp, 0xffffffff, CPUSTATE_EXPORT, MASK_030_OR_LATER)
- M68K_STATE_ENTRY(FP5, "%s", iotemp, 0xffffffff, CPUSTATE_EXPORT, MASK_030_OR_LATER)
- M68K_STATE_ENTRY(FP6, "%s", iotemp, 0xffffffff, CPUSTATE_EXPORT, MASK_030_OR_LATER)
- M68K_STATE_ENTRY(FP7, "%s", iotemp, 0xffffffff, CPUSTATE_EXPORT, MASK_030_OR_LATER)
- M68K_STATE_ENTRY(FPSR, "%08X", fpsr, 0xffffffff, 0, MASK_030_OR_LATER)
- M68K_STATE_ENTRY(FPCR, "%08X", fpcr, 0xffffffff, 0, MASK_030_OR_LATER)
-};
-
-static const cpu_state_table state_table_template =
-{
- NULL, /* pointer to the base of state (offsets are relative to this) */
- 0, /* subtype this table refers to */
- ARRAY_LENGTH(state_array), /* number of entries */
- state_array /* array of entries */
-};
-
-
INLINE m68ki_cpu_core *get_safe_token(running_device *device)
{
assert(device != NULL);
- assert(device->token != NULL);
- assert(device->type == CPU);
+ assert(device->type() == CPU);
assert(cpu_get_type(device) == CPU_M68000 ||
cpu_get_type(device) == CPU_M68008 ||
cpu_get_type(device) == CPU_M68010 ||
@@ -579,7 +508,7 @@ INLINE m68ki_cpu_core *get_safe_token(running_device *device)
cpu_get_type(device) == CPU_M68EC040 ||
cpu_get_type(device) == CPU_M68040 ||
cpu_get_type(device) == CPU_SCC68070);
- return (m68ki_cpu_core *)device->token;
+ return (m68ki_cpu_core *)downcast<cpu_device *>(device)->token();
}
/* ======================================================================== */
@@ -708,7 +637,7 @@ static CPU_INIT( m68k )
m68ki_cpu_core *m68k = get_safe_token(device);
m68k->device = device;
- m68k->program = device->space(AS_PROGRAM);
+ m68k->program = device_memory(device)->space(AS_PROGRAM);
m68k->int_ack_callback = irqcallback;
/* The first call to this function initializes the opcode handler jump table */
@@ -718,10 +647,6 @@ static CPU_INIT( m68k )
emulation_initialized = 1;
}
- /* set up the state table */
- m68k->state = state_table_template;
- m68k->state.baseptr = m68k;
-
/* Note, D covers A because the dar array is common, REG_A=REG_D+8 */
state_save_register_device_item_array(device, 0, REG_D);
state_save_register_device_item(device, 0, REG_PPC);
@@ -802,9 +727,10 @@ static CPU_IMPORT_STATE( m68k )
{
m68ki_cpu_core *m68k = get_safe_token(device);
- switch (entry->index)
+ switch (entry.index())
{
case M68K_SR:
+ case STATE_GENFLAGS:
m68ki_set_sr(m68k, m68k->iotemp);
break;
@@ -840,9 +766,10 @@ static CPU_EXPORT_STATE( m68k )
{
m68ki_cpu_core *m68k = get_safe_token(device);
- switch (entry->index)
+ switch (entry.index())
{
case M68K_SR:
+ case STATE_GENFLAGS:
m68k->iotemp = m68ki_get_sr(m68k);
break;
@@ -897,47 +824,68 @@ static CPU_SET_INFO( m68k )
static CPU_EXPORT_STRING( m68k )
{
m68ki_cpu_core *m68k = get_safe_token(device);
+ UINT16 sr;
- switch (entry->index)
+ switch (entry.index())
{
case M68K_FP0:
- sprintf(string, "%f", fx80_to_double(REG_FP[0]));
+ string.printf("%f", fx80_to_double(REG_FP[0]));
break;
case M68K_FP1:
- sprintf(string, "%f", fx80_to_double(REG_FP[1]));
+ string.printf("%f", fx80_to_double(REG_FP[1]));
break;
case M68K_FP2:
- sprintf(string, "%f", fx80_to_double(REG_FP[2]));
+ string.printf("%f", fx80_to_double(REG_FP[2]));
break;
case M68K_FP3:
- sprintf(string, "%f", fx80_to_double(REG_FP[3]));
+ string.printf("%f", fx80_to_double(REG_FP[3]));
break;
case M68K_FP4:
- sprintf(string, "%f", fx80_to_double(REG_FP[4]));
+ string.printf("%f", fx80_to_double(REG_FP[4]));
break;
case M68K_FP5:
- sprintf(string, "%f", fx80_to_double(REG_FP[5]));
+ string.printf("%f", fx80_to_double(REG_FP[5]));
break;
case M68K_FP6:
- sprintf(string, "%f", fx80_to_double(REG_FP[6]));
+ string.printf("%f", fx80_to_double(REG_FP[6]));
break;
case M68K_FP7:
- sprintf(string, "%f", fx80_to_double(REG_FP[7]));
+ string.printf("%f", fx80_to_double(REG_FP[7]));
+ break;
+
+ case STATE_GENFLAGS:
+ sr = m68ki_get_sr(m68k);
+ string.printf("%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c",
+ sr & 0x8000 ? 'T':'.',
+ sr & 0x4000 ? 't':'.',
+ sr & 0x2000 ? 'S':'.',
+ sr & 0x1000 ? 'M':'.',
+ sr & 0x0800 ? '?':'.',
+ sr & 0x0400 ? 'I':'.',
+ sr & 0x0200 ? 'I':'.',
+ sr & 0x0100 ? 'I':'.',
+ sr & 0x0080 ? '?':'.',
+ sr & 0x0040 ? '?':'.',
+ sr & 0x0020 ? '?':'.',
+ sr & 0x0010 ? 'X':'.',
+ sr & 0x0008 ? 'N':'.',
+ sr & 0x0004 ? 'Z':'.',
+ sr & 0x0002 ? 'V':'.',
+ sr & 0x0001 ? 'C':'.');
break;
}
}
static CPU_GET_INFO( m68k )
{
- m68ki_cpu_core *m68k = (device != NULL && device->token != NULL) ? get_safe_token(device) : NULL;
- int sr;
+ m68ki_cpu_core *m68k = (device != NULL && downcast<cpu_device *>(device)->token() != NULL) ? get_safe_token(device) : NULL;
switch (state)
{
@@ -979,7 +927,6 @@ static CPU_GET_INFO( m68k )
/* --- the following bits of info are returned as pointers --- */
case CPUINFO_PTR_INSTRUCTION_COUNTER: info->icount = &m68k->remaining_cycles; break;
- case CPUINFO_PTR_STATE_TABLE: info->state_table = &m68k->state; break;
/* --- the following bits of info are returned as NULL-terminated strings --- */
case DEVINFO_STR_NAME: /* set per-core */ break;
@@ -987,27 +934,6 @@ static CPU_GET_INFO( m68k )
case DEVINFO_STR_VERSION: strcpy(info->s, "4.60"); break;
case DEVINFO_STR_SOURCE_FILE: strcpy(info->s, __FILE__); break;
case DEVINFO_STR_CREDITS: strcpy(info->s, "Copyright Karl Stenerud. All rights reserved. (2.1 fixes HJB, FPU+MMU by RB)"); break;
-
- case CPUINFO_STR_FLAGS:
- sr = m68ki_get_sr(m68k);
- sprintf(info->s, "%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c",
- sr & 0x8000 ? 'T':'.',
- sr & 0x4000 ? '?':'.',
- sr & 0x2000 ? 'S':'.',
- sr & 0x1000 ? '?':'.',
- sr & 0x0800 ? '?':'.',
- sr & 0x0400 ? 'I':'.',
- sr & 0x0200 ? 'I':'.',
- sr & 0x0100 ? 'I':'.',
- sr & 0x0080 ? '?':'.',
- sr & 0x0040 ? '?':'.',
- sr & 0x0020 ? '?':'.',
- sr & 0x0010 ? 'X':'.',
- sr & 0x0008 ? 'N':'.',
- sr & 0x0004 ? 'Z':'.',
- sr & 0x0002 ? 'V':'.',
- sr & 0x0001 ? 'C':'.');
- break;
}
}
@@ -1309,6 +1235,61 @@ void m68k_set_tas_callback(running_device *device, m68k_tas_func callback)
/****************************************************************************
+ * State definition
+ ****************************************************************************/
+
+static void define_state(running_device *device)
+{
+ m68ki_cpu_core *m68k = get_safe_token(device);
+ UINT32 addrmask = (m68k->cpu_type & MASK_24BIT_SPACE) ? 0xffffff : 0xffffffff;
+
+ device_state_interface *state;
+ device->interface(state);
+ state->state_add(M68K_PC, "PC", m68k->pc).mask(addrmask);
+ state->state_add(STATE_GENPC, "GENPC", m68k->pc).mask(addrmask).noshow();
+ state->state_add(STATE_GENPCBASE, "GENPCBASE", m68k->ppc).mask(addrmask).noshow();
+ state->state_add(M68K_SP, "SP", m68k->dar[15]);
+ state->state_add(STATE_GENSP, "GENSP", m68k->dar[15]).noshow();
+ state->state_add(STATE_GENFLAGS, "GENFLAGS", m68k->iotemp).noshow().callimport().callexport().formatstr("%16s");
+ state->state_add(M68K_ISP, "ISP", m68k->iotemp).callimport().callexport();
+ state->state_add(M68K_USP, "USP", m68k->iotemp).callimport().callexport();
+ if (m68k->cpu_type & MASK_020_OR_LATER)
+ state->state_add(M68K_MSP, "MSP", m68k->iotemp).callimport().callexport();
+ state->state_add(M68K_ISP, "ISP", m68k->iotemp).callimport().callexport();
+
+ astring tempstr;
+ for (int regnum = 0; regnum < 8; regnum++)
+ state->state_add(M68K_D0 + regnum, tempstr.format("D%d", regnum), m68k->dar[regnum]);
+ for (int regnum = 0; regnum < 8; regnum++)
+ state->state_add(M68K_A0 + regnum, tempstr.format("A%d", regnum), m68k->dar[8 + regnum]);
+
+ state->state_add(M68K_PREF_ADDR, "PREF_ADDR", m68k->pref_addr).mask(addrmask);
+ state->state_add(M68K_PREF_DATA, "PREF_DATA", m68k->pref_data);
+
+ if (m68k->cpu_type & MASK_010_OR_LATER)
+ {
+ state->state_add(M68K_SFC, "SFC", m68k->sfc).mask(0x7);
+ state->state_add(M68K_DFC, "DFC", m68k->dfc).mask(0x7);
+ state->state_add(M68K_VBR, "VBR", m68k->vbr);
+ }
+
+ if (m68k->cpu_type & MASK_020_OR_LATER)
+ {
+ state->state_add(M68K_CACR, "CACR", m68k->cacr);
+ state->state_add(M68K_CAAR, "CAAR", m68k->caar);
+ }
+
+ if (m68k->cpu_type & MASK_030_OR_LATER)
+ {
+ for (int regnum = 0; regnum < 8; regnum++)
+ state->state_add(M68K_FP0 + regnum, tempstr.format("FP%d", regnum), m68k->iotemp).callimport().callexport().formatstr("%10s");
+ state->state_add(M68K_FPSR, "FPSR", m68k->fpsr);
+ state->state_add(M68K_FPCR, "FPCR", m68k->fpcr);
+ }
+}
+
+
+/****************************************************************************
* 68000 section
****************************************************************************/
@@ -1319,7 +1300,6 @@ static CPU_INIT( m68000 )
CPU_INIT_CALL(m68k);
m68k->cpu_type = CPU_TYPE_000;
- m68k->state.subtypemask = m68k->cpu_type;
m68k->dasm_type = M68K_CPU_TYPE_68000;
m68k->memory = interface_d16;
m68k->sr_mask = 0xa71f; /* T1 -- S -- -- I2 I1 I0 -- -- -- X N Z V C */
@@ -1335,6 +1315,8 @@ static CPU_INIT( m68000 )
m68k->cyc_shift = 1;
m68k->cyc_reset = 132;
m68k->has_pmmu = 0;
+
+ define_state(device);
}
CPU_GET_INFO( m68000 )
@@ -1363,7 +1345,6 @@ static CPU_INIT( m68008 )
CPU_INIT_CALL(m68k);
m68k->cpu_type = CPU_TYPE_008;
- m68k->state.subtypemask = m68k->cpu_type;
m68k->dasm_type = M68K_CPU_TYPE_68008;
m68k->memory = interface_d8;
m68k->sr_mask = 0xa71f; /* T1 -- S -- -- I2 I1 I0 -- -- -- X N Z V C */
@@ -1379,6 +1360,8 @@ static CPU_INIT( m68008 )
m68k->cyc_shift = 1;
m68k->cyc_reset = 132;
m68k->has_pmmu = 0;
+
+ define_state(device);
}
CPU_GET_INFO( m68008 )
@@ -1411,7 +1394,6 @@ static CPU_INIT( m68010 )
CPU_INIT_CALL(m68k);
m68k->cpu_type = CPU_TYPE_010;
- m68k->state.subtypemask = m68k->cpu_type;
m68k->dasm_type = M68K_CPU_TYPE_68010;
m68k->memory = interface_d16;
m68k->sr_mask = 0xa71f; /* T1 -- S -- -- I2 I1 I0 -- -- -- X N Z V C */
@@ -1427,6 +1409,8 @@ static CPU_INIT( m68010 )
m68k->cyc_shift = 1;
m68k->cyc_reset = 130;
m68k->has_pmmu = 0;
+
+ define_state(device);
}
CPU_GET_INFO( m68010 )
@@ -1455,7 +1439,6 @@ static CPU_INIT( m68020 )
CPU_INIT_CALL(m68k);
m68k->cpu_type = CPU_TYPE_020;
- m68k->state.subtypemask = m68k->cpu_type;
m68k->dasm_type = M68K_CPU_TYPE_68020;
m68k->memory = interface_d32;
m68k->sr_mask = 0xf71f; /* T1 T0 S M -- I2 I1 I0 -- -- -- X N Z V C */
@@ -1471,13 +1454,12 @@ static CPU_INIT( m68020 )
m68k->cyc_shift = 0;
m68k->cyc_reset = 518;
m68k->has_pmmu = 0;
+
+ define_state(device);
}
CPU_GET_INFO( m68020 )
{
- m68ki_cpu_core *m68k = (device != NULL && device->token != NULL) ? get_safe_token(device) : NULL;
- int sr;
-
switch (state)
{
/* --- the following bits of info are returned as 64-bit signed integers --- */
@@ -1494,27 +1476,6 @@ CPU_GET_INFO( m68020 )
/* --- the following bits of info are returned as NULL-terminated strings --- */
case DEVINFO_STR_NAME: strcpy(info->s, "68020"); break;
- case CPUINFO_STR_FLAGS:
- sr = m68ki_get_sr(m68k);
- sprintf(info->s, "%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c",
- sr & 0x8000 ? 'T':'.',
- sr & 0x4000 ? 't':'.',
- sr & 0x2000 ? 'S':'.',
- sr & 0x1000 ? 'M':'.',
- sr & 0x0800 ? '?':'.',
- sr & 0x0400 ? 'I':'.',
- sr & 0x0200 ? 'I':'.',
- sr & 0x0100 ? 'I':'.',
- sr & 0x0080 ? '?':'.',
- sr & 0x0040 ? '?':'.',
- sr & 0x0020 ? '?':'.',
- sr & 0x0010 ? 'X':'.',
- sr & 0x0008 ? 'N':'.',
- sr & 0x0004 ? 'Z':'.',
- sr & 0x0002 ? 'V':'.',
- sr & 0x0001 ? 'C':'.');
- break;
-
default: CPU_GET_INFO_CALL(m68k); break;
}
}
@@ -1555,7 +1516,6 @@ static CPU_INIT( m68ec020 )
CPU_INIT_CALL(m68k);
m68k->cpu_type = CPU_TYPE_EC020;
- m68k->state.subtypemask = m68k->cpu_type;
m68k->dasm_type = M68K_CPU_TYPE_68EC020;
m68k->memory = interface_d32;
m68k->sr_mask = 0xf71f; /* T1 T0 S M -- I2 I1 I0 -- -- -- X N Z V C */
@@ -1571,6 +1531,8 @@ static CPU_INIT( m68ec020 )
m68k->cyc_shift = 0;
m68k->cyc_reset = 518;
m68k->has_pmmu = 0;
+
+ define_state(device);
}
CPU_GET_INFO( m68ec020 )
@@ -1601,7 +1563,6 @@ static CPU_INIT( m68030 )
CPU_INIT_CALL(m68k);
m68k->cpu_type = CPU_TYPE_030;
- m68k->state.subtypemask = m68k->cpu_type;
m68k->dasm_type = M68K_CPU_TYPE_68030;
m68k->memory = interface_d32_mmu;
m68k->sr_mask = 0xf71f; /* T1 T0 S M -- I2 I1 I0 -- -- -- X N Z V C */
@@ -1617,13 +1578,12 @@ static CPU_INIT( m68030 )
m68k->cyc_shift = 0;
m68k->cyc_reset = 518;
m68k->has_pmmu = 1;
+
+ define_state(device);
}
CPU_GET_INFO( m68030 )
{
- m68ki_cpu_core *m68k = (device != NULL && device->token != NULL) ? get_safe_token(device) : NULL;
- int sr;
-
switch (state)
{
/* --- the following bits of info are returned as 64-bit signed integers --- */
@@ -1640,27 +1600,6 @@ CPU_GET_INFO( m68030 )
/* --- the following bits of info are returned as NULL-terminated strings --- */
case DEVINFO_STR_NAME: strcpy(info->s, "68030"); break;
- case CPUINFO_STR_FLAGS:
- sr = m68ki_get_sr(m68k);
- sprintf(info->s, "%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c",
- sr & 0x8000 ? 'T':'.',
- sr & 0x4000 ? 't':'.',
- sr & 0x2000 ? 'S':'.',
- sr & 0x1000 ? 'M':'.',
- sr & 0x0800 ? '?':'.',
- sr & 0x0400 ? 'I':'.',
- sr & 0x0200 ? 'I':'.',
- sr & 0x0100 ? 'I':'.',
- sr & 0x0080 ? '?':'.',
- sr & 0x0040 ? '?':'.',
- sr & 0x0020 ? '?':'.',
- sr & 0x0010 ? 'X':'.',
- sr & 0x0008 ? 'N':'.',
- sr & 0x0004 ? 'Z':'.',
- sr & 0x0002 ? 'V':'.',
- sr & 0x0001 ? 'C':'.');
- break;
-
default: CPU_GET_INFO_CALL(m68k); break;
}
}
@@ -1677,7 +1616,6 @@ static CPU_INIT( m68ec030 )
CPU_INIT_CALL(m68k);
m68k->cpu_type = CPU_TYPE_EC030;
- m68k->state.subtypemask = m68k->cpu_type;
m68k->dasm_type = M68K_CPU_TYPE_68EC030;
m68k->memory = interface_d32;
m68k->sr_mask = 0xf71f; /* T1 T0 S M -- I2 I1 I0 -- -- -- X N Z V C */
@@ -1693,6 +1631,8 @@ static CPU_INIT( m68ec030 )
m68k->cyc_shift = 0;
m68k->cyc_reset = 518;
m68k->has_pmmu = 0; /* EC030 lacks the PMMU and is effectively a die-shrink 68020 */
+
+ define_state(device);
}
CPU_GET_INFO( m68ec030 )
@@ -1720,7 +1660,6 @@ static CPU_INIT( m68040 )
CPU_INIT_CALL(m68k);
m68k->cpu_type = CPU_TYPE_040;
- m68k->state.subtypemask = m68k->cpu_type;
m68k->dasm_type = M68K_CPU_TYPE_68040;
m68k->memory = interface_d32_mmu;
m68k->sr_mask = 0xf71f; /* T1 T0 S M -- I2 I1 I0 -- -- -- X N Z V C */
@@ -1736,13 +1675,12 @@ static CPU_INIT( m68040 )
m68k->cyc_shift = 0;
m68k->cyc_reset = 518;
m68k->has_pmmu = 1;
+
+ define_state(device);
}
CPU_GET_INFO( m68040 )
{
- m68ki_cpu_core *m68k = (device != NULL && device->token != NULL) ? get_safe_token(device) : NULL;
- int sr;
-
switch (state)
{
/* --- the following bits of info are returned as 64-bit signed integers --- */
@@ -1759,27 +1697,6 @@ CPU_GET_INFO( m68040 )
/* --- the following bits of info are returned as NULL-terminated strings --- */
case DEVINFO_STR_NAME: strcpy(info->s, "68040"); break;
- case CPUINFO_STR_FLAGS:
- sr = m68ki_get_sr(m68k);
- sprintf(info->s, "%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c",
- sr & 0x8000 ? 'T':'.',
- sr & 0x4000 ? 't':'.',
- sr & 0x2000 ? 'S':'.',
- sr & 0x1000 ? 'M':'.',
- sr & 0x0800 ? '?':'.',
- sr & 0x0400 ? 'I':'.',
- sr & 0x0200 ? 'I':'.',
- sr & 0x0100 ? 'I':'.',
- sr & 0x0080 ? '?':'.',
- sr & 0x0040 ? '?':'.',
- sr & 0x0020 ? '?':'.',
- sr & 0x0010 ? 'X':'.',
- sr & 0x0008 ? 'N':'.',
- sr & 0x0004 ? 'Z':'.',
- sr & 0x0002 ? 'V':'.',
- sr & 0x0001 ? 'C':'.');
- break;
-
default: CPU_GET_INFO_CALL(m68k); break;
}
}
@@ -1795,7 +1712,6 @@ static CPU_INIT( m68ec040 )
CPU_INIT_CALL(m68k);
m68k->cpu_type = CPU_TYPE_EC040;
- m68k->state.subtypemask = m68k->cpu_type;
m68k->dasm_type = M68K_CPU_TYPE_68EC040;
m68k->memory = interface_d32;
m68k->sr_mask = 0xf71f; /* T1 T0 S M -- I2 I1 I0 -- -- -- X N Z V C */
@@ -1811,6 +1727,8 @@ static CPU_INIT( m68ec040 )
m68k->cyc_shift = 0;
m68k->cyc_reset = 518;
m68k->has_pmmu = 0;
+
+ define_state(device);
}
CPU_GET_INFO( m68ec040 )
@@ -1838,7 +1756,6 @@ static CPU_INIT( m68lc040 )
CPU_INIT_CALL(m68k);
m68k->cpu_type = CPU_TYPE_LC040;
- m68k->state.subtypemask = m68k->cpu_type;
m68k->dasm_type = M68K_CPU_TYPE_68LC040;
m68k->memory = interface_d32;
m68k->sr_mask = 0xf71f; /* T1 T0 S M -- I2 I1 I0 -- -- -- X N Z V C */
@@ -1854,6 +1771,8 @@ static CPU_INIT( m68lc040 )
m68k->cyc_shift = 0;
m68k->cyc_reset = 518;
m68k->has_pmmu = 1;
+
+ define_state(device);
}
CPU_GET_INFO( m68lc040 )
diff --git a/src/emu/cpu/m68000/m68kcpu.h b/src/emu/cpu/m68000/m68kcpu.h
index 6b04a6cd65e..65b6eb3d3fd 100644
--- a/src/emu/cpu/m68000/m68kcpu.h
+++ b/src/emu/cpu/m68000/m68kcpu.h
@@ -620,7 +620,7 @@ struct _m68ki_cpu_core
const UINT8* cyc_exception;
/* Callbacks to host */
- cpu_irq_callback int_ack_callback; /* Interrupt Acknowledge */
+ device_irq_callback int_ack_callback; /* Interrupt Acknowledge */
m68k_bkpt_ack_func bkpt_ack_callback; /* Breakpoint Acknowledge */
m68k_reset_func reset_instr_callback; /* Called when a RESET instruction is encountered */
m68k_cmpild_func cmpild_instr_callback; /* Called when a CMPI.L #v, Dn instruction is encountered */
@@ -633,7 +633,6 @@ struct _m68ki_cpu_core
offs_t encrypted_start;
offs_t encrypted_end;
- cpu_state_table state;
UINT32 iotemp;
/* save state data */
diff --git a/src/emu/cpu/m6805/m6805.c b/src/emu/cpu/m6805/m6805.c
index 292772b7fc8..bca36f885bb 100644
--- a/src/emu/cpu/m6805/m6805.c
+++ b/src/emu/cpu/m6805/m6805.c
@@ -60,7 +60,7 @@ typedef struct
UINT8 cc; /* Condition codes */
UINT16 pending_interrupts; /* MB */
- cpu_irq_callback irq_callback;
+ device_irq_callback irq_callback;
running_device *device;
const address_space *program;
int irq_state[9]; /* KW Additional lines for HD63705 */
@@ -70,12 +70,11 @@ typedef struct
INLINE m6805_Regs *get_safe_token(running_device *device)
{
assert(device != NULL);
- assert(device->token != NULL);
- assert(device->type == CPU);
+ assert(device->type() == CPU);
assert(cpu_get_type(device) == CPU_M6805 ||
cpu_get_type(device) == CPU_M68705 ||
cpu_get_type(device) == CPU_HD63705);
- return (m6805_Regs *)device->token;
+ return (m6805_Regs *)downcast<cpu_device *>(device)->token();
}
/****************************************************************************/
@@ -460,20 +459,20 @@ static CPU_INIT( m6805 )
state_register(cpustate, "m6805", device);
cpustate->irq_callback = irqcallback;
cpustate->device = device;
- cpustate->program = cpustate->device->space(AS_PROGRAM);
+ cpustate->program = device_memory(device)->space(AS_PROGRAM);
}
static CPU_RESET( m6805 )
{
m6805_Regs *cpustate = get_safe_token(device);
- cpu_irq_callback save_irqcallback = cpustate->irq_callback;
+ device_irq_callback save_irqcallback = cpustate->irq_callback;
memset(cpustate, 0, sizeof(m6805_Regs));
cpustate->iCount=50000; /* Used to be global */
cpustate->irq_callback = save_irqcallback;
cpustate->device = device;
- cpustate->program = cpustate->device->space(AS_PROGRAM);
+ cpustate->program = device_memory(device)->space(AS_PROGRAM);
/* Force CPU sub-type and relevant masks */
cpustate->subtype = SUBTYPE_M6805;
@@ -908,7 +907,7 @@ static CPU_SET_INFO( m6805 )
CPU_GET_INFO( m6805 )
{
- m6805_Regs *cpustate = (device != NULL && device->token != NULL) ? get_safe_token(device) : NULL;
+ m6805_Regs *cpustate = (device != NULL && downcast<cpu_device *>(device)->token() != NULL) ? get_safe_token(device) : NULL;
switch (state)
{
@@ -1002,7 +1001,7 @@ static CPU_SET_INFO( m68705 )
CPU_GET_INFO( m68705 )
{
- m6805_Regs *cpustate = (device != NULL && device->token != NULL) ? get_safe_token(device) : NULL;
+ m6805_Regs *cpustate = (device != NULL && downcast<cpu_device *>(device)->token() != NULL) ? get_safe_token(device) : NULL;
switch (state)
{
@@ -1049,7 +1048,7 @@ static CPU_SET_INFO( hd63705 )
CPU_GET_INFO( hd63705 )
{
- m6805_Regs *cpustate = (device != NULL && device->token != NULL) ? get_safe_token(device) : NULL;
+ m6805_Regs *cpustate = (device != NULL && downcast<cpu_device *>(device)->token() != NULL) ? get_safe_token(device) : NULL;
switch (state)
{
diff --git a/src/emu/cpu/m6809/6809dasm.c b/src/emu/cpu/m6809/6809dasm.c
index 41534d1ee2a..430d2d9636d 100644
--- a/src/emu/cpu/m6809/6809dasm.c
+++ b/src/emu/cpu/m6809/6809dasm.c
@@ -369,7 +369,7 @@ CPU_DISASSEMBLE( m6809 )
const UINT8 *operandarray;
unsigned int ea, flags;
int numoperands, offset, indirect;
- const m6809_config *configdata = device ? (const m6809_config *)device->baseconfig().static_config : NULL;
+ const m6809_config *configdata = device ? (const m6809_config *)device->baseconfig().static_config() : NULL;
int encrypt_only_first_byte = configdata ? configdata->encrypt_only_first_byte : 0;
int i, p = 0, page = 0, opcode_found = FALSE;
diff --git a/src/emu/cpu/m6809/m6809.c b/src/emu/cpu/m6809/m6809.c
index 710fc762a0d..65debfcf7fd 100644
--- a/src/emu/cpu/m6809/m6809.c
+++ b/src/emu/cpu/m6809/m6809.c
@@ -98,7 +98,7 @@ struct _m68_state_t
UINT8 irq_state[2];
int extra_cycles; /* cycles used up by interrupts */
- cpu_irq_callback irq_callback;
+ device_irq_callback irq_callback;
running_device *device;
const m6809_config *config;
int icount;
@@ -114,11 +114,10 @@ struct _m68_state_t
INLINE m68_state_t *get_safe_token(running_device *device)
{
assert(device != NULL);
- assert(device->token != NULL);
- assert(device->type == CPU);
+ assert(device->type() == CPU);
assert(cpu_get_type(device) == CPU_M6809 ||
cpu_get_type(device) == CPU_M6809E);
- return (m68_state_t *)device->token;
+ return (m68_state_t *)downcast<cpu_device *>(device)->token();
}
static void check_irq_lines( m68_state_t *m68_state );
@@ -377,14 +376,14 @@ static CPU_INIT( m6809 )
0
};
- const m6809_config *configdata = device->baseconfig().static_config ? (const m6809_config *)device->baseconfig().static_config : &default_config;
+ const m6809_config *configdata = device->baseconfig().static_config() ? (const m6809_config *)device->baseconfig().static_config() : &default_config;
m68_state_t *m68_state = get_safe_token(device);
m68_state->config = configdata;
m68_state->irq_callback = irqcallback;
m68_state->device = device;
- m68_state->program = device->space(AS_PROGRAM);
+ m68_state->program = device_memory(device)->space(AS_PROGRAM);
/* setup regtable */
@@ -1102,7 +1101,7 @@ static CPU_SET_INFO( m6809 )
CPU_GET_INFO( m6809 )
{
- m68_state_t *m68_state = (device != NULL && device->token != NULL) ? get_safe_token(device) : NULL;
+ m68_state_t *m68_state = (device != NULL && downcast<cpu_device *>(device)->token() != NULL) ? get_safe_token(device) : NULL;
switch (state)
{
diff --git a/src/emu/cpu/mb86233/mb86233.c b/src/emu/cpu/mb86233/mb86233.c
index 88ec36a31a7..c5fb8016f9a 100644
--- a/src/emu/cpu/mb86233/mb86233.c
+++ b/src/emu/cpu/mb86233/mb86233.c
@@ -68,10 +68,9 @@ struct _mb86233_state
INLINE mb86233_state *get_safe_token(running_device *device)
{
assert(device != NULL);
- assert(device->token != NULL);
- assert(device->type == CPU);
+ assert(device->type() == CPU);
assert(cpu_get_type(device) == CPU_MB86233);
- return (mb86233_state *)device->token;
+ return (mb86233_state *)downcast<cpu_device *>(device)->token();
}
/***************************************************************************
@@ -108,12 +107,12 @@ INLINE mb86233_state *get_safe_token(running_device *device)
static CPU_INIT( mb86233 )
{
mb86233_state *cpustate = get_safe_token(device);
- mb86233_cpu_core * _config = (mb86233_cpu_core *)device->baseconfig().static_config;
+ mb86233_cpu_core * _config = (mb86233_cpu_core *)device->baseconfig().static_config();
(void)irqcallback;
memset(cpustate, 0, sizeof( *cpustate ) );
cpustate->device = device;
- cpustate->program = device->space(AS_PROGRAM);
+ cpustate->program = device_memory(device)->space(AS_PROGRAM);
if ( _config )
{
@@ -1607,7 +1606,7 @@ static CPU_SET_INFO( mb86233 )
CPU_GET_INFO( mb86233 )
{
- mb86233_state *cpustate = (device != NULL && device->token != NULL) ? get_safe_token(device) : NULL;
+ mb86233_state *cpustate = (device != NULL && downcast<cpu_device *>(device)->token() != NULL) ? get_safe_token(device) : NULL;
switch (state)
{
diff --git a/src/emu/cpu/mb88xx/mb88xx.c b/src/emu/cpu/mb88xx/mb88xx.c
index 7fa2b3e576b..f21dde9f633 100644
--- a/src/emu/cpu/mb88xx/mb88xx.c
+++ b/src/emu/cpu/mb88xx/mb88xx.c
@@ -73,7 +73,7 @@ struct _mb88_state
/* IRQ handling */
UINT8 pending_interrupt;
- cpu_irq_callback irqcallback;
+ device_irq_callback irqcallback;
running_device *device;
const address_space *program;
const address_space *data;
@@ -84,14 +84,13 @@ struct _mb88_state
INLINE mb88_state *get_safe_token(running_device *device)
{
assert(device != NULL);
- assert(device->token != NULL);
- assert(device->type == CPU);
+ 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);
- return (mb88_state *)device->token;
+ return (mb88_state *)downcast<cpu_device *>(device)->token();
}
static TIMER_CALLBACK( serial_timer );
@@ -137,17 +136,17 @@ static CPU_INIT( mb88 )
{
mb88_state *cpustate = get_safe_token(device);
- if ( device->baseconfig().static_config )
+ if ( device->baseconfig().static_config() )
{
- const mb88_cpu_core *_config = (const mb88_cpu_core*)device->baseconfig().static_config;
+ const mb88_cpu_core *_config = (const mb88_cpu_core*)device->baseconfig().static_config();
cpustate->PLA = _config->PLA_config;
}
cpustate->irqcallback = irqcallback;
cpustate->device = device;
- cpustate->program = device->space(AS_PROGRAM);
- cpustate->data = device->space(AS_DATA);
- cpustate->io = device->space(AS_IO);
+ cpustate->program = device_memory(device)->space(AS_PROGRAM);
+ cpustate->data = device_memory(device)->space(AS_DATA);
+ cpustate->io = device_memory(device)->space(AS_IO);
cpustate->serial = timer_alloc(device->machine, serial_timer, (void *)device);
@@ -263,7 +262,7 @@ static void update_pio_enable( mb88_state *cpustate, UINT8 newpio )
if ((newpio & 0x30) == 0)
timer_adjust_oneshot(cpustate->serial, attotime_never, 0);
else if ((newpio & 0x30) == 0x20)
- timer_adjust_periodic(cpustate->serial, ATTOTIME_IN_HZ(cpustate->device->clock / SERIAL_PRESCALE), 0, ATTOTIME_IN_HZ(cpustate->device->clock / SERIAL_PRESCALE));
+ timer_adjust_periodic(cpustate->serial, ATTOTIME_IN_HZ(cpustate->device->clock() / SERIAL_PRESCALE), 0, ATTOTIME_IN_HZ(cpustate->device->clock() / SERIAL_PRESCALE));
else
fatalerror("mb88xx: update_pio_enable set serial enable to unsupported value %02X\n", newpio & 0x30);
}
@@ -615,7 +614,7 @@ static CPU_EXECUTE( mb88 )
{
/* re-enable the timer if we disabled it previously */
if (cpustate->SBcount >= SERIAL_DISABLE_THRESH)
- timer_adjust_periodic(cpustate->serial, ATTOTIME_IN_HZ(cpustate->device->clock / SERIAL_PRESCALE), 0, ATTOTIME_IN_HZ(cpustate->device->clock / SERIAL_PRESCALE));
+ timer_adjust_periodic(cpustate->serial, ATTOTIME_IN_HZ(cpustate->device->clock() / SERIAL_PRESCALE), 0, ATTOTIME_IN_HZ(cpustate->device->clock() / SERIAL_PRESCALE));
cpustate->SBcount = 0;
}
cpustate->sf = 0;
@@ -927,7 +926,7 @@ static CPU_SET_INFO( mb88 )
CPU_GET_INFO( mb88 )
{
- mb88_state *cpustate = (device != NULL && device->token != NULL) ? get_safe_token(device) : NULL;
+ mb88_state *cpustate = (device != NULL && downcast<cpu_device *>(device)->token() != NULL) ? get_safe_token(device) : NULL;
switch (state)
{
diff --git a/src/emu/cpu/mc68hc11/mc68hc11.c b/src/emu/cpu/mc68hc11/mc68hc11.c
index 76361913085..c701e911d16 100644
--- a/src/emu/cpu/mc68hc11/mc68hc11.c
+++ b/src/emu/cpu/mc68hc11/mc68hc11.c
@@ -59,7 +59,7 @@ struct _hc11_state
UINT8 adctl;
int ad_channel;
- cpu_irq_callback irq_callback;
+ device_irq_callback irq_callback;
UINT8 irq_state[2];
running_device *device;
const address_space *program;
@@ -81,10 +81,9 @@ struct _hc11_state
INLINE hc11_state *get_safe_token(running_device *device)
{
assert(device != NULL);
- assert(device->token != NULL);
- assert(device->type == CPU);
+ assert(device->type() == CPU);
assert(cpu_get_type(device) == CPU_MC68HC11);
- return (hc11_state *)device->token;
+ return (hc11_state *)downcast<cpu_device *>(device)->token();
}
#define HC11OP(XX) hc11_##XX
@@ -370,7 +369,7 @@ static CPU_INIT( hc11 )
hc11_state *cpustate = get_safe_token(device);
int i;
- const hc11_config *conf = (const hc11_config *)device->baseconfig().static_config;
+ const hc11_config *conf = (const hc11_config *)device->baseconfig().static_config();
/* clear the opcode tables */
for(i=0; i < 256; i++) {
@@ -417,8 +416,8 @@ static CPU_INIT( hc11 )
cpustate->ram_position = 0x100;
cpustate->irq_callback = irqcallback;
cpustate->device = device;
- cpustate->program = device->space(AS_PROGRAM);
- cpustate->io = device->space(AS_IO);
+ cpustate->program = device_memory(device)->space(AS_PROGRAM);
+ cpustate->io = device_memory(device)->space(AS_IO);
}
static CPU_RESET( hc11 )
@@ -538,7 +537,7 @@ static CPU_SET_INFO( mc68hc11 )
CPU_GET_INFO( mc68hc11 )
{
- hc11_state *cpustate = (device != NULL && device->token != NULL) ? get_safe_token(device) : NULL;
+ hc11_state *cpustate = (device != NULL && downcast<cpu_device *>(device)->token() != NULL) ? get_safe_token(device) : NULL;
switch(state)
{
diff --git a/src/emu/cpu/mcs48/mcs48.c b/src/emu/cpu/mcs48/mcs48.c
index 68ff876bd2c..44aa706e9e6 100644
--- a/src/emu/cpu/mcs48/mcs48.c
+++ b/src/emu/cpu/mcs48/mcs48.c
@@ -149,7 +149,7 @@ struct _mcs48_state
UINT16 a11; /* A11 value, either 0x000 or 0x800 */
- cpu_irq_callback irq_callback;
+ device_irq_callback irq_callback;
running_device *device;
int icount;
@@ -161,7 +161,6 @@ struct _mcs48_state
UINT8 feature_mask; /* processor feature flags */
UINT16 int_rom_size; /* internal rom size */
- cpu_state_table state; /* state table */
UINT8 rtemp; /* temporary for import/export */
};
@@ -172,57 +171,6 @@ typedef int (*mcs48_ophandler)(mcs48_state *state);
/***************************************************************************
- CPU STATE DESCRIPTION
-***************************************************************************/
-
-#define MCS48_STATE_ENTRY(_name, _format, _member, _datamask, _flags) \
- CPU_STATE_ENTRY(MCS48_##_name, #_name, _format, mcs48_state, _member, _datamask, MCS48_FEATURE | UPI41_FEATURE, _flags)
-
-#define UPI41_STATE_ENTRY(_name, _format, _member, _datamask, _flags) \
- CPU_STATE_ENTRY(MCS48_##_name, #_name, _format, mcs48_state, _member, _datamask, UPI41_FEATURE, _flags)
-
-static const cpu_state_entry state_array[] =
-{
- MCS48_STATE_ENTRY(PC, "%03X", pc, 0xfff, 0)
- MCS48_STATE_ENTRY(GENPC, "%03X", pc, 0xfff, CPUSTATE_NOSHOW)
- MCS48_STATE_ENTRY(GENPCBASE, "%03X", prevpc, 0xfff, CPUSTATE_NOSHOW)
-
- MCS48_STATE_ENTRY(GENSP, "%1X", psw, 0x7, CPUSTATE_NOSHOW)
-
- MCS48_STATE_ENTRY(A, "%02X", a, 0xff, 0)
- MCS48_STATE_ENTRY(TC, "%02X", timer, 0xff, 0)
- MCS48_STATE_ENTRY(TPRE, "%02X", prescaler, 0x1f, 0)
-
- MCS48_STATE_ENTRY(P1, "%02X", p1, 0xff, 0)
- MCS48_STATE_ENTRY(P2, "%02X", p2, 0xff, 0)
-
- MCS48_STATE_ENTRY(R0, "%02X", rtemp, 0xff, CPUSTATE_IMPORT | CPUSTATE_EXPORT)
- MCS48_STATE_ENTRY(R1, "%02X", rtemp, 0xff, CPUSTATE_IMPORT | CPUSTATE_EXPORT)
- MCS48_STATE_ENTRY(R2, "%02X", rtemp, 0xff, CPUSTATE_IMPORT | CPUSTATE_EXPORT)
- MCS48_STATE_ENTRY(R3, "%02X", rtemp, 0xff, CPUSTATE_IMPORT | CPUSTATE_EXPORT)
- MCS48_STATE_ENTRY(R4, "%02X", rtemp, 0xff, CPUSTATE_IMPORT | CPUSTATE_EXPORT)
- MCS48_STATE_ENTRY(R5, "%02X", rtemp, 0xff, CPUSTATE_IMPORT | CPUSTATE_EXPORT)
- MCS48_STATE_ENTRY(R6, "%02X", rtemp, 0xff, CPUSTATE_IMPORT | CPUSTATE_EXPORT)
- MCS48_STATE_ENTRY(R7, "%02X", rtemp, 0xff, CPUSTATE_IMPORT | CPUSTATE_EXPORT)
-
- MCS48_STATE_ENTRY(EA, "%1u", ea, 0x1, 0)
-
- UPI41_STATE_ENTRY(STS, "%02X", sts, 0xff, 0)
- UPI41_STATE_ENTRY(DBBI, "%02X", dbbi, 0xff, 0)
- UPI41_STATE_ENTRY(DBBO, "%02X", dbbo, 0xff, 0)
-};
-
-static const cpu_state_table state_table_template =
-{
- NULL, /* pointer to the base of state (offsets are relative to this) */
- 0, /* subtype this table refers to */
- ARRAY_LENGTH(state_array), /* number of entries */
- state_array /* array of entries */
-};
-
-
-
-/***************************************************************************
MACROS
***************************************************************************/
@@ -272,8 +220,7 @@ static int check_irqs(mcs48_state *cpustate);
INLINE mcs48_state *get_safe_token(running_device *device)
{
assert(device != NULL);
- assert(device->token != NULL);
- assert(device->type == CPU);
+ assert(device->type() == CPU);
assert(cpu_get_type(device) == CPU_I8035 ||
cpu_get_type(device) == CPU_I8048 ||
cpu_get_type(device) == CPU_I8648 ||
@@ -291,7 +238,7 @@ INLINE mcs48_state *get_safe_token(running_device *device)
cpu_get_type(device) == CPU_MB8884 ||
cpu_get_type(device) == CPU_N7751 ||
cpu_get_type(device) == CPU_M58715);
- return (mcs48_state *)device->token;
+ return (mcs48_state *)downcast<cpu_device *>(device)->token();
}
@@ -893,7 +840,7 @@ static const mcs48_ophandler opcode_table[256]=
mcs48_init - generic MCS-48 initialization
-------------------------------------------------*/
-static void mcs48_init(running_device *device, cpu_irq_callback irqcallback, UINT8 feature_mask, UINT16 romsize)
+static void mcs48_init(running_device *device, device_irq_callback irqcallback, UINT8 feature_mask, UINT16 romsize)
{
mcs48_state *cpustate = get_safe_token(device);
@@ -910,14 +857,39 @@ static void mcs48_init(running_device *device, cpu_irq_callback irqcallback, UIN
cpustate->int_rom_size = romsize;
cpustate->feature_mask = feature_mask;
- cpustate->program = device->space(AS_PROGRAM);
- cpustate->data = device->space(AS_DATA);
- cpustate->io = device->space(AS_IO);
+ cpustate->program = device_memory(device)->space(AS_PROGRAM);
+ cpustate->data = device_memory(device)->space(AS_DATA);
+ cpustate->io = device_memory(device)->space(AS_IO);
/* set up the state table */
- cpustate->state = state_table_template;
- cpustate->state.baseptr = cpustate;
- cpustate->state.subtypemask = feature_mask;
+ {
+ device_state_interface *state;
+ device->interface(state);
+ state->state_add(MCS48_PC, "PC", cpustate->pc).mask(0xfff);
+ state->state_add(STATE_GENPC, "GENPC", cpustate->pc).mask(0xfff).noshow();
+ state->state_add(STATE_GENPCBASE, "GENPCBASE", cpustate->prevpc).mask(0xfff).noshow();
+ state->state_add(STATE_GENSP, "GENSP", cpustate->psw).mask(0x7).noshow();
+ state->state_add(STATE_GENFLAGS, "GENFLAGS", cpustate->psw).noshow().formatstr("%10s");
+ state->state_add(MCS48_A, "A", cpustate->a);
+ state->state_add(MCS48_TC, "TC", cpustate->timer);
+ state->state_add(MCS48_TPRE, "TPRE", cpustate->prescaler).mask(0x1f);
+ state->state_add(MCS48_P1, "P1", cpustate->p1);
+ state->state_add(MCS48_P2, "P2", cpustate->p2);
+
+ astring tempstr;
+ for (int regnum = 0; regnum < 8; regnum++)
+ state->state_add(MCS48_R0 + regnum, tempstr.format("R%d", regnum), cpustate->rtemp).callimport().callexport();
+
+ state->state_add(MCS48_EA, "EA", cpustate->ea).mask(0x1);
+
+ if (feature_mask & UPI41_FEATURE)
+ {
+ state->state_add(MCS48_STS, "STS", cpustate->sts);
+ state->state_add(MCS48_DBBI, "DBBI", cpustate->dbbi);
+ state->state_add(MCS48_DBBO, "DBBO", cpustate->dbbo);
+ }
+
+ }
/* ensure that regptr is valid before get_info gets called */
update_regptr(cpustate);
@@ -1292,7 +1264,7 @@ static CPU_IMPORT_STATE( mcs48 )
{
mcs48_state *cpustate = get_safe_token(device);
- switch (entry->index)
+ switch (entry.index())
{
case MCS48_R0:
case MCS48_R1:
@@ -1302,7 +1274,7 @@ static CPU_IMPORT_STATE( mcs48 )
case MCS48_R5:
case MCS48_R6:
case MCS48_R7:
- cpustate->regptr[entry->index - MCS48_R0] = cpustate->rtemp;
+ cpustate->regptr[entry.index() - MCS48_R0] = cpustate->rtemp;
break;
default:
@@ -1321,7 +1293,7 @@ static CPU_EXPORT_STATE( mcs48 )
{
mcs48_state *cpustate = get_safe_token(device);
- switch (entry->index)
+ switch (entry.index())
{
case MCS48_R0:
case MCS48_R1:
@@ -1331,7 +1303,7 @@ static CPU_EXPORT_STATE( mcs48 )
case MCS48_R5:
case MCS48_R6:
case MCS48_R7:
- cpustate->rtemp = cpustate->regptr[entry->index - MCS48_R0];
+ cpustate->rtemp = cpustate->regptr[entry.index() - MCS48_R0];
break;
default:
@@ -1340,6 +1312,27 @@ static CPU_EXPORT_STATE( mcs48 )
}
}
+static CPU_EXPORT_STRING( mcs48 )
+{
+ mcs48_state *cpustate = get_safe_token(device);
+
+ switch (entry.index())
+ {
+ case CPUINFO_STR_FLAGS:
+ string.printf("%c%c %c%c%c%c%c%c%c%c",
+ cpustate->irq_state ? 'I':'.',
+ cpustate->a11 ? 'M':'.',
+ cpustate->psw & 0x80 ? 'C':'.',
+ cpustate->psw & 0x40 ? 'A':'.',
+ cpustate->psw & 0x20 ? 'F':'.',
+ cpustate->psw & 0x10 ? 'B':'.',
+ cpustate->psw & 0x08 ? '?':'.',
+ cpustate->psw & 0x04 ? '4':'.',
+ cpustate->psw & 0x02 ? '2':'.',
+ cpustate->psw & 0x01 ? '1':'.');
+ break;
+ }
+}
/*-------------------------------------------------
mcs48_set_info - set a piece of information
@@ -1366,7 +1359,7 @@ static CPU_SET_INFO( mcs48 )
static CPU_GET_INFO( mcs48 )
{
- mcs48_state *cpustate = (device != NULL && device->token != NULL) ? get_safe_token(device) : NULL;
+ mcs48_state *cpustate = (device != NULL && downcast<cpu_device *>(device)->token() != NULL) ? get_safe_token(device) : NULL;
switch (state)
{
@@ -1403,10 +1396,10 @@ static CPU_GET_INFO( mcs48 )
case CPUINFO_FCT_DISASSEMBLE: info->disassemble = CPU_DISASSEMBLE_NAME(mcs48); break;
case CPUINFO_FCT_IMPORT_STATE: info->import_state = CPU_IMPORT_STATE_NAME(mcs48); break;
case CPUINFO_FCT_EXPORT_STATE: info->export_state = CPU_EXPORT_STATE_NAME(mcs48); break;
+ case CPUINFO_FCT_EXPORT_STRING: info->export_string = CPU_EXPORT_STRING_NAME(mcs48); break;
/* --- the following bits of info are returned as pointers --- */
case CPUINFO_PTR_INSTRUCTION_COUNTER: info->icount = &cpustate->icount; break;
- case CPUINFO_PTR_STATE_TABLE: info->state_table = &cpustate->state; break;
case DEVINFO_PTR_INTERNAL_MEMORY_MAP + ADDRESS_SPACE_PROGRAM: /* set per-core */ break;
case DEVINFO_PTR_INTERNAL_MEMORY_MAP + ADDRESS_SPACE_DATA: /* set per-core */ break;
@@ -1416,20 +1409,6 @@ static CPU_GET_INFO( mcs48 )
case DEVINFO_STR_VERSION: strcpy(info->s, "1.2"); break;
case DEVINFO_STR_SOURCE_FILE: strcpy(info->s, __FILE__); break;
case DEVINFO_STR_CREDITS: strcpy(info->s, "Copyright Mirko Buffoni\nBased on the original work Copyright Dan Boris"); break;
-
- case CPUINFO_STR_FLAGS:
- sprintf(info->s, "%c%c %c%c%c%c%c%c%c%c",
- cpustate->irq_state ? 'I':'.',
- cpustate->a11 ? 'M':'.',
- cpustate->psw & 0x80 ? 'C':'.',
- cpustate->psw & 0x40 ? 'A':'.',
- cpustate->psw & 0x20 ? 'F':'.',
- cpustate->psw & 0x10 ? 'B':'.',
- cpustate->psw & 0x08 ? '?':'.',
- cpustate->psw & 0x04 ? '4':'.',
- cpustate->psw & 0x02 ? '2':'.',
- cpustate->psw & 0x01 ? '1':'.');
- break;
}
}
diff --git a/src/emu/cpu/mcs48/mcs48.h b/src/emu/cpu/mcs48/mcs48.h
index 347c4b069d9..6d27bd55ccd 100644
--- a/src/emu/cpu/mcs48/mcs48.h
+++ b/src/emu/cpu/mcs48/mcs48.h
@@ -44,9 +44,9 @@ enum
MCS48_DBBO, /* UPI-41 systems only */
MCS48_DBBI, /* UPI-41 systems only */
- MCS48_GENPC = REG_GENPC,
- MCS48_GENSP = REG_GENSP,
- MCS48_GENPCBASE = REG_GENPCBASE
+ MCS48_GENPC = STATE_GENPC,
+ MCS48_GENSP = STATE_GENSP,
+ MCS48_GENPCBASE = STATE_GENPCBASE
};
diff --git a/src/emu/cpu/mcs51/mcs51.c b/src/emu/cpu/mcs51/mcs51.c
index 60fdd3a165f..e42eb551331 100644
--- a/src/emu/cpu/mcs51/mcs51.c
+++ b/src/emu/cpu/mcs51/mcs51.c
@@ -281,7 +281,7 @@ struct _mcs51_state_t
UINT8 (*sfr_read)(mcs51_state_t *mcs51_state, size_t offset);
/* Interrupt Callback */
- cpu_irq_callback irq_callback;
+ device_irq_callback irq_callback;
running_device *device;
/* Memory spaces */
@@ -651,8 +651,7 @@ 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->token != NULL);
- assert(device->type == CPU);
+ assert(device->type() == CPU);
assert(cpu_get_type(device) == CPU_I8031 ||
cpu_get_type(device) == CPU_I8032 ||
cpu_get_type(device) == CPU_I8051 ||
@@ -667,7 +666,7 @@ INLINE mcs51_state_t *get_safe_token(running_device *device)
cpu_get_type(device) == CPU_I87C52 ||
cpu_get_type(device) == CPU_AT89C4051 ||
cpu_get_type(device) == CPU_DS5002FP);
- return (mcs51_state_t *)device->token;
+ return (mcs51_state_t *)downcast<cpu_device *>(device)->token();
}
INLINE void clear_current_irq(mcs51_state_t *mcs51_state)
@@ -2080,9 +2079,9 @@ static CPU_INIT( mcs51 )
mcs51_state->irq_callback = irqcallback;
mcs51_state->device = device;
- mcs51_state->program = device->space(AS_PROGRAM);
- mcs51_state->data = device->space(AS_DATA);
- mcs51_state->io = device->space(AS_IO);
+ mcs51_state->program = device_memory(device)->space(AS_PROGRAM);
+ mcs51_state->data = device_memory(device)->space(AS_DATA);
+ mcs51_state->io = device_memory(device)->space(AS_IO);
mcs51_state->features = FEATURE_NONE;
mcs51_state->ram_mask = 0x7F; /* 128 bytes of ram */
@@ -2389,7 +2388,7 @@ static CPU_INIT( ds5002fp )
{
/* default configuration */
static const ds5002fp_config default_config = { 0x00, 0x00, 0x00 };
- const ds5002fp_config *sconfig = device->baseconfig().static_config ? (const ds5002fp_config *)device->baseconfig().static_config : &default_config;
+ const ds5002fp_config *sconfig = device->baseconfig().static_config() ? (const ds5002fp_config *)device->baseconfig().static_config() : &default_config;
mcs51_state_t *mcs51_state = get_safe_token(device);
CPU_INIT_CALL( mcs51 );
@@ -2476,7 +2475,7 @@ static CPU_SET_INFO( mcs51 )
static CPU_GET_INFO( mcs51 )
{
- mcs51_state_t *mcs51_state = (device != NULL && device->token != NULL) ? get_safe_token(device) : NULL;
+ mcs51_state_t *mcs51_state = (device != NULL && downcast<cpu_device *>(device)->token() != NULL) ? get_safe_token(device) : NULL;
switch (state)
{
diff --git a/src/emu/cpu/minx/minx.c b/src/emu/cpu/minx/minx.c
index fba6a4df76b..202b9a21da2 100644
--- a/src/emu/cpu/minx/minx.c
+++ b/src/emu/cpu/minx/minx.c
@@ -83,7 +83,7 @@ typedef struct {
UINT8 YI;
UINT8 halted;
UINT8 interrupt_pending;
- cpu_irq_callback irq_callback;
+ device_irq_callback irq_callback;
running_device *device;
const address_space *program;
int icount;
@@ -96,11 +96,10 @@ typedef struct {
INLINE minx_state *get_safe_token(running_device *device)
{
assert(device != NULL);
- assert(device->token != NULL);
- assert(device->type == CPU);
+ assert(device->type() == CPU);
assert(cpu_get_type(device) == CPU_MINX);
- return (minx_state *)device->token;
+ return (minx_state *)downcast<cpu_device *>(device)->token();
}
INLINE UINT16 rd16( minx_state *minx, UINT32 offset )
@@ -121,8 +120,8 @@ static CPU_INIT( minx )
minx_state *minx = get_safe_token(device);
minx->irq_callback = irqcallback;
minx->device = device;
- minx->program = device->space(AS_PROGRAM);
- if ( device->baseconfig().static_config != NULL )
+ minx->program = device_memory(device)->space(AS_PROGRAM);
+ if ( device->baseconfig().static_config() != NULL )
{
}
else
@@ -226,9 +225,9 @@ static unsigned minx_get_reg( minx_state *minx, int regnum )
{
switch( regnum )
{
- case REG_GENPC: return GET_MINX_PC;
+ case STATE_GENPC: return GET_MINX_PC;
case MINX_PC: return minx->PC;
- case REG_GENSP:
+ case STATE_GENSP:
case MINX_SP: return minx->SP;
case MINX_BA: return minx->BA;
case MINX_HL: return minx->HL;
@@ -251,9 +250,9 @@ static void minx_set_reg( minx_state *minx, int regnum, unsigned val )
{
switch( regnum )
{
- case REG_GENPC: break;
+ case STATE_GENPC: break;
case MINX_PC: minx->PC = val; break;
- case REG_GENSP:
+ case STATE_GENSP:
case MINX_SP: minx->SP = val; break;
case MINX_BA: minx->BA = val; break;
case MINX_HL: minx->HL = val; break;
@@ -313,7 +312,7 @@ static CPU_SET_INFO( minx )
CPU_GET_INFO( minx )
{
- minx_state *minx = (device != NULL && device->token != NULL) ? get_safe_token(device) : NULL;
+ minx_state *minx = (device != NULL && downcast<cpu_device *>(device)->token() != NULL) ? get_safe_token(device) : NULL;
switch( state )
{
case CPUINFO_INT_CONTEXT_SIZE: info->i = sizeof(minx_state); break;
@@ -336,8 +335,8 @@ CPU_GET_INFO( minx )
case DEVINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_IO: info->i = 0; break;
case DEVINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_IO: info->i = 0; break;
case CPUINFO_INT_INPUT_STATE + 0: info->i = 0; break;
- case CPUINFO_INT_REGISTER + REG_GENPC: info->i = GET_MINX_PC; break;
- case CPUINFO_INT_REGISTER + REG_GENSP:
+ case CPUINFO_INT_REGISTER + STATE_GENPC: info->i = GET_MINX_PC; break;
+ case CPUINFO_INT_REGISTER + STATE_GENSP:
case CPUINFO_INT_REGISTER + MINX_PC:
case CPUINFO_INT_REGISTER + MINX_SP:
case CPUINFO_INT_REGISTER + MINX_BA:
diff --git a/src/emu/cpu/mips/mips3com.c b/src/emu/cpu/mips/mips3com.c
index a0113413710..221f8318791 100644
--- a/src/emu/cpu/mips/mips3com.c
+++ b/src/emu/cpu/mips/mips3com.c
@@ -69,19 +69,19 @@ INLINE int tlb_entry_is_global(const mips3_tlb_entry *entry)
structure based on the configured type
-------------------------------------------------*/
-void mips3com_init(mips3_state *mips, mips3_flavor flavor, int bigendian, running_device *device, cpu_irq_callback irqcallback)
+void mips3com_init(mips3_state *mips, mips3_flavor flavor, int bigendian, running_device *device, device_irq_callback irqcallback)
{
- const mips3_config *config = (const mips3_config *)device->baseconfig().static_config;
+ const mips3_config *config = (const mips3_config *)device->baseconfig().static_config();
int tlbindex;
/* initialize based on the config */
memset(mips, 0, sizeof(*mips));
mips->flavor = flavor;
mips->bigendian = bigendian;
- mips->cpu_clock = device->clock;
+ mips->cpu_clock = device->clock();
mips->irq_callback = irqcallback;
mips->device = device;
- mips->program = device->space(AS_PROGRAM);
+ mips->program = device_memory(device)->space(AS_PROGRAM);
mips->icache_size = config->icache;
mips->dcache_size = config->dcache;
mips->system_clock = config->system_clock;
diff --git a/src/emu/cpu/mips/mips3com.h b/src/emu/cpu/mips/mips3com.h
index 26462b4b28a..282d208d002 100644
--- a/src/emu/cpu/mips/mips3com.h
+++ b/src/emu/cpu/mips/mips3com.h
@@ -194,7 +194,7 @@ struct _mips3_state
/* internal stuff */
mips3_flavor flavor;
- cpu_irq_callback irq_callback;
+ device_irq_callback irq_callback;
running_device *device;
const address_space *program;
UINT32 system_clock;
@@ -229,7 +229,7 @@ struct _mips3_state
FUNCTION PROTOTYPES
***************************************************************************/
-void mips3com_init(mips3_state *mips, mips3_flavor flavor, int bigendian, running_device *device, cpu_irq_callback irqcallback);
+void mips3com_init(mips3_state *mips, mips3_flavor flavor, int bigendian, running_device *device, device_irq_callback irqcallback);
void mips3com_exit(mips3_state *mips);
void mips3com_reset(mips3_state *mips);
diff --git a/src/emu/cpu/mips/mips3drc.c b/src/emu/cpu/mips/mips3drc.c
index c2ff2b70e40..0b2a72df334 100644
--- a/src/emu/cpu/mips/mips3drc.c
+++ b/src/emu/cpu/mips/mips3drc.c
@@ -276,8 +276,7 @@ static const UINT8 fpmode_source[4] =
INLINE mips3_state *get_safe_token(running_device *device)
{
assert(device != NULL);
- assert(device->token != NULL);
- assert(device->type == CPU);
+ assert(device->type() == CPU);
assert(cpu_get_type(device) == CPU_VR4300BE ||
cpu_get_type(device) == CPU_VR4300LE ||
cpu_get_type(device) == CPU_VR4310BE ||
@@ -294,7 +293,7 @@ INLINE mips3_state *get_safe_token(running_device *device)
cpu_get_type(device) == CPU_QED5271LE ||
cpu_get_type(device) == CPU_RM7000BE ||
cpu_get_type(device) == CPU_RM7000LE);
- return *(mips3_state **)device->token;
+ return *(mips3_state **)downcast<cpu_device *>(device)->token();
}
@@ -360,7 +359,7 @@ INLINE void save_fast_iregs(mips3_state *mips3, drcuml_block *block)
mips3_init - initialize the processor
-------------------------------------------------*/
-static void mips3_init(mips3_flavor flavor, int bigendian, running_device *device, cpu_irq_callback irqcallback)
+static void mips3_init(mips3_flavor flavor, int bigendian, running_device *device, device_irq_callback irqcallback)
{
drcfe_config feconfig =
{
@@ -381,7 +380,7 @@ static void mips3_init(mips3_flavor flavor, int bigendian, running_device *devic
fatalerror("Unable to allocate cache of size %d", (UINT32)(CACHE_SIZE + sizeof(*mips3)));
/* allocate the core memory */
- *(mips3_state **)device->token = mips3 = (mips3_state *)drccache_memory_alloc_near(cache, sizeof(*mips3));
+ *(mips3_state **)downcast<cpu_device *>(device)->token() = mips3 = (mips3_state *)drccache_memory_alloc_near(cache, sizeof(*mips3));
memset(mips3, 0, sizeof(*mips3));
/* initialize the core */
@@ -602,7 +601,7 @@ static CPU_SET_INFO( mips3 )
static CPU_GET_INFO( mips3 )
{
- mips3_state *mips3 = (device != NULL && device->token != NULL) ? get_safe_token(device) : NULL;
+ mips3_state *mips3 = (device != NULL && downcast<cpu_device *>(device)->token() != NULL) ? get_safe_token(device) : NULL;
switch (state)
{
/* --- the following bits of info are returned as 64-bit signed integers --- */
diff --git a/src/emu/cpu/mips/psx.c b/src/emu/cpu/mips/psx.c
index 2d3d9ddc1e8..e4ce31d14e0 100644
--- a/src/emu/cpu/mips/psx.c
+++ b/src/emu/cpu/mips/psx.c
@@ -184,7 +184,7 @@ struct _psxcpu_state
int multiplier_operation;
UINT32 multiplier_operand1;
UINT32 multiplier_operand2;
- cpu_irq_callback irq_callback;
+ device_irq_callback irq_callback;
running_device *device;
const address_space *program;
int bus_attached;
@@ -196,11 +196,10 @@ struct _psxcpu_state
INLINE psxcpu_state *get_safe_token(running_device *device)
{
assert(device != NULL);
- assert(device->token != NULL);
- assert(device->type == CPU);
+ assert(device->type() == CPU);
assert(cpu_get_type(device) == CPU_PSXCPU ||
cpu_get_type(device) == CPU_CXD8661R);
- return (psxcpu_state *)device->token;
+ return (psxcpu_state *)downcast<cpu_device *>(device)->token();
}
static const UINT32 mips_mtc0_writemask[]=
@@ -1633,11 +1632,11 @@ static void mips_state_register( const char *type, running_device *device )
static CPU_INIT( psxcpu )
{
psxcpu_state *psxcpu = get_safe_token(device);
-// psxcpu->intf = (psxcpu_interface *) device->baseconfig().static_config;
+// psxcpu->intf = (psxcpu_interface *) device->baseconfig().static_config();
psxcpu->irq_callback = irqcallback;
psxcpu->device = device;
- psxcpu->program = device->space(AS_PROGRAM);
+ psxcpu->program = device_memory(device)->space(AS_PROGRAM);
mips_state_register( "psxcpu", device );
}
@@ -6111,7 +6110,7 @@ static CPU_SET_INFO( psxcpu )
CPU_GET_INFO( psxcpu )
{
- psxcpu_state *psxcpu = (device != NULL && device->token != NULL) ? get_safe_token(device) : NULL;
+ psxcpu_state *psxcpu = (device != NULL && downcast<cpu_device *>(device)->token() != NULL) ? get_safe_token(device) : NULL;
switch (state)
{
/* --- the following bits of info are returned as 64-bit signed integers --- */
diff --git a/src/emu/cpu/mips/r3000.c b/src/emu/cpu/mips/r3000.c
index 7f5e2fc926e..94a08d52af3 100644
--- a/src/emu/cpu/mips/r3000.c
+++ b/src/emu/cpu/mips/r3000.c
@@ -137,7 +137,7 @@ struct _r3000_state
int icount;
int interrupt_cycles;
int hasfpu;
- cpu_irq_callback irq_callback;
+ device_irq_callback irq_callback;
running_device *device;
const address_space *program;
@@ -165,13 +165,12 @@ struct _r3000_state
INLINE r3000_state *get_safe_token(running_device *device)
{
assert(device != NULL);
- assert(device->token != NULL);
- assert(device->type == CPU);
+ 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);
- return (r3000_state *)device->token;
+ return (r3000_state *)downcast<cpu_device *>(device)->token();
}
@@ -300,7 +299,7 @@ static void set_irq_line(r3000_state *r3000, int irqline, int state)
static CPU_INIT( r3000 )
{
- const r3000_cpu_core *configdata = (const r3000_cpu_core *)device->baseconfig().static_config;
+ const r3000_cpu_core *configdata = (const r3000_cpu_core *)device->baseconfig().static_config();
r3000_state *r3000 = get_safe_token(device);
/* allocate memory */
@@ -313,7 +312,7 @@ static CPU_INIT( r3000 )
r3000->irq_callback = irqcallback;
r3000->device = device;
- r3000->program = device->space(AS_PROGRAM);
+ r3000->program = device_memory(device)->space(AS_PROGRAM);
}
@@ -1164,7 +1163,7 @@ static CPU_SET_INFO( r3000 )
static CPU_GET_INFO( r3000 )
{
- r3000_state *r3000 = (device != NULL && device->token != NULL) ? get_safe_token(device) : NULL;
+ r3000_state *r3000 = (device != NULL && downcast<cpu_device *>(device)->token() != NULL) ? get_safe_token(device) : NULL;
switch (state)
{
/* --- the following bits of info are returned as 64-bit signed integers --- */
diff --git a/src/emu/cpu/mn10200/mn10200.c b/src/emu/cpu/mn10200/mn10200.c
index 8fb39bc6954..1c66ae76d45 100644
--- a/src/emu/cpu/mn10200/mn10200.c
+++ b/src/emu/cpu/mn10200/mn10200.c
@@ -149,11 +149,10 @@ INLINE void mn102_change_pc(mn102_info *mn102, UINT32 pc)
INLINE mn102_info *get_safe_token(running_device *device)
{
assert(device != NULL);
- assert(device->token != NULL);
- assert(device->type == CPU);
+ assert(device->type() == CPU);
assert(cpu_get_type(device) == CPU_MN10200);
- return (mn102_info *)device->token;
+ return (mn102_info *)downcast<cpu_device *>(device)->token();
}
static void mn102_take_irq(mn102_info *mn102, int level, int group)
@@ -277,8 +276,8 @@ static CPU_INIT(mn10200)
memset(cpustate, 0, sizeof(mn102_info));
cpustate->device = device;
- cpustate->program = device->space(AS_PROGRAM);
- cpustate->io = device->space(AS_IO);
+ cpustate->program = device_memory(device)->space(AS_PROGRAM);
+ cpustate->io = device_memory(device)->space(AS_IO);
state_save_register_device_item(device, 0, cpustate->pc);
state_save_register_device_item_array(device, 0, cpustate->d);
@@ -2336,7 +2335,7 @@ static UINT32 mn10200_r(mn102_info *mn102, UINT32 adr, int type)
static CPU_SET_INFO(mn10200)
{
- mn102_info *cpustate = (device != NULL && device->token != NULL) ? get_safe_token(device) : NULL;
+ mn102_info *cpustate = (device != NULL && downcast<cpu_device *>(device)->token() != NULL) ? get_safe_token(device) : NULL;
switch (state)
{
@@ -2365,7 +2364,7 @@ static CPU_SET_INFO(mn10200)
CPU_GET_INFO( mn10200 )
{
- mn102_info *cpustate = (device != NULL && device->token != NULL) ? get_safe_token(device) : NULL;
+ mn102_info *cpustate = (device != NULL && downcast<cpu_device *>(device)->token() != NULL) ? get_safe_token(device) : NULL;
switch(state)
{
diff --git a/src/emu/cpu/nec/nec.c b/src/emu/cpu/nec/nec.c
index f85a2ae642e..b705963df27 100644
--- a/src/emu/cpu/nec/nec.c
+++ b/src/emu/cpu/nec/nec.c
@@ -160,7 +160,7 @@ struct _nec_state_t
UINT32 poll_state;
UINT8 no_interrupt;
- cpu_irq_callback irq_callback;
+ device_irq_callback irq_callback;
running_device *device;
const address_space *program;
const address_space *io;
@@ -184,14 +184,13 @@ struct _nec_state_t
INLINE nec_state_t *get_safe_token(running_device *device)
{
assert(device != NULL);
- assert(device->token != NULL);
- assert(device->type == CPU);
+ 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);
- return (nec_state_t *)device->token;
+ return (nec_state_t *)downcast<cpu_device *>(device)->token();
}
/* The interrupt number of a pending external interrupt pending NMI is 2. */
@@ -1101,9 +1100,9 @@ static CPU_DISASSEMBLE( nec )
return necv_dasm_one(buffer, pc, oprom, nec_state->config);
}
-static void nec_init(running_device *device, cpu_irq_callback irqcallback, int type)
+static void nec_init(running_device *device, device_irq_callback irqcallback, int type)
{
- const nec_config *config = device->baseconfig().static_config ? (const nec_config *)device->baseconfig().static_config : &default_config;
+ const nec_config *config = device->baseconfig().static_config() ? (const nec_config *)device->baseconfig().static_config() : &default_config;
nec_state_t *nec_state = get_safe_token(device);
nec_state->config = config;
@@ -1131,8 +1130,8 @@ static void nec_init(running_device *device, cpu_irq_callback irqcallback, int t
nec_state->irq_callback = irqcallback;
nec_state->device = device;
- nec_state->program = device->space(AS_PROGRAM);
- nec_state->io = device->space(AS_IO);
+ nec_state->program = device_memory(device)->space(AS_PROGRAM);
+ nec_state->io = device_memory(device)->space(AS_IO);
}
@@ -1321,7 +1320,7 @@ static CPU_SET_INFO( nec )
static CPU_GET_INFO( nec )
{
- nec_state_t *nec_state = (device != NULL && device->token != NULL) ? get_safe_token(device) : NULL;
+ nec_state_t *nec_state = (device != NULL && downcast<cpu_device *>(device)->token() != NULL) ? get_safe_token(device) : NULL;
int flags;
switch (state)
diff --git a/src/emu/cpu/pdp1/pdp1.c b/src/emu/cpu/pdp1/pdp1.c
index 3aecd7c0905..82ee77aa82b 100644
--- a/src/emu/cpu/pdp1/pdp1.c
+++ b/src/emu/cpu/pdp1/pdp1.c
@@ -425,10 +425,9 @@ struct _pdp1_state
INLINE pdp1_state *get_safe_token(running_device *device)
{
assert(device != NULL);
- assert(device->token != NULL);
- assert(device->type == CPU);
+ assert(device->type() == CPU);
assert(cpu_get_type(device) == CPU_PDP1);
- return (pdp1_state *)device->token;
+ return (pdp1_state *)downcast<cpu_device *>(device)->token();
}
static void execute_instruction(pdp1_state *cpustate);
@@ -539,14 +538,14 @@ static void pdp1_set_irq_line (pdp1_state *cpustate, int irqline, int state)
static CPU_INIT( pdp1 )
{
- const pdp1_reset_param_t *param = (const pdp1_reset_param_t *)device->baseconfig().static_config;
+ const pdp1_reset_param_t *param = (const pdp1_reset_param_t *)device->baseconfig().static_config();
pdp1_state *cpustate = get_safe_token(device);
int i;
/* clean-up */
memset (cpustate, 0, sizeof (*cpustate));
cpustate->device = device;
- cpustate->program = device->space(AS_PROGRAM);
+ cpustate->program = device_memory(device)->space(AS_PROGRAM);
/* set up params and callbacks */
for (i=0; i<64; i++)
@@ -937,7 +936,7 @@ static CPU_SET_INFO( pdp1 )
CPU_GET_INFO( pdp1 )
{
- pdp1_state *cpustate = (device != NULL && device->token != NULL) ? get_safe_token(device) : NULL;
+ pdp1_state *cpustate = (device != NULL && downcast<cpu_device *>(device)->token() != NULL) ? get_safe_token(device) : NULL;
switch (state)
{
diff --git a/src/emu/cpu/pdp1/tx0.c b/src/emu/cpu/pdp1/tx0.c
index dc4f6857994..29f925f5e74 100644
--- a/src/emu/cpu/pdp1/tx0.c
+++ b/src/emu/cpu/pdp1/tx0.c
@@ -71,11 +71,10 @@ struct _tx0_state
INLINE tx0_state *get_safe_token(running_device *device)
{
assert(device != NULL);
- assert(device->token != NULL);
- assert(device->type == CPU);
+ assert(device->type() == CPU);
assert(cpu_get_type(device) == CPU_TX0_64KW ||
cpu_get_type(device) == CPU_TX0_8KW);
- return (tx0_state *)device->token;
+ return (tx0_state *)downcast<cpu_device *>(device)->token();
}
#define READ_TX0_18BIT(A) ((signed)memory_read_dword_32be(cpustate->program, (A)<<2))
@@ -127,18 +126,18 @@ static void tx0_write(tx0_state *cpustate, offs_t address, int data)
;
}
-static void tx0_init_common(running_device *device, cpu_irq_callback irqcallback, int is_64kw)
+static void tx0_init_common(running_device *device, device_irq_callback irqcallback, int is_64kw)
{
tx0_state *cpustate = get_safe_token(device);
/* clean-up */
- cpustate->iface = (const tx0_reset_param_t *)device->baseconfig().static_config;
+ cpustate->iface = (const tx0_reset_param_t *)device->baseconfig().static_config();
cpustate->address_mask = is_64kw ? ADDRESS_MASK_64KW : ADDRESS_MASK_8KW;
cpustate->ir_mask = is_64kw ? 03 : 037;
cpustate->device = device;
- cpustate->program = device->space(AS_PROGRAM);
+ cpustate->program = device_memory(device)->space(AS_PROGRAM);
}
static CPU_INIT( tx0_64kw )
@@ -435,7 +434,7 @@ static CPU_SET_INFO( tx0 )
CPU_GET_INFO( tx0_64kw )
{
- tx0_state *cpustate = ( device != NULL && device->token != NULL ) ? get_safe_token(device) : NULL;
+ tx0_state *cpustate = ( device != NULL && downcast<cpu_device *>(device)->token() != NULL ) ? get_safe_token(device) : NULL;
switch (state)
{
@@ -561,7 +560,7 @@ CPU_GET_INFO( tx0_64kw )
CPU_GET_INFO( tx0_8kw )
{
- tx0_state *cpustate = ( device != NULL && device->token != NULL ) ? get_safe_token(device) : NULL;
+ tx0_state *cpustate = ( device != NULL && downcast<cpu_device *>(device)->token() != NULL ) ? get_safe_token(device) : NULL;
switch (state)
{
diff --git a/src/emu/cpu/pic16c5x/pic16c5x.c b/src/emu/cpu/pic16c5x/pic16c5x.c
index 5722e9206bc..d10bfe0911f 100644
--- a/src/emu/cpu/pic16c5x/pic16c5x.c
+++ b/src/emu/cpu/pic16c5x/pic16c5x.c
@@ -106,14 +106,13 @@ struct _pic16c5x_state
INLINE pic16c5x_state *get_safe_token(running_device *device)
{
assert(device != NULL);
- assert(device->token != NULL);
- assert(device->type == CPU);
+ 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);
- return (pic16c5x_state *)device->token;
+ return (pic16c5x_state *)downcast<cpu_device *>(device)->token();
}
@@ -730,9 +729,9 @@ static CPU_INIT( pic16c5x )
pic16c5x_state *cpustate = get_safe_token(device);
cpustate->device = device;
- cpustate->program = device->space(AS_PROGRAM);
- cpustate->data = device->space(AS_DATA);
- cpustate->io = device->space(AS_IO);
+ cpustate->program = device_memory(device)->space(AS_PROGRAM);
+ cpustate->data = device_memory(device)->space(AS_DATA);
+ cpustate->io = device_memory(device)->space(AS_IO);
/* ensure the internal ram pointers are set before get_info is called */
update_internalram_ptr(cpustate);
@@ -997,7 +996,7 @@ static CPU_SET_INFO( pic16c5x )
static CPU_GET_INFO( pic16c5x )
{
- pic16c5x_state *cpustate = (device != NULL && device->token != NULL) ? get_safe_token(device) : NULL;
+ pic16c5x_state *cpustate = (device != NULL && downcast<cpu_device *>(device)->token() != NULL) ? get_safe_token(device) : NULL;
switch (state)
{
diff --git a/src/emu/cpu/pic16c62x/pic16c62x.c b/src/emu/cpu/pic16c62x/pic16c62x.c
index fce03383309..98c97b162ed 100644
--- a/src/emu/cpu/pic16c62x/pic16c62x.c
+++ b/src/emu/cpu/pic16c62x/pic16c62x.c
@@ -96,8 +96,7 @@ struct _pic16c62x_state
INLINE pic16c62x_state *get_safe_token(running_device *device)
{
assert(device != NULL);
- assert(device->token != NULL);
- assert(device->type == CPU);
+ assert(device->type() == CPU);
assert(cpu_get_type(device) == CPU_PIC16C620 ||
cpu_get_type(device) == CPU_PIC16C620A ||
// cpu_get_type(device) == CPU_PIC16CR620A ||
@@ -105,7 +104,7 @@ INLINE pic16c62x_state *get_safe_token(running_device *device)
cpu_get_type(device) == CPU_PIC16C621A ||
cpu_get_type(device) == CPU_PIC16C622 ||
cpu_get_type(device) == CPU_PIC16C622A);
- return (pic16c62x_state *)device->token;
+ return (pic16c62x_state *)downcast<cpu_device *>(device)->token();
}
@@ -838,9 +837,9 @@ static CPU_INIT( pic16c62x )
pic16c62x_state *cpustate = get_safe_token(device);
cpustate->device = device;
- cpustate->program = device->space(AS_PROGRAM);
- cpustate->data = device->space(AS_DATA);
- cpustate->io = device->space(AS_IO);
+ cpustate->program = device_memory(device)->space(AS_PROGRAM);
+ cpustate->data = device_memory(device)->space(AS_DATA);
+ cpustate->io = device_memory(device)->space(AS_IO);
cpustate->CONFIG = 0x3fff;
@@ -1115,7 +1114,7 @@ static CPU_SET_INFO( pic16c62x )
static CPU_GET_INFO( pic16c62x )
{
- pic16c62x_state *cpustate = (device != NULL && device->token != NULL) ? get_safe_token(device) : NULL;
+ pic16c62x_state *cpustate = (device != NULL && downcast<cpu_device *>(device)->token() != NULL) ? get_safe_token(device) : NULL;
switch (state)
{
diff --git a/src/emu/cpu/powerpc/ppc.c b/src/emu/cpu/powerpc/ppc.c
index 95c6cde13a3..41d71c75007 100644
--- a/src/emu/cpu/powerpc/ppc.c
+++ b/src/emu/cpu/powerpc/ppc.c
@@ -305,7 +305,7 @@ typedef struct {
UINT64 tb; /* 56-bit timebase register */
- cpu_irq_callback irq_callback;
+ device_irq_callback irq_callback;
running_device *device;
const address_space *program;
@@ -929,7 +929,7 @@ static void ppc_init(void)
// !!! probably should move this stuff elsewhere !!!
static CPU_INIT( ppc403 )
{
- const ppc_config *configdata = device->baseconfig().static_config;
+ const ppc_config *configdata = device->baseconfig().static_config();
ppc_init();
@@ -963,7 +963,7 @@ static CPU_INIT( ppc403 )
ppc.irq_callback = irqcallback;
ppc.device = device;
- ppc.program = device->space(AS_PROGRAM);
+ ppc.program = device_memory(device)->space(AS_PROGRAM);
ppc.pvr = configdata->pvr;
}
@@ -975,7 +975,7 @@ static CPU_EXIT( ppc403 )
static CPU_INIT( ppc603 )
{
- const ppc_config *configdata = device->baseconfig().static_config;
+ const ppc_config *configdata = device->baseconfig().static_config();
int pll_config = 0;
float multiplier;
int i ;
@@ -1088,7 +1088,7 @@ static CPU_INIT( ppc603 )
ppc.irq_callback = irqcallback;
ppc.device = device;
- ppc.program = device->space(AS_PROGRAM);
+ ppc.program = device_memory(device)->space(AS_PROGRAM);
ppc.pvr = configdata->pvr;
@@ -1120,7 +1120,7 @@ static CPU_EXIT( ppc603 )
static CPU_INIT( ppc602 )
{
float multiplier;
- const ppc_config *configdata = device->baseconfig().static_config;
+ const ppc_config *configdata = device->baseconfig().static_config();
int i ;
@@ -1236,7 +1236,7 @@ static CPU_INIT( ppc602 )
ppc.irq_callback = irqcallback;
ppc.device = device;
- ppc.program = device->space(AS_PROGRAM);
+ ppc.program = device_memory(device)->space(AS_PROGRAM);
ppc.pvr = configdata->pvr;
@@ -1263,7 +1263,7 @@ static void mpc8240_tlbld(UINT32 op)
static CPU_INIT( mpc8240 )
{
float multiplier;
- const ppc_config *configdata = device->baseconfig().static_config;
+ const ppc_config *configdata = device->baseconfig().static_config();
int i ;
@@ -1377,7 +1377,7 @@ static CPU_INIT( mpc8240 )
ppc.irq_callback = irqcallback;
ppc.device = device;
- ppc.program = device->space(AS_PROGRAM);
+ ppc.program = device_memory(device)->space(AS_PROGRAM);
ppc.pvr = configdata->pvr;
@@ -1393,7 +1393,7 @@ static CPU_EXIT( mpc8240 )
static CPU_INIT( ppc601 )
{
- const ppc_config *configdata = device->baseconfig().static_config;
+ const ppc_config *configdata = device->baseconfig().static_config();
float multiplier;
int i ;
@@ -1503,7 +1503,7 @@ static CPU_INIT( ppc601 )
ppc.irq_callback = irqcallback;
ppc.device = device;
- ppc.program = device->space(AS_PROGRAM);
+ ppc.program = device_memory(device)->space(AS_PROGRAM);
ppc.pvr = configdata->pvr;
@@ -1521,7 +1521,7 @@ static CPU_EXIT( ppc601 )
static CPU_INIT( ppc604 )
{
- const ppc_config *configdata = device->baseconfig().static_config;
+ const ppc_config *configdata = device->baseconfig().static_config();
float multiplier;
int i ;
@@ -1633,7 +1633,7 @@ static CPU_INIT( ppc604 )
ppc.irq_callback = irqcallback;
ppc.device = device;
- ppc.program = device->space(AS_PROGRAM);
+ ppc.program = device_memory(device)->space(AS_PROGRAM);
ppc.pvr = configdata->pvr;
diff --git a/src/emu/cpu/powerpc/ppccom.c b/src/emu/cpu/powerpc/ppccom.c
index 2974b356a56..66cd194eb4a 100644
--- a/src/emu/cpu/powerpc/ppccom.c
+++ b/src/emu/cpu/powerpc/ppccom.c
@@ -286,9 +286,9 @@ INLINE int sign_double(double x)
structure based on the configured type
-------------------------------------------------*/
-void ppccom_init(powerpc_state *ppc, powerpc_flavor flavor, UINT8 cap, int tb_divisor, running_device *device, cpu_irq_callback irqcallback)
+void ppccom_init(powerpc_state *ppc, powerpc_flavor flavor, UINT8 cap, int tb_divisor, running_device *device, device_irq_callback irqcallback)
{
- const powerpc_config *config = (const powerpc_config *)device->baseconfig().static_config;
+ const powerpc_config *config = (const powerpc_config *)device->baseconfig().static_config();
/* initialize based on the config */
memset(ppc, 0, sizeof(*ppc));
@@ -296,14 +296,14 @@ void ppccom_init(powerpc_state *ppc, powerpc_flavor flavor, UINT8 cap, int tb_di
ppc->cap = cap;
ppc->cache_line_size = 32;
ppc->tb_divisor = tb_divisor;
- ppc->cpu_clock = device->clock;
+ ppc->cpu_clock = device->clock();
ppc->irq_callback = irqcallback;
ppc->device = device;
- ppc->program = device->space(AS_PROGRAM);
- ppc->system_clock = (config != NULL) ? config->bus_frequency : device->clock;
- ppc->tb_divisor = (ppc->tb_divisor * device->clock + ppc->system_clock / 2 - 1) / ppc->system_clock;
+ ppc->program = device_memory(device)->space(AS_PROGRAM);
+ ppc->system_clock = (config != NULL) ? config->bus_frequency : device->clock();
+ ppc->tb_divisor = (ppc->tb_divisor * device->clock() + ppc->system_clock / 2 - 1) / ppc->system_clock;
ppc->codexor = 0;
- if (!(cap & PPCCAP_4XX) && device->endianness() != ENDIANNESS_NATIVE)
+ if (!(cap & PPCCAP_4XX) && device_memory(device)->space_config()->m_endianness != ENDIANNESS_NATIVE)
ppc->codexor = 4;
/* allocate the virtual TLB */
@@ -1980,7 +1980,7 @@ updateirq:
static READ8_HANDLER( ppc4xx_spu_r )
{
- powerpc_state *ppc = *(powerpc_state **)space->cpu->token;
+ powerpc_state *ppc = *(powerpc_state **)downcast<cpu_device *>(space->cpu)->token();
UINT8 result = 0xff;
switch (offset)
@@ -2007,7 +2007,7 @@ static READ8_HANDLER( ppc4xx_spu_r )
static WRITE8_HANDLER( ppc4xx_spu_w )
{
- powerpc_state *ppc = *(powerpc_state **)space->cpu->token;
+ powerpc_state *ppc = *(powerpc_state **)downcast<cpu_device *>(space->cpu)->token();
UINT8 oldstate, newstate;
if (PRINTF_SPU)
@@ -2084,7 +2084,7 @@ ADDRESS_MAP_END
void ppc4xx_spu_set_tx_handler(running_device *device, ppc4xx_spu_tx_handler handler)
{
- powerpc_state *ppc = *(powerpc_state **)device->token;
+ powerpc_state *ppc = *(powerpc_state **)downcast<cpu_device *>(device)->token();
ppc->spu.tx_handler = handler;
}
@@ -2096,7 +2096,7 @@ void ppc4xx_spu_set_tx_handler(running_device *device, ppc4xx_spu_tx_handler han
void ppc4xx_spu_receive_byte(running_device *device, UINT8 byteval)
{
- powerpc_state *ppc = *(powerpc_state **)device->token;
+ powerpc_state *ppc = *(powerpc_state **)downcast<cpu_device *>(device)->token();
ppc4xx_spu_rx_data(ppc, byteval);
}
diff --git a/src/emu/cpu/powerpc/ppccom.h b/src/emu/cpu/powerpc/ppccom.h
index b9c038acb74..698dd1f228b 100644
--- a/src/emu/cpu/powerpc/ppccom.h
+++ b/src/emu/cpu/powerpc/ppccom.h
@@ -550,7 +550,7 @@ struct _powerpc_state
UINT32 mmu603_r[4];
/* internal stuff */
- cpu_irq_callback irq_callback;
+ device_irq_callback irq_callback;
running_device *device;
const address_space *program;
offs_t codexor;
@@ -571,7 +571,7 @@ struct _powerpc_state
FUNCTION PROTOTYPES
***************************************************************************/
-void ppccom_init(powerpc_state *ppc, powerpc_flavor flavor, UINT8 cap, int tb_divisor, running_device *device, cpu_irq_callback irqcallback);
+void ppccom_init(powerpc_state *ppc, powerpc_flavor flavor, UINT8 cap, int tb_divisor, running_device *device, device_irq_callback irqcallback);
void ppccom_exit(powerpc_state *ppc);
void ppccom_reset(powerpc_state *ppc);
diff --git a/src/emu/cpu/powerpc/ppcdrc.c b/src/emu/cpu/powerpc/ppcdrc.c
index ff8a5c8862d..0da960f9bea 100644
--- a/src/emu/cpu/powerpc/ppcdrc.c
+++ b/src/emu/cpu/powerpc/ppcdrc.c
@@ -438,8 +438,7 @@ static const UINT8 fcmp_cr_table_source[32] =
INLINE powerpc_state *get_safe_token(running_device *device)
{
assert(device != NULL);
- assert(device->token != NULL);
- assert(device->type == CPU);
+ assert(device->type() == CPU);
assert(cpu_get_type(device) == CPU_PPC403GA ||
cpu_get_type(device) == CPU_PPC403GCX ||
cpu_get_type(device) == CPU_PPC601 ||
@@ -449,7 +448,7 @@ INLINE powerpc_state *get_safe_token(running_device *device)
cpu_get_type(device) == CPU_PPC603R ||
cpu_get_type(device) == CPU_PPC604 ||
cpu_get_type(device) == CPU_MPC8240);
- return *(powerpc_state **)device->token;
+ return *(powerpc_state **)downcast<cpu_device *>(device)->token();
}
/*-------------------------------------------------
@@ -548,7 +547,7 @@ INLINE UINT32 compute_spr(UINT32 spr)
ppcdrc_init - initialize the processor
-------------------------------------------------*/
-static void ppcdrc_init(powerpc_flavor flavor, UINT8 cap, int tb_divisor, running_device *device, cpu_irq_callback irqcallback)
+static void ppcdrc_init(powerpc_flavor flavor, UINT8 cap, int tb_divisor, running_device *device, device_irq_callback irqcallback)
{
drcfe_config feconfig =
{
@@ -569,7 +568,7 @@ static void ppcdrc_init(powerpc_flavor flavor, UINT8 cap, int tb_divisor, runnin
fatalerror("Unable to allocate cache of size %d", (UINT32)(CACHE_SIZE + sizeof(*ppc)));
/* allocate the core from the near cache */
- *(powerpc_state **)device->token = ppc = (powerpc_state *)drccache_memory_alloc_near(cache, sizeof(*ppc));
+ *(powerpc_state **)downcast<cpu_device *>(device)->token() = ppc = (powerpc_state *)drccache_memory_alloc_near(cache, sizeof(*ppc));
memset(ppc, 0, sizeof(*ppc));
/* initialize the core */
@@ -794,7 +793,7 @@ static CPU_SET_INFO( ppcdrc )
static CPU_GET_INFO( ppcdrc )
{
- powerpc_state *ppc = (device != NULL && device->token != NULL) ? get_safe_token(device) : NULL;
+ powerpc_state *ppc = (device != NULL && downcast<cpu_device *>(device)->token() != NULL) ? get_safe_token(device) : NULL;
switch (state)
{
/* --- the following bits of info are returned as 64-bit signed integers --- */
@@ -1479,7 +1478,7 @@ static void static_generate_memory_accessor(powerpc_state *ppc, int mode, int si
/* on exit, read result is in I0 */
/* routine trashes I0-I3 */
drcuml_state *drcuml = ppc->impstate->drcuml;
- int fastxor = BYTE8_XOR_BE(0) >> (int)(ppc->device->databus_width(AS_PROGRAM) < 64);
+ int fastxor = BYTE8_XOR_BE(0) >> (int)(device_memory(ppc->device)->space_config(AS_PROGRAM)->m_databus_width < 64);
drcuml_block *block;
jmp_buf errorbuf;
int translate_type;
@@ -4291,7 +4290,7 @@ static void log_opcode_desc(drcuml_state *drcuml, const opcode_desc *desclist, i
static CPU_GET_INFO( ppcdrc4xx )
{
- powerpc_state *ppc = (device != NULL && device->token != NULL) ? get_safe_token(device) : NULL;
+ powerpc_state *ppc = (device != NULL && downcast<cpu_device *>(device)->token() != NULL) ? get_safe_token(device) : NULL;
CPU_GET_INFO_CALL(ppcdrc);
ppc4xx_get_info(ppc, state, info);
}
diff --git a/src/emu/cpu/rsp/rsp.c b/src/emu/cpu/rsp/rsp.c
index b1f2652f9d8..721a8ff0aaa 100644
--- a/src/emu/cpu/rsp/rsp.c
+++ b/src/emu/cpu/rsp/rsp.c
@@ -30,10 +30,9 @@ 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->token != NULL);
- assert(device->type == CPU);
+ assert(device->type() == CPU);
assert(cpu_get_type(device) == CPU_RSP);
- return (rsp_state *)device->token;
+ return (rsp_state *)downcast<cpu_device *>(device)->token();
}
#define SIMM16 ((INT32)(INT16)(op))
@@ -302,14 +301,14 @@ static CPU_INIT( rsp )
rsp_state *rsp = get_safe_token(device);
int regIdx;
int accumIdx;
- rsp->config = (const rsp_config *)device->baseconfig().static_config;
+ rsp->config = (const rsp_config *)device->baseconfig().static_config();
if (LOG_INSTRUCTION_EXECUTION)
rsp->exec_output = fopen("rsp_execute.txt", "wt");
rsp->irq_callback = irqcallback;
rsp->device = device;
- rsp->program = device->space(AS_PROGRAM);
+ rsp->program = device_memory(device)->space(AS_PROGRAM);
#if 1
// Inaccurate. RSP registers power on to a random state...
@@ -2866,7 +2865,7 @@ static CPU_SET_INFO( rsp )
CPU_GET_INFO( rsp )
{
- rsp_state *rsp = (device != NULL && device->token != NULL) ? get_safe_token(device) : NULL;
+ rsp_state *rsp = (device != NULL && downcast<cpu_device *>(device)->token() != NULL) ? get_safe_token(device) : NULL;
switch(state)
{
diff --git a/src/emu/cpu/rsp/rsp.h b/src/emu/cpu/rsp/rsp.h
index 4a206474401..02baab1f4f6 100644
--- a/src/emu/cpu/rsp/rsp.h
+++ b/src/emu/cpu/rsp/rsp.h
@@ -208,7 +208,7 @@ struct _rsp_state
UINT32 ppc;
UINT32 nextpc;
- cpu_irq_callback irq_callback;
+ device_irq_callback irq_callback;
running_device *device;
const address_space *program;
int icount;
diff --git a/src/emu/cpu/rsp/rspdrc.c b/src/emu/cpu/rsp/rspdrc.c
index 74f586488e1..4bee6959240 100644
--- a/src/emu/cpu/rsp/rspdrc.c
+++ b/src/emu/cpu/rsp/rspdrc.c
@@ -351,10 +351,9 @@ 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->token != NULL);
- assert(device->type == CPU);
+ assert(device->type() == CPU);
assert(cpu_get_type(device) == CPU_RSP);
- return *(rsp_state **)device->token;
+ return *(rsp_state **)downcast<cpu_device *>(device)->token();
}
/***************************************************************************
@@ -685,17 +684,17 @@ static const int vector_elements_2[16][8] =
{ 7, 7, 7, 7, 7, 7, 7, 7 }, // 7
};
-static void rspcom_init(rsp_state *rsp, running_device *device, cpu_irq_callback irqcallback)
+static void rspcom_init(rsp_state *rsp, running_device *device, device_irq_callback irqcallback)
{
int regIdx = 0;
int accumIdx;
memset(rsp, 0, sizeof(*rsp));
- rsp->config = (const rsp_config *)device->baseconfig().static_config;
+ rsp->config = (const rsp_config *)device->baseconfig().static_config();
rsp->irq_callback = irqcallback;
rsp->device = device;
- rsp->program = device->space(AS_PROGRAM);
+ rsp->program = device_memory(device)->space(AS_PROGRAM);
#if 1
// Inaccurate. RSP registers power on to a random state...
@@ -748,7 +747,7 @@ static CPU_INIT( rsp )
}
/* allocate the core memory */
- *(rsp_state **)device->token = rsp = (rsp_state *)drccache_memory_alloc_near(cache, sizeof(*rsp));
+ *(rsp_state **)downcast<cpu_device *>(device)->token() = rsp = (rsp_state *)drccache_memory_alloc_near(cache, sizeof(*rsp));
memset(rsp, 0, sizeof(*rsp));
rspcom_init(rsp, device, irqcallback);
@@ -8595,7 +8594,7 @@ static CPU_SET_INFO( rsp )
CPU_GET_INFO( rsp )
{
- rsp_state *rsp = (device != NULL && device->token != NULL) ? get_safe_token(device) : NULL;
+ rsp_state *rsp = (device != NULL && downcast<cpu_device *>(device)->token() != NULL) ? get_safe_token(device) : NULL;
switch(state)
{
diff --git a/src/emu/cpu/s2650/s2650.c b/src/emu/cpu/s2650/s2650.c
index 759cdfc897a..325b8bcb589 100644
--- a/src/emu/cpu/s2650/s2650.c
+++ b/src/emu/cpu/s2650/s2650.c
@@ -41,7 +41,7 @@ struct _s2650_regs {
UINT8 irq_state;
int icount;
- cpu_irq_callback irq_callback;
+ device_irq_callback irq_callback;
running_device *device;
const address_space *program;
const address_space *io;
@@ -50,10 +50,9 @@ struct _s2650_regs {
INLINE s2650_regs *get_safe_token(running_device *device)
{
assert(device != NULL);
- assert(device->token != NULL);
- assert(device->type == CPU);
+ assert(device->type() == CPU);
assert(cpu_get_type(device) == CPU_S2650);
- return (s2650_regs *)device->token;
+ return (s2650_regs *)downcast<cpu_device *>(device)->token();
}
/* condition code changes for a byte */
@@ -797,8 +796,8 @@ static CPU_INIT( s2650 )
s2650c->irq_callback = irqcallback;
s2650c->device = device;
- s2650c->program = device->space(AS_PROGRAM);
- s2650c->io = device->space(AS_IO);
+ s2650c->program = device_memory(device)->space(AS_PROGRAM);
+ s2650c->io = device_memory(device)->space(AS_IO);
state_save_register_device_item(device, 0, s2650c->ppc);
state_save_register_device_item(device, 0, s2650c->page);
@@ -829,8 +828,8 @@ static CPU_RESET( s2650 )
memset(s2650c->ras, 0, sizeof(s2650c->ras));
s2650c->device = device;
- s2650c->program = device->space(AS_PROGRAM);
- s2650c->io = device->space(AS_IO);
+ s2650c->program = device_memory(device)->space(AS_PROGRAM);
+ s2650c->io = device_memory(device)->space(AS_IO);
s2650c->psl = COM | WC;
/* force write */
s2650c->psu = 0xff;
@@ -1546,7 +1545,7 @@ static CPU_SET_INFO( s2650 )
CPU_GET_INFO( s2650 )
{
- s2650_regs *s2650c = (device != NULL && device->token != NULL) ? get_safe_token(device) : NULL;
+ s2650_regs *s2650c = (device != NULL && downcast<cpu_device *>(device)->token() != NULL) ? get_safe_token(device) : NULL;
switch (state)
{
/* --- the following bits of info are returned as 64-bit signed integers --- */
diff --git a/src/emu/cpu/saturn/saturn.c b/src/emu/cpu/saturn/saturn.c
index 3b739e77850..17920054d54 100644
--- a/src/emu/cpu/saturn/saturn.c
+++ b/src/emu/cpu/saturn/saturn.c
@@ -81,7 +81,7 @@ struct _saturn_state
UINT8 sleeping; /* low-consumption state */
int monitor_id;
int monitor_in;
- cpu_irq_callback irq_callback;
+ device_irq_callback irq_callback;
running_device *device;
const address_space *program;
int icount;
@@ -90,10 +90,9 @@ struct _saturn_state
INLINE saturn_state *get_safe_token(running_device *device)
{
assert(device != NULL);
- assert(device->token != NULL);
- assert(device->type == CPU);
+ assert(device->type() == CPU);
assert(cpu_get_type(device) == CPU_SATURN);
- return (saturn_state *)device->token;
+ return (saturn_state *)downcast<cpu_device *>(device)->token();
}
/***************************************************************
@@ -113,10 +112,10 @@ static CPU_INIT( saturn )
{
saturn_state *cpustate = get_safe_token(device);
- cpustate->config = (saturn_cpu_core *) device->baseconfig().static_config;
+ cpustate->config = (saturn_cpu_core *) device->baseconfig().static_config();
cpustate->irq_callback = irqcallback;
cpustate->device = device;
- cpustate->program = device->space(AS_PROGRAM);
+ cpustate->program = device_memory(device)->space(AS_PROGRAM);
state_save_register_device_item_array(device, 0,cpustate->reg[R0]);
state_save_register_device_item_array(device, 0,cpustate->reg[R1]);
@@ -305,7 +304,7 @@ static INT64 Reg64Int(Saturn64 r)
CPU_GET_INFO( saturn )
{
- saturn_state *cpustate = (device != NULL && device->token != NULL) ? get_safe_token(device) : NULL;
+ saturn_state *cpustate = (device != NULL && downcast<cpu_device *>(device)->token() != NULL) ? get_safe_token(device) : NULL;
switch (state)
{
diff --git a/src/emu/cpu/sc61860/sc61860.c b/src/emu/cpu/sc61860/sc61860.c
index 09baa0690f6..629c0ccfb9a 100644
--- a/src/emu/cpu/sc61860/sc61860.c
+++ b/src/emu/cpu/sc61860/sc61860.c
@@ -63,10 +63,9 @@ struct _sc61860_state
INLINE sc61860_state *get_safe_token(running_device *device)
{
assert(device != NULL);
- assert(device->token != NULL);
- assert(device->type == CPU);
+ assert(device->type() == CPU);
assert(cpu_get_type(device) == CPU_SC61860);
- return (sc61860_state *)device->token;
+ return (sc61860_state *)downcast<cpu_device *>(device)->token();
}
UINT8 *sc61860_internal_ram(running_device *device)
@@ -104,10 +103,10 @@ static CPU_RESET( sc61860 )
static CPU_INIT( sc61860 )
{
sc61860_state *cpustate = get_safe_token(device);
- cpustate->config = (sc61860_cpu_core *) device->baseconfig().static_config;
+ cpustate->config = (sc61860_cpu_core *) device->baseconfig().static_config();
timer_pulse(device->machine, ATTOTIME_IN_HZ(500), cpustate, 0, sc61860_2ms_tick);
cpustate->device = device;
- cpustate->program = device->space(AS_PROGRAM);
+ cpustate->program = device_memory(device)->space(AS_PROGRAM);
}
static CPU_EXECUTE( sc61860 )
@@ -174,7 +173,7 @@ static CPU_SET_INFO( sc61860 )
CPU_GET_INFO( sc61860 )
{
- sc61860_state *cpustate = (device != NULL && device->token != NULL) ? get_safe_token(device) : NULL;
+ sc61860_state *cpustate = (device != NULL && downcast<cpu_device *>(device)->token() != NULL) ? get_safe_token(device) : NULL;
switch (state)
{
/* --- the following bits of info are returned as 64-bit signed integers --- */
diff --git a/src/emu/cpu/scmp/scmp.c b/src/emu/cpu/scmp/scmp.c
index 5ebf5d57bd1..fbb965c55d0 100644
--- a/src/emu/cpu/scmp/scmp.c
+++ b/src/emu/cpu/scmp/scmp.c
@@ -35,7 +35,6 @@ struct _scmp_state
running_device *device;
const address_space *program;
const address_space *io;
- cpu_state_table state;
int icount;
devcb_resolved_write8 flag_out_func;
@@ -51,44 +50,15 @@ struct _scmp_state
***************************************************************************/
/***************************************************************************
- CPU STATE DESCRIPTION
-***************************************************************************/
-
-#define SCMP_STATE_ENTRY(_name, _format, _member, _datamask, _flags) \
- CPU_STATE_ENTRY(SCMP_##_name, #_name, _format, scmp_state, _member, _datamask, ~0, _flags)
-
-static const cpu_state_entry state_array[] =
-{
- SCMP_STATE_ENTRY(PC, "%04X", PC.w.l, 0xffff, 0)
- SCMP_STATE_ENTRY(GENPC,"%04X", PC.w.l, 0xffff, CPUSTATE_NOSHOW)
- SCMP_STATE_ENTRY(P1, "%04X", P1.w.l, 0xffff, 0)
- SCMP_STATE_ENTRY(P2, "%04X", P2.w.l, 0xffff, 0)
- SCMP_STATE_ENTRY(P3, "%04X", P3.w.l, 0xffff, 0)
- SCMP_STATE_ENTRY(AC, "%02X", AC, 0xff, 0)
- SCMP_STATE_ENTRY(ER, "%02X", ER, 0xff, 0)
- SCMP_STATE_ENTRY(SR, "%02X", SR, 0xff, 0)
-
-};
-
-static const cpu_state_table state_table_template =
-{
- NULL, /* pointer to the base of state (offsets are relative to this) */
- 0, /* subtype this table refers to */
- ARRAY_LENGTH(state_array), /* number of entries */
- state_array /* array of entries */
-};
-
-/***************************************************************************
INLINE FUNCTIONS
***************************************************************************/
INLINE scmp_state *get_safe_token(running_device *device)
{
assert(device != NULL);
- assert(device->token != NULL);
- assert(device->type == CPU);
+ assert(device->type() == CPU);
assert(cpu_get_type(device) == CPU_SCMP || cpu_get_type(device) == CPU_INS8060);
- return (scmp_state *)device->token;
+ return (scmp_state *)downcast<cpu_device *>(device)->token();
}
INLINE UINT16 ADD12(UINT16 addr, INT8 val)
@@ -528,16 +498,27 @@ static CPU_INIT( scmp )
{
scmp_state *cpustate = get_safe_token(device);
- if (device->baseconfig().static_config != NULL)
- cpustate->config = *(scmp_config *)device->baseconfig().static_config;
+ if (device->baseconfig().static_config() != NULL)
+ cpustate->config = *(scmp_config *)device->baseconfig().static_config();
+
/* set up the state table */
- cpustate->state = state_table_template;
- cpustate->state.baseptr = cpustate;
- cpustate->state.subtypemask = 1;
+ {
+ device_state_interface *state;
+ device->interface(state);
+ state->state_add(SCMP_PC, "PC", cpustate->PC.w.l);
+ state->state_add(STATE_GENPC, "GENPC", cpustate->PC.w.l).noshow();
+ state->state_add(STATE_GENFLAGS, "GENFLAGS", cpustate->SR).noshow().formatstr("%8s");
+ state->state_add(SCMP_P1, "P1", cpustate->P1.w.l);
+ state->state_add(SCMP_P2, "P2", cpustate->P2.w.l);
+ state->state_add(SCMP_P3, "P3", cpustate->P3.w.l);
+ state->state_add(SCMP_AC, "AC", cpustate->AC);
+ state->state_add(SCMP_ER, "ER", cpustate->ER);
+ state->state_add(SCMP_SR, "SR", cpustate->SR);
+ }
cpustate->device = device;
- cpustate->program = device->space(AS_PROGRAM);
+ cpustate->program = device_memory(device)->space(AS_PROGRAM);
/* resolve callbacks */
devcb_resolve_write8(&cpustate->flag_out_func, &cpustate->config.flag_out_func, device);
@@ -589,6 +570,26 @@ static CPU_EXPORT_STATE( scmp )
{
}
+static CPU_EXPORT_STRING( scmp )
+{
+ scmp_state *cpustate = get_safe_token(device);
+
+ switch (entry.index())
+ {
+ case STATE_GENFLAGS:
+ string.printf("%c%c%c%c%c%c%c%c",
+ (cpustate->SR & 0x80) ? 'C' : '.',
+ (cpustate->SR & 0x40) ? 'V' : '.',
+ (cpustate->SR & 0x20) ? 'B' : '.',
+ (cpustate->SR & 0x10) ? 'A' : '.',
+ (cpustate->SR & 0x08) ? 'I' : '.',
+ (cpustate->SR & 0x04) ? '2' : '.',
+ (cpustate->SR & 0x02) ? '1' : '.',
+ (cpustate->SR & 0x01) ? '0' : '.');
+ break;
+ }
+}
+
/***************************************************************************
COMMON SET INFO
***************************************************************************/
@@ -602,7 +603,7 @@ static CPU_SET_INFO( scmp )
CPU_GET_INFO( scmp )
{
- scmp_state *cpustate = (device != NULL && device->token != NULL) ? get_safe_token(device) : NULL;
+ scmp_state *cpustate = (device != NULL && downcast<cpu_device *>(device)->token() != NULL) ? get_safe_token(device) : NULL;
switch (state)
{
/* --- the following bits of info are returned as 64-bit signed integers --- */
@@ -637,10 +638,10 @@ CPU_GET_INFO( scmp )
case CPUINFO_FCT_DISASSEMBLE: info->disassemble = CPU_DISASSEMBLE_NAME(scmp); break;
case CPUINFO_FCT_IMPORT_STATE: info->import_state = CPU_IMPORT_STATE_NAME(scmp); break;
case CPUINFO_FCT_EXPORT_STATE: info->export_state = CPU_EXPORT_STATE_NAME(scmp); break;
+ case CPUINFO_FCT_EXPORT_STRING: info->export_string = CPU_EXPORT_STRING_NAME(scmp); break;
/* --- the following bits of info are returned as pointers --- */
case CPUINFO_PTR_INSTRUCTION_COUNTER: info->icount = &cpustate->icount; break;
- case CPUINFO_PTR_STATE_TABLE: info->state_table = &cpustate->state; break;
/* --- the following bits of info are returned as NULL-terminated strings --- */
case DEVINFO_STR_NAME: strcpy(info->s, "INS 8050 SC/MP"); break;
@@ -648,18 +649,6 @@ CPU_GET_INFO( scmp )
case DEVINFO_STR_VERSION: strcpy(info->s, "1.0"); break;
case DEVINFO_STR_SOURCE_FILE: strcpy(info->s, __FILE__); break;
case DEVINFO_STR_CREDITS: strcpy(info->s, "Copyright Miodrag Milanovic"); break;
-
- case CPUINFO_STR_FLAGS:
- sprintf(info->s, "%c%c%c%c%c%c%c%c",
- (cpustate->SR & 0x80) ? 'C' : '.',
- (cpustate->SR & 0x40) ? 'V' : '.',
- (cpustate->SR & 0x20) ? 'B' : '.',
- (cpustate->SR & 0x10) ? 'A' : '.',
- (cpustate->SR & 0x08) ? 'I' : '.',
- (cpustate->SR & 0x04) ? '2' : '.',
- (cpustate->SR & 0x02) ? '1' : '.',
- (cpustate->SR & 0x01) ? '0' : '.');
- break;
}
}
diff --git a/src/emu/cpu/scmp/scmp.h b/src/emu/cpu/scmp/scmp.h
index 968e9685bda..e8fccffe9ff 100644
--- a/src/emu/cpu/scmp/scmp.h
+++ b/src/emu/cpu/scmp/scmp.h
@@ -9,9 +9,9 @@
enum
{
SCMP_PC, SCMP_P1, SCMP_P2, SCMP_P3, SCMP_AC, SCMP_ER, SCMP_SR,
- SCMP_GENPC = REG_GENPC,
- SCMP_GENSP = REG_GENSP,
- SCMP_GENPCBASE = REG_GENPCBASE
+ SCMP_GENPC = STATE_GENPC,
+ SCMP_GENSP = STATE_GENSP,
+ SCMP_GENPCBASE = STATE_GENPCBASE
};
/***************************************************************************
diff --git a/src/emu/cpu/se3208/se3208.c b/src/emu/cpu/se3208/se3208.c
index a9726e0ed31..52abbf7152d 100644
--- a/src/emu/cpu/se3208/se3208.c
+++ b/src/emu/cpu/se3208/se3208.c
@@ -22,7 +22,7 @@ struct _se3208_state_t
UINT32 ER;
UINT32 PPC;
- cpu_irq_callback irq_callback;
+ device_irq_callback irq_callback;
running_device *device;
const address_space *program;
UINT8 IRQ;
@@ -61,10 +61,9 @@ static _OP *OpTable=NULL;
INLINE se3208_state_t *get_safe_token(running_device *device)
{
assert(device != NULL);
- assert(device->token != NULL);
- assert(device->type == CPU);
+ assert(device->type() == CPU);
assert(cpu_get_type(device) == CPU_SE3208);
- return (se3208_state_t *)device->token;
+ return (se3208_state_t *)downcast<cpu_device *>(device)->token();
}
INLINE UINT32 read_dword_unaligned(const address_space *space, UINT32 address)
@@ -1715,11 +1714,11 @@ static CPU_RESET( se3208 )
{
se3208_state_t *se3208_state = get_safe_token(device);
- cpu_irq_callback save_irqcallback = se3208_state->irq_callback;
+ device_irq_callback save_irqcallback = se3208_state->irq_callback;
memset(se3208_state,0,sizeof(se3208_state_t));
se3208_state->irq_callback = save_irqcallback;
se3208_state->device = device;
- se3208_state->program = device->space(AS_PROGRAM);
+ se3208_state->program = device_memory(device)->space(AS_PROGRAM);
se3208_state->PC=SE3208_Read32(se3208_state, 0);
se3208_state->SR=0;
se3208_state->IRQ=CLEAR_LINE;
@@ -1792,7 +1791,7 @@ static CPU_INIT( se3208 )
se3208_state->irq_callback = irqcallback;
se3208_state->device = device;
- se3208_state->program = device->space(AS_PROGRAM);
+ se3208_state->program = device_memory(device)->space(AS_PROGRAM);
}
static CPU_EXIT( se3208 )
@@ -1843,7 +1842,7 @@ static CPU_SET_INFO( se3208 )
CPU_GET_INFO( se3208 )
{
- se3208_state_t *se3208_state = (device != NULL && device->token != NULL) ? get_safe_token(device) : NULL;
+ se3208_state_t *se3208_state = (device != NULL && downcast<cpu_device *>(device)->token() != NULL) ? get_safe_token(device) : NULL;
switch (state)
{
diff --git a/src/emu/cpu/sh2/sh2.c b/src/emu/cpu/sh2/sh2.c
index a7150eca15c..8e8ba0d5e3c 100644
--- a/src/emu/cpu/sh2/sh2.c
+++ b/src/emu/cpu/sh2/sh2.c
@@ -2142,7 +2142,7 @@ static CPU_RESET( sh2 )
int save_is_slave;
void (*f)(UINT32 data);
- cpu_irq_callback save_irqcallback;
+ device_irq_callback save_irqcallback;
m = sh2->m;
tsave = sh2->timer;
diff --git a/src/emu/cpu/sh2/sh2comn.c b/src/emu/cpu/sh2/sh2comn.c
index cbeb42d3bcb..b31528fafb0 100644
--- a/src/emu/cpu/sh2/sh2comn.c
+++ b/src/emu/cpu/sh2/sh2comn.c
@@ -16,9 +16,9 @@
#define LOG(x) do { if (VERBOSE) logerror x; } while (0)
#ifdef USE_SH2DRC
-#define GET_SH2(dev) *(SH2 **)(dev)->token
+#define GET_SH2(dev) *(SH2 **)downcast<cpu_device *>(dev)->token()
#else
-#define GET_SH2(dev) (SH2 *)(dev)->token
+#define GET_SH2(dev) (SH2 *)downcast<cpu_device *>(dev)->token()
#endif
@@ -699,9 +699,9 @@ void sh2_exception(SH2 *sh2, const char *message, int irqline)
#endif
}
-void sh2_common_init(SH2 *sh2, running_device *device, cpu_irq_callback irqcallback)
+void sh2_common_init(SH2 *sh2, running_device *device, device_irq_callback irqcallback)
{
- const sh2_cpu_core *conf = (const sh2_cpu_core *)device->baseconfig().static_config;
+ const sh2_cpu_core *conf = (const sh2_cpu_core *)device->baseconfig().static_config();
sh2->timer = timer_alloc(device->machine, sh2_timer_callback, sh2);
timer_adjust_oneshot(sh2->timer, attotime_never, 0);
@@ -727,8 +727,8 @@ void sh2_common_init(SH2 *sh2, running_device *device, cpu_irq_callback irqcallb
}
sh2->irq_callback = irqcallback;
sh2->device = device;
- sh2->program = device->space(AS_PROGRAM);
- sh2->internal = device->space(AS_PROGRAM);
+ sh2->program = device_memory(device)->space(AS_PROGRAM);
+ sh2->internal = device_memory(device)->space(AS_PROGRAM);
state_save_register_device_item(device, 0, sh2->pc);
state_save_register_device_item(device, 0, sh2->r[15]);
diff --git a/src/emu/cpu/sh2/sh2comn.h b/src/emu/cpu/sh2/sh2comn.h
index f9559d72d0c..c9055133a08 100644
--- a/src/emu/cpu/sh2/sh2comn.h
+++ b/src/emu/cpu/sh2/sh2comn.h
@@ -114,7 +114,7 @@ typedef struct
UINT32 pcflushes[16]; // pcflush entries
INT8 irq_line_state[17];
- cpu_irq_callback irq_callback;
+ device_irq_callback irq_callback;
running_device *device;
const address_space *program;
const address_space *internal;
@@ -172,7 +172,7 @@ typedef struct
#endif
} SH2;
-void sh2_common_init(SH2 *sh2, running_device *device, cpu_irq_callback irqcallback);
+void sh2_common_init(SH2 *sh2, running_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);
diff --git a/src/emu/cpu/sh2/sh2drc.c b/src/emu/cpu/sh2/sh2drc.c
index 571ae8a237a..d0f98a19095 100644
--- a/src/emu/cpu/sh2/sh2drc.c
+++ b/src/emu/cpu/sh2/sh2drc.c
@@ -140,11 +140,10 @@ static void cfunc_DIV1(void *param);
INLINE SH2 *get_safe_token(running_device *device)
{
assert(device != NULL);
- assert(device->token != NULL);
- assert(device->type == CPU);
+ assert(device->type() == CPU);
assert(cpu_get_type(device) == CPU_SH1 ||
cpu_get_type(device) == CPU_SH2);
- return *(SH2 **)device->token;
+ return *(SH2 **)downcast<cpu_device *>(device)->token();
}
INLINE UINT16 RW(SH2 *sh2, offs_t A)
@@ -694,7 +693,7 @@ static CPU_INIT( sh2 )
fatalerror("Unable to allocate cache of size %d", (UINT32)(CACHE_SIZE + sizeof(SH2)));
/* allocate the core memory */
- *(SH2 **)device->token = sh2 = (SH2 *)drccache_memory_alloc_near(cache, sizeof(SH2));
+ *(SH2 **)downcast<cpu_device *>(device)->token() = sh2 = (SH2 *)drccache_memory_alloc_near(cache, sizeof(SH2));
memset(sh2, 0, sizeof(SH2));
/* initialize the common core parts */
@@ -797,7 +796,7 @@ static CPU_RESET( sh2 )
UINT32 *m;
void (*f)(UINT32 data);
- cpu_irq_callback save_irqcallback;
+ device_irq_callback save_irqcallback;
m = sh2->m;
tsave = sh2->timer;
@@ -3263,7 +3262,7 @@ static CPU_SET_INFO( sh2 )
CPU_GET_INFO( sh2 )
{
- SH2 *sh2 = (device != NULL && device->token != NULL) ? get_safe_token(device) : NULL;
+ SH2 *sh2 = (device != NULL && downcast<cpu_device *>(device)->token() != NULL) ? get_safe_token(device) : NULL;
switch (state)
{
/* --- the following bits of info are returned as 64-bit signed integers --- */
diff --git a/src/emu/cpu/sh4/sh4.c b/src/emu/cpu/sh4/sh4.c
index 11defd4522e..27f9b5f44f6 100644
--- a/src/emu/cpu/sh4/sh4.c
+++ b/src/emu/cpu/sh4/sh4.c
@@ -33,10 +33,9 @@ CPU_DISASSEMBLE( sh4 );
INLINE SH4 *get_safe_token(running_device *device)
{
assert(device != NULL);
- assert(device->token != NULL);
- assert(device->type == CPU);
+ assert(device->type() == CPU);
assert(cpu_get_type(device) == CPU_SH4);
- return (SH4 *)device->token;
+ return (SH4 *)downcast<cpu_device *>(device)->token();
}
/* Called for unimplemented opcodes */
@@ -3255,7 +3254,7 @@ static CPU_RESET( sh4 )
int savecpu_clock, savebus_clock, savepm_clock;
void (*f)(UINT32 data);
- cpu_irq_callback save_irqcallback;
+ device_irq_callback save_irqcallback;
m = sh4->m;
tsaved[0] = sh4->dma_timer[0];
@@ -3282,9 +3281,9 @@ static CPU_RESET( sh4 )
sh4->ftcsr_read_callback = f;
sh4->irq_callback = save_irqcallback;
sh4->device = device;
- sh4->internal = device->space(AS_PROGRAM);
- sh4->program = device->space(AS_PROGRAM);
- sh4->io = device->space(AS_IO);
+ sh4->internal = device_memory(device)->space(AS_PROGRAM);
+ sh4->program = device_memory(device)->space(AS_PROGRAM);
+ sh4->io = device_memory(device)->space(AS_IO);
sh4->dma_timer[0] = tsaved[0];
sh4->dma_timer[1] = tsaved[1];
@@ -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;
+ const struct sh4_config *conf = (const struct sh4_config *)device->baseconfig().static_config();
SH4 *sh4 = get_safe_token(device);
sh4_common_init(device);
@@ -3393,9 +3392,9 @@ static CPU_INIT( sh4 )
sh4->irq_callback = irqcallback;
sh4->device = device;
- sh4->internal = device->space(AS_PROGRAM);
- sh4->program = device->space(AS_PROGRAM);
- sh4->io = device->space(AS_IO);
+ sh4->internal = device_memory(device)->space(AS_PROGRAM);
+ sh4->program = device_memory(device)->space(AS_PROGRAM);
+ sh4->io = device_memory(device)->space(AS_IO);
sh4_default_exception_priorities(sh4);
sh4->irln = 15;
sh4->test_irq = 0;
@@ -3675,7 +3674,7 @@ ADDRESS_MAP_END
CPU_GET_INFO( sh4 )
{
- SH4 *sh4 = (device != NULL && device->token != NULL) ? get_safe_token(device) : NULL;
+ SH4 *sh4 = (device != NULL && downcast<cpu_device *>(device)->token() != NULL) ? get_safe_token(device) : NULL;
switch (state)
{
diff --git a/src/emu/cpu/sh4/sh4comn.c b/src/emu/cpu/sh4/sh4comn.c
index 18cf77fc8a3..ce8304887a9 100644
--- a/src/emu/cpu/sh4/sh4comn.c
+++ b/src/emu/cpu/sh4/sh4comn.c
@@ -33,10 +33,9 @@ static const UINT16 tcr[] = { TCR0, TCR1, TCR2 };
INLINE SH4 *get_safe_token(running_device *device)
{
assert(device != NULL);
- assert(device->token != NULL);
- assert(device->type == CPU);
+ assert(device->type() == CPU);
assert(cpu_get_type(device) == CPU_SH4);
- return (SH4 *)device->token;
+ return (SH4 *)downcast<cpu_device *>(device)->token();
}
void sh4_change_register_bank(SH4 *sh4, int to)
diff --git a/src/emu/c