summaryrefslogtreecommitdiffstatshomepage
path: root/src/emu/cpuintrf.h
Commit message (Collapse)AuthorAgeFilesLines
* WARNING: There are likely to be regressions in both functionality and Aaron Giles2010-06-081-429/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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]
* Made device->tag and devconfig->tag into private member variables (m_tag). Aaron Giles2010-03-081-1/+1
| | | | | | 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-211-16/+0
| | | | | | usage. Also converted a few more places to use the new accessors.
* Correct a long-standing design flaw: device configuration state Aaron Giles2010-01-181-82/+71
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* Created new template class tagged_list which manages a simple list Aaron Giles2010-01-171-4/+4
| | | | | | | | along with a tagmap. Changed memory regions, input ports, and devices to use this class. For devices, converted typenext and classnext fields into methods which dynamically search for the next item. Changed a number of macros to use the features of the class, removing the need for a bunch of helper functions.
* First round of an attempted cleanup of header files in the system. Aaron Giles2010-01-101-5/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | - 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!)
* Results of running the latest srcclean. Aaron Giles2009-12-281-3/+3
|
* Added new module tagmap which is a simple hashed string map. Aaron Giles2009-11-231-3/+3
| | | | | | Updated device and input port lists to use the tagmap for tag searches. Also removed the whole "quark" thing from the validity checker in favor of using the tagmaps.
* Added 'options' parameter to the CPU_DISASSEMBLE prototype. For now, the Aaron Giles2009-09-071-4/+4
| | | | | debugger always passes 0 for this. unidasm has been updated to accept a mode parameter, which is passed for the options.
* Expanded address maps from 3 to 4. Moved ADDRESS_SPACE_PROGRAM/DATA/IO Aaron Giles2009-07-091-4/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | constants to cpuintrf, as those names are really only applicable to CPUs. Added new ADDRESS_MAP_0/1/2/3 constants to identify address maps more generically. Updated memory system to be more general about address map handling. Added the concept of default address maps (in addition to the already existing internal memory maps). The difference between internal and default memory maps is that internal memory maps always override everything (including user-specified maps), but default memory maps simply provide a default that can be overridden. Converted the okim6295 sound driver to use address maps for access. By default, it defines a ROM address map that overlays its full region. As a result, the validity checks require all okim6295 regions to be at least 256k, unless you provide your own address map. Updated all regions to meet this requirement. Updated the atarijsa code to use a custom address space for its okim6295 accesses (which are banked on the first half and static on the second half), as an example of configuring a device with a custom address space. For now, attempts to use okim6295_set_bank_base() will still work, though banking for the okim chips should be moved to custom address maps in the drivers eventually. The first time okim6295_set_bank_base() is called, it will install a banked memory handler over the region and use memory_set_bankptr() to change the base on subsequent bank switches. Moved address map validity checks to be run for each device instead of just each CPU.
* Another step. Moved the address-space related get_info constants Aaron Giles2009-07-081-37/+27
| | | | | | 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.
* Deprecated device_set_info. Almost all devices had a NULL or empty Aaron Giles2009-04-231-1/+3
| | | | | | | | | function here. Remaining devices have been converted to have device-specific functions to do the same thing with proper type checking. CPUs still have a set_info function but it is CPU-specific now and no longer piggybacks on the general device function.
* CPU interface organization shuffle. The file cpuintrf.h now merely Aaron Giles2008-12-221-130/+21
| | | | | | | | | | | | | | | | | | | describes the interface, but does not contain any implementation. All remaining bits of implementation have been migrated either to cpuexec.c or to debugcpu.c. Specifically, cpu_dasm() is now debug_cpu_disassemble(), and cpu_set_dasm_override() is now debug_cpu_set_dasm_override(). Also moved memory_address_physical() to debug_cpu_translate(), since it was only ever used for debugging. Changed all CPU and sound cores to use memory_find_address_space() instead of cpu_get_address_space(). The former is reliable even during early initialization when the CPU cores generally need it. Removed the dummy CPU core and cpuintrf.c. Changed the core execution loop to directly call the execute function instead of using the inline helper (which has been removed).
* More cleanup. Added address-space-specific constants for the various Aaron Giles2008-12-201-8/+30
| | | | | | | | | | | | | | 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.
* Fixed registers view to only show those entries valid for the Aaron Giles2008-12-191-0/+1
| | | | CPU type.
* Renamed CPUINFO_PTR_* to CPUINFO_FCT_* for function get infos. Aaron Giles2008-12-191-26/+26
| | | | Changed Z80 over to the new cpu_state_table mechanism.
* This update is the below two patches, plus the remaining changes Aaron Giles2008-12-191-4/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | necessary to remove 12 of the final 14 references to the global Machine. The remaining 2 are in fatalerror() and logerror(), which are both local to mame.c, so Machine is now fully static. -- From: Atari Ace [mailto:atari_ace@verizon.net] Sent: Thursday, December 18, 2008 5:47 PM To: submit@mamedev.org Cc: atariace@hotmail.com Subject: [patch] Make Machine static followup Hi mamedev, This incremental patch to my last patch undoes the change that caches the ppu2c0x videorom. I changed the code back to how it behaved originally, using an existing machine on the chip struct to eliminate the one troublesome Machine reference. ~aa -- From: Atari Ace [mailto:atari_ace@verizon.net] Sent: Thursday, December 18, 2008 2:54 PM To: submit@mamedev.org Cc: atariace@hotmail.com Subject: [patch] Make Machine static! Hi mamedev, This large patch completes the removal of the use of Machine throughout MAME. It does so primarily by adding machine, device or space to various apis and modifying the callers, but for some remaining cases it adds a new api, mame_get_running_machine(), which will be called instead. There are only 14 uses of this api currently, and that number should drop over time. There are a few changes of note: 1. 6821pia.c. I attached machine to the 'device' structure. I'm working on converting this to a proper device, but that change isn't ready. 2. fddebug.c. I added a proper header so that the apis won't get accidentally converted to static again. 3. scsi.c. I added a machine to SCSIInstance. 4. system16.c. I modified sys16_patch_code to take an array of patches. 4. custom.h. I added the owning sound device to the reset/stop routines as well as the token. Note that passing only the device would require exposing the internals of custom_sound, as the token passed is not the device token, but the token returned from the CUSTOM_START routine. Better ideas here are welcome. 4. ppc2c0x.c. To avoid changing more interfaces, the init routine saves the videorom location rather than looks it up each time. I tried to choose what I felt was the natural parameter for an api, rather than always pass machine, but in some cases I used machine to limit the number of additional changes. Some additional cleanup here is probably warranted, I'll look into that later once I'm recovered from this two-week project. ~aa
* Cleaned up device and sound interfaces to match the CPU Aaron Giles2008-12-191-69/+120
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | interfaces when handling strings. Namely, the generic get_info functions allocate a temporary string and the device in question copies its string to the target, instead of assigning a const char *. Updated all device and sound cores to operate this way. Added the concept of a cpu_state_table, which is supplied by the CPU cores and which describes all the register state accessible to the debugger and other subsystems. The format of the table is such that most data can be simply fetched from memory without the further involvement of the CPU core, including the display of common formats. Extensibility points are available for custom display and for importing/exporting the data to intermediate variables for more complicated scenarios. Updated the ADSP21xx, TMS340x0, and i86 cores to use this. Removed the old debugger register list, which was never used. Replaced it with using ordering from the cpu_state_table. Renamed REG_PC -> REG_GENPC, REG_SP -> REG_GENSP, and REG_PREVIOUSPC -> REG_GENPCBASE. Updated a few spots that were using these directly. Moved these definitions into the end of the register area rather than leaving them outside which put them in a weird range.
* Removed index and clock parameters from CPU_INIT function. Aaron Giles2008-12-181-3/+3
|
* From: Atari Ace [atari_ace@verizon.net] Aaron Giles2008-12-171-449/+0
| | | | | | | | | | | | | | | | | | | | | 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
* More device normalization: Aaron Giles2008-12-161-98/+31
| | | | | | | | | | cpu_get_info_* -> device_get_info_* cpu_set_info_* -> device_set_info_* cpu_reset -> device_reset Removed the cputype_get_* macros as they are not necessary. Removed cpuintrf_init() which is no longer necessary.
* Made CPUs into proper devices. CPUs are now added in the Aaron Giles2008-12-161-276/+501
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | machine configuration just as any other device, and the standard CPU configuration is performed via the inline configuration macros. Change cpu_type from an enumeration into a pointer to the CPU's get_info function, very similar to device behavior. For now all CPUs are declared in cpuintrf.h, but eventually they should be declared in the CPU's header file, and the driver should #include that header. Added function cpu_get_type() to return the CPU type. Changed several cpu_* functions into macros that call through to the equivalent device_* function. The device system now maintains a parallel list of devices based on type, for faster iteration through all devices of a given type. Cleaned up code that looped over CPUs via the machine->cpu array to now loop using the type-based device list. Removed start/stop/reset/nvram functions from the device_config in favor of grabbing them as needed. Cleaned up the generic interrupt_enable code to work with CPU devices instead of numbers. Mapped the devtag_* functions to device_* functions via macros instead of parallel implementations.
* Fixed remaining crash regressions from recent changes. Aaron Giles2008-12-131-0/+2
|
* Removed safe_cpu_get_pc() which doesn't really make sense anymore. Aaron Giles2008-12-111-14/+12
| | | | Moved cpu_execute() to be an inline function.
* Removed get context/set context calls from the CPU interface entirely. Aaron Giles2008-12-111-20/+0
| | | | Pointer-ified the TMS99xx core (missed that one!)
* Here's the big one.... Aaron Giles2008-12-111-9/+3
| | | | | | | | | | | | | | | | | | | | | | | | Added new function cpuexec_describe_context(machine) which can be used in logerror() and other printf-style functions to return a description of the current CPU/PC given only the machine. Changed several dozen sites to use this instead of directly interrogating the activecpu. Removed all other uses of activecpu throughout the system. Removed activecpu from the machine structure to prevent future abuse. Removed cpu_push_context() and cpu_pop_context(), and all call sites. Voodoo devices now require a CPU to be defined in the configuration in order to know whom to steal cycles from or stall when FIFOs get full. Updated all voodoo users to specify one. CPD1869 devices now also require a CPU to be defined in the configuration, in order to know which CPU's registers to fetch. Updated all cdp1869 users to specify one. Many other small changes to make this all work.
* Re-routed empty get/set context calls to the dummy CPU's, and removed them Aaron Giles2008-12-091-0/+3
| | | | | | | | | 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.
* Removed cpunum_get_active(). Aaron Giles2008-12-061-3/+0
| | | | | Main important change is that IDE controllers with bus mastering (DMA) need to specify the target address space in the IDE device configuration.
* Changed save state system to accept machine parameters where Aaron Giles2008-12-051-71/+85
| | | | | | | | | | | | | | | | | | | | | | | | | | | 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-041-9/+1
| | | | | | CPU_IS_BE -> ENDIANNESS_BIG Also fixed help for step over/in to specify correct keys.
* Big debugger cleanup. Aaron Giles2008-12-031-70/+1
| | | | | | | | | | | | | | | | | | | | | | | Important note for OSD ports: the get/set property functions have been retired for debug_views. Instead, there are specific functions to perform each get/set operation. In addition, the format of the update callback has changed to pass the osd private data in, and the update callback/osd private data must be passed in at view allocation time. And osd_wait_for_debugger() now gets a CPU object instead of the machine. Removed extra debugger tracking for address spaces and added some of the useful data to the address_space structure. Updated all debugger commands and views to use CPU and address space objects where appropriate. Added new memory functions for converting between bytes and addresses, and for performing translations for a given address space. Removed debugger macros that did similar things in favor of calling these functions. Rewrote most of the memory view handling. Disasm and register views still need some additional tweaking.
* Removed cpu_read_byte/cpu_write_byte. Fixed a few lingering compiler Aaron Giles2008-11-231-13/+0
| | | | issues. Fixed Z8000 crash.
* Another big one. Aaron Giles2008-11-201-1/+24
| | | | | | | | | | | | | | | | | | | | Moved memory global state into a struct hanging off of the machine. Updated almost all memory APIs to take an address_space * where appropriate, and updated all callers. Changed memory internals to use address spaces where appropriate. Changed accessors to point to the memory_* functions instead of the address space-specific functions. Improved internal handling of watchpoints. Added cputag_* functions: cputag_reset(), cputag_get_index(), cputag_get_address_space(). These just expand via macros to an initial fetch of the CPU via cputag_get_cpu() followed by the standard CPU call. Added debugger_interrupt_hook() and debugger_exception_hook() calls which intelligently look at the debugger flags before calling. Did minimal cleanup of debugger, mainly moving CPU-specific data to hang off of the CPU classdata for more direct access.
* Fixed "H8/3344" to "H8/3334" as per Guru. R. Belmont2008-11-191-1/+1
|
* Big H8 update R. Belmont2008-11-191-0/+1
| | | | | | | | | | | | H8: - Added support for 8-bit H8 family MCUs, starting with the H8/3344 - Pointer-ified all H8 cores - Some cleanup and renames toward additional future work System 23: - Added extremely preliminary support for I/O boards with the H8/3344 - Added new game: Motocross Go! (MG3 Ver. A) [credit Guru]
* Pointerized the COP400 CPU cores. Curt Coder2008-11-181-6/+15
|
* Generalized the concept of opbase access into "direct" access. Aaron Giles2008-11-171-3/+0
| | | | | | | | Removed opbase globals to the address_space structure. Cleaned up names of pointers (decrypted and raw versus rom and ram). Added inline functions to read/write data via any address space. Added macros for existing functions to point them to the new functions. Other related cleanups.
* Disassemblers now get the CPU object. Aaron Giles2008-11-161-3/+3
|
* Const-ified the return from cpu_get_address_space. Aaron Giles2008-11-151-1/+1
| | | | Fixed a few errors.
* WARNING: this compiles, but not fully cleanly, and a number of drivers Aaron Giles2008-11-141-3/+17
| | | | | | | | | | | | | | | | are broken. Changed READ/WRITE handlers to accept an address_space * instead of a machine *. The address_space object was enhanced to contain a machine and a pointer to the relevant CPU object. Fixed a number of errors found by the compiler, mostly in the core and CPU/sound handlers, but there is a lot remaining to fix. Added new function cpu_get_address_space() to fetch the address space for calling in manually to these functions. In some instances, code which should eventually be converted to a device is hard-coding fetching the program space of CPU #0 in order to have something valid to pass.
* Massive API cleanup/change. The primary goal is that all CPU- Aaron Giles2008-11-131-112/+402
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | related APIs now take a device pointer instead of an index. All functions that take a CPU device are prefixed with cpu_* All functions that are globally related to cpu execution are prefixed with cpuexec_*. Below is a list of some of the mappings: cpu_boost_interleave -> cpuexec_boost_interleave cpunum_suspend -> cpu_suspend cpunum_resume -> cpu_resume cpunum_is_suspended -> cpu_is_suspended cpunum_get_clock -> cpu_get_clock cpunum_set_clock -> cpu_set_clock cpunum_get_clockscale -> cpu_get_clockscale cpunum_set_clockscale -> cpu_set_clockscale cpunum_get_localtime -> cpu_get_local_time cpunum_gettotalcycles -> cpu_get_total_cycles activecpu_eat_cycles -> cpu_eat_cycles activecpu_adjust_icount -> cpu_adjust_icount cpu_trigger -> cpuexec_trigger cpu_triggertime -> cpuexec_triggertime cpunum_set_input_line -> cpu_set_input_line cpunum_set_irq_callback -> cpu_set_irq_callback In addition, a number of functions retain the same name but now require a specific CPU parameter to be passed in: cpu_yield cpu_spin cpu_spinuntil_time cpu_spinuntil_int cpu_spinuntil_trigger cpu_triggerint Merged cpuint.c into cpuexec.c. One side-effect of this change is that driver reset callbacks are called AFTER the CPUs and devices are reset. This means that if you make changes to the CPU state and expect the reset vectors to recognize the changes in your reset routine, you will need to manually reset the CPU after making the change (since it has already been reset). Added a number of inline helper functions to cpuintrf.h for managing addresses Removed cpu_gettotalcpu(). This information is rarely needed outside of the core and can be obtained by looking at the machine->cpu[] array. Changed CPU interrupt acknowledge callbacks to pass a CPU device instead of machine/cpunum pair. Changed VBLANK and periodic timer callbacks to pass a CPU device instead of machine/cpunum pair. Renamed all information getters from cpu_* to cpu_get_* and from cputype_* to cputype_get_*.
* Added CPU device parameters to all CPU callbacks except for the Aaron Giles2008-11-101-38/+39
| | | | | | | | context ones (which are going away), the disassembler (which should have no dependencies on the live CPU), and the validity check. Removed global token from all pointer-ified CPU cores that don't have internal read/write callbacks (which still need to reference it).
* Major cpuintrf changes: Aaron Giles2008-11-101-132/+67
| | | | | | | | | | | | | | | | | | | | | | * added a set of cpu_* calls which accept a CPU device object; these are now the preferred means of manipulating a CPU * removed the cpunum_* calls; added an array of cpu[] to the running_machine object; converted all existing cpunum_* calls to cpu_* calls, pulling the CPU device object from the new array in the running_machine * removed the activecpu_* calls; added an activecpu member to the running_machine object; converted all existing activecpu_* calls to cpu_* calls, pulling the active CPU device object from the running_machine * changed cpuintrf_push_context() to cpu_push_context(), taking a CPU object pointer; changed cpuintrf_pop_context() to cpu_pop_context(); eventually these will go away * many other similar changes moving toward a model where all CPU references are done by the CPU object and not by index
* Populated tag and static_config parts of fake CPU device. Removed 'config' Aaron Giles2008-11-091-5/+4
| | | | | parameter from CPU_INIT. Modified CPU cores to pull config from the device static_config.
* Added macros for all CPU callbacks to ease future changes. Aaron Giles2008-11-081-17/+65
| | | | Updated all CPU cores to use them.
* WARNING: This is a significant change. If you are risk-averse and Aaron Giles2008-11-061-6/+30
| | | | | | | | | | | | | | | | | | | | | working on something, hold off syncing. Defined macros for core CPU functions: CPU_INIT, CPU_RESET, CPU_EXIT, CPU_EXECUTE, along with macros for the name and for calling, in the spirit of the devintrf.h macros. More will come later. Changed init, reset, exit, and execute interfaces to be passed a const device_config * object. This is a fake object for the moment, but encapsulates the machine pointer and token. Eventually this will be a real device. Changed the CPU IRQ callbacks to a proper type, and added a device parameter to them. Updated all CPU cores to the new macros and parameters. Note that this changes the way we "pointer"-ify cores. I'll send an update shortly.
* Adding per-device and per-CPU validity checks Nathan Woods2008-07-061-0/+3
|
* Several miscellaneous changes: Aaron Giles2008-05-291-2/+18
| | | | | | | | | | | | | | | | | | | | | | | | 1. In the MIPS core: - renamed struct mips3_config -> mips3_config - updated all drivers to the new names - removed MIPS3DRC_STRICT_COP0 flag, which is no longer used - a few minor cleanups 2. In the CPU interface: - added new 'intention' parameter to the translate callback to indicate read/write/fetch access, user/supervisor mode, and a flag for debugging - updated all call sites to pass an appropriate value - updated all CPU cores to the new prototype 3. In the UML: - added new opcode SETC to set the carry flag from a source bit - added new opcode BSWAP to swap bytes within a value - updated C, x86, x64 back-ends to support the new opcodes - updated disassembler to support the new opcodes 4. In the DRC frontend: - fixed bug in handling edge case with the PC near the 0 or ~0
* WIP check-in. Things work now, but I'm still working on the code. Aaron Giles2008-03-091-2/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | Converted address maps to tokens. Changed the address_map structure to house global map-wide information and hung a list of entries off of it corresponding to each address range. Introduced new functions address_map_alloc() and address_map_free() to build/destroy these structures. Updated all code as necessary. Fixed several instances of porttagtohandler*() in the address maps. Drivers should use AM_READ_PORT() macros instead. ADDRESS_MAP_EXTERN() now is required to specify the number of databits, just like ADDRESS_MAP_START. Removed ADDRESS_MAP_FLAGS() grossness. There are now three new macros which replace its former usage. ADDRESS_MAP_GLOBAL_MASK(mask) specifies a global address-space-wide mask on all addresses. Useful for cases where one or more address lines simply are not used at all. And ADDRESS_MAP_UNMAP_LOW/HIGH specifies the behavior of unmapped reads (do they come back as 0 or ~0). Changed internal memory mapping behavior to keep only a single address map and store the byte-adjusted values next in the address map entries rather than maintaining two separate maps. Many other small internal changes/cleanups.
* Normalized function pointer typedefs: they are now all Aaron Giles2008-03-031-40/+40
| | | | | | | | | | suffixed with _func. Did this throughout the core and drivers I was familiar with. Fixed gcc compiler error with recent render.c changes. gcc does not like explicit (int) casts on float or double functions. This is fracking annoying and stupid, but there you have it.