Commit Graph

56 Commits

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