Commit Graph

142 Commits

Author SHA1 Message Date
Aaron Giles
2577a0b22d Another step. Moved the address-space related get_info constants
to devintrf (including endianness). Removed space array from the
CPU class header. Made the memory system much more device-neutral.
Various other cleanups along the way.
2009-07-08 16:20:01 +00:00
Aaron Giles
e692918b34 Added casts to ensure proper values are passed to the ctype.h functions.
[Juergen Buchmueller]
2009-06-25 08:04:39 +00:00
Aaron Giles
ad4910a8a8 Bulk change alert.
This update changes the way we handle memory allocation. Rather
than allocating in terms of bytes, allocations are now done in
terms of objects. This is done via new set of macros that replace
the malloc_or_die() macro:

  alloc_or_die(t) - allocate memory for an object of type 't'
  alloc_array_or_die(t,c) - allocate memory for an array of 'c' objects of type 't'
  alloc_clear_or_die(t) - same as alloc_or_die but memset's the memory to 0
  alloc_array_clear_or_die(t,c) - same as alloc_array_or_die but memset's the memory to 0

All original callers of malloc_or_die have been updated to call these
new macros. If you just need an array of bytes, you can use
alloc_array_or_die(UINT8, numbytes).

Made a similar change to the auto_* allocation macros. In addition,
added 'machine' as a required parameter to the auto-allocation macros,
as the resource pools will eventually be owned by the machine object.
The new macros are:

  auto_alloc(m,t) - allocate memory for an object of type 't'
  auto_alloc_array(m,t,c) - allocate memory for an array of 'c' objects of type 't'
  auto_alloc_clear(m,t) - allocate and memset
  auto_alloc_array_clear(m,t,c) - allocate and memset

All original calls or auto_malloc have been updated to use the new
macros. In addition, auto_realloc(), auto_strdup(), auto_astring_alloc(),
and auto_bitmap_alloc() have been updated to take a machine parameter.

Changed validity check allocations to not rely on auto_alloc* anymore
because they are not done in the context of a machine.

One final change that is included is the removal of SMH_BANKn macros.
Just use SMH_BANK(n) instead, which is what the previous macros mapped
to anyhow.
2009-04-26 23:54:37 +00:00
Aaron Giles
eb539cce9d Many casts added to the core files, and various other tweaks
to make them compile as either C or C++.
2009-03-12 07:43:03 +00:00
Aaron Giles
cef6764910 Cleanups and version bump. 2009-02-17 15:31:20 +00:00
Aaron Giles
cc14b2aaa7 Opcode accesses are now marked debugger_access. This is important with the recent
changes to automatically call the read handler if the opcode base cannot be
found.

Changed logging for non-RAM opcode bases so that it does not output in the case
of debugger_access being set.

Fixed logic for deriving direct ranges so that it uses the non-watchpoint-
infected tables for its lookups.
2009-01-30 18:11:46 +00:00
Aaron Giles
0b6ec32822 Made direct (opcode) access more robust. Direct access now crawls the
memory table to find its ranges, and caches them for fast access in
the future. It invalidates intersecting regions when new ones are
installed, and now properly handles mirrored ranges.

Also changed the disassembly view to call the decrypted read routines
for each opcode byte/word instead of fetching from a pointer, which
prevented opcodes that crossed range boundaries from working correctly,
even though they would execute correctly.
2009-01-13 15:32:36 +00:00
Nathan Woods
45a3d96248 Added check to debug_cpu_set_dasm_override(), because callers do not know if we
are in debug mode or not
2009-01-07 11:42:24 +00:00
Aaron Giles
835ace034d Cleanups and version bump. 2009-01-04 23:31:12 +00:00
Aaron Giles
a70fdf00a1 CPU interface organization shuffle. The file cpuintrf.h now merely
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).
2008-12-22 17:35:27 +00:00
Aaron Giles
c0ca96b075 Cleanups and version bump. 2008-12-22 04:01:51 +00:00
Aaron Giles
320097d9fe Renamed CPUINFO_PTR_* to CPUINFO_FCT_* for function get infos.
Changed Z80 over to the new cpu_state_table mechanism.
2008-12-19 22:26:25 +00:00
Aaron Giles
42c9aeff39 Cleaned up device and sound interfaces to match the CPU
interfaces when handling strings. Namely, the generic
get_info functions allocate a temporary string and the
device in question copies its string to the target,
instead of assigning a const char *. Updated all device
and sound cores to operate this way.

Added the concept of a cpu_state_table, which is
supplied by the CPU cores and which describes all the
register state accessible to the debugger and other
subsystems. The format of the table is such that most
data can be simply fetched from memory without the
further involvement of the CPU core, including the 
display of common formats. Extensibility points are
available for custom display and for importing/exporting
the data to intermediate variables for more complicated
scenarios. Updated the ADSP21xx, TMS340x0, and i86 cores
to use this.

Removed the old debugger register list, which was never
used. Replaced it with using ordering from the
cpu_state_table.

Renamed REG_PC -> REG_GENPC, REG_SP -> REG_GENSP, and
REG_PREVIOUSPC -> REG_GENPCBASE. Updated a few spots
that were using these directly. Moved these definitions
into the end of the register area rather than leaving
them outside which put them in a weird range.
2008-12-19 06:46:17 +00:00
Aaron Giles
5630547540 More device normalization:
cpu_get_info_* -> device_get_info_*
  cpu_set_info_* -> device_set_info_*
  cpu_reset      -> device_reset

Removed the cputype_get_* macros as they are not necessary.

Removed cpuintrf_init() which is no longer necessary.
2008-12-16 16:30:28 +00:00
Aaron Giles
98c40f06db Made CPUs into proper devices. CPUs are now added in the
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.
2008-12-16 15:02:15 +00:00
Aaron Giles
54db8f077b Cleanups and version bump. 2008-12-15 01:46:32 +00:00
Aaron Giles
7eaa676d90 Fixed compile error, and fixed crash when handling an exception when the
debugger is disabled.
2008-12-11 11:03:11 +00:00
Aaron Giles
d87ef8f79b Here's the big one....
Added new function cpuexec_describe_context(machine) which can be
used in logerror() and other printf-style functions to return a
description of the current CPU/PC given only the machine. Changed
several dozen sites to use this instead of directly interrogating
the activecpu.

Removed all other uses of activecpu throughout the system. Removed
activecpu from the machine structure to prevent future abuse.

Removed cpu_push_context() and cpu_pop_context(), and all call
sites.

Voodoo devices now require a CPU to be defined in the configuration
in order to know whom to steal cycles from or stall when FIFOs get
full. Updated all voodoo users to specify one.

CPD1869 devices now also require a CPU to be defined in the
configuration, in order to know which CPU's registers to fetch.
Updated all cdp1869 users to specify one.

Many other small changes to make this all work.
2008-12-11 09:40:22 +00:00
Aaron Giles
5b64c00674 Added logic to track OSD updates separately from internal view updates in the
debugger. In order to get the OSD to update, a new function 
debug_view_flush_updates() must be called. Currently this is automatically
called before osd_wait_for_debugger(), and during the periodic updates while
executing. The OSD code may occasionally need to call it under other
circumstances (for example, the Windows code calls it explicitly while
tracking scrollbar thumbs to get live scrolling).
2008-12-08 10:11:29 +00:00
Aaron Giles
d92a2e0c4e Cleanups/version bump/added missing drivers. 2008-12-06 17:54:42 +00:00
Aaron Giles
8169eeefca 02687: emuopts.c: CORE INPUT AUTOMATIC ENABLE OPTIONS
02683: Pressing F5 while running debugger causes access violation 
02669: pandoras: music tempo is too fast 
02691: Some drivers with z80/ay8910 Audio: Audio tempo has changed 

Also fixed debugger memory leak.

Added a number of new cputag_* macros to cpuexec.h.
2008-12-04 09:34:38 +00:00
Aaron Giles
85b961f5af CPU_IS_LE -> ENDIANNESS_LITTLE
CPU_IS_BE -> ENDIANNESS_BIG

Also fixed help for step over/in to specify correct keys.
2008-12-04 06:08:32 +00:00
Aaron Giles
30aa31f163 More debugger changes.
Added the concept of 'subviews' to the debugger views. The core
now creates a list of possible subviews, and the OSD can select
between them. This removes code from the OSD that was previously
required to find all possible memory and disassembly views.

Added machine parameters to debugger console output functions.

Fixed some oddities in the memory view.

Moved globals to hang off of the machine structure.

Fixed bug where the visiblecpu was not updated immediately upon
a break.
2008-12-03 17:31:20 +00:00
Aaron Giles
d924407859 Big debugger cleanup.
Important note for OSD ports: the get/set property functions have 
been retired for debug_views. Instead, there are specific functions
to perform each get/set operation. In addition, the format of the
update callback has changed to pass the osd private data in, and
the update callback/osd private data must be passed in at view
allocation time. And osd_wait_for_debugger() now gets a CPU object
instead of the machine.

Removed extra debugger tracking for address spaces and added some
of the useful data to the address_space structure. Updated all
debugger commands and views to use CPU and address space objects
where appropriate.

Added new memory functions for converting between bytes and
addresses, and for performing translations for a given address
space. Removed debugger macros that did similar things in favor
of calling these functions.

Rewrote most of the memory view handling. Disasm and register views
still need some additional tweaking.
2008-12-03 06:35:34 +00:00
Aaron Giles
6924ad8120 Changed timer_alloc, timer_set, timer_pulse, timer_call_after_resynch,
and timer_get_time to pass the machine parameter. Moved timer globals
to hang off of the running_machine.
2008-11-26 06:38:08 +00:00
Aaron Giles
1d05ea6089 Cleanups and version bump for 0.128u4. 2008-11-24 04:10:18 +00:00
Aaron Giles
513011179d change_pc? What change_pc? 2008-11-24 02:40:16 +00:00
Aaron Giles
5d89160f3b Further debugger cleanup. Symbol tables now have a global ref
as well as a per-symbol ref. Debugcpu is now clear of active
CPU references and global Machine references.
2008-11-22 16:50:00 +00:00
Aaron Giles
5816061f8e Debugger interfaces cleanup. Still more to do but this compiles and
works. Added callback parameters to the expression engine. Improved
CPU parsing so you can use a CPU tag or index in most commands that
take one. Switched to passing CPU and address space objects around
where appropriate. Lots of other minor tweaks.
2008-11-21 16:53:48 +00:00
Aaron Giles
371cd0a56d Another big one.
Moved memory global state into a struct hanging off of the machine.
Updated almost all memory APIs to take an address_space * where
appropriate, and updated all callers. Changed memory internals to
use address spaces where appropriate. Changed accessors to point
to the memory_* functions instead of the address space-specific
functions. Improved internal handling of watchpoints.

Added cputag_* functions: cputag_reset(), cputag_get_index(),
cputag_get_address_space(). These just expand via macros to an
initial fetch of the CPU via cputag_get_cpu() followed by the
standard CPU call.

Added debugger_interrupt_hook() and debugger_exception_hook() calls
which intelligently look at the debugger flags before calling.

Did minimal cleanup of debugger, mainly moving CPU-specific data
to hang off of the CPU classdata for more direct access.
2008-11-20 09:50:31 +00:00
Aaron Giles
0801d1254c Converted change_pc() into a no-op. Changed memory_set_direct_region() to
return a boolean indicating whether the given address was successfully
located in a bank. Change raw/decrypted access to look at this result, and
if the given address is not in a bank, calls through to the standard read
handlers.

In theory, this should prevent crashes when accessing opcodes. It does in
fact prevent mp_col3 from crashing.

Fixed address space mapping handlers to invalidate direct access regions
if a change is made to the mapping. This is needed to prevent the Sega
dynamic memory mapping chips from falling over.
2008-11-19 06:36:01 +00:00
Aaron Giles
e7c418ef0f Generalized the concept of opbase access into "direct" access.
Removed opbase globals to the address_space structure.
Cleaned up names of pointers (decrypted and raw versus rom and ram).
Added inline functions to read/write data via any address space.
Added macros for existing functions to point them to the new functions.
Other related cleanups.
2008-11-17 18:33:10 +00:00
Aaron Giles
537c9becf6 WARNING: this compiles, but not fully cleanly, and a number of drivers
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.
2008-11-14 16:43:46 +00:00
Aaron Giles
62a2f2fba0 This patch:
- removed unnecessary deprecat.h includes
- replaces Machine with existing running_machine* instances
- re-adds a peroid I accidentally removed when changed a message to
use defines
- adds a running_machine* to win_window_info and debugwin_info to get
rid of most Machine occurances and clean up the running_machine*
parameters I added in the past

[Oliver Stoeneberg]
2008-11-13 07:33:00 +00:00
Aaron Giles
63d10ee9bf Massive API cleanup/change. The primary goal is that all CPU-
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_*.
2008-11-13 06:59:57 +00:00
Aaron Giles
6f4ee44948 Added CPU device parameters to all CPU callbacks except for the
context ones (which are going away), the disassembler (which should
have no dependencies on the live CPU), and the validity check.

Removed global token from all pointer-ified CPU cores that don't
have internal read/write callbacks (which still need to reference it).
2008-11-10 08:51:06 +00:00
Aaron Giles
92f3053105 Major cpuintrf changes:
* 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
2008-11-10 07:42:09 +00:00
Aaron Giles
229d598989 Cleanups and version bump. 2008-09-26 13:42:51 +00:00
Aaron Giles
0f3e79564d From: Atari Ace [mailto:atari_ace@verizon.net]
Sent: Sunday, September 21, 2008 10:45 AM
To: submit@mamedev.org
Cc: atariace@hotmail.com
Subject: [patch] More static qualifiers

Hi mamedev,

Another static function update from yours truly, almost entirely
affecting code added in the last few months to MAME.  The fixes are
the usual lot, changing enum definitions so they aren't declared,
decorating dead code/declarations with #if...#endif, and of course,
adding static where appropriate.  In addition, I fixed a bunch of
UNUSED_FUNCTON symbols to be spelled correctly (I didn't introduce
this).

~aa
2008-09-26 05:25:11 +00:00
Aaron Giles
990ef98b53 02280: any set with multiple CPUs: Disassembler freezes when doing a Run on any CPU other than CPU 0 2008-09-22 06:06:23 +00:00
Aaron Giles
1eb3c2d964 Changed requirements for laserdisc CHDs to require a new chunk of
metadata with pre-decoded frame information. Modified chdman to
automatically produce this for CHDs that are of the appropriate
parameters. To fix up existing CHDs, use chdman -fixavdata on the
CHD.

Modified the laserdisc core to leverage the pre-decoded frame
metadata, which is now required. This improves seek times when
searching and allows the player-specific emulation access to the
VBI data as soon as it would really be available. Changed update
callback timing to fire just before the first line of VBI data
would be read; at that point, the frame selection is assumed to
be committed. 

Converted PR-8210 emulation over to using the actual MCU from the
laserdisc player. This MCU controls low-level functions such as
slider position and laser on/off, and receives decoded vertical
blanking data in order to make decisions. Removed old HLE behavior.
Note that the overlay text is displayed via the UI; this is
temporary and will be fixed shortly.

Converted Simutrek-hacked laserdisc emulation to using the actual
MCU from the game, which in turn hands off commands to the PR-8210
MCU. This is still not 100% but is pretty close at this point and
achieves the correct behaviors in most cases.

Fixed Cube Quest overlay scaling to cover the whole screen.

Changed laserdisc video parameters to position the screen area at
the bottom rather than the top, since this corresponds more closely
to standard line numbering.

Extended the vbiparse code to support pack/unpack, and to more
fully document all the meanings of the VBI codes.

Updated ldplayer to support slow/fast forward movement, frame/chapter
display, and separate controls for scanning/stepping.

Added new built-in variable "frame" to the debugger.

Fixed device-based ROM loading to support loading ROMs from the
game's ZIP as well.
2008-09-18 15:17:42 +00:00
Aaron Giles
3d1dbafcc2 From: Oliver Stoeneberg [mailto:oliverst@online.de]
Subject: Machine -> machine

This is a big patch adding running_machine* parameters and using 
"machine" where available.
2008-09-11 15:57:52 +00:00
Aaron Giles
9b4e46fad5 Changed DEVICE_START functions to return an error code. Currently this
is either DEVICE_START_OK or DEVICE_START_MISSING_DEPENDENCY. The latter
should be returned by a device if there is another device it depends on
which hasn't been started yet. Added new flag in the device interface to
indicate whether a device has been started.

Changed laserdisc interface to explicitly specify the screen and sound
devices it should route to. Drivers no longer have to manually call
laserdisc_vsync(). Instead, the laserdisc code connects up to the routed
screen device and works based on that screen's VBLANK timing. Removed
all existing calls to laserdisc_vsync().

Changed laserdisc behavior so that it completes the previous video read
and initiates the next read at the end of VBLANK instead of the beginning.
This gives player logic time during VBLANK to alter the slider position
prior to fetching the next frame.

Added new laserdisc callback for vsync begin and changed the update
callback to be called at the end of VBLANK. Also added functions to set
the slider speed, advance the slider, and directly control the video/
audio squelch. In addition, there is a new status function to get the
slider position in general terms.

Added parameter to the VBLANK callbacks supported in emu/video.c. Updated
all callers to provide a callback value.

Fixed bug that would cause watchpoints to trigger if you had a memory
window open to the watchpoint address.

Further updates to the PR-8210 ROM simulation. Still not quite there but
the system is much better understood now. Added layout to the PR-8210
which displays the state of the front-panel LEDs.
2008-09-09 16:10:11 +00:00
Aaron Giles
cffe201094 From Oliver Stoeneberg [oliverst@online.de]
This contains three different patches:

20080829.patch
Introducing the running_machine* parameter in a few more places. Next 
step would be to make the execute_* function aware of it, if that's 
OK. Also used the machine parameter in memory.c were it's available.

20080829_1.patch
The already discussed and probably being rejected removal of 
dreprecat.h from debugger.h. I think this is a low-risk patch (we had 
worse cleanups) and it lowers the risk of new code using deprecated 
function beign introduced in MAME/MESS, because there is no invisible 
inclusion of deprecat.h anymore (I think one driver - kofball.c - got 
it with deprecated code).

20080829_2.patch
The last Machine -> machine conversion I had sitting in my local 
tree. I know the proper way is to turn them into devices, but I still 
haven't looked into that.
2008-09-04 08:55:01 +00:00
Aaron Giles
a2caa558e2 Cleanups and version bump. 2008-08-28 15:26:11 +00:00
Aaron Giles
7521888dd7 Added PR-8210 support to the ldplayer. Fixed step forward command on the PR-8210.
02136: cubeqst: from minimal UI cubeqst requires the optional CHD 
02127: xymg: The game name should be Xing Yun Man Guan and "Pin Yin:"should be omitted 
02138: flamegun: Debugger/Cheat System upper case cpu tag of MAIN doesn't work 
02139: In audio/system16.c, there is a reference to REGION_SOUND1 
02133: chindrah: The title of Zhong Guo Long?(Hong Kong,V011H) is Dong Fang Zhi Zhu(Hong Kong, V011H) 
02126: corrupt CHDs are reported as missing
2008-08-22 02:43:32 +00:00
Aaron Giles
b40a4f5531 Cleanups and version bump. 2008-08-07 16:02:05 +00:00
Aaron Giles
9df01a2896 Added expression validation callback to verify names for CPUs and
memory regions. Extended error codes to report incorrect memory 
spaces, memory names, or memory sizes. Added verification callback
to the debugger to validate CPU and memory region names, as well
as verifying that a requested address space exists for a given
CPU.

Added support for oneshot cheats (those with only an "on" script).
They are activated via UI_SELECT in the cheat menu, and pop up a
message when activated. Also added a "Reset All" item in the cheat
menu to reset all cheats back to their default state, and added
support for UI_SELECT on a non-oneshot cheat so that it resets that
cheat to its default value.

Restored previous behavior that allowed popmessage() messages to
overlay menus and other UI.
2008-08-07 15:53:58 +00:00
Aaron Giles
e0409bc7b1 From: Oliver Stoeneberg [mailto:oliverst@online.de]
Subject: a few cleanups

This patch contains:
- removal of unprintable chars (newlines) in SH-2 disassembler (I 
submitted this in the past nd it wasn't included)
- a few unnecessary checks after malloc_ort_die() calls
- changes two romload.c warnings to use GAMENOUN instead
- adds "deprecat.h" in a  few src/mame/drivers files (would be 
necessary, if the debugger.h one would be removed)
- cleans up the mame.mak by adding all missing defines and grouping 
them based on cpu.mak
- renamed video_exit() to winvideo_exit() for consistency in function 
names
2008-07-31 08:26:39 +00:00
R. Belmont
818cfdc705 Fixed 64-bit GCC compile. 2008-07-31 04:49:54 +00:00
Aaron Giles
5a17b8a274 Changed symbol table reference parameters to void * from UINT32. 2008-07-31 00:19:30 +00:00
Aaron Giles
4a6fc8d5e5 Region classes go bye-bye. 2008-07-28 16:22:20 +00:00
Aaron Giles
27fed1ec97 Changed the way memory regions are referenced. Instead of a single
integer value, regions are now referred to by a region class and
a region tag. The class specifies the type of region (one of CPU,
gfx, sound, user, disk, prom, pld) while the tag uniquely specifies
the region. This change required updating all the ROM region
definitions in the project to specify the class/tag instead of
region number.

Updated the core memory_region_* functions to accept a class/tag
pair. Added new memory_region_next() function to allow for iteration
over all memory regions of a given class. Added new function
memory_region_class_name() to return the name for a given CPU
memory region class.

Changed the auto-binding behavior of CPU regions. Previously, the
first CPU would auto-bind to REGION_CPU1 (that is, any ROM references
would automatically assume that they lived in the corresponding
region). Now, each CPU automatically binds to the RGNCLASS_CPU region
with the same tag as the CPU itself. This behavior required ensuring
that all previous REGION_CPU* regions were changed to RGNCLASS_CPU
with the same tag as the CPU.

Introduced a new auto-binding mechanism for sound cores. This works
similarly to the CPU binding. Each sound core that requires a memory
region now auto-binds to the RGNCLASS_SOUND with the same tag as the
sound core. In almost all cases, this allowed for the removal of the
explicit region item in the sound configuration, which in turn 
allowed for many sound configurations to removed altogether.

Updated the expression engine's memory reference behavior. A recent
update expanded the scope of memory references to allow for referencing
data in non-active CPU spaces, in memory regions, and in EEPROMs.
However, this previous update required an index, which is no longer
appropriate for regions and will become increasingly less appropriate
for CPUs over time. Instead, a new syntax is supported, of the form:
"[tag.][space]size@addr", where 'tag' is an optional tag for the CPU
or memory region you wish to access, followed by a period as a 
separator; 'space' is the memory address space or region class you
wish to access (p/d/i for program/data/I/O spaces; o for opcode space;
r for direct RAM; c/u/g/s for CPU/user/gfx/sound regions; e for 
EEPROMs); and 'size' is the usual b/w/d/q for byte/word/dword/qword.

Cleaned up ROM definition flags and removed some ugly hacks that had
existed previously. Expanded to support up to 256 BIOSes. Updated
ROM_COPY to support specifying class/tag for the source region.

Updated the address map AM_REGION macro to support specifying a
class/tag for the region.

Updated debugger windows to display the CPU and region tags where
appropriate.

Updated -listxml to output region class and tag for each ROM entry.
2008-07-28 09:35:36 +00:00
Aaron Giles
7a14f21c15 Cleanups and version bump. 2008-07-24 09:07:49 +00:00
Aaron Giles
517a24c0ef Robustified key behavior when the debugger is visible. Should now
properly ignore the "break into debugger" keypress and not allow
related characters to filter through. Removed some hacks related to
making that work in the past.

Changed osd_wait_for_debugger() to take a machine parameter and a
"firsttime" parameter, which is set to 1 the first time the function
is called after a break. The Windows debugger uses this to ensure
that the debugger has focus when you break into it.
2008-07-17 16:09:52 +00:00
Aaron Giles
5244807bf3 Cleanups. 2008-07-17 08:09:52 +00:00
Aaron Giles
b5f2aa1240 Changed direct access EEPROM interface to return the "bus width" of the
EEPROM data, and the size is in terms of units, not bytes. Updated all
drivers accordingly.

Changed the ROM loading code to actually alter the region flags based
on the CPU endianness and bus width when creating the region, rather
than fixing them up on the fly. This means that callers to
memory_region_flags() will get the correct results.

Changed the expression engine to use two callbacks for read/write rather
than relying on externally defined functions.

Expanded memory access support in the expression engine. Memory accesses
can now be specified as [space][num]<size>@<address>. 'space' can be
one of the following:

   p = program address space of CPU #num (default)
   d = data address space of CPU #num
   i = I/O address space of CPU #num
   o = opcode address space of CPU #num (R/W access to decrypted opcodes)
   r = direct RAM space of CPU #num (always allows writes, even for ROM)
   e = EEPROM index #num
   c = direct REGION_CPU#num access
   u = direct REGION_USER#num access
   g = direct REGION_GFX#num access
   s = direct REGION_SOUND#num access

The 'num' field is optional for p/d/i/o/r, where is defaults to the
current CPU, and for e, where it defaults to EEPROM #0. 'num' is required
for all region-related prefixes. Some examples:

   w@curpc = word at 'curpc' in the active CPU's program address space
   dd@0    = dword at 0x0 in the active CPU's data address space
   r2b@100 = byte at 0x100 from a RAM/ROM region in CPU #2's program space
   ew@7f   = word from EEPROM address 0x7f
   u2q@40  = qword from REGION_USER2, offset 0x40
   
The 'size' field is always required, and can be b/w/d/q for byte, word,
dword, and qword accesses.
2008-07-17 08:07:12 +00:00
Aaron Giles
d8715ab4ac Note: I have done some testing, but there are probably more bugs
lurking. If you run into anything odd, please let me know.

Added new module uiinput.c which manages input for the user interface.
The OSD is responsible for pushing mouse events and character events
to this interface in order to support mouse movement and text-based
input (currently only used for the select game menu). Added support
for navigating through the menus using the mouse. 
[Nathan Woods, Aaron Giles]

Redesigned the UI menus so that they can maintain a richer state. Now
the menus can be generated once and reused, rather than requiring them
to be regenerated on each frame. All menus also share a comment eventing
system and navigation through them is managed centrally. Rewrote all the 
menus to use the new system, apart from the cheat menus, which are now 
disabled. Reorganized the video menu to make it easier to understand.
[Aaron Giles]
2008-07-12 20:18:25 +00:00
Aaron Giles
e376a53661 Cleanups and version bump. 2008-07-03 15:50:46 +00:00
Aaron Giles
75d18b3a33 Changed how watchpoints work so that supporting them adds 0 overhead
unless some are actually live.

Changed a few call sites from using memory_set_context() to cpuintrf_push_context().
2008-06-28 07:21:54 +00:00
R. Belmont
077cd49d2e GCC 64-bit compile fix 2008-06-26 16:33:51 +00:00
Aaron Giles
3d1376ed97 Cleanups/version bump. 2008-06-26 16:05:46 +00:00
Aaron Giles
68f3a9ab9e Removed DEBUGGER flag from makefile and ENABLE_DEBUGGER
macro from the source code. All MAME builds now include
the debugger, and it is enabled/disabled exclusively by
the runtime command-line/ini settings. This is a minor 
speed hit for now, but will be further optimized going 
forward.

Changed the 'd' suffix in the makefile to apply to DEBUG
builds (versus DEBUGGER builds as it did before).

Changed machine->debug_mode to machine->debug_flags.
These flags now indicate several things, such as whether
debugging is enabled, whether CPU cores should call the
debugger on each instruction, and whether there are live
watchpoints on each address space.

Redesigned a significant portion of debugcpu.c around
the concept of maintaining these flags globally and a
similar, more complete set of flags internally for each
CPU. All previous functionality should work as designed
but should be more robust and faster to work with.

Added new debugger hooks for starting/stopping CPU
execution. This allows the debugger to decide whether
or not a given CPU needs to call the debugger on each
instruction during the coming timeslice.

Added new debugger hook for reporting exceptions.
Proper exception breakpoints are not yet implemented.

Added new module debugger.c which is where global
debugger functions live.
2008-06-26 14:51:23 +00:00
Aaron Giles
75a009ac40 Do not stop in the debugger while we are waiting for a pending
event to occur. This eliminates some confusion during reset and
state loading.
2008-06-24 05:21:19 +00:00
Aaron Giles
eeb821032e Several miscellaneous changes:
1. In the MIPS core:
    - renamed struct mips3_config -> mips3_config
    - updated all drivers to the new names
    - removed MIPS3DRC_STRICT_COP0 flag, which is no longer used
    - a few minor cleanups

2. In the CPU interface:
    - added new 'intention' parameter to the translate callback to
       indicate read/write/fetch access, user/supervisor mode, and
       a flag for debugging
    - updated all call sites to pass an appropriate value
    - updated all CPU cores to the new prototype

3. In the UML:
    - added new opcode SETC to set the carry flag from a source bit
    - added new opcode BSWAP to swap bytes within a value
    - updated C, x86, x64 back-ends to support the new opcodes
    - updated disassembler to support the new opcodes

4. In the DRC frontend:
    - fixed bug in handling edge case with the PC near the 0 or ~0
2008-05-29 07:18:35 +00:00
Aaron Giles
096331c856 Restructured input port internals and cleaned up inptport.c:
* Input ports are now maintained hierarchically. At the top
level are input ports, which contain a list of fields. Each
field represents one or more bits of the port. Certain fields
such as DIP switches and configuration switches contain a
list of settings, which can be selected. DIP switch fields
can also contain a list of DIP switch locations.

* Normalized behavior of port overrides (via PORT_INCLUDE or
by defining multiple overlapping bits). All fields within a
port are kept in strict increasing bit order, so altered DIP
switches are now kept in the appropriate order. This addresses
MAMETesters bug 01671.

* Live port state is now fully separate from configured 
state. This is manifested in a similar way to devices, where
a const list of ports can be managed either offline or live.
Each port has a pointer to an opaque set of live state which
is NULL when offline or valid when live. Each port also has
a running_machine * which is also NULL when offline.

* Because of this new arrangement, the conversion from tokens
to a list of ports now requires reasonably complex memory
allocation, so these port lists must be explicitly allocated
and freed (they are not mantained by automatic resource
allocation).

* Custom and changed callbacks now take a pointer to a field
config instead of a running machine. This provides more
information about what field triggered the change notification.
The machine can be found by referenced field->port->machine.

* The inptport.c module has been cleaned up and many 
ambiguities resolved. Most of this is internal, though it did
result in osd_customize_inputport_list() being changed to
osd_customize_input_type_list(). The parameter to this function
is now a linked list instead of an array, and the structures
referenced have been reorganized somewhat.

* Updated config.c to pass machine parameters to its callbacks.

* Updated validity checks, XML output, and UI system to handle
the new structures.

* Moved large table of default input settings to a separate
include file inpttype.h.

* Removed gross hacks in trackfld and hyperspt NVRAM. These
may be broken as a result.
2008-05-15 16:25:03 +00:00
Aaron Giles
e91eb4007c Flipped the damn mem_mask. It is no longer inverted when passed to
read/write handlers. Updated all drivers accordingly. Hope I didn't
miss anything important!

Blame OG and smf for goading me into it. :)
2008-04-20 02:38:35 +00:00
Aaron Giles
31336e491e Cleanups and version bump to 0.124u1. 2008-04-03 07:57:25 +00:00
Aaron Giles
bddaca5de2 From: Oliver Stoeneberg [mailto:oliverst@online.de]
Subject: Machine -> machine cleanups

This patch changes "Machine" to "machine", when the runnin-machine 
parameter is already available. In some cases I could even remove the 
dprecat.h.

I will look for some occurances where it can be easily changed and 
afterward take a step at adding the running_machine parameter in a 
few places.
2008-04-02 08:33:06 +00:00
smf-
07459e6491 Passes mem_mask to the read and write debug hooks. This allows the address & size of the memory access to be correctly calculated when using a memory call that takes a mem_mask. Unexpected results will occur if you pass in a mem_mask that has a gap in. For example 0x00ff00ff is treated as a 3 byte operation, a watchpoint for the gap will still trigger. To simplify the mem_mask decoding it is inverted before passing to the debugger. 2008-03-27 20:23:36 +00:00
smf-
7d38bf085f reverted, I misunderstood something and it's broken. I'm on it. 2008-03-27 19:56:24 +00:00
smf-
8b7582a477 Passes mem_mask to the read and write debug hooks. This allows the address & size of the memory access to be correctly calculated when using a memory call that takes a mem_mask. While testing I found that the address had already had it's lower bits masked out, so watch points were broken already. Unexpected results will occur if you pass in a mem_mask that has a gap in. For example 0x00ff00ff is treated as a 3 byte operation, a watchpoint for the gap will still trigger. To simplify the mem_mask decoding it is inverted before passing to the debugger. 2008-03-27 19:22:20 +00:00
Aaron Giles
8fcd45cab1 Renamed *_vbl_cb to *_vblank_callback.
Fixed 01475: Screenless systems are broken because of a vblank callback.
We now create an artificial update mechanism when there are no screens.
2008-03-14 05:19:53 +00:00
Zsolt Vasvari
4eecf5199d Removes "global" VBLANK callback hack 2008-03-12 11:06:29 +00:00
Zsolt Vasvari
2a8c73cc45 All video_screen_*_scrnum functions have been removed. Next step is to remove the scrnum from VIDEO_UPDATE 2008-03-10 06:39:20 +00:00
Zsolt Vasvari
ac9778cdb0 Changes first argument of video_screen_* functions to take a device_config
All callers that used 0 for the screen number now use machine->primary_screen
As a gap meassure, Where necessary, create a parallel set of video_screen_*_scrnum functions that take scrnum
All callers that specified a specific screen number now call the *_scrnum versions
Changed game info screen and overlay UI to display the screen tag instead of screen number
2008-03-09 15:41:17 +00:00
Zsolt Vasvari
9ad9532722 Seperates out the notion of screen specific vs. "global" VBLANK callbacks
"Global" VBLANK callbacks, of course, make no conceptual sense -- it should probably fire every once in a while even if there is no screen
2008-03-07 08:18:28 +00:00
Zsolt Vasvari
8f43de6a46 Removed runnning_machine as the first parameter of a VBLANK callback
video.c: some Machine->machine changes
2008-03-07 00:08:19 +00:00
Tomasz Slanina
183f506a2f debug build - fixed compilation error and warning. 2008-03-06 23:23:57 +00:00
Zsolt Vasvari
793cf2e715 VBLANK based watchdogs can be disabled once again
Removed debugging fprintf
2008-03-05 04:20:01 +00:00
Aaron Giles
e31f9a6313 Normalized function pointer typedefs: they are now all
suffixed with _func. Did this throughout the core and
drivers I was familiar with.

Fixed gcc compiler error with recent render.c changes.
gcc does not like explicit (int) casts on float or
double functions. This is fracking annoying and stupid,
but there you have it.
2008-03-03 01:51:31 +00:00
Zsolt Vasvari
7198a00e65 - Moves all video timing logic from cpuexec.c to video.c
- Added a video_screen_register_vbl_cb() function for registering VBLANK callbanks
- Changed inptport.c and debugcpu.c to make use the VBLANK callbacks
- Added video_screen_get_time_until_vblank_start()
- CCPU and anything using cpu_scalebyfcount() are currently broken
- I did some fairly extensive testing, but this is a very signficant internal change,
  so some things may have broke
2008-03-01 15:50:12 +00:00
Aaron Giles
109bb332f0 The term "driver" is way overloaded in the system.
machine->drv is now machine->config.
Sorry.
2008-02-18 06:08:39 +00:00
Aaron Giles
aa16ee779d Changed debugger-related code to be based off a new makefile define (DEBUGGER) which sets
a new compile-time define (ENABLE_DEBUGGER). This means that MAME_DEBUG no longer means
"enable debugger", it simply enables debugging features such as assertions and debug code
in drivers.

Also removed the various levels of opbase protection in memory.h and always just turned 
on full bounds checking.

Fixed build break due to missing ampoker.lay -> ampoker2.lay renaming.
2008-02-02 08:57:39 +00:00
Zsolt Vasvari
4930b2dbfd - Added deprecat.h that contains some deprecated/discouraged contructs (see below)
The idea is to create extra work if a driver wants to use these and hopefully
  gives an incentive to look for an alternate solution
- Added #include of deprecat.h that rely on these contructs
- Removed a bunch of unneccassary #include's from these files
2008-01-25 09:30:43 +00:00
Zsolt Vasvari
f7c5c67e2e First in a series of updates to remove the use of the global Machine from as many places as possible 2008-01-24 09:12:03 +00:00
Aaron Giles
ee9f88963c Copyright cleanup:
- removed years from copyright notices
 - removed redundant (c) from copyright notices
 - updated "the MAME Team" to be "Nicola Salmoria and the MAME Team"
2008-01-06 00:47:40 +00:00
Aaron Giles
d73ea1bf01 (From Oliver Stoneberg)
This patch fixes a few UNICODE=1 issues in the disassembly and memory 
windows of the MAME debugger. I also removed two redundant arrays.
2008-01-03 09:03:31 +00:00
Aaron Giles
507ca2d275 Changes for MAME 0.121u4. 2007-12-17 16:41:39 +00:00
Aaron Giles
c82a966b3b Changes for MAME 0.121u2. 2007-12-17 16:37:57 +00:00
Aaron Giles
8a8ccc5949 Changes for MAME 0.121u1. 2007-12-17 16:33:33 +00:00
Aaron Giles
7b77f12186 Initial checkin of MAME 0.121. 2007-12-17 15:19:59 +00:00