| 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]
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
path in all #include occurences. [Oliver Stoneberg]
---------- Forwarded message ----------
From: Oliver Stöneberg <oliverst@online.de>
Date: Sat, Dec 12, 2009 at 3:27 PM
Subject: includes cleanup
To: submit@mamedev.org
This patch removes the global "includes" include and explcitly
specifies the "includes" path in all #include occurances.
|
|
|
|
| |
* added driver data struct to neogeo.c and added GAME_SUPPORTS_SAVE flag to all sets, because save state support was already there
* added driver data struct and save state support to cps1.c, cps2.c and fcrash.c
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Sent: Wednesday, September 23, 2009 2:54 PM
To: submit@mamedev.org
Subject: Tiny speed up in 'src\mame\video\neogeo.c'
Hi,
here is a patch against 'src\mame\video\neogeo.c'
This patch give a tiny speed up in neogeo rendering and, IMO, gives the
source code more readable.
This is achieved by unrolling a loop in 'draw_fixed_layer'
Doing so, the logic inside the loop is simplified, less arithmetic is
performed and branches are avoided.
Hope this helps,
Best regards,
Christophe Jaillet
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This update changes the way we handle memory allocation. Rather
than allocating in terms of bytes, allocations are now done in
terms of objects. This is done via new set of macros that replace
the malloc_or_die() macro:
alloc_or_die(t) - allocate memory for an object of type 't'
alloc_array_or_die(t,c) - allocate memory for an array of 'c' objects of type 't'
alloc_clear_or_die(t) - same as alloc_or_die but memset's the memory to 0
alloc_array_clear_or_die(t,c) - same as alloc_array_or_die but memset's the memory to 0
All original callers of malloc_or_die have been updated to call these
new macros. If you just need an array of bytes, you can use
alloc_array_or_die(UINT8, numbytes).
Made a similar change to the auto_* allocation macros. In addition,
added 'machine' as a required parameter to the auto-allocation macros,
as the resource pools will eventually be owned by the machine object.
The new macros are:
auto_alloc(m,t) - allocate memory for an object of type 't'
auto_alloc_array(m,t,c) - allocate memory for an array of 'c' objects of type 't'
auto_alloc_clear(m,t) - allocate and memset
auto_alloc_array_clear(m,t,c) - allocate and memset
All original calls or auto_malloc have been updated to use the new
macros. In addition, auto_realloc(), auto_strdup(), auto_astring_alloc(),
and auto_bitmap_alloc() have been updated to take a machine parameter.
Changed validity check allocations to not rely on auto_alloc* anymore
because they are not done in the context of a machine.
One final change that is included is the removal of SMH_BANKn macros.
Just use SMH_BANK(n) instead, which is what the previous macros mapped
to anyhow.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
| |
Note that the parameters to the latter are in a different order
(bitmap, clip, color). [Atari Ace]
|
|
|
|
|
| |
and timer_get_time to pass the machine parameter. Moved timer globals
to hang off of the running_machine.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* 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: Sunday, October 05, 2008 1:46 PM
To: submit@mamedev.org
Subject: 2 small patches
Here are two small patches.
The first one remove a profiler_mark that has been forgotten in one of
the
last update in the tx1.c video driver.
The second is a small speed up in the neo-geo driver which gives a 0.5%
speed up on my machine.
- replace a loop with an equivalent memset
- remove a useless parameter I forgot to remove in a previous patch
Hope this help.
Best regards,
CJ
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
compared to other emulator (i.e. kawak), mame does not perform very well in
terms of speed of emulation against Neo Geo games.
Looking at profiling data for these neo geo games, we can see :
---------------------------------------------------------
% cumulative self self total
time seconds seconds calls s/call s/call name
18.40 18.80 18.80 971070 0.00 0.00 video_update_neogeo
10.42 29.45 10.65 4416 0.00 0.00 texture_set_data
10.06 39.73 10.28 1144463 0.00 0.00
sprite_line_timer_callback
6.24 46.10 6.37 187970965 0.00 0.00 astring_cmpc
3.77 49.95 3.85 35732143 0.00 0.00 memory_region
---------------------------------------------------------
I was wondering why functions like 'astring_cmpc' and 'memory_region' where
in the top 5 of the most time consuming functions.
The answer is found in the function 'draw_sprites' from
'mame/video/neogeo.c' where 'memory_region' is called for each sprites for
each VIDEO_UPDATE.
I patched mame in order to keep track of this 'memory_region'. This is done
in VIDEO_START via a global variable (region_zoomy) just like in some other
drivers.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
integer value, regions are now referred to by a region class and
a region tag. The class specifies the type of region (one of CPU,
gfx, sound, user, disk, prom, pld) while the tag uniquely specifies
the region. This change required updating all the ROM region
definitions in the project to specify the class/tag instead of
region number.
Updated the core memory_region_* functions to accept a class/tag
pair. Added new memory_region_next() function to allow for iteration
over all memory regions of a given class. Added new function
memory_region_class_name() to return the name for a given CPU
memory region class.
Changed the auto-binding behavior of CPU regions. Previously, the
first CPU would auto-bind to REGION_CPU1 (that is, any ROM references
would automatically assume that they lived in the corresponding
region). Now, each CPU automatically binds to the RGNCLASS_CPU region
with the same tag as the CPU itself. This behavior required ensuring
that all previous REGION_CPU* regions were changed to RGNCLASS_CPU
with the same tag as the CPU.
Introduced a new auto-binding mechanism for sound cores. This works
similarly to the CPU binding. Each sound core that requires a memory
region now auto-binds to the RGNCLASS_SOUND with the same tag as the
sound core. In almost all cases, this allowed for the removal of the
explicit region item in the sound configuration, which in turn
allowed for many sound configurations to removed altogether.
Updated the expression engine's memory reference behavior. A recent
update expanded the scope of memory references to allow for referencing
data in non-active CPU spaces, in memory regions, and in EEPROMs.
However, this previous update required an index, which is no longer
appropriate for regions and will become increasingly less appropriate
for CPUs over time. Instead, a new syntax is supported, of the form:
"[tag.][space]size@addr", where 'tag' is an optional tag for the CPU
or memory region you wish to access, followed by a period as a
separator; 'space' is the memory address space or region class you
wish to access (p/d/i for program/data/I/O spaces; o for opcode space;
r for direct RAM; c/u/g/s for CPU/user/gfx/sound regions; e for
EEPROMs); and 'size' is the usual b/w/d/q for byte/word/dword/qword.
Cleaned up ROM definition flags and removed some ugly hacks that had
existed previously. Expanded to support up to 256 BIOSes. Updated
ROM_COPY to support specifying class/tag for the source region.
Updated the address map AM_REGION macro to support specifying a
class/tag for the region.
Updated debugger windows to display the CPU and region tags where
appropriate.
Updated -listxml to output region class and tag for each ROM entry.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Subject: [patch] memory_region madness reloaded
Hi mamedev,
The memory_region and memory_region_length functions are probably the
two most common functions in MAME that don't take a machine parameter
but should given the syntax of the related apis memory_region_type and
memory_region_flags. Clearly they didn't get the parameter because of
the sheer number of changes needed to change the apis. This pair of
patches makes the change, and deals with the consequences.
The second patch then changes the api for memory_region and
memory_region_length, and fixes the fallout. It generally plumbs
through machine parameters where needed, except for the case of sound
apis which I deferred doing so till later. This increased the number
of deprecat.h includes by ~50. Given it is a massive patch, there are
bound to be a few mistakes in it (I had to make ~20% of the changes by
hand), but I exercised care and reviewed the patch several times to
minimize the problems.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Subject: [patch] memory_region madness reloaded
Hi mamedev,
The memory_region and memory_region_length functions are probably the
two most common functions in MAME that don't take a machine parameter
but should given the syntax of the related apis memory_region_type and
memory_region_flags. Clearly they didn't get the parameter because of
the sheer number of changes needed to change the apis. This pair of
patches makes the change, and deals with the consequences.
The first patch makes some changes to help the second patch
along, as well as moves some uses of the memory_region apis within for
loops outside the loops.
|
|
|
|
|
|
|
| |
Subject: more Machine -> machine cleanups
This is mostly a cleanup of src/drivers/* and src/machine/*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Subject: [patch] memory_region madness
The memory_region and memory_region_length functions are probably the
two most common functions in MAME that don't take a machine parameter
but probably should given the direction MAME has been going in
removing global variable references. Attached are massive patches to
accomplish this. I wish they could be smaller, but sadly, this is
butchery, not brain surgery.
The first patch makes some simplifications to help the second patch
along. It is a general improvement as well, and hopefully can be
applied even if the second patch is rejected. Specifically:
1. Introduced/updated some include files for files that export
functions whose apis will need to be changed (cps1.h, decocrpt.h,
ms32.h, pgm.h, fd1089.h, konami1.h). In the case of konami.c, I
renamed the file konami1.c and changed the api and callers to only
require one function export.
2. Pulled memory_region*() calls out of for loops and folded the
occasional duplicated call. The compiler can't likely infer that the
results are constant, so this should be a minor performance win as
well.
|
|
|
|
|
|
|
| |
read/write handlers. Updated all drivers accordingly. Hope I didn't
miss anything important!
Blame OG and smf for goading me into it. :)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
only remaining form is the one that takes a pointer parameter.
Added macros for STATE_PRESAVE and STATE_POSTLOAD to define common
functions. Added machine parameter to these functions.
Updated all drivers and CPU/sound cores to use the new macros
and consolidate on the single function type. As a result pushed
the machine parameter through a few initialization stacks.
Removed unnecessary postload callbacks which only marked all tiles
dirty, since this is done automatically by the tilemap engine.
|
|
|
|
|
|
|
| |
All callers that used 0 for the screen number now use machine->primary_screen
As a gap meassure, Where necessary, create a parallel set of video_screen_*_scrnum functions that take scrnum
All callers that specified a specific screen number now call the *_scrnum versions
Changed game info screen and overlay UI to display the screen tag instead of screen number
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Updated all call-through handlers appropriately. Renamed read8_handler to
read8_machine_func, replicating this pattern throughout.
Defined new set of memory handler functions which are similar but which
pass a const device_config * in place of the running_machine *. These are
called read8_device_func, etc. Added macros READ8_DEVICE_HANDLER() for
specifying functions of this type. Note that some plumbing still needs to
happen in memory.c before this will work.
This check-in should remove the need for the global Machine and in turn
"deprecat.h" for a lot of drivers, but that work has not been done. On
the flip side, some new accesses to the global Machine were added in the
emu/ files. These should be addressed over time, but are smaller in
number than the references in the driver.
|
|
|
|
| |
Removes mame_bitmap
|
|
|
|
|
| |
Updated all call sites.
Fixed recent build breaks.
|
| |
|
|
|
|
|
|
|
|
| |
The attached patch adjusts most conditional logging in MAME to use the
idiom "do { if (VERBOSE) logerror x; } while (0)". This has the
benefit that the compiler checks the syntax of the logging even in the
case it will be eliminated, and in fact a number of cases here needed
adjustments to compile because of this.
|
| |
|
| |
|
|
|