| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
to pass a core_options object to the constructor, along with
a search path. This required pushing either a running_machine
or a core_options through some code that wasn't previously
ready to handle it. emu_files can be reused over multiple
open/close sessions, and a lot of core code cleaned up
nicely as things were converted to them.
Also created a file_enumerator class for iterating over files
in a searchpath. This replaces the old mame_openpath functions.
Changed machine->options() to return a reference.
Removed public nvram_open() and fixed jchan/kaneko16 to
stop directly saving NVRAM.
Removed most of the mame_options() calls; this will soon go
away entirely, so don't add any more.
Added core_options to device_validity_check() so they can be
used to validate things.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
calls on the device object.
Regex used:
state_save_register_device_item( *)\(( *)([^,]+), *([^,]+),( *)([^ )]+)( *)\)
\3->save_item\1\(\2NAME\(\6\),\5\4\7\)
state_save_register_device_item_array( *)\(( *)([^,]+), *([^,]+),( *)([^ )]+)( *)\)
\3->save_item\1\(\2NAME\(\6\),\5\4\7\)
state_save_register_device_item_2d_array( *)\(( *)([^,]+), *([^,]+),( *)([^ )]+)( *)\)
\3->save_item\1\(\2NAME\(\6\),\5\4\7\)
state_save_register_device_item_bitmap( *)\(( *)([^,]+), *([^,]+),( *)([^ )]+)( *)\)
\3->save_item\1\(\2NAME\(\*\6\),\5\4\7\)
state_save_register_device_item_pointer( *)\(( *)([^,]+), *([^,]+),( *)([^,]+), *([^ )]+)( *)\)
\3->save_pointer\1\(\2NAME\(\6\),\5\7,\5\4\8\)
this->save_
save_
(save_item[^;]+), *0( *)\);
\1\2\);
(save_pointer[^;]+), *0( *)\);
\1\2\);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Also replace timer_get_time() with machine->time()
1. Main conversion
timer_get_time( *)\( *([^)]+) *\)
\2->time\1()
2. Cleanup #1
&machine->time
machine.time
3. Cleanup #2
&m_machine->time
m_machine.time
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
timers into the scheduler. Retain TIMER devices as a separate wrapper
in timer.c/.h. Inline wrappers are currently provided for all timer
operations; a future update will bulk clean these up.
Rather than using macros which hide generation of a string-ified name
for callback functions, the new methods require passing both a function
pointer plus a name string. A new macro FUNC() can be used to output
both, and another macro MFUNC() can be used to output a stub-wrapped
class member as a callback.
Also added a time() method on the machine, so that machine->time() gives
the current emulated time. A wrapper for timer_get_time is currently
provided but will be bulk replaced in the future.
For this update, convert all classic timer_alloc, timer_set,
timer_pulse, and timer_call_after_resynch calls into method calls on
the scheduler.
For new device timers, added methods to the device_t class that make
creating and managing these much simpler. Modern devices were updated
to use these.
Here are the regexes used; some manual cleanup (compiler-caught) will
be needed since regex doesn't handle nested parentheses cleanly
1. Convert timer_call_after_resynch calls
timer_call_after_resynch( *)\(( *)([^,;]+), *([^,;]+), *([^,;]+), *([^);]+)\)
\3->scheduler().synchronize\1\(\2FUNC(\6), \5, \4\)
2. Clean up trailing 0, NULL parameters
(synchronize[^;]+), 0, NULL\)
\1)
3. Clean up trailing NULL parameters
(synchronize[^;]+), NULL\)
\1)
4. Clean up completely empty parameter lists
synchronize\(FUNC\(NULL\)\)
synchronize()
5. Convert timer_set calls
timer_set( *)\(( *)([^,;]+), *([^,;]+), *([^,;]+), *([^,;]+), *([^);]+)\)
\3->scheduler().timer_set\1\(\2\4, FUNC(\7), \6, \5\)
6. Clean up trailing 0, NULL parameters
(timer_set[^;]+), 0, NULL\)
\1)
7. Clean up trailing NULL parameters
(timer_set[^;]+), NULL\)
\1)
8. Convert timer_set calls
timer_pulse( *)\(( *)([^,;]+), *([^,;]+), *([^,;]+), *([^,;]+), *([^);]+)\)
\3->scheduler().timer_pulse\1\(\2\4, FUNC(\7), \6, \5\)
9. Clean up trailing 0, NULL parameters
(timer_pulse[^;]+), 0, NULL\)
\1)
10. Clean up trailing NULL parameters
(timer_pulse[^;]+), NULL\)
\1)
11. Convert timer_alloc calls
timer_alloc( *)\(( *)([^,;]+), *([^,;]+), *([^);]+)\)
\3->scheduler().timer_alloc\1\(\2FUNC(\4), \5\)
12. Clean up trailing NULL parameters
(timer_alloc[^;]+), NULL\)
\1)
13. Clean up trailing 0 parameters
(timer_alloc[^;]+), 0\)
\1)
14. Fix oddities introduced
\&m_machine->scheduler()
m_machine.scheduler()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
global functions which are now superceded by the operators and
methods on the class. [Aaron Giles]
Required mappings are:
attotime_make(a,b) => attotime(a,b)
attotime_to_double(t) => t.as_double()
double_to_attotime(d) => attotime::from_double(d)
attotime_to_attoseconds(t) => t.as_attoseconds()
attotime_to_ticks(t,f) => t.as_ticks(f)
ticks_to_attotime(t,f) => attotime::from_ticks(t,f)
attotime_add(a,b) => a + b
attotime_add_attoseconds(a,b) => a + attotime(0, b)
attotime_sub(a,b) => a - b
attotime_sub_attoseconds(a,b) => a - attotime(0, b)
attotime_compare(a,b) == 0 => a == b
attotime_compare(a,b) != 0 => a != b
attotime_compare(a,b) < 0 => a < b
attotime_compare(a,b) <= 0 => a <= b
attotime_compare(a,b) > 0 => a > b
attotime_compare(a,b) >= 0 => a >= b
attotime_mul(a,f) => a * f
attotime_div(a,f) => a / f
attotime_min(a,b) => min(a,b)
attotime_max(a,b) => max(a,b)
attotime_is_never(t) => t.is_never()
attotime_string(t,p) => t.as_string(p)
In addition, some existing #defines still exist but will go away:
attotime_zero => attotime::zero
attotime_never => attotime::never
ATTOTIME_IN_SEC(s) => attotime::from_seconds(s)
ATTOTIME_IN_MSEC(m) => attotime::from_msec(m)
ATTOTIME_IN_USEC(u) => attotime::from_usec(u)
ATTOTIME_IN_NSEC(n) => attotime::from_nsec(n)
ATTOTIME_IN_HZ(h) => attotime::from_hz(h)
|
|
|
|
|
| |
They both already existed. No sense in having two names for the
same object type.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
work just like required_device<> and optional_device<> for retrieving a
pointer by tag from an address space that specifies AM_SHARE("tag").
Also added templates required_shared_size<> and optional_shared_size<>
for retrieving the size of the AM_SHARE region.
Created a new generic NVRAM device. It can be configured to default to
0-fill, 1-fill, random-fill, or custom fill. In all cases, a same-named
memory region overrides the default fill. The address range where the
NVRAM can be found is now identified by an AM_SHARE() region of the
same tag as the NVRAM device. Drivers can also explicitly configure a
separately-allocated NVRAM region via nvram_device::set_base().
Replaced all instances of MDRV_NVRAM_HANDLER(generic_*) with
MDRV_NVRAM_ADD_*("nvram"). Replaced all AM_BASE_GENERIC/AM_SIZE_GENERIC(nvram)
with AM_SHARE("nvram"). For all remaining drivers that referenced the
generic.nvram directly, changed them to hold a required_shared_ptr<UINTx>
to the NVRAM in their driver state, and use that instead. Removed
nvram and nvram_size from the generic_ptrs.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
supporting cleaner implementations of drivers in the explicitly OO world.
Expect a follow-on of several more changes to clean up from this one, which
deliberately tried to avoid touching much driver code.
Converted address_space to a class, and moved most members behind accessor
methods, apart from space->machine and space->cpu. Removed external references
to 8le/8be/16le/16be/32le/32be/64le/64be. All external access is now done via
virtual functions read_byte()/read_word()/etc. Moved differentiation between
the endianness and the bus width internal to memory.c, and also added a new
axis to support small/large address spaces, which allows for faster lookups
on spaces smaller than 18 bits.
Provided methods for most global memory operations within the new address_space
class. These will be bulk converted in a future update, but for now there are
inline wrappers to hide this change from existing callers.
Created new module delegate.h which implements C++ delegates in a form that
works for MAME. Details are in the opening comment. Delegates allow member
functions of certain classes to be used as callbacks, which will hopefully
be the beginning of the end of fetching the driver_data field in most
callbacks. All classes that host delegates must derive from bindable_object.
Today, all devices and driver_data do implicitly via their base class.
Defined delegates for read/write handlers. The new delegates are always
passed an address_space reference, along with offset, data, and mask. Delegates
can refer to methods either in the driver_data class or in a device class.
To specify a callback in an address map, just use AM_READ_MEMBER(class, member).
In fact, all existing AM_ macros that take read/write handlers can now accept
delegates in their place. Delegates that are specified in an address map are
proto-delegates which have no object; they are bound to their object when
the corresponding address_space is created.
Added machine->m_nonspecific_space which can be passed as the required
address_space parameter to the new read/write methods in legacy situations
where the space is not provided. Eventually this can go away but we will
need it for a while yet.
Added methods to the new address_space class to dynamically install delegates
just like you can dynamically install handlers today. Delegates installed this
way must be pre-bound to their object.
Moved beathead's read/write handlers into members of beathead_state as an
example of using the new delegates. This provides examples of both static (via
an address_map) and dynamic (via install_handler calls) mapping using delegates.
Added read/write member functions to okim6295_device as an example of using
delegates to call devices. Updated audio/williams.c as a single example of
calling the device via its member function callbacks. These will be bulk
updated in a future update, and the old global callbacks removed.
Changed the DIRECT_UPDATE_CALLBACKs into delegates as well. Updated all users
to the new function format. Added methods on direct_read_data for configuring the
parameters in a standard way to make the implementation clearer.
Created a simple_list template container class for managing the common
singly-linked lists we use all over in the project.
Many other internal changes in memory.c, mostly involving restructuring the code
into proper classes.
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
DECLARE_LEGACY_CPU_DEVICE and DEFINE_LEGACY_CPU_DEVICE. Changed CPUs
to be their own device types, rather than all of type CPU with a
special internal subtype. Note that as part of this process I removed
the CPU_ prefix from the ALL-CAPS device name, so CPU_Z80 is just
plain old Z80 now. This required changing a couple of names like
8080 to I8080 so that there was an alphabetic first character.
Added memory interfaces to the list of fast-access interfaces. To do
this properly I had to add a separate method to devices which is
called immediately after construction, when it is possible to perform
dynamic_casts on fully-constructed objects. (This is just internal,
no changes necessary to the devices themselves.)
Some additional notes:
* SH2 and SH4 had typedefs that conflicted with their CPU_-less names
so I bulk renamed to structures to sh2_state and sh4_state; RB, feel
free to choose alternate names if you don't like 'em
* SCSP was caught doing something to the 3rd indexed CPU. Since several
systems that use SCSP don't even have 3 CPUs, I had no idea what
this was supposed to do, so I changed to it reference "audiocpu"
assuming that stv was the assumed target. This is really gross and
should be a configuration parameter, not a hard-coded assumption.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
cpu_get_total_cycles() == cpudevice->total_cycles()
cpu_clocks_to_attotime() == cpudevice->cycles_to_attotime()
cpu_attotime_to_clocks() == cpudevice->attotime_to_cycles()
In some cases, I updated existing code that fetched and cached
devices to fetch them as cpu_device so that these can be called
without casting.
In other cases, I did the quick & dirty thing which was to downcast
a generic device to a cpu_device and then call the function.
Note that cpu_clocks_to_attotime() and cpu_attotime_to_clocks()
were previously mapping to the device-level functions
clocks_to_attotime() and attotime_to_clocks(). This was different
behavior than before the big devices change, so with this update
I have fixed it to match the previous behavior (i.e., map cycles
not clocks).
This may impact timing of drivers that used these functions on
CPUs that have clock dividers or multipliers.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
running_machine definition and implementation.
Moved global machine-level operations and accessors into methods on the
running_machine class. For the most part, this doesn't affect drivers
except for a few occasional bits:
mame_get_phase() == machine->phase()
add_reset_callback() == machine->add_notifier(MACHINE_NOTIFY_RESET, ...)
add_exit_callback() == machine->add_notifier(MACHINE_NOTIFY_EXIT, ...)
mame_get_base_datetime() == machine->base_datetime()
mame_get_current_datetime() == machine->current_datetime()
Cleaned up the region_info class, removing most global region accessors
except for memory_region() and memory_region_length(). Again, this doesn't
generally affect drivers.
|
|
|
|
|
|
|
|
|
|
|
|
| |
this object which can be called multiple times to append new devices
after the initial machine configuration is set up. Updated member
variables to match new naming convention.
Changed the running_machine to take a constructed machine_config
object in the constructor, instead of creating one itself, for
consistency. Also added machine->total_colors() as a shortcut to
machine->config->m_total_colors.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
atarijsa.c: just use a generic device for the tms5220 to handle variants until
we have a proper base class (fixes eprom, eprom2 - eprom.c
"assert: src/emu/emucore.h:328: dynamic_cast<_Dest>(src) == src")
decocass.c: invert sense of reset line to MCU (fixes All sets in decocass.c -
Games no longer begin loading (countdown))
metro.c: use generic device for the YM sound since multiple YM chips are used.
(fixes 3kokushi, blzntrnd, dharma, dharmak, dokyusei, dokyusp, gstrik2, gstrik2j,
karatour, ladykill, lastfort, lastforte, lastforte, lastfortg, lastfortk, skyalert,
toride2g, toride2gg, toride2j - metro.c
"assert: src/emu/emucore.h:328: dynamic_cast<_Dest>(src) == src")
mitchell.c: when swapping the OKIM6295 for an MSM5205, use a different tag.
(fixes pangba, spangbl - mitchell.c
"assert: src/emu/emucore.h:328: dynamic_cast<_Dest>(src) == src")
deco32.c: use a proper EEPROM device to fetch the space from.
(fixes tattass, tattassa - deco32.c - Crash while checking "Jack Ram" before start
"assert: src/emu/emucore.h:328: dynamic_cast<_Dest>(src) == src")
system1.c: use a proper z80pio_device (cleanup)
vconv.c: support -g* options for MSVC builds (cleanup)
m377101.c/g65816.c: fix fault logic for mapping icount (fixes
All sets in namcofl.c, namcona1.c, namconb1.c, nss.c, sfcbox.c, snesb.c
airco22b, cybrcycc, dirtdash, rrf, timecrs, timecrsa - namcos22.c
Hanging immediately or shortly after start.
"assert: src/emu/schedule.c:189: ran >= *exec->m_icount")
schedule.c/diexec.c/timer.c: add temporary logging to permit direct comparisons with
earlier games timing (cleanup)
generic.c: fix computation of time for turning off the IRQ when using
generic_pulse_irq() to account for CPU-local time (fixes
Any sets in bublbobl.c which use the which use m6801 - Frequent/Random watchdog resets.)
z80pio.c: convert internal line states to bool, and fix typo (control_write should have
been data_write in one place) (fixes Any system1.c games which use z80pio - No sound)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
- 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!)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
useable as a stack object. Also designed the interfaces to allow
for chaining operations. And added a casting operator to const
char * for seamless use in most functions that take plain old C
strings.
Changed all uses of astring to use the object directly on the
stack or embedded in objects instead of explicitly allocating
and deallocating it. Removed a lot of annoying memory management
code as a result.
Changed interfaces that accepted/returned an astring * to
use an astring & instead.
Removed auto_alloc_astring(machine). Use
auto_alloc(machine, astring) instead.
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
Added equivalent pointers to machine->generic. Updated all
references.
Now that accessing these is more awkward, it is probably best
to put these pointers in the driver data structures instead
of using the generic pointers. The main reason to continue
using generic pointers is to allow use of paletteram shortcuts
and buffered spriteram handling.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
designed to hold generic pointers that are commonly used. For
now, only generic_nvram has moved there. Added AM_BASE_GENERIC
and AM_SIZE_GENERIC macros for initializing generic pointers
in memory maps. Also added AM_BASE_SIZE_GENERIC to set both
base and size in one step.
Moved global variables out of machine/generic and into a private
data structure hanging off of the running_machine. Added newly-
needed machine parameters to coin_counter_w, coin_lockout_w, and
coin_lockout_global_w. Also added machine parameter to
set_led_state.
Added interface functions to get the number of dispensed tickets
and to increment the count, to remove the need for direct access
to these global variables. Also added functions to get the
current count on a particular coin counter and to determine the
lockout state.
Future checkins will move the remaining generic pointers (for
paletteram, videoram, spriteram, colorram, etc.) into the new
generic_pointers structure.
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
|
| |
space's unmapped value rather than 0xff.
|
|
|
|
|
| |
Replaced with machine->firstcpu which is a fast access to the head
of the list of CPUs.
|
|
|
|
|
|
|
| |
for a memory region named "nvram". If it is found and is of
the same length as the generic_nvram_size, data is copied
from there instead of filling the RAM with the fallback
pattern.
|
| |
|
| |
|
|
|
|
| |
to make them compile as either C or C++.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
- qix
- mcr/williams
- coinmstr
- funworld
- goldnpkr
- jokrwild
- nyny
- r2dtank
- spiders
- tugboat
Added new function memory_install_read_port_handler() to more
easily allow you to install read handlers for ports based on tag.
Removed input_port_read_handler8/16/32/64 functions, since they
were really only used for getting a memory handler for a port by
tag, and this is no longer necessary.
Moved input port handlers to internal code in the memory system.
Added port names to the taito8741 device pending its proper
devicification.
Removed all remaining uses of input_port_n_r() functions, and
purged them from src/emu/machine/generic.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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).
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
| |
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
|
|
| |
and timer_get_time to pass the machine parameter. Moved timer globals
to hang off of the running_machine.
|
|
|
|
|
|
| |
state_save_combine_module_and_tag() function in favor of passing
the tag when registering. Revisited all save state item registrations
and changed them to use the tag where appropriate.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Subject: a few patches
Hi,
enclosed please find a few patches that finally conclude my
input_port cleanups. I will still probably change some bit
here and there, but there will be no more massive changes
which could collide with current developments.
Notice that, after applying these patches, indexed input reads
remain only present in CPU interfaces (e.g. all the yamaha
interfaces when the sound cpu is used to read inputs) and no
more 16bit/32bit indexed read are present at all in MAME or
MESS source. Therefore, you may consider the removal of
input_port_N_word_r & input_port_N_dword_r, if you think you
don't need them anymore.
More in detail:
* patch01.diff & patch02.diff: conclude the cleanup for
drivers W -> Z
* primrage.diff: changes the start buttons with input buttons
in primrage, as per the test mode (no start button is reported)
and the control panel (see
http://www.mameworld.info/ubbthreads/showthreaded.php?Cat=&Number=161107 )
* drivedge.diff: makes drivedge ports fully 32bit and removes
the protection bit (which seems not to be used in this game, or
at least not in the port where it was tested since at least MAME
0.100)
* duplicate.diff: introduces a PORT_CUSTOM which returns a tagged
input (like a input_port_read). this could be useful for those
games which require to read the same 8bit (resp. 16bit) input in
both the upper and lower half of a 16bit (resp. 32bit) port. you
can see its use for this purpose in the modified drivers (fuukifg3,
dreamwld, cojag etc.)
Regards,
Fabio Priuli
|