| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
constructor and a static allocation function.
Changed MDRV_DRIVER_DATA to reference driver_data::alloc
instead of just providing a size. This function is called
to allocate the driver data. This allows objects to be
embedded in the state data and be properly initialized.
Ideally, new driver_data constructors should perform
initialization actions in the constructor, but for now
most just use auto_alloc_clear() to blast everything to
zero.
Moved driver data allocation after device list construction
so that devices can be found when the driver data is
constructed.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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 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!)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
osd_free(). They take the same parameters as malloc() and free().
Renamed mamecore.h -> emucore.h.
New C++-aware memory manager, implemented in emualloc.*. This is a
simple manager that allows you to add any type of object to a
resource pool. Most commonly, allocated objects are added, and so
a set of allocation macros is provided to allow you to manage
objects in a particular pool:
pool_alloc(p, t) = allocate object of type 't' and add to pool 'p'
pool_alloc_clear(p, t) = same as above, but clear the memory first
pool_alloc_array(p, t, c) = allocate an array of 'c' objects of type
't' and add to pool 'p'
pool_alloc_array_clear(p, t, c) = same, but with clearing
pool_free(p, v) = free object 'v' and remove it from the pool
Note that pool_alloc[_clear] is roughly equivalent to "new t" and
pool_alloc_array[_clear] is roughly equivalent to "new t[c]". Also
note that pool_free works for single objects and arrays.
There is a single global_resource_pool defined which should be used
for any global allocations. It has equivalent macros to the pool_*
macros above that automatically target the global pool.
In addition, the memory module defines global new/delete overrides
that access file and line number parameters so that allocations can
be tracked. Currently this tracking is only done if MAME_DEBUG is
enabled. In debug builds, any unfreed memory will be printed at
the end of the session.
emualloc.h also has #defines to disable malloc/free/realloc/calloc.
Since emualloc.h is included by emucore.h, this means pretty much
all code within the emulator is forced to use the new allocators.
Although straight new/delete do work, their use is discouraged, as
any allocations made with them will not be tracked.
Changed the familar auto_alloc_* macros to map to the resource pool
model described above. The running_machine is now a class and contains
a resource pool which is automatically destructed upon deletion. If
you are a driver writer, all your allocations should be done with
auto_alloc_*.
Changed all drivers and files in the core using malloc/realloc or the
old alloc_*_or_die macros to use (preferably) the auto_alloc_* macros
instead, or the global_alloc_* macros if necessary.
Added simple C++ wrappers for astring and bitmap_t, as these need
proper constructors/destructors to be used for auto_alloc_astring and
auto_alloc_bitmap.
Removed references to the winalloc prefix file. Most of its
functionality has moved into the core, save for the guard page
allocations, which are now implemented in osd_alloc and osd_free.
|
| |
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
|
|
|
|
|
|
|
| |
future lookup optimizations.
By and large, the only things that used 2-character tags were bulk-
converted sound chips which were generally mapped to "ym" or "ay"
(and a few others). These were changed to "ymsnd" and "aysnd",
mimicking the way CPUs were changed from "main" to "maincpu" a while
back.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
> From: Atari Ace [mailto:atari_ace@verizon.net]
> Sent: Sunday, September 27, 2009 7:58 AM
> To: submit@mamedev.org
> Cc: atariace@hotmail.com
> Subject: [patch] More _NAME macros
>
> Hi mamedev,
>
> MAME's idiom for function/data macros is to first implement
> <name>_NAME, then implement the other macros in terms of the _NAME
> macro. Then in principle only a single line needs editing to change
> the naming convention.
>
> This patchset implements this idiom more completely. The first patch
> adds some missing _NAME macros and fixes cases in source files that
> should be using the macros. The second patch then changes header
> files where the macros should have been used, but weren't. This
> required changing the idiom for removing a machine driver function
> pointer from MDRV_<FUNCTION>(NULL) to MDRV_<FUNCTION>(0), to avoid
> problems with NULL being macro expanded. This actually unifies the
> handling of all such cases, as we already had ipt_0 and driver_init_0.
> It also required reworking the devtempl.h implementation in a way that
> triggered a warning on MSVC about using empty macros, so vconv.c
> needed to be updated. The third patch then renames all the _NAME and
> _0 macros to verify that all the cases have been covered, so it isn't
> intended to be applied.
>
> ~aa
|
|
|
|
|
|
|
|
| |
MDRV macros in the device for specifying address maps. Changed
the memory system to fetch the maps from the new location.
This is just a small step toward the end goal of getting address
maps into arbitrary devices.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
assumption that all device tags are unique. Specifically, the
following no longer need to provide a device type:
AM_DEVREAD/WRITE
DEVCB_DEVICE_HANDLER
devtag_get_device
devtag_reset
device_list_find_by_tag
as well as several device interfaces that referenced other devices.
Also fixed assertion due to overflow in the recent sound fix.
|
|
|
|
|
|
|
|
|
|
|
|
| |
This was primarily added to allow for sound routes to be supported in a way that
is compatible with the current driver structure. A device can now define a
DEVICE_CUSTOM_CONFIG callback which is called whenever one of the
MCONFIG_TOKEN_DEVICE_CONFIG_CUSTOM_* tokens is encountered. A special token
MCONFIG_TOKEN_DEVICE_CONFIG_CUSTOM_FREE is defined to clean up memory allocated
and/or reset the custom configuration, and is called when the device is torn down
to allow for memory cleanup.
Reimplemented the sound routing using this new mechanism.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Please note: regression testing is in progress, but the first round
of glaring regressions have already been taken care of. That said,
there is likely to be a host of regressions as a result of this
change.
Also note: There are still a few rough edges in the interfaces. I
will try to clean them up systematically once the basic system is
working.
All sound chips are now proper devices.
Merged the sound chip interface into the device interface,
removing any differences (such as the whole ALIASing concept).
Modified every sound chip in the following ways:
* updated to match the device interface
* reduced read/write handlers down to the minimal number
* added the use of get_safe_token() for ensuring correctness
* other minor cleanup
Removed the custom sound device. The additional work to just make
custom sound cases into full devices is minimal, so I just converted
them all over to be actual devices.
Vastly simplified the sound interfaces, removing the ghastly
sndti_* business and moving everyone over to using tags for
sound identity. sndintrf, like cpuintrf, is now just a header
file with no implementation.
Modified each and every driver that references a sound chip:
* all memory maps explicitly reference the targeted device via
AM_DEVREAD/AM_DEVWRITE/AM_DEVREADWRITE
* 16-bit and 32-bit accesses to 8-bit chips no longer use
trampoline functions but instead use the 8-bit AM_DEVREAD/WRITE
macros
* all references to sound chips are now done via tags
* note that these changes are brute force, not optimal; in many
cases drivers should grab pointers to devices in MACHINE_START
and stash them away
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Sent: Monday, December 22, 2008 3:00 PM
To: submit@mamedev.org
Cc: atariace@hotmail.com
Subject: [patch] Make SOUND_xxx pointers to SND_GET_INFO functions
Hi mamedev,
This patch probably should wait till after 0.129 goes out, but may be
of interest regardless. It makes the treatment of SOUND_xxx the same
as that of CPU_xxx. That is, they are function pointers to the
SND_GET_INFO routine for the sound.
The first patch just adds some missing include files and modifies a
few cases where a sound_type was used as an integer. This could go in
now. The second patch then adds the needed #defines to all the sound
headers (it assumes the previous patch I sent to add the SND_GET_INFO
declarations was applied), and modifies the sound code accordingly. It
also moves the sound clock to the device object. Note that the dummy
sound core is removed entirely. I cheated a bit and made VERIFY_SNDTI
also declare and fill in the sndnum, making this an INLINE function
would probably be more appropriate, but all of this code's days are
numbered.
There may be some performance loss in drivers that expect sndti_xxx
routines to be fast, since sound_matrix has been removed. The
performance however should be similar to looking up items in a
devicelist, so those drivers will have to adjust eventually.
~aa
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
quantum in terms of "frames" (a dubious concept now with multiple
screens and changing refresh rates). Replaced it with a new
MDRV_QUANTUM_TIME(x) which specifies the minimum scheduling quantum
as a time value. Time can be specified as HZ(x), NSEC(x), USEC(x),
etc. Updated all drivers to use this, assuming 60 was the frame
rate (this is not perfect but should work for almost all cases).
Changed MDRV_WATCHDOG_INIT_TIME(x) to automatically prepend
UINT64_ATTOTIME_IN_ to the parameter, ensuring there is no
improper use of this macro and bringing it in line with the
MDRV_QUANTUM_TIME() macro. Updated all callers.
Added new MDRV_QUANTUM_PERFECT_CPU(x) to specify that the minimum
quantum should be enough to ensure that the specified CPU tag
only ever executes a single instruction at a time. This can be
used to explicitly require "perfect" synchronization for drivers
that have multiple CPUs with shared memory. Turned this on for
the arknoid2 driver for now as a test (the interleave on that
driver was already very close to perfect anyway).
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
specified when the device is added, and the clock is available in
the device_config directly via device->clock. Updated all devices
that have a clock to specify it when adding the device, rather than
as part of their configuration. As part of this work, also created
device-specific _ADD and _REMOVE macros to simplify configuration.
Dfined a generic device execute function callback, though it
is not used yet. The long term plan is that any device with an
execute callback will be scheduled along with the CPUs. Now that
CPUs are devices, their scheduling will be moved over to this
logic eventually.
Changed various NVRAM devices to fetch their default memory region
from the device->region rather than specifying it in the
configuration.
Moved a number of CPUINFO_PTR_* constants to CPUINFO_FCT_*.
Fixed several drivers that manually created their own gfx_elements
to fill in the machine object, so they no longer crash.
Fixed incorrect CPU display on info screen (recently broken).
Moved device startup to *before* the DRIVER_INIT is called. This
is to allow the DRIVER_INIT to configure devices that have been
properly allocated. So far I don't see any negative effects, but
be on the lookout if something weird shows up.
Rewrote the device iteration logic to make use of the typenext
field and the newly-introduced classnext field for iterating more
efficiently through devices of a given type or class.
Fixed behavior of MDRV_CPU_REPLACE so it does not delete and then
re-add a CPU (causing the order to change).
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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 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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Sent: Wednesday, November 05, 2008 8:22 AM
To: submit@mamedev.org
Cc: atariace@hotmail.com
Subject: [patch] Add ADDRESS_MAP_NAME macro
Hi mamedev,
In theory, MAME's interface macros should completely hide the naming
conventions from the drivers and sound/cpu cores. So as an
experiment, I renamed all the core apis and looked to see what broke.
The most common api coupling was with address maps in the CPU cores,
which this patch addresses by introducing a new macro,
ADDRESS_MAP_NAME (mimicing what is done in devintrf.h). There were a
handful of related problems in some drivers which this patch also
fixes. Some remaining issues I left alone (laserdisk apis reference
rom, video_update, machine_config, ksys573 use of nvram_handler,
megadriv use of ipt), in principle all the apis need _NAME variants to
encode the conventions.
~aa
|
| |
|
|
|
|
| |
there were only a few cases where longer tags were in use.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
now have their tags auto-prefixed with the device's tag. This allows for
multiple instances to be present. For example, the PR-8210 laserdisc player
has a CPU with a tag of "pr8210". When it is included as a device by a
driver, the driver may tag the device "laserdisc". The resulting final
CPU tag name will be "laserdisc:pr8210". Also updated the debugger
expression engine to support names with embedded colons.
Added warnings to ensure that tags used for CPUs, sound chips, regions, and
devices follow some basic rules: they should be less than 12 characters long,
be all lower-case, and only contain letters, numbers, underscores, or dots
(no spaces). This is to ensure that they can be used properly in debugger
expressions and don't get too long or unwieldy to type (even 12 chars is a
bit long).
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
device to provide a set of ROM regions to be loaded along with the game
ROMs. It is expected that most regions defined for devices will use the
ROMREGION_LOADBYNAME flag to enable the ROMs to live in a central location.
Added new device interface selector: DEVINFO_PTR_MACHINE_CONFIG. This allows
a device to specify a partial machine driver which is appended to the end of
the machine driver for any game using that device. The intention for this is
to allow devices which have their own BIOS logic to specify CPUs and other
characteristics common to all systems using the device.
Added new ROMREGION flag: ROMREGION_LOADBYNAME, which means that if the ROMs
in that region are not found in the usual driver files, then the name of the
region will be used as a driver filename for loading.
Extended the ldcore interface structure to allow each player type to provide
its own ROM region and partial machine driver.
Moved preliminary PR-8210 emulation code from ldplayer.c to ldpr8210.c. It
is currently disabled behind the EMULATE_PR8210_ROM compile time flag.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
array is involved, it seems to think it is not a constant expression.
Added MDRV_DEVICE_CONFIG_DATA32_EXPLICIT() macro which takes an explicit
size and offset. Changed MDRV_DEVICE_CONFIG_DATA32() to be built off of
this macro. Added MDRV_DEVICE_CONFIG_DATA32_ARRAY() and
MDRV_DEVICE_CONFIG_DATA32_ARRAY_MEMBER() which do explicit computations
of the offset to work around MSVC's problems.
Replicated these changes for DATA64 and DATAPTR macros. Updated latch8.h
to use the new macros.
|
|
|
|
|
| |
Tagged all CPUs. Now I will take a break until my fingers stop
cramping. :)
|
|
|
|
|
|
|
|
|
|
|
| |
MDRV_SOUND_ADD. All sound chips must now include a tag.
Laboriously changed all existing drivers to define a
unique tag for each sound chip.
CPUs are next, but will require a more hands-on manual
process to produce reasonable tags.
|
|
|
|
|
| |
Apparently if you cast a negative number to a UINT32 at compile-time,
gcc does the "right thing" and saturates it to 0.
|
|
|
|
|
| |
Renames duration to start_delay in timer_adjust_periodic() as well
Moves MDRV_ macros into proper header files
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Converted Centipede, as an example.
To define a scanline timer, use something like this:
MDRV_TIMER_ADD("32V", SCANLINE, generate_interrupt)
MDRV_TIMER_SCANLINE("main", 0, 16)
The first number is the first scanline the timer will fire on, the 2nd number is the increment.
So in this case, the timer will fire on 0, 16, 32, ..., 224, 240, then wrap around
because the screen is defined as 256 lines high.
The current scanline is passed to the callback in its 'param' argument
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
- Where applicable, added a parallel set of timer functions that take a device_config instead of emu_timer:
void timer_device_adjust_oneshot(const device_config *timer, attotime duration, INT32 param);
void timer_device_adjust_periodic(const device_config *timer, attotime duration, INT32 param, attotime period);
void timer_device_reset(const device_config *timer, attotime duration);
int timer_device_enable(const device_config *timer, int enable);
int timer_device_enabled(const device_config *timer);
int timer_device_get_param(const device_config *timer);
void *timer_device_get_param_ptr(const device_config *timer);
attotime timer_device_timeelapsed(const device_config *timer);
attotime timer_device_timeleft(const device_config *timer);
attotime timer_device_starttime(const device_config *timer);
attotime timer_device_firetime(const device_config *timer);
- Added MACHINE_CONFIG macros:
MDRV_TIMER_ADD(_tag, _type, _callback) /* type can only be PERIODIC right now (can scanline based later, or even NE555) */
MDRV_TIMER_REMOVE(_tag)
MDRV_TIMER_MODIFY(_tag)
MDRV_TIMER_TYPE(_type)
MDRV_TIMER_CALLBACK(_callback)
MDRV_TIMER_DURATION(_duration)
MDRV_TIMER_PERIOD(_period)
MDRV_TIMER_PARAM(_param)
MDRV_TIMER_PTR(_ptr)
- Modified Space Encounters to create two timers and use those:
MDRV_TIMER_ADD("STROBE_ON", PERIODIC, spcenctr_strobe_timer_callback)
MDRV_TIMER_PARAM(TRUE) /* indicates strobe ON */
MDRV_TIMER_PERIOD(UINT64_ATTOTIME_IN_HZ(SPCENCTR_STROBE_FREQ))
MDRV_TIMER_ADD("STROBE_OFF", PERIODIC, spcenctr_strobe_timer_callback)
MDRV_TIMER_PARAM(FALSE) /* indicates strobe OFF */
MDRV_TIMER_DURATION(UINT64_ATTOTIME_IN_HZ(SPCENCTR_STROBE_FREQ * 100 / SPCENCTR_DUTY_CYCLE))
MDRV_TIMER_PERIOD(UINT64_ATTOTIME_IN_HZ(SPCENCTR_STROBE_FREQ))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
| |
typedef UINT32 (*video_update_func)(const device_config *screen, int scrnum, bitmap_t *bitmap, const rectangle *cliprect);
Adds const device_config *primary_screen to running_machine (not yet used)
|
|
|
|
|
|
|
| |
accessed by drivers
- populating screen_state is moved from mame.c to video.c
- defstate is gone -- the default screen parameters live in screen_config directly
|
|
|
| |
* removed a number of extra semicolons
|
|
|
|
|
|
|
|
|
|
|
| |
- Define a new MDRV_CPU_VBLANK_INT_HACK() (ZV: defined in deprecat.h) which is a copy of the current MDRV_CPU_VBLANK_INT()
- Find all the places where VBLANK_INT is used with something other than 1 interrupt per frame and change it to the new macro
- Remove the "# per frame" parameter from the MDRV_SCREEN_VBLANK_INT() and add a screen tag in its place; updated all callers appropriately.
- ZV: Added some validation of the interrupt setup to validate.c
The idea behind this is that using a VBLANK interrupt with more than one interrupt per frame in conceptually wrong.
The screen tag will allow us to move the interrupt timing code from cpuexec.c to video.c, where it really belongs.
|
|
|
|
| |
Removes mame_bitmap
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
constructors to tokenized lists. For the most part
this is a non-invasive change, except for those drivers
using MDRV_WATCHDOG_TIME_INIT. In order to allow for
tokenization of attotimes, a set of new macros is
provided called UINT64_ATTOTIME_IN_x() which follows the
same pattern as ATTOTIME_IN_x() but packs the attotime
down into a single 64-bit value for easier tokenization.
Separated MDRV_DEVICE_CONFIG_DATA into 32-bit and 64-bit
versions. Added floating-point versions with configurable
resolutions.
Fixed several errors in the machine drivers which were
caught by the additional checks now done in the machine
config detokenization code.
Converted speakers into devices. Machine->config no
longer houses an array of speakers; instead they are
iterated through using the new macros (defined in sound.h)
speaker_output_first() and speaker_output_next(). Updated
all relevant code to do this.
Improved game info display with multiple screens. Fixed
bug which caused all screens to display equally.
Added typedefs for all the machine config callback
functions at the top of driver.h.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
ALL DRIVERS MUST NOW EXPLICITLY DECLARE THEIR SCREENS.
Read on for more detail....
Added device tag as a parameter to the start function for devices.
Updated MC6845 to accept this tag.
Added new functions for iterating through the device list and
counting devices of a given type. Updated search and iteration
functions to accept DEVICE_TYPE_WILDCARD to work across all
devices.
Added new macro MDRV_DEVICE_CONFIG_DATA() which is used to set a
single item in an inline data structure.
Removed the per-screen palette_base. This was an idea that never
really worked out, nor have we really needed it.
Defined a new device type VIDEO_SCREEN. Currently this has no
live functionality, but merely serves as a placeholder/identifier
for video screens. Eventually some of the screen management code
may move into the start/stop/reset functions.
Changed MDRV_SCREEN_* macros to build up VIDEO_SCREEN devices
rather than storing values in the screen[] array.
Changed MDRV_SCREEN_ADD to specify a screen type (RASTER, VECTOR,
LCD for the moment).
Removed the older VIDEO_TYPE_RASTER and VIDEO_TYPE_VECTOR; this
information is now determined by walking the screen list.
Removed the screen[] array from machine_config. Modified all code
referencing Machine->config->screen[] and changed it to iterate
over the devices using the new video_screen_first() and
video_screen_next() functions.
(The next step will be to add video_* functions that accept a tag
instead of screen index, and then move systems over to always
referencing screens by tag instead of index.)
Removed implicit screen #0. This means that ALL DRIVERS MUST
EXPLICITLY DECLARE THEIR SCREENS. Updated all drivers to do
so. While there, grouped all MDRV_SCREEN_* parameters together.
Also removed unnecessary VIDEO_TYPE_RASTER and VIDEO_TYPE_VECTOR.
Also removed VBLANK and bitmap format information from vector
games. This was painful and very tedious.
Changed game information to display info about all screens.
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* PALETTE_INIT no longer has a colortable parameter
* removed game_colortable and remapped_colortable from machine_config
* updated a few stragglers that still referenced these fields
* removed tile_draw_colortable from tilemap.c
(From Zsolt): Added support for the new colortable object in the palette viewer
Changed the input port tokens to use a union instead of casting everything to FPTR.
In the future, C99-enabled compilers will be able to achieve type safety with
designated initializers.
|
|
to the sound and CPU interfaces. This is still a bit WIP, but works at
a fundamental level. Currently the only example of usage is in qix.c for
the MC6845 CRTC.
New module: mconfig.c/.h. Moved all machine_config and MDRV_* macros here,
out of driver.c/.h. Added MDRV macros for adding/removing/configuring
devices.
qix.c: Moved video part of machine driver to video/qix.c. Added MC6845
as a device in the machine driver. Removed explicit MC6845 initialization
from VIDEO_START in favor of simply retrieving the token from the device
interface code.
mc6845.c: Updated all callbacks to pass the mc6845_t * object. Updated
all drivers accordingly. Added a minimal device interface.
Deprecated the following constants because global constants that pretend
to document things but which are only guesses are dumb:
- DEFAULT_60HZ_VBLANK_DURATION
- DEFAULT_30HZ_VBLANK_DURATION
- DEFAULT_REAL_60HZ_VBLANK_DURATION
- DEFAULT_REAL_30HZ_VBLANK_DURATION
- DEFAULT_60HZ_3S_VBLANK_WATCHDOG
- DEFAULT_30HZ_3S_VBLANK_WATCHDOG
Updated all drivers to explicitly specify the equivalent bogus times.
Added comments for the "REAL" VBLANK durations to indicate that they are
not accurate.
|