summaryrefslogtreecommitdiffstatshomepage
path: root/src/emu/cpu/m6502
Commit message (Collapse)AuthorAgeFilesLines
* Replace "const address_space" with "address_space" throughout the system. Aaron Giles2010-08-194-13/+13
| | | | | | | | | | | The purpose of making it const before was to discourage direct tampering, but private/protected does a better job of that now anyhow, and it is annoying now. s/const[ \t]+address_space\b/address_space/g; Is basically what I did.
* Created CPU-specific device types for all CPUs, using new macros Aaron Giles2010-07-038-40/+39
| | | | | | | | | | | | | | | | | | | | | | | | | | DECLARE_LEGACY_CPU_DEVICE and DEFINE_LEGACY_CPU_DEVICE. Changed CPUs to be their own device types, rather than all of type CPU with a special internal subtype. Note that as part of this process I removed the CPU_ prefix from the ALL-CAPS device name, so CPU_Z80 is just plain old Z80 now. This required changing a couple of names like 8080 to I8080 so that there was an alphabetic first character. Added memory interfaces to the list of fast-access interfaces. To do this properly I had to add a separate method to devices which is called immediately after construction, when it is possible to perform dynamic_casts on fully-constructed objects. (This is just internal, no changes necessary to the devices themselves.) Some additional notes: * SH2 and SH4 had typedefs that conflicted with their CPU_-less names so I bulk renamed to structures to sh2_state and sh4_state; RB, feel free to choose alternate names if you don't like 'em * SCSP was caught doing something to the 3rd indexed CPU. Since several systems that use SCSP don't even have 3 CPUs, I had no idea what this was supposed to do, so I changed to it reference "audiocpu" assuming that stv was the assumed target. This is really gross and should be a configuration parameter, not a hard-coded assumption.
* Fixed missing cpu_device -> legacy_cpu_device (no whatsnew) Miodrag Milanovic2010-06-172-2/+2
|
* Change cpu_device into a base class. Rename old cpu_device to legacy_cpu_device. Aaron Giles2010-06-175-12/+12
| | | | Update interfaces as appropriate.
* Removed not needed constant, set proper return type and added call to m4510 ↵ Miodrag Milanovic2010-06-134-12/+7
| | | | core too (no whatsnew)
* Added back software list support in emu core, and update 6510 and SM8500 cpu ↵ Miodrag Milanovic2010-06-132-6/+3
| | | | cores with calls needed by MESS (no whatsnew)
* Change cpu execute function to just use the icount stuffed by Aaron Giles2010-06-094-24/+0
| | | | | the scheduler, rather than manging an incoming cycle count. It was confusing to have multiple sources of cycle counts.
* Changed CPU callbacks to use cpu_device, eliminating a bunch of casting. Aaron Giles2010-06-084-15/+15
|
* WARNING: There are likely to be regressions in both functionality and Aaron Giles2010-06-084-35/+31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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]
* rm logerror flood Michaël Banaan Ananas2010-05-231-3/+2
|
* - even more small company name cleanups Michaël Banaan Ananas2010-05-221-1/+1
| | | | - "Somecompany License -> "Somecompany license" (no caps) - corrected "licence" typos, there were lots
* Made device->tag and devconfig->tag into private member variables (m_tag). Aaron Giles2010-03-086-37/+37
| | | | | | Added inline tag() function to return a const char * version. Updated callers to use this instead of directly accessing tag.cstr() which was awkward.
* Remove some aliases between CPUINFO_ and DEVINFO_ to help clarify Aaron Giles2010-01-214-41/+41
| | | | | | usage. Also converted a few more places to use the new accessors.
* Correct a long-standing design flaw: device configuration state Aaron Giles2010-01-185-17/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | is now separate from runtime device state. I have larger plans for devices, so there is some temporary scaffolding to hold everything together, but this first step does separate things out. There is a new class 'running_device' which represents the state of a live device. A list of these running_devices sits in machine->devicelist and is created when a running_machine is instantiated. To access the configuration state, use device->baseconfig() which returns a reference to the configuration. The list of running_devices in machine->devicelist has a 1:1 correspondance with the list of device configurations in machine->config->devicelist, and most navigation options work equally on either (scanning by class, type, etc.) For the most part, drivers will now deal with running_device objects instead of const device_config objects. In fact, in order to do this patch, I did the following global search & replace: const device_config -> running_device device->static_config -> device->baseconfig().static_config device->inline_config -> device->baseconfig().inline_config and then fixed up the compiler errors that fell out. Some specifics: Removed device_get_info_* functions and replaced them with methods called get_config_*. Added methods for get_runtime_* to access runtime state from the running_device. DEVICE_GET_INFO callbacks are only passed a device_config *. This means they have no access to the token or runtime state at all. For most cases this is fine. Added new DEVICE_GET_RUNTIME_INFO callback that is passed the running_device for accessing data that is live at runtime. In the future this will go away to make room for a cleaner mechanism. Cleaned up the handoff of memory regions from the memory subsystem to the devices.
* Cleanups and version bump. Aaron Giles2010-01-161-1/+1
|
* Within src/emu, basic conversions: Aaron Giles2010-01-124-5/+5
| | | | | | devtag_get_device ... machine->device() memory_find_address_space ... device->space()
* First round of an attempted cleanup of header files in the system. Aaron Giles2010-01-108-38/+42
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Created new central header "emu.h"; this should be included by pretty much any driver or device as the first include. This file in turn includes pretty much everything a driver or device will need, minus any other devices it references. Note that emu.h should *never* be included by another header file. - Updated all files in the core (src/emu) to use emu.h. - Removed a ton of redundant and poorly-tracked header includes from within other header files. - Temporarily changed driver.h to map to emu.h until we update files outside of the core. Added class wrapper around tagmap so it can be directly included and accessed within objects that need it. Updated all users to embed tagmap objects and changed them to call through the class. Added nicer functions for finding devices, ports, and regions in a machine: machine->device("tag") -- return the named device, or NULL machine->port("tag") -- return the named port, or NULL machine->region("tag"[, &length[, &flags]]) -- return the named region and optionally its length and flags Made the device tag an astring. This required touching a lot of code that printed the device to explicitly fetch the C-string from it. (Thank you gcc for flagging that issue!)
* gcc 4.5.0 compilation fixes. Aaron Giles2009-12-292-6/+6
|
* Cleaned up braces in the code so that they are properly balanced. [Atari Ace] Aaron Giles2009-12-282-5/+4
|
* Results of running the latest srcclean. Aaron Giles2009-12-289-200/+200
|
* Remove remaining references to machine->cpu[n]. Removed cpu[n] array. Aaron Giles2009-09-082-2/+2
| | | | | Replaced with machine->firstcpu which is a fast access to the head of the list of CPUs.
* Another step. Moved the address-space related get_info constants Aaron Giles2009-07-084-43/+43
| | | | | | to devintrf (including endianness). Removed space array from the CPU class header. Made the memory system much more device-neutral. Various other cleanups along the way.
* Implemented a new DECO CPU-16 opcode, used by Express Raider for V-BLANK bit ↵ Angelo Salese2009-06-151-3/+3
| | | | | and a bunch of liberate.c games for TILT bit. Converted Express Raider to use the DECO CPU-16 core instead of the plain M6502. [Angelo Salese]
* Fixed a DECO16 CPU core bug that was causing issues with Pro Bowling part of ↵ Angelo Salese2009-06-141-1/+1
| | | | Pro Sports [Angelo Salese]
* Disabled an heavy logerror msg. Angelo Salese2009-06-131-0/+2
|
* Moved the configuration of m6502-family callbacks to the cpu configuration. Wilbert Pol2009-05-155-53/+75
|
* Fixed CPU_GET_INFO issues spotted by -validate in MESS debug build Fabio Priuli2009-04-112-2/+2
|
* CPU cores are now enabled on a per cpu core family basis instead of per cpu ↵ Wilbert Pol2009-03-253-96/+0
| | | | core variant. As a result CPUDEFS is no longer needed in the makefile.
* CPU cores now compile cleanly. Aaron Giles2009-03-155-87/+129
|
* Improved implementations for undocumented instructions 63, 67, 6f, 73, 77, ↵ Wilbert Pol2009-01-172-10/+82
| | | | 7b, 7f, 9c, 9e, ab, e3, e7, ef, f3, f7, fb, and ff in the n2a3 cpu core.
* PTR -> FCT naming for a few remaining items in CPU cores. [Duke, Aaron Giles] Aaron Giles2008-12-315-28/+28
|
* 02714: 3stooges: Speech works for a while, then starts going in and out of ↵ Aaron Giles2008-12-311-1/+4
| | | | | | | horrible noise and static Interim fix, waiting until 0.129 is done before trying to sort out IRQ handling for real.
* More cleanup. Added address-space-specific constants for the various Aaron Giles2008-12-204-42/+42
| | | | | | | | | | | | | | bus width and shift CPU interface constants. Changed all the cores to use them. Minor spacing cleanup in Z80, Z180, TMS34010, ADSP21xx cores. Changed ADSP21xx cores to accept a configuration struct instead of using set_info to specify serial port callbacks. Simplified the ADSP21xx get/set info significantly. Removed support for only including certain variants of the chips; they are now either all supported or all unsupported.
* Renamed CPUINFO_PTR_* to CPUINFO_FCT_* for function get infos. Aaron Giles2008-12-194-46/+46
| | | | Changed Z80 over to the new cpu_state_table mechanism.
* Removed index and clock parameters from CPU_INIT function. Aaron Giles2008-12-181-7/+7
|
* From: Atari Ace [atari_ace@verizon.net] Aaron Giles2008-12-174-0/+12
| | | | | | | | | | | | | | | | | | | | | Sent: Tuesday, December 16, 2008 12:20 PM To: submit@mamedev.org Cc: atariace@hotmail.com Subject: [patch] Migrate CPU defines to cpu header files Hi mamedev, This patch migrates all the CPU definitions into the cpu header files. The #defines and CPU_GET_INFO declarations were added by hand to the cpu cores in the first patch, plus a few partly related fixes to the non-DRC cores. The second patch was produced by the attached script which inserts all needed #includes, except for two that were added by hand in the first patch. The first patch also removed an extra define of N2A03_DEFAULTCLOCK that would have caused problems with the second patch. ~aa
* Removed get context/set context calls from the CPU interface entirely. Aaron Giles2008-12-114-8/+0
| | | | Pointer-ified the TMS99xx core (missed that one!)
* Enabled all CPU cores/variants. Fixed compile issue revealed as a result. Aaron Giles2008-12-101-1/+1
|
* Completed pointer-izing the 6502 cores. Removed h6280 SET_CONTEXT calls. Aaron Giles2008-12-093-68/+10
|
* Re-routed empty get/set context calls to the dummy CPU's, and removed them Aaron Giles2008-12-091-6/+2
| | | | | | | | | from the CPU cores. Disabled the use of PULSE_LINE for any input lines except NMI and RESET. Added a helper function generic_pulse_irq_line() for doing a single-cycle assert/deassert for those few drivers remaining that were trying to use PULSE_LINE directly.
* From: Atari Ace [mailto:atari_ace@verizon.net] Aaron Giles2008-12-074-4/+0
| | | | | | | | | | | | | | | | | | Sent: Saturday, December 06, 2008 4:52 PM To: submit@mamedev.org Cc: atariace@hotmail.com Subject: [patch] Deprecat.h cleanup Hi mamedev, This patch changes some global Machine references to use machine, device->machine, ... instead, and removes any unneeded #include "deprecat.h" lines as well (about 10% of them in fact). It was generated using the attached script, and then reverting some cases where it was overzealous. ~aa
* 02638: various cpu cores don't compile anymore Aaron Giles2008-12-061-1/+0
| | | | (mostly fixed before)
* activecpu_count -= 133 Aaron Giles2008-12-061-16/+16
| | | | Removed mostly silly uses of activecpu from the CPU cores.
* Changed save state system to accept machine parameters where Aaron Giles2008-12-051-13/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | appropriate, and to keep all global variables hanging off the machine structure. Once again, this means all state registration call sites have been touched: - state_save_register_global* now takes a machine parameter - state_save_register_item* now takes a machine parameter - added new state_save_register_device_item* which now uses the device name and tag to generate the base name Extended the fake sound devices to have more populated fields. Modified sound cores to use tags from the devices and simplified the start function. Renumbered CPU and sound get/set info constants to align with the device constants, and shared values where they were perfectly aligned. Set the type field in the fake device_configs for CPU and sound chips to a get_info stub which calls through to the CPU and sound specific get_info functions. This means the device_get_info() functions work for CPU and sound cores, even in their fake state. Changed device information getters from device_info() to device_get_info() to match the CPU and sound macros.
* CPU_IS_LE -> ENDIANNESS_LITTLE Aaron Giles2008-12-044-4/+4
| | | | | | CPU_IS_BE -> ENDIANNESS_BIG Also fixed help for step over/in to specify correct keys.
* Moves empty brackets to the same line as CPU_(GET|SET)_CONTEXT calls. Andrew Gardner2008-11-301-6/+2
| | | This makes it easy to grep the CPU code to figure out which cores still need pointer-ification.
* Removed cpunum_get_active() calls from a number of CPU cores. Aaron Giles2008-11-2619-751/+744
| | | | | Normalized 6502 state variable to the generic 'cpustate' which makes the macros work more cleanly.
* Cleanups and version bump for 0.128u4.mame0128u4 Aaron Giles2008-11-241-1/+1
|
* change_pc? What change_pc? Aaron Giles2008-11-2412-94/+22
|
* Removed NO_LEGACY_MEMORY_HANDLERS defines. Aaron Giles2008-11-244-5/+0
|