Commit Graph

458 Commits

Author SHA1 Message Date
Andrew Gardner
846d034c3a Fixed strange display of long strings in Qt debugger (nw). 2014-10-19 12:44:24 +00:00
Miodrag Milanovic
c93ed344fb Cleanups and version bump 2014-10-15 07:19:47 +00:00
Scott Stone
3b23f9c85e Make cheat initialization debugger message more verbose. [Pugsy] 2014-10-08 23:57:17 +00:00
Alex W. Jackson
ace8c59d1a Memory system and Namco improvements: [Alex Jackson]
Explicit regions in address maps (AM_REGION) are now looked up relative to the
device rather than as siblings when in an internal address map (similar to
devices and shared pointers)  Besides being more orthogonal than before, this
allows internal ROMs of MCUs and similar devices to be hooked up in a nicer
and more foolproof way. Updated the m37710 and m5074x (m6502 derivative)
to take advantage of this.

Divided the M37702/M37710 into specific models, with each model having its own
internal address map containing the correct amounts of internal RAM and ROM.

M37702 MCUs found on various Namco PCBs are now all unique devices and have
their respective internal ROMs loaded as device ROMs.

(nw)
Also did some spring (fall) cleaning in addrmap.c/memory.c/dimemory.c

m_devbase (the base device used for tagmap lookup when late-binding handlers and
finding memory regions and shares) is now a reference rather than a pointer,
since we know what it is when the address_map_entry is constructed and it
doesn't change (it depends solely on whether it's an entry in an MCFG-provided
address map or an internal one) And for the same reason, there's now only one
m_devbase per address_map_entry rather than individual copies for
read/write/setoffset/sharedptr.

Removed mysterious unused address_map_entry member "m_region_string", along
with a silly assert probably left over from when Aaron was replacing AM_BASE
with AM_SHARE years ago.

Added a comment noting that "make sure all devices exist" in
device_memory_interface::interface_validity_check() actually does nothing,
like the proverbial goggles. The reason there's just a comment and not a fix
is I haven't figured out how to fix it yet
(is it possible to extract the original device tag that was given to a
proto-delegate? Sorry, the template hell in devdelegate.h and
lib/util/delegate.h makes me want to run screaming like a little girl)
2014-09-18 01:07:22 +00:00
Oliver Stöneberg
3568cf772f fixed most of the -Wunreachable-code-break and -Wunreachable-code-return warnings of clang 3.5 when compiling MESS (nw) 2014-09-08 12:00:45 +00:00
Miodrag Milanovic
d14d6a8099 Do web serving in main thread (nw) 2014-09-08 07:51:14 +00:00
Scott Stone
f5d2eb5c6c Fix uninitialized auto; should fix instances where a game with cheats active using multiple expressions in one action crashes at start. [m4st4] 2014-07-21 23:58:30 +00:00
Oliver Stöneberg
f59638c2a1 more passing of attotime as const references (nw) 2014-07-04 07:17:48 +00:00
Alex W. Jackson
b025f698a1 m68000: Do what the real M68K does on byte writes. Fix the debugger so watchpoints continue to work as expected [Alex Jackson] 2014-05-30 04:05:49 +00:00
Sandro Ronco
64f307a27b Fixed cheatnext command. (nw) 2014-05-19 20:05:10 +00:00
Miodrag Milanovic
69faaf3aeb -Reorganized OSD, handling more sound output systems and debuggers, defaults left same as before [Miodrag Milanovic]
-Created osd_options as base option class for non-system specific options
2014-05-08 07:39:04 +00:00
Miodrag Milanovic
67663501d7 Moved eminline and related files into /src/osd since it's system related (nw)
Moved delegates into /src/lib/util to enable usage of delegates in other project parts

Moved mame_printf_* calls into /src/osd/osdcore.c and renamed them to osd_printf_* 

Changed mess.mak to display compilation of ymmu100.ppm nicely
2014-04-16 08:04:20 +00:00
Alex W. Jackson
6513c5b67e device_gfx_interface and memory system improvements: [Alex Jackson]
Added macros to facilitate declaring gfxdecode info arrays as members
of a device class.

AM_SHAREs in a device's internal address map or its default address map are
now tagmapped as children of that device rather than siblings (analogous
to how handlers in internal/default address maps are scoped).

Converted the Namco C45 to device_gfx_interface.
2014-04-08 15:41:46 +00:00
Oliver Stöneberg
f2de945ef9 use ARRAY_LENGTH (nw) 2014-04-03 22:48:35 +00:00
Miodrag Milanovic
de513a0f98 reverting, sorry for this vconv needs to be updated (nw) 2014-03-31 10:23:22 +00:00
Miodrag Milanovic
2cc9ca4c5e VS2013 x64 is little bit more anal about signed/unsigned comparison (nw) 2014-03-31 10:06:05 +00:00
Miodrag Milanovic
b297c61ebd made MAME and MESS compile under VS2013, 32bit only for now (nw)
OG: please check things in H8 core, thing in timer16 can caused some issues in past
2014-03-31 08:29:30 +00:00
Oliver Stöneberg
6bd1f0b658 osd_* -> global_* compilation fixes (nw) 2014-03-24 22:16:44 +00:00
Oliver Stöneberg
2e5ea37f65 removed mame_* aliases and just use core_* functions (nw) 2014-03-24 22:05:08 +00:00
Oliver Stöneberg
7a135e058a do not use osd_malloc/osd_free in non-OSD code (nw) 2014-03-24 21:56:16 +00:00
Aaron Giles
19bd5c8117 Nuke some more auto_allocs. 2014-03-16 05:41:28 +00:00
Miodrag Milanovic
a66aff27d6 primary_screen -> first_screen() (nw) 2014-03-15 13:00:23 +00:00
Aaron Giles
4ea9df02a1 Moved core template container classes up from emutempl.h to coretmpl.h:
[Aaron Giles]
 * these classes now no longer take a resource_pool; everything is
    managed globally -- this means that objects added to lists must be
    allocated with global_alloc
 * added new auto_pointer<> template which wraps a pointer and auto-frees
    it upon destruction; it also defaults to NULL so it doesn't need to
    be explicitly initialized
 * moved tagged_list template to tagmap.h

Redo of the low-level memory tracking system: [Aaron Giles]
 * moved low-level tracking out of emu\emualloc into lib\util\corealloc
    so it can be shared among all components and used by core libraries
 * global_alloc and friends no longer use a resource pool to track
    allocations; turns out this was a wholly redundant system that wasted
    a lot of memory
 * removed global_resource_pool entirely
 * added global_free_array to delete arrays allocated with 
    global_alloc_array
 * added tracking of object versus array allocation; we will now error
    if you use global_free on an array, or global_free_array on an object

Added new utility helper const_string_pool which can be used to 
efficiently accumulate strings that are not intended to be modified.
Used by updated makelist and software list code. [Aaron Giles]

Updated png2bdc and makelist tools to not leak memory and use more modern
techniques (no more MAX_DRIVERS in makelist, for example). [Aaron Giles]

Deprecated auto_strdup and removed all uses by way of caller-managed 
astrings and the software list rewrite. [Aaron Giles]

Rewrote software list management: [Aaron Giles]
 * removed the notion of a software_list that is separate from a
    software_list_device; they are one and the same now
 * moved several functions into device_image_interface since they really
    didn't belong in the core software list class
 * lots of simplification as a result of the above changes

Additional notes (no whatsnew):

Moved definition of FPTR to osdcomm.h.

Some changes happened in the OSD code to fix issues, especially regarding
freeing arrays. SDL folks may need to fix up some of these.

The following devices still are using tokens and should be modernized
(I found them because they kept their token as void * and tried to
delete it, which you can't):

namco_52xx_device (mame/audio/namco52.c)
namco_54xx_device (mame/audio/namco54.c)
namco_06xx_device (mame/machine/namco06.c)
namco_50xx_device (mame/machine/namco50.c)
namco_51xx_device (mame/machine/namco51.c)
namco_53xx_device (mame/machine/namco53.c)
voodoo_device (emu/video/voodoo.c)
mos6581_device (emu/sound/mos6581.c)
aica_device (emu/sound/aica.c)
scsp_device (emu/sound/scsp.c)
dmadac_sound_device (emu/sound/dmadac.c)
s3c2440_device (emu/machine/s3c2440.c)
wd1770_device (emu/machine/wd17xx.c)
latch8_device (emu/machine/latch8.c)
duart68681_device (emu/machine/68681.c)
s3c2400_device (emu/machine/s3c2400.c)
s3c2410_device (emu/machine/s3c2410.c)
strataflash_device (mess/machine/strata.c)
hd63450_device (mess/machine/hd63450.c)
tap_990_device (mess/machine/ti99/990_tap.c)
omti8621_device (mess/machine/omti8621.c)
vdt911_device (mess/video/911_vdt.c)
apollo_graphics_15i (mess/video/apollo.c)
asr733_device (mess/video/733_asr.c)
2014-03-11 15:54:58 +00:00
Oliver Stöneberg
5278254236 rest of ATTR_PRINTF review (nw) 2014-02-25 12:25:33 +00:00
Aaron Giles
dd15b719a3 Another round of auto_alloc_array conversions.
Some minor enhancements to dynamic_array, including clearing to specific values
and expanding and clearing newly allocated values.
2014-02-20 18:11:00 +00:00
Couriersud
00391468b0 Fixed a bug preventing memory display of INT8/UINT8 in debugger [Couriersud] 2013-12-24 13:53:11 +00:00
Aaron Giles
5d0ce54f9e Bulk convert files that already had standard BSD license in my name
to new license tagged form.
2013-10-16 08:14:49 +00:00
Miodrag Milanovic
96aa5e1c08 Cleanups and version bump 2013-09-17 06:47:03 +00:00
Dirk Best
273fe7960e added support to display dividers in the debugger state view
i8089: improved debugger view
2013-08-25 12:23:20 +00:00
Andrew Gardner
6ab38a50ef Fixed the build. 2013-07-26 03:40:55 +00:00
Andrew Gardner
a53b68ddb6 Adds a watchpoint debug view. [Andrew Gardner] 2013-07-26 00:48:19 +00:00
Miodrag Milanovic
14629cbcb4 Cleanups and version bump 2013-07-23 07:18:56 +00:00
smf-
2e9622ecdb Fixes for building MAME with Visual Studio 2013 preview [smf] 2013-07-05 00:45:14 +00:00
Andrew Gardner
e74983f6f8 QT Debugger: Finished up the breakpoints window. [Andrew Gardner]
It now shows breakpoints for all CPUs and lets you sort by
each field.
2013-06-12 06:22:35 +00:00
Miodrag Milanovic
16f5234d43 Cleanups and version bump 2013-06-11 07:16:42 +00:00
Andrew Gardner
32861d94f5 QT Debugger: WIP for a new breakpoints window. [Andrew Gardner]
--out of whatsnew.txt--
You can't click to enable/disable breakpoints yet, and the number of rows 
doesn't resize yet, but that stuff will come.
2013-06-06 17:58:16 +00:00
Miodrag Milanovic
1c05ccc93b Cleanups and version bump 2013-05-20 06:51:25 +00:00
Andrew Gardner
9007f91982 Adds statesave (ss) & stateload (sl) commands to the debugger. [Andrew Gardner] 2013-05-14 04:24:31 +00:00
Andrew Gardner
7964d924b3 Adds memory tracking to debugger. This includes two new commands: trackmem and
pcatmem(p|d|i).  [Andrew Gardner]

Fixes left-click selection bug in the memory window. [Andrew Gardner]


Explanation:
------------
Call trackmem to start tracking which PC writes to which address in memory and 
pcatmem(p|d|i) to query a memory region for which PC wrote to it.  Users of 
the QT debugger can also right click on a memory address in the memory window 
to make a popup message appear with the results - right-clicking also 
automatically copies the resultant PC onto the clipboard.  (I'll attach an 
image of this behavior in a follow-up mail).
2013-05-09 19:20:05 +00:00
Miodrag Milanovic
4bf717996f Cleanups and version bump 2013-04-30 06:36:06 +00:00
Andrew Gardner
dd8d9b0044 QT Debugger: Adds trackpc command, allowing for a visual display of where the
program counter has visited in the dasm windows.
Run "help trackpc" in the debugger to see the options. [Andrew Gardner]


Out of whatsnew:
This isn't enabled by default because of how sloooow it is to disassemble each
opcode when you want to compute its crc32.  That can be sped up with lookup 
tables and the like.

There's a good chance I should pull the 'clear tracks' argument into its own
command, but it functions as-is.

This can be added to the windows debugger with a simple change to the
osd display code.
2013-04-20 16:36:14 +00:00
Andrew Gardner
7bf57783e7 Adds simple_set data structure and hooked it up to the debugger comment system.
[Andrew Gardner]
2013-04-13 20:03:24 +00:00
Miodrag Milanovic
c6cd8a09c8 Cleanups and version bump 2013-04-09 06:46:57 +00:00
Andrew Gardner
1e83d998b7 Fix visual studio compile. (nw) 2013-04-03 04:26:18 +00:00
Andrew Gardner
de35bcf071 QT Debugger: The memory view chunk size radio now reports proper sizes.
Fixed "ignore" command reporting incorrect invalid CPUs.
             Fixed crazy code responsible for opcodes' crc32s in the comments system
             (what was I thinking back then?). [Andrew Gardner]
2013-04-02 03:33:43 +00:00
Miodrag Milanovic
0e1f5ad25b Cleanups and version bump 2013-03-19 07:22:20 +00:00
smf-
60ed70ef50 revision 21548 caused "trace off" to crash with a access violation [smf] 2013-03-16 11:52:50 +00:00
Wilbert Pol
c03729e963 Debugger: [Wilbert Pol]
- Added support for registerpoints.
- Added 'exit' as a synonym for 'quit'.
2013-03-11 21:29:51 +00:00
Nathan Woods
55ffd20dda Added the ability to tracelog to '{game}' (without the quotes); performing a
substitution when the trace is run.
2013-03-03 14:01:13 +00:00
Nathan Woods
86c10b9f89 Added a new 'lastinstructioncycles' property to the debugger to measure the
amount of CPU cycles taken by the last instruction.  This is useful to people
(me) who are rewriting CPU cores, specifically with regression testing.
2013-02-17 20:47:48 +00:00
Oliver Stöneberg
9c6a2d3705 fixed crash with -debug when image loading failed (nw) 2013-02-12 18:27:58 +00:00
Miodrag Milanovic
a440a8e020 Cleanups and version bump 2013-02-11 07:44:56 +00:00
Nathan Woods
eb8dbb4fe5 Fixing natural keyboard debugger commands (input, dumpkbd) 2013-02-10 21:56:42 +00:00
Andrew Gardner
ba61a286f3 QT Debugger improvements [Andrew Gardner]
- Save and load window locations.
  - Preliminary work on "run and hide" and "hard reset" 
    (don't crash on one of my copmilers but do on another - more work to do!)
  - Fixed color when cursor is the same as PC in debug view.
  - Closing the main window now shuts down the machine (same as quit)
  - Help now wraps to the log window size.
2013-01-24 17:06:42 +00:00
Andrew Gardner
7c81353d9c QT Debugger improvements. [Andrew Gardner]
- Fixed disassembly window not following PC correctly.
 - Switched font to Courier New since it seems more universal.
 - Fixed gaps between rendered text characters.
 - Plumbed mouse handling through the debugger core (clicking selects).
 - Made the Enter key behave like old SDL debugger; silently steps.
2013-01-16 04:37:30 +00:00
Miodrag Milanovic
0e19f641d3 Cleanups and version bump 2013-01-11 07:32:46 +00:00
cracyc
aa67b79340 make expression functions work (nw) 2012-11-04 13:55:43 +00:00
R. Belmont
dd83f53979 Drink from the firehose, my pretties (nw) 2012-10-19 20:22:20 +00:00
mahlemiut
d6ce1d486a Fix GCC 4.4 compile (no whatsnew) 2012-09-20 02:06:26 +00:00
Aaron Giles
621ac620ae Since nobody checks for NULLs anyway, make
device_memory_interface::space() assert against NULL and
return a reference, and pushed references throughout all 
address space usage in the system. Added a has_space() 
method to check for those rare case when it is ambiguous.
[Aaron Giles]

Also reinstated the generic space and added fatal error
handlers if anyone tries to actually read/write from it.
2012-09-19 19:48:09 +00:00
Aaron Giles
3cce7e019e Memory handler normalization, part 2. Change legacy
read/write handlers to take an address_space & instead
of an address_space *. Also update pretty much all other
functions to take a reference where appropriate.
[Aaron Giles]
2012-09-17 08:22:16 +00:00
Aaron Giles
1a30184903 Final round of struct/union/enum normalization. 2012-09-16 05:24:30 +00:00
Aaron Giles
ab97dc30ef First pass at modernizing struct definitions. 2012-09-15 21:47:30 +00:00
Aaron Giles
0aa418e85b In device_state_interface, rename state() to state_int()
and set_state() to set_state_int() for consistency.
Update all callers. Also add set_pc() helper and updated
all callers to use that instead of set_state_int(STATE_GENPC)
[Aaron Giles]

Added device_t::state() method to get the state interface.
Added redundant device_state_interface::state() method to
catch redundant use of it. [Aaron Giles]

Removed cpu_get_reg() and cpu_set_reg() macros in favor of
using the above methods. [Aaron Giles]
2012-09-11 15:58:04 +00:00
Aaron Giles
8669a28810 Add safe_pc() and safe_pcbase() methods to device_t.
Convert all cpu_get_pc() to safe_pc() and
cpu_getpreviouspc() to safe_basepc(). Removed the
old macros.
2012-09-11 05:50:50 +00:00
Oliver Stöneberg
679e9323be added missing \n to some more fatalerror() calls (no whatsnew) 2012-09-08 11:47:17 +00:00
Oliver Stöneberg
b4c9829d8e removed some astring::stringbuffer() usage - fixes potential missing \0 termination (no whatsnew) 2012-09-07 19:56:45 +00:00
Oliver Stöneberg
61b9e62493 debugger has been "new" for long enough now. also show the proper application name (no whatsnew) 2012-08-17 16:12:05 +00:00
Oliver Stöneberg
39ff9938d8 remived some redundant assignments (also fixes uninitialized array in karnov) (no whatsnew) 2012-08-11 09:57:46 +00:00
Aaron Giles
18f33f4eff Changed device->subregion to device->memregion. Moved
memory_region management into the memory manager instead
of directly in the machine. Hid the global region method;
now all regions must be looked up relative to a device.

If you're a member function, you can just use memregion("tag") 
directly. If you're a global function or a device referencing
global regions, use machine().root_device().memregion("tag")
to look up regions relative to the root.

S&R to convert all references:

machine([()]*)\.region
machine\1\.root_device\(\).subregion

Then remove redundant machine().root_device() within src/mame:

([ \t])machine\(\)\.root_device\(\)\.
\1

And use state->memregion() if we have a state variable present:

(state *= *[^;]+driver_data[^}]+)([^ \t]*)machine[()]*\.root_device\(\)\.
\1state->

Finally some cleanup:

screen.state->
state->

device->state->
state->

space->state->
state->

And a few hand-tweaks.
2012-04-20 05:54:39 +00:00
Aaron Giles
f87e01ed81 Converted memory_private to memory_manager and moved global memory
operations into methods on it. Converted the less-popular cases over
in drivers that used them, leaving the bank management APIs global
for now.
2012-04-05 18:25:39 +00:00
Aaron Giles
64dbe52ef5 Fixed device search in the debugger to work like a normal
device search.
2012-02-04 20:18:31 +00:00
Aaron Giles
23d7f9e1fa Undo last change, it is unnecessary. Cheat problems must lie elsewhere. 2012-02-04 20:06:48 +00:00
Aaron Giles
d5620a5bdf Root colons not required by default in the debugger for region
lookups. Should address cheat expressions as well.
2012-02-04 20:04:49 +00:00
R. Belmont
21f5a0ff63 [MT #3444] Show save state items in debugger memory windows [R. Belmont] 2012-01-29 17:52:49 +00:00
Miodrag Milanovic
960b0edc75 Sync with MESS, including OG's fix for exiting with debugger active (no whatsnew) 2012-01-26 10:28:50 +00:00
Aaron Giles
ed0207f126 Move devices into a proper hierarchy and handle naming
and paths consistently for devices, I/O ports, memory
regions, memory banks, and memory shares. [Aaron Giles]

NOTE: there are likely regressions lurking here, mostly
due to devices not being properly found. I have temporarily
added more logging to -verbose to help understand what's
going on. Please let me know ASAP if anything that is being
actively worked on got broken.

As before, the driver device is the root device and all 
other devices are owned by it. Previously all devices
were kept in a single master list, and the hierarchy was
purely logical. With this change, each device owns its
own list of subdevices, and the hierarchy is explicitly
manifest. This means when a device is removed, all of its
subdevices are automatically removed as well.

A side effect of this is that walking the device list is
no longer simple. To address this, a new set of iterator
classes is provided, which walks the device tree in a depth
first manner. There is a general device_iterator class for
walking all devices, plus templates for a device_type_iterator
and a device_interface_iterator which are used to build
iterators for identifying only devices of a given type or
with a given interface. Typedefs for commonly-used cases
(e.g., screen_device_iterator, memory_interface_iterator)
are provided. Iterators can also provide counts, and can
perform indexed lookups.

All device name lookups are now done relative to another 
device. The maching_config and running_machine classes now
have a root_device() method to get the root of the hierarchy. 
The  existing machine->device("name") is now equivalent to
machine->root_device().subdevice("name").

A proper and normalized device path structure is now
supported. Device names that start with a colon are
treated as absolute paths from the root device. Device
names can also use a caret (^) to refer to the owning
device. Querying the device's tag() returns the device's
full path from the root. A new method basetag() returns
just the final tag.

The new pathing system is built on top of the 
device_t::subtag() method, so anyone using that will 
automatically support the new pathing rules. Each device
has its own internal map to cache successful lookups so
that subsequent lookups should be very fast.

Updated every place I could find that referenced devices,
memory regions, I/O ports, memory banks and memory shares
to leverage subtag/subdevice (or siblingtag/siblingdevice
which are built on top).

Removed the device_list class, as it doesn't apply any
more. Moved some of its methods into running_machine
instead.

Simplified the device callback system since the new 
pathing can describe all of the special-case devices that
were previously handled manually.

Changed the core output function callbacks to be delegates.

Completely rewrote the validity checking mechanism. The
validity checker is now a proper C++ class, and temporarily
takes over the error and warning outputs. All errors and 
warnings are collected during a session, and then output in
a consistent manner, with an explicit driver and source file
listed for each one, as well as additional device and/or
I/O port contexts where appropriate. Validity checkers 
should no longer explicitly output this information, just
the error, assuming that the context is provided.

Rewrote the software_list_device as a modern device, getting
rid of the software_list_config abstraction and simplifying
things.

Changed the way FLAC compiles so that it works like other
external libraries, and also compiles successfully for MSVC
builds.
2012-01-24 20:18:55 +00:00
Aaron Giles
64f1231c63 Removed old C-based interface to astrings. astring exists only as
a class now. Updated all stragglers (mostly tools) to use the class
form. [Aaron Giles]
2012-01-03 00:21:13 +00:00
Nathan Woods
8bfeccfb66 Adding "totalcycles" debugger variable 2011-12-29 12:21:45 +00:00
Angelo Salese
5ee0c7d818 clean-ups and version bump 2011-10-10 21:17:54 +00:00
Miodrag Milanovic
86676fd04c Fixes views without device (no whatsnew) 2011-10-04 13:13:04 +00:00
Miodrag Milanovic
eea7bacd20 Made disassembler view show in octal if cpu core is specified like that, for now address and data values (no whatsnew) 2011-10-04 12:38:52 +00:00
Miodrag Milanovic
8449a9cbdc - Removing MD5 support in ROMLOAD_* [Oliver Stoneberg]
- Various core and tools memory leaks fixes [Oliver Stoneberg]
2011-07-31 15:46:18 +00:00
Miodrag Milanovic
25f191ace7 Break into debugger check outside of vblank check (no whatsnew)
Note: Please inform me if you notice some performance hit due to this.
2011-07-26 14:31:57 +00:00
Miodrag Milanovic
887fbd7203 Allow break into debugger for screen less systems (no whatsnew) 2011-07-19 09:05:22 +00:00
Angelo Salese
e6050ace10 Cleanups and version bump 2011-06-19 19:29:25 +00:00
Miodrag Milanovic
9a6d2b7bac Added image devices support to debugger [Miodrag Milanovic] 2011-06-08 07:03:24 +00:00
Angelo Salese
62950e6917 Fixed the disassembly of the "mov ax, mem" instructions (opcodes A0-
A3) in the i386 and NEC disassemblers. The argument (the memory
address) was being displayed as a signed number, which doesn't make
any sense. [Alex Jackson]

Fixed a tiny bug with the debugger hex dump command: the printable
characters in ASCII range from 32 to 12*6*, not 127. [Alex Jackson]
2011-05-15 23:57:04 +00:00
Aaron Giles
af94c692bb Switch to using delegates for some callbacks:
- non-device timer callbacks
 - machine state changing callbacks
 - configuration callbacks
 - per-screen VBLANK callbacks
 - DRC backend callbacks

For the timer case only, I added wrappers for the old-style functions.
Over time, drivers should switch to device timers instead, reducing the
number of timers that are directly allocated through the scheduler.
2011-04-27 20:34:45 +00:00
Aaron Giles
919913f118 Collapsed device_config and device_t into one class. Updated all
existing modern devices and the legacy wrappers to work in this
environment. This in general greatly simplifies writing a modern
device. [Aaron Giles]

General notes:
 * some more cleanup probably needs to happen behind this change,
   but I needed to get it in before the next device modernization 
   or import from MESS  :)

 * new template function device_creator which automatically defines
   the static function that creates the device; use this instead of
   creating a static_alloc_device_config function

 * added device_stop() method which is called at around the time
   the previous device_t's destructor was called; if you auto_free
   anything, do it here because the machine is gone when the 
   destructor is called

 * changed the static_set_* calls to pass a device_t & instead of
   a device_config *

 * for many devices, the static config structure member names over-
   lapped the device's names for devcb_* functions; in these cases
   the members in the interface were renamed to have a _cb suffix

 * changed the driver_enumerator to only cache 100 machine_configs
   because caching them all took a ton of memory; fortunately this
   implementation detail is completely hidden behind the 
   driver_enumerator interface

 * got rid of the macros for creating derived classes; doing it
   manually is now clean enough that it isn't worth hiding the
   details in a macro
2011-04-27 05:11:18 +00:00
Aaron Giles
543fa08fd0 Rename state_manager -> save_manager since the term "state" is overloaded. 2011-04-20 15:14:54 +00:00
Angelo Salese
d3a1560433 Ok, last spring cleaning, I hope ... 2011-04-19 14:36:17 +00:00
Aaron Giles
d971ce8f36 Privatized most of the m_machine pointers in the system to prevent
direct use.
2011-04-19 06:02:01 +00:00
Aaron Giles
fecfc465df Switch from m_machine to machine() everywhere. In some cases this
meant adding a machine() accessor but it's worth it for consistency.
This will allow future changes from reference to pointer to happen
transparently for devices. [Aaron Giles]

Simple S&R:
m_machine( *[^ (!=;])
machine()\1
2011-04-18 20:06:43 +00:00
Aaron Giles
00d745ca77 (Big tangle of changes that all happened as I was looking into the ROM
loader rewrite, which is still in progress....)

Replaced mamedriv.c with a new driver list mechanism that is generated
by the build tools. The emulator core now expects the presence of a
file called src/$(TARGET)/$(SUBTARGET).lst which is just a raw list of
driver names, one per line. C and C++ comments are still permitted.
This file is parsed by a new build tool makelist which extracts the
driver names, sorts them, and generates a file called drivlist.c, which
is consumed by the core. [Aaron Giles]

Added new osdcore function osd_malloc_array() which is identical to
osd_malloc() but obviously hints that the underlying allocation is for
an array. Updated all callers to use the appropriate form. Modified the
Windows allocator to only use guard pages for array-style allocations,
allowing us to enable them once again in debug builds. [Aaron Giles]

Created new static class driver_list to wrap accesses to the list of
available drivers. Improved speed of driver lookups by relying on the
presorting done by makelist. [Aaron Giles]

Created helper class driver_enumerator as a helper for iterating through 
the list of drivers. This class supports basic filtering and iteration,
and also serves as a temporary cache of machine_configs. [Aaron Giles]

Created cli_frontend object to wrap all the CLI handling code in
clifront.c. Updated/simplified all the code to take advantage of the
driver_enumerator. [Aaron Giles]

Created media_auditor object to wrap all the auditing functions in
audit.c. Updated all users to the new interface. Note that the new
auditing mechanism is slightly out of sync with the romload code in
terms of finding ROMs owned by devices, so it may mis-report some
issues until the new ROM loading code is in. [Aaron Giles]

Added concept of a per-device searchpath. For most devices, their 
searchpath is just the short name of the device. For driver_devices, the
searchpath is driver[;parent[;bios]]. This searchpath will eventually be
used by the rom loader to find ROMs. For now it is used by the media
auditor only. [Aaron Giles]

Created info_xml_creator object to wrap all the info generation functions
in info.c. Converted the file to C++ and cleaned up the input processing
code. [Aaron Giles]

(not for whatsnew ... Known issues: auditing of CHDs appears busted, and 
debug builds report unfreed memory if you use the built-in game picker)
2011-04-13 20:31:00 +00:00
Aaron Giles
68958f72db Cleanups and version bump. 2011-04-03 05:49:24 +00:00
Aaron Giles
17e077da3a Remove redundant item cpu from address_space, in favor of
space->device().

S: space->cpu->
R: space->device\(\)\.

S: space->cpu
R: \&space->device\(\)
2011-03-29 16:31:32 +00:00
Aaron Giles
2ad5072023 BIG update.
Remove redundant machine items from address_space and device_t.
Neither machine nor m_machine are directly accessible anymore.
Instead a new getter machine() is available which returns a
machine reference. So:

  space->machine->xxx   ==>  space->machine().xxx
  device->machine->yyy  ==>  device->machine().yyy

Globally changed all running_machine pointers to running_machine
references. Any function/method that takes a running_machine takes
it as a required parameter (1 or 2 exceptions). Being consistent
here gets rid of a lot of odd &machine or *machine, but it does
mean a very large bulk change across the project.

Structs which have a running_machine * now have that variable
renamed to m_machine, and now have a shiny new machine() method
that works like the space and device methods above. Since most of
these are things that should eventually be devices anyway, consider
this a step in that direction.

98% of the update was done with regex searches. The changes are
architected such that the compiler will catch the remaining
errors:

// find things that use an embedded machine directly and replace
// with a machine() getter call
S: ->machine->
R: ->machine\(\)\.

// do the same if via a reference
S: \.machine->
R: \.machine\(\)\.

// convert function parameters to running_machine &
S: running_machine \*machine([^;])
R: running_machine \&machine\1

// replace machine-> with machine.
S: machine->
R: machine\.

// replace &machine() with machine()
S: \&([()->a-z0-9_]+machine\(\))
R: \1

// sanity check: look for this used as a cast
(running_machine &)
// and change to this:
*(running_machine *)
2011-03-29 15:50:04 +00:00
Aaron Giles
af071893a6 Cleanup of machine.h. Shuffled some fields around, and moved several
to private member variables with accessors:

machine->m_respool     ==> machine->respool()
machine->config        ==> machine->config()
machine->gamedrv       ==> machine->system()
machine->m_regionlist  ==> machine->first_region()
machine->sample_rate   ==> machine->sample_rate()

Also converted internal lists to use simple_list.
2011-03-28 09:10:17 +00:00
Aaron Giles
202d7680a4 Created new enum type address_spacenum for specifying an address
space by index. Update functions and methods that accepted an
address space index to take an address_spacenum instead. Note that
this means you can't use a raw integer in ADDRESS_SPACE macros, so
instead of 0 use the enumerated AS_0.

Standardized the project on the shortened constants AS_* over the
older ADDRESS_SPACE_*. Removed the latter to prevent confusion.
Also centralized the location of these definitions to memory.h.
2011-03-27 07:37:24 +00:00
Aaron Giles
4b3aa02618 Added device_t::memory() to fetch a reference to the memory interface,
or assert if not present.

Split address_space::install_[legacy_]handler into 
install_[legacy_]read_handler, install_[legacy_]write_handler,
and install_[legacy_]readwrite_handler.

Added variants of address_space handler installers which don't take
mirror or mask parameters, since this is by far the most common case.

Deprecated API cleanup. Simple search & replace:
cpu_suspend                          ==> device_suspend
cpu_resume                           ==> device_resume
cpu_yield                            ==> device_yield
cpu_spin                             ==> device_spin
cpu_spinuntil_trigger                ==> device_spin_until_trigger
cpu_spinuntil_time                   ==> device_spin_until_time
cpu_spinuntil_int                    ==> device_spin_until_interrupt
cpu_eat_cycles                       ==> device_eat_cycles
cpu_adjust_icount                    ==> device_adjust_icount
cpu_triggerint                       ==> device_triggerint
cpu_set_input_line                   ==> device_set_input_line
cpu_set_input_line_vector            ==> device_set_input_line_vector
cpu_set_input_line_and_vector        ==> device_set_input_line_and_vector
cpu_set_irq_callback                 ==> device_set_irq_callback

More complex changes:
device_memory(device)                ==>  device->memory()
device_get_space(device, spacenum)   ==>  device->memory().space(spacenum)
cpu_get_address_space(cpu, spacenum) ==> cpu->memory().space(spacenum)
cputag_get_address_space(mach, tag, spacenum) ==> mach->device("tag")->memory().space(spacenum)
cputag_get_clock(mach, tag)          ==> mach->device("tag")->unscaled_clock()
cputag_set_clock(mach, tag, hz)      ==> mach->device("tag")->set_unscaled_clock(hz)

Some regex'es for the more prevalent cases above:
S: cpu_get_address_space( *)\(( *)([^,]+)( *), *
R: \3->memory().space\1\(\2
S: cputag_get_address_space( *)\(( *)([^,]+)( *),( *)([^,]+)( *), *
R: \3->device\1\(\2\6\7\)->memory().space\1\(\2
S: cputag_get_clock( *)\(( *)([^,]+)( *),( *)([^ )]+) *\)
R: \3->device\1\(\2\6\7\)->unscaled_clock\(\)
2011-03-27 01:19:26 +00:00
Aaron Giles
06ee6804dd Converted core_options to a class. Removed a bunch of marginal
functionality in favor of alternate mechanisms. Errors are
now reported via an astring rather than via callbacks. Every
option must now specify a type (command, integer, float, string,
boolean, etc). Command behavior has changed so that only one
command is permitted. [Aaron Giles]

Changed fileio system to accept just a raw searchpath instead of
an options/option name combination. [Aaron Giles]

Created emu_options class dervied from core_options which wraps
core emulator options. Added mechanisms to cleanly change the
system name and add/remove system-specific options, versus the
old way using callbacks. Also added read accessors for all the
options, to ensure consistency in how parameters are handled.
Changed most core systems to access emu_options instead of
core_options. Also changed machine->options() to return emu_options.
[Aaron Giles]
 
Created cli_options class derived from emu_options which adds the
command-line specific options. Updated clifront code to leverage
the new class and the new core behaviors. cli_execute() now accepts
a cli_options object when called. [Aaron Giles]

Updated both SDL and Windows to have their own options classes,
derived from cli_options, which add the OSD-specific options on
top of everything else. Added accessors for all the options so
that queries are strongly typed and simplified. [Aaron Giles]

Out of whatsnew: I've surely screwed up some stuff, though I have
smoke tested a bunch of things. Let me know if you hit anything odd.
Also I know this change will impact the WINUI stuff, please let me 
know if there are issues. All the functionality necessary should 
still be present. If it's not obvious, please talk to me before 
adding stuff to the core_options class.
2011-03-03 17:05:24 +00:00
R. Belmont
a5f476e301 Fix disassembler override hook [Aaron Giles] 2011-02-19 19:25:30 +00:00
Aaron Giles
1b54456be5 mame_file is now emu_file and is a class. It is required
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.
2011-02-12 03:47:37 +00:00
Aaron Giles
4fa610aa02 Cleanups and version bump. 2011-02-09 15:01:01 +00:00
Aaron Giles
79f1fbb380 Make "run to next CPU" more reliable. 2011-02-09 04:07:19 +00:00
Aaron Giles
4f7efb1ca4 Moved the state saving system to C++. For now the registration macros
are still intact. The new state_manager class has templatized methods
for saving the various types, and through template specialization can
save more complex system types cleanly (like bitmaps and attotimes).

Added new mechanism to detect proper state save types. This is much
more strict and there will likely be some games/devices that fatalerror
at startup until they are remedied. Spot checking has caught the more
common situations.

The new state_manager is embedded directly in the running_machine, 
allowing objects to register state saving in their constructors now.

Added NAME() macro which is a generalization of FUNC() and can be
used to wrap variables that are registered when directly using the
new methods as opposed to the previous macros. For example:

  machine->state().save_item(NAME(global_item))

Added methods in the device_t class that implicitly register state
against the current device, making for a cleaner interface.

Just a couple of required regexes for now:

state_save_register_postload( *)\(( *)([^,;]+), *
\3->state().register_postload\1\(\2

state_save_register_presave( *)\(( *)([^,;]+), *
\3->state().register_presave\1\(\2
2011-02-08 06:48:39 +00:00
Aaron Giles
07a66f8c54 Move generic templates from emucore.h to emutempl.h.
Normalize the tagged_list template to wrap a regular standard_list
and have similar semantics. Updated a few direct callers to handle
the changes.
2011-02-07 05:47:17 +00:00
Aaron Giles
ae5dfca0bf Fix build break from last checkin.
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
2011-02-06 07:29:03 +00:00
Scott Stone
00a3403054 Add basic LOAD function to the debugger to complement the existing SAVE function. It allows you to load a binary file straight into writeable memory. The format is the same as the SAVE function with the exception that the <length> can be handled differently. [Pugsy] 2011-02-03 17:09:41 +00:00
Aaron Giles
f534d245c0 Attotime bulk conversion step:
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)

Also, changed the following MCFG macros to require a full
attotime specification:

MCFG_TIMER_ADD_PERIODIC
MCFG_QUANTUM_TIME
MCFG_WATCHDOG_TIME_INIT
2011-02-03 09:06:34 +00:00
Aaron Giles
1e88333178 Converted attotime to a class, with proper operators. Removed old
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)
2011-02-03 07:52:45 +00:00
R. Belmont
28e34ea140 NetBSD support [Thomas Klausner]
Not for whatsnew: I added -Wno-conversion unconditionally to disable the 
warnings Thomas reported.  That setting is the default for GCC out-of-the-box 
but apparently not on NetBSD.  As far as I know it shouldn't cause a problem 
with any GCC version back to at least 4.0.0 so we're safe even on PPC OSX, 
but do let me know if hilarity ensues.
2011-02-02 03:29:54 +00:00
Aaron Giles
c94b8c9490 C++-ified the sound and streams interfaces. Combined sound.c and streams.c
into one file, and separated the speaker device into its own file.
Generalized the concept of dynamically assigned inputs and re-wired the
speaker to work this way, so it is now treated just like any other
sound device. Added methods to the device_sound_interface for controlling
output gain and mapping device inputs/outputs to stream inputs/outputs.
Also made the sound_stream_update() method pure virtual, so all modern
sound devices must use the new mechanism for stream updates.

Primary changes outside of the core are:

  stream_update(stream) == stream->update()
  stream_create(device,...) == machine->sound().stream_alloc(*device,...)
  sound_global_enable(machine,enable) == machine->sound().system_enable(enable)

Beyond this, the patterns are relatively obvious for the remaining calls.
2011-01-27 08:06:43 +00:00
R. Belmont
2d32a07198 SDL OS/2 fixes [K.O. Myung-Hun] 2011-01-10 14:32:42 +00:00
Aaron Giles
5db7b9e8a3 Ok, last major rename for this round:
memory_region()        == machine->region()->base()
memory_region_length() == machine->region()->bytes()

region_info -> memory_region

Regex searches:

S: memory_region( *)\(( *)([^,&]+), *([^)]+)\)
R: \3->region\1\(\2\4\)->base\(\)

S: memory_region_length( *)\(( *)([^,&]+), *([^)]+)\)
R: \3->region\1\(\2\4\)->bytes\(\)
2011-01-01 00:41:25 +00:00
Aaron Giles
b921f65454 Add directxor parameter to direct memory accessors. Update all callers
that manually XORed addresses to pass the XOR instead.

This improves behavior when direct accessors hit non-RAM regions, or
when watchpoints are used, because we now know the original, un-xored
address and can fall back to standard read/write handlers properly.
Also fixes glitched disassembly when read watchpoints are enabled.
2010-12-31 17:55:41 +00:00
Phil Bennett
31d554dc17 Added a 'changed by' search to the cheat engine [Pugsy]
---------- Forwarded message ----------
From: Pugsy <pugsy@gmx.net>
Date: Tue, Dec 14, 2010 at 3:13 PM
Subject: Minor patch to improve cheat finding functionality
To: submit@mamedev.org
Cc: "stephh U.P." <upstephh_wip@yahoo.com>


Hi

Here is a simple patch that will add a "changed by" search - it's effectively a increased and decreased search rolled into one. It is useful when you are uncertain if the value has increased by x or decreased by x so it saves having to guess which search method to try first.


-- 
Martin 'Pugsy' Pugh


MAME Cheat File Maintainer http://mamecheat.co.uk
Gamebase64 Team Member http://www.gamebase64.com
2010-12-19 17:41:56 +00:00
Miodrag Milanovic
84c873b4fd Fixed debug command symlist (bug #4131) [Robbbert] 2010-12-12 09:50:47 +00:00
R. Belmont
1d37415a4a Fixed BSD compile [ElBarto] 2010-12-06 14:39:18 +00:00
Aaron Giles
57ef3a5ed6 Split the screen device into a separate module.
Converted global video routines into a video_manager.
Moved video manager initialization earlier in startup.
2010-12-02 17:26:38 +00:00
Aaron Giles
92b3dd111f Cleanup & version bump. 2010-11-08 09:08:55 +00:00
Aaron Giles
12111c21d0 Fix issues with setting condition expressions on break/watchpoints. 2010-11-08 08:58:41 +00:00
Aaron Giles
39cd5cc7f5 Fix compile error. 2010-11-03 04:10:51 +00:00
Tomasz Slanina
b3b3913080 OSX compile fix. 2010-11-01 23:51:09 +00:00
Aaron Giles
a2ce61ac6c Converted the expression engine to C++, did the usual cleanup. 2010-11-01 07:48:02 +00:00
Aaron Giles
e4beed95a6 Create new class osd_interface to house OSD callbacks. Added new
module osdepend.c with default empty implementations. Changed
mame_execute() and cli_execute() to accept a reference to an
osd_interface which is provided by the caller.

Updated SDL and Windows OSD to create an osd_interface-derived
class and moved their OSD callbacks to be members.
2010-10-21 15:59:44 +00:00
Aaron Giles
3beb0ec246 Converted render.c objects into C++ objects. Updated all callers. 2010-10-13 06:20:10 +00:00
Aaron Giles
7a4744d31d Cleanups and version bump. 2010-09-19 05:09:00 +00:00
Aaron Giles
85d240c04c Move debug_setup() call to after the device_debug class is created. 2010-09-06 19:05:34 +00:00
Aaron Giles
6fe9fe53f4 Integrated comments into debugcpu.c, and removed debugcmt.c. Modernized
the code and updated so it actually works with the modern debug classes.
2010-09-05 06:12:47 +00:00
Aaron Giles
820fc8f8ea Whoops, one more reference.... 2010-09-04 20:55:22 +00:00
Aaron Giles
15ec9dd390 Remove unused debug_comment_exit 2010-09-04 20:44:53 +00:00
Aaron Giles
1359ea15b1 Have each device create its own device_debug instead of letting the
debugger do it. This allows the device to start itself up before the
debugger tries to figure out what to do with it. Fixes the problem
where register names were not populated into the symbol table
correctly after I shuffled the initialization order.
2010-09-04 19:47:54 +00:00
Miodrag Milanovic
82c98dfa1b Since previous fix made lot of issues, found better solution for this astring bool problem (no whatsnew) 2010-08-22 12:36:56 +00:00
Aaron Giles
4d1fc8fafa Swap: (astring.len() != 0) -> astring
Swap: (astring.len() == 0) -> !astring
2010-08-21 19:27:14 +00:00
Aaron Giles
0e09afc1a8 Added bool operator to astring, returning true if the string is
not empty. Conveniently, this creates ambiguity if you write
astring == NULL. Rooted out remaining cases where we were doing
that and fixed them.
2010-08-21 19:23:48 +00:00
Aaron Giles
621a2faa2a Remove final set of legacy inlines from memory.h. Mostly affects CPU
cores, which all now cache a copy of space->direct() and use it for
direct accesses.
2010-08-19 16:10:19 +00:00
Aaron Giles
44c78c4939 Remove most of the temporary inline helpers.
The only one that touched a lot of drivers is this one:

S: memory_set_decrypted_region( *)\(( *)([^,]+)( *),( *)
R: \3->set_decrypted_region\1\(\2
2010-08-19 14:19:38 +00:00
Aaron Giles
3598b772bc Replace "const address_space" with "address_space" throughout the system.
The purpose of making it const before was to discourage direct tampering,
but private/protected does a better job of that now anyhow, and it is
annoying now.

    s/const[ \t]+address_space\b/address_space/g;

Is basically what I did.
2010-08-19 07:26:14 +00:00
Aaron Giles
dd19e512c0 Massive memory system change. This is another step along the path toward
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.
2010-08-19 06:57:51 +00:00
Aaron Giles
fe47da274e Return to type safety. Changed address maps back into functions that build
up the definition, rather than the whole tokenizing system, which lost type
checking. Added a new module addrmap.c which implements the address map
classes, and changed the macros to call methods on the address_map and
address_map_entry classes which are strongly typed.

Fixed a few incorrectly specified memory map entries along the way. Please
double-check to make sure the behavior is expected in: twincobr.c, lordgun.c,
galaxold.c.

This change also means that since the address_maps are now constructor
functions, they are detected when not used, so a number of #ifdef UNUSED_CODE
were added around dangling address map definitions.

Also included with this change:
- removed cputag_clocks_to_attotime() and cputag_attotime_to_clocks() in
   favor of just expanding the class
- same for cputag_suspend() and cputag_resume()
2010-08-01 21:04:03 +00:00
Miodrag Milanovic
184ee16762 Debugger : Removed stray garbage characters from beamx, beamy, and frame counter displays. [Robbbert] 2010-07-22 13:24:52 +00:00
Wilbert Pol
82f1a8e9df Allow beamx > 999 to be displayed in the debugger. Updated beamy config accordingly to keep beamx and beamy aligned. (no whatsnew) 2010-07-20 20:46:53 +00:00
Quench
c5c7945aa4 Fixed Debugger bpenable/bpdisable commands which were not
seeing parameters - no whatsnew.
2010-07-13 09:57:37 +00:00
R. Belmont
6a315283c9 More loop initializers for PowerPC compile. 2010-07-07 03:30:06 +00:00
Aaron Giles
30662dcdef Cleanups and version bump. 2010-07-06 17:30:28 +00:00
Aaron Giles
f7ce43f8fb Cleanup debugger interface some more. 2010-07-06 16:12:53 +00:00
Aaron Giles
5d21c672af Moved debugging structure away from CPUs only and attached to all
devices. Debugger now creates one for each device. C++-ified most
debugger operations to hang off the debugging class, and updated
most callers. This still needs a little cleanup, but it fixes most
issues introduced when the CPUs were moved to their own devices.

Got rid of cpu_count, cpu_first, cpu_next, etc. as they were badly 
broken. Also removed cpu_is_executing, cpu_is_suspended,
cpu_get_local_time, and cpu_abort_timeslice.

Some minor name changes:
  state_value() -> state()
  state_set_value() -> set_state()
2010-07-06 00:52:36 +00:00
Aaron Giles
c70c5fee5a Created CPU-specific device types for all CPUs, using new macros
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.
2010-07-03 00:12:44 +00:00