Commit Graph

307 Commits

Author SHA1 Message Date
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