Commit Graph

135 Commits

Author SHA1 Message Date
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
a5bf427929 Added "tag" parameter to state_save_register_item_* calls. Removed
state_save_combine_module_and_tag() function in favor of passing
the tag when registering. Revisited all save state item registrations
and changed them to use the tag where appropriate.
2008-11-17 06:21:26 +00:00
Aaron Giles
1794cfa5a1 Terminology cleanup. "Machine" handlers are now "space" handlers. 2008-11-15 21:36:21 +00:00
Aaron Giles
41b8e37e3d Added generic read/write callbacks. 2008-11-15 21:04:15 +00:00
Aaron Giles
d10a7cccd5 God forbid, neogeo doesn't work.... 2008-11-15 20:02:40 +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
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
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
099373081e Added new functions for building device-relative tags. Changed machine
configuration builder to use these functions. Also changed the laserdisc
player devices to use them. Updated Z80 CTC/SIO code to assume that the
CPU provided for the clock is relative to the device that the CTC/SIO
belong to. Updated memory code to assume that regions and devices
referenced by the memory map are relative to the device the associated
CPU belongs to.
2008-10-03 16:29:33 +00:00
Aaron Giles
db3e968a6d CPU-internal regions now have priority again. Fixed mario by
installing a handler in the SOUND_START function.

02249: All Sets in zn.c: Game Hangs 
02248: All sets in m58.c: No sound in game 
02241: kncljoe, kncljoea: Missing AY-3-8910A sound effects. 
02240: All Sets in namcos12.c: Game Freeze 
02239: stunrun: No OKI6295 sound.
2008-09-18 15:54:25 +00:00
Aaron Giles
fc453dc652 Fixed crash when hitting watchpoints on static handlers. 2008-09-13 06:36:29 +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
2398d51941 Fixed memory handling of internal banks. They should be LOWER priority than
the driver's memory maps.

Reverted recent changes to MCS-48 core that were very hacky and which crashed
many games. You can now properly override the internal memory map and do
your own banking.

Also fixed 02204: masao: Memory bank error.
2008-09-11 14:33:52 +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
Nathan Woods
15969c0428 Readded generic calls to install memory handlers that were in long before
0.126u5 - these are useful on the MESS side for things like the PC driver
2008-08-19 11:13:43 +00:00
Aaron Giles
8b8585328c From: Christophe Jaillet [mailto:christophe.jaillet@wanadoo.fr]
Subject: Profiler related
Hi,

here is a smalll patch that :
   - remove include "profiler.h" to files that do not use profiling function
        * emu/machine/laserdsc.c
        * osd/windows/video.c

    - use PROFILER_USER2 instead of PROFILER_USER1 in mame/video/tx1.c
      USER1 was used twice, USER3 once. I guess that USER1 should be used
only once and USER2 used in the 2nd place

   - remove unused MACRO in emu/memory.c

Best regards,
Christophe JAILLET
2008-08-19 06:13:26 +00:00
smf-
e334a63782 reverted unit mask changes and removed the unused & unsafe memory_install functions. 2008-08-18 12:08:08 +00:00
smf-
5c5337424a Added unit mask to all memory installs that override the bus width. You couldn't install a handler with a different width before, as it complained about the lack of the unit mask. So I've assumed it's safe for all current calls to be changed to the one that picks up the cpu bus width. 2008-08-17 10:15:22 +00:00
Aaron Giles
2d165fe1c3 Fixed I/O watchpoints. 2008-08-06 05:04:05 +00:00
Aaron Giles
57bd1856b5 Cleanups/version bump. 2008-07-31 09:00:13 +00:00
Aaron Giles
e70d4b0a85 (Modified to allow for overwrites of RAM ranges only.)
From: Atari Ace [mailto:atari_ace@verizon.net] 
Subject: [patch] Stricter ADDRESS_MAP checks

Hi mamedev,

The current implementation of address maps is lacking some useful
checks of the initial tokens.  In particular, it doesn't validate that
a particular entry doesn't try to define the same handler multiple
times.

The attached patch adds this and some other validations as fatalerrors
in address_map_detokenize, and fixes the affected maps.  The errors
generally fall into the following categories.

1.  AM_RAM AM_WRITE(...).  Should have been AM_RAM_WRITE(...)
2.  AM_RAM AM_READWRITE(...).  The AM_RAM is a NOP.
3.  AM_RAM AM_RAMBANK(...).  The AM_RAM is a NOP.
4.  AM_ROM AM_ROMBANK(...).  The AM_ROM is a NOP.
5.  AM_ROM AM_READ(...).  The AM_ROM is a NOP.

One peculiar error was in equites.c, where there were two AM_BASE
entries.

~aa
2008-07-29 17:08:43 +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
e376a53661 Cleanups and version bump. 2008-07-03 15:50:46 +00:00
Aaron Giles
7d1d630f91 Fixed some save state problems in the DCS driver. Still comes out garbled
on a load, however. Extended memory.c to support up to 4096 banks.
2008-06-30 16:03:49 +00:00
Aaron Giles
64048d74f7 Oops, forgot to shift addresses for 16,32,64-bit watchpoint stubs. 2008-06-28 17:55:58 +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
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
57c35a0efc From: Atari Ace [mailto:atari_ace@verizon.net]
Subject: [patch] memory_region madness reloaded
Hi mamedev,

The memory_region and memory_region_length functions are probably the
two most common functions in MAME that don't take a machine parameter
but should given the syntax of the related apis memory_region_type and
memory_region_flags.  Clearly they didn't get the parameter because of
the sheer number of changes needed to change the apis.  This pair of
patches makes the change, and deals with the consequences.

The second patch then changes the api for memory_region and
memory_region_length, and fixes the fallout.  It generally plumbs
through machine parameters where needed, except for the case of sound
apis which I deferred doing so till later.  This increased the number
of deprecat.h includes by ~50.  Given it is a massive patch, there are
bound to be a few mistakes in it (I had to make ~20% of the changes by
hand), but I exercised care and reviewed the patch several times to
minimize the problems.
2008-06-23 08:32:42 +00:00
Aaron Giles
ed6ad8b4f9 PowerPC dynamic recompiler: [Aaron Giles]
- rewrote PowerPC implementation as a dynamic recompiler on top
    of the universal recompiler engine
 - wrote a front-end to analyze PowerPC code paths and register usage
 - wrote a common shared module with C implementations of tricky
    CPU behaviors
 - added separate CPU types for the variants supported, instead of
    relying on a hidden model enum
 - rewrote the serial port emulation for the 4xx series to be more
    accurate and not rely on separate DMA handlers
 - rewrote the MMU handling to implement a software TLB that faults
    in pages and handles changed bits appropriately
 - implemented emulation of the PowerPC 603's software TLB, which
    allows the model 3 games to run without a hack to disable the MMU

Updated the PowerPC disassembler to share constants with the rest of
the core, and to more aggressively use simplified mnemonics, especially
for branches. [Aaron Giles]

Universal recompiler:
 - fixed frontend to handle opcode widths different from bus width
 - added several new opcodes:
    * (D)GETFLGS - copies the UML flags to a destination operand
    * FDRNDS - rounds a double precision value to single precision
 - renamed several opcodes:
    * SETC   -> CARRY
    * XTRACT -> ROLAND
    * INSERT -> ROLINS
 - consolidated the following opcodes:
    * LOAD?U -> LOAD
    * LOAD?S -> LOADS
    * STORE? -> STORE
    * READ?U -> READ
    * READ?M -> READM
    * WRITE? -> WRITE
    * WRITM? -> WRITEM
    * SEXT?  -> SEXT
    * FTOI?? -> FTOINT
    * FFRI?  -> FFRINT
    * FFRF?  -> FFRFLT
 - removed some opcodes:
    * FLAGS - can be done with GETFLGS/LOAD4/ROLINS
    * ZEXT - can be achieved with AND
    * READ?S - can be achieved with READ/SEXT
 - updated C, x86, and x64 back-ends to support these opcode changes
 - updated disassembler to support these opcode changes
 
MIPS3 dynamic recompiler:
 - updated to use new/changed opcode forms
 - changed context switch so that it only swaps a single pointer

Konami Hornet changes: [Aaron Giles]
 - updated to new PowerPC configurations
 - updated some memory handlers to be native 8-bit handlers
 - cleaned up JVS implementation to work with new serial code
 - added fast RAM for the work RAM to give a small speed boost

Konami GTI Club changes: [Aaron Giles]
 - updated to new PowerPC configurations
 - updated some memory handlers to be native 8-bit handlers

Konami Viper/ZR107 changes: [Aaron Giles]
 - updated to new PowerPC configurations

Sega Model 3 changes: [Aaron Giles]
 - updated to new PowerPC configurations
 - reimplemented/centralized interrupt handling
 - these games are broken for the moment

Fixed crasher due to some Konami games using 8 layers in
the K056832 implementation, even though it was only written
for 4. [Aaron Giles]

Added fisttp opcode to i386 disassembler. [Aaron Giles]
2008-06-05 08:34:13 +00:00
Aaron Giles
d5ff8c002a Cleanups and version bump. 2008-05-22 05:19:16 +00:00
Aaron Giles
defcc8895b From: Atari Ace [mailto:atari_ace@verizon.net]
Subject: [patch] Missed Machine->machine changes

Hi mamedev,

A short incremental to my last deprecat.h patches.  This one is the
result of a slightly improved fixup script, which finds more cases
where Machine can be replaced with machine.  Six more files lose
deprecat.h.

~aa
2008-05-22 03:24:45 +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
44fbeff9bf From: Atari Ace [mailto:atari_ace@verizon.net]
Subject: [patch] Remove opbase globals from the public interface

Hi mamedev,

There are several variables associated with opbase handling which are
global and documented in memory.h and thus their use is not well
controlled.  This patch attempts to remedy this.  Because they are
used in various inline memory functions, they can't yet be made local
to memory.c, but by rescoping their declaration they can be hidden,
much like we hide totalcpu.

Most of the uses are in OPBASE_HANDLER() macros, so by encapsulating
the opbase state into a struct and adding that to the handler
interface those can be converted to local variable manipulation. There
is one use in missile.c in a MACHINE_START that I simply removed, it
shouldn't be needed.

One side effect of this patch is that the various unsafe memory macros
can't be used directly, they will be a compiler error now.  That is
probably for the best.

~aa
2008-05-15 08:22:17 +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
9dd3f691ba Expanded the set of memory accessor functions. In addition to
direct byte, word, dword, and qword accessors for all bus sizes,
there are now masked word, dword, and qword accessors for all
bus sizes.

IMPORTANT: masks that are passed to the _masked_* functions are
NOT inverted. Although inverted masks are still passed to callback
functions, when you request a masked read or write the masks should
represent the bits you want.

Updated the various MIPS cores that use these functions to invert
their masks.
2008-04-19 19:09:24 +00:00
Aaron Giles
b35c15fef5 Cleanups and version bump to 0.124u3. 2008-04-17 05:26:05 +00:00
Aaron Giles
ffc326f8be Converted the IDE controller to a device. Updated all drivers
accordingly.

Added new functions for dynamically installing device memory 
read/write handlers.

Updated install_memory_XXX_handler() functions to take a machine
parameter. Updated all drivers accordingly.

Merged installation of read and write handlers where appropriate.

Simplified memory.c code for dynamic installation so that a single
function handles all the work; a NULL read or write handler 
indicates not to install anything for reads or writes.
2008-04-15 16:49:50 +00:00
Aaron Giles
71ca9ecec2 Switched subhandlers to using masks instead of shifts. Reduced the number
of stub handlers required as a result. Updated all drivers accordingly.
2008-04-15 06:39:34 +00:00
Aaron Giles
7b97535eae Added support for using smaller-sized memory handlers directly in
memory maps. To do so, you either need to specify a shift amount 
(mapping to a particular subset of the bus) or SHIFT_PACKED, which
maps a single larger sized read/write down to multiple reads or
writes at the smaller size.

Removed word-sized handlers from 6821pia.c. Updated drivers that
needed them to use these new interfaces instead.

Updated gaelco3d.c and itech8.c to remove the need for memconv.h
by using this new feature.

Re-removed input_port_set_digital_value().
2008-04-14 16:47:02 +00:00
Aaron Giles
439dbe872a Cleanups and version bump to 0.124u2. 2008-04-12 05:16:26 +00:00
smf-
22df06f724 fixed sign extension when inverting mem_mask. 2008-04-11 18:01:14 +00:00
Aaron Giles
dbb98c5473 Reduced the number of save state callback types from 3 to 1. The
only remaining form is the one that takes a pointer parameter.

Added macros for STATE_PRESAVE and STATE_POSTLOAD to define common
functions. Added machine parameter to these functions.

Updated all drivers and CPU/sound cores  to use the new macros 
and consolidate on the single function type. As a result pushed
the machine parameter through a few initialization stacks.

Removed unnecessary postload callbacks which only marked all tiles
dirty, since this is done automatically by the tilemap engine.
2008-04-11 05:41:46 +00:00
Aaron Giles
4867aa38b9 Take two of the previous changes. I think this is a little simpler,
using masks instead of the generic byte/word/dword read functions.
2008-04-09 14:48:22 +00:00
Aaron Giles
eeee1cb437 Rewrote core memory handlers as inline functions. These should be easier to
trace through in a debug build, yet should operate the same as before.

Created a complete set of functions for all databus sizes (8,16,32,64) and
all endiannesses. A few functions are redundant, but it is now very clear
which functions to use in which scenarios. It is also now possible to rely
on being able to access values of 8, 16, 32 or 64 bits via the built-in
accessors without fear of crashing.

Updated all cores using 8-bit handlers to explicitly call the 8-bit handlers
with the appropriate endianness.

Fixed a few games which were calling n-bit handlers directly to use the
generic forms. In the future, this is all the access drivers will have.
2008-04-09 07:31:47 +00:00
Aaron Giles
31336e491e Cleanups and version bump to 0.124u1. 2008-04-03 07:57:25 +00:00
Aaron Giles
984380354e Added fatal error if AM_READ_PORT() references a non-existent port. 2008-03-28 00:03:25 +00:00
smf-
5ed703d6d5 fixed another bug in new debug hook code, data wasn't shifted properly in all cases. 2008-03-27 21:04:02 +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
9476c50ee6 Cleanups for 0.124. Marked Mermaid as working per checkin comment. 2008-03-24 04:07:46 +00:00
Aaron Giles
b28f2c2504 Explicitly fixed unmapped handler masks so that we don't report
all unmapped addresses as 0.
2008-03-20 14:16:00 +00:00
Aaron Giles
a6b4a6ad50 Cleanups and version bump to 0.123u5. 2008-03-13 16:21:46 +00:00
Aaron Giles
9d3f7f8680 From: Mariusz Wojcieszek
Attached is update for Merit hardware based on V9938 (CRT-250 and CRT-260 - meritm.c).

New playable games:

Pit Boss II
Super Pit Boss
Pit Boss Megastar
Megatouch IV
Megatouch IV Tournament Edition
Megatouch 6
2008-03-13 15:04:33 +00:00
Aaron Giles
d5561a8e75 Removed cpu_scalebyfcount().
Changed input ports to register a frame callback, which is
called immediately after throttling and updating. This is the
proper "sync point" between emulated time and real time. Moved
all analog and digital port processing into a central place
here. Added tracking of time since the previous frame update
and use that as an estimate for the time of the current frame.
This is used to scale analog ports without the use of
cpu_scalebyfcount(). This is not perfect in the case where
frame rates are dynamic (vector games), but works well for
other cases.

Further cleanup of memory header and code.
2008-03-12 05:13:03 +00:00
Aaron Giles
c4cfa7bde4 Compilation fixes for my last checkin (sorry). 2008-03-10 16:22:01 +00:00
Aaron Giles
8006568b87 More WIP cleanup of memory.*
Made address versus byte offsets explicit throughout.
Removed some unused parameters.
Consolidated initialization process.
Removed maximum memory block count.
Centralized bank management.
Added masked handlers and change_pc to the accessors.
Added memory_get_accessors() to return a pointer to the accessors
   for a given address space/databus width/endian configuration.

More to come.
2008-03-10 16:00:26 +00:00
Aaron Giles
0862cce453 Replaced the following macros (SMH == static memory handler)
MRA*_BANK*/MRA*_BANK* -> SMH_BANK*
   MRA*_RAM/MRA*_ROM     -> SMH_RAM
   MRA*_ROM/MWA*_ROM     -> SMH_ROM
   MRA*_NOP/MWA*_NOP     -> SMH_NOP
   MRA*_UNMAP/MWA*_UNMAP -> SMH_UNMAP

This removes the silly need for a bunch of redundant constants
with faux type definitions that didn't buy anything.

Moved some memory system constants into memory.c.
2008-03-10 02:29:15 +00:00
Aaron Giles
ddfc0c3259 WIP check-in. Things work now, but I'm still working on the code.
Converted address maps to tokens. Changed the address_map structure
to house global map-wide information and hung a list of entries off
of it corresponding to each address range. Introduced new functions
address_map_alloc() and address_map_free() to build/destroy these
structures. Updated all code as necessary.

Fixed several instances of porttagtohandler*() in the address maps.
Drivers should use AM_READ_PORT() macros instead.

ADDRESS_MAP_EXTERN() now is required to specify the number of 
databits, just like ADDRESS_MAP_START.

Removed ADDRESS_MAP_FLAGS() grossness. There are now three new macros
which replace its former usage. ADDRESS_MAP_GLOBAL_MASK(mask)
specifies a global address-space-wide mask on all addresses. Useful
for cases where one or more address lines simply are not used at
all. And ADDRESS_MAP_UNMAP_LOW/HIGH specifies the behavior of
unmapped reads (do they come back as 0 or ~0).

Changed internal memory mapping behavior to keep only a single
address map and store the byte-adjusted values next in the address
map entries rather than maintaining two separate maps. Many other
small internal changes/cleanups.
2008-03-09 21:59:57 +00:00
Aaron Giles
fb26ec7c01 Cleanups and version bump. 2008-03-06 07:31:20 +00:00
Aaron Giles
0046339284 Removed AM_SPACE and matchmask support. Updated relevant drivers
to use AM_MIRROR() and AM_MASK() to achieve the same thing.
2008-03-06 07:02:10 +00:00
Couriersud
dbd1965d0e * pass running_machine parameter to construct_map_##_name, i.e. ADDRESS_MAP_START
* Change "Machine->" to "machine->" in AM_BASE_MEMBER, AM_SIZE_MEMBER
* Pass Machine in construct_address_map

This is not perfect yet, but there is no need any longer to include deprecat.h in drivers using AM_*_MEMBER.
2008-03-05 22:01:37 +00:00
Aaron Giles
31bb5d3f3c Added new macros AM_DEVREAD, AM_DEVWRITE, and AM_DEVREADWRITE,
which specify device read/write handlers in address maps, along
with the type/tag of the device they reference.

Converted MC6845 read/write handlers to READ/WRITE8_DEVICE_HANDLERs.
Updated all MC6845-using drivers to use the new macros and call
the updated functions. Removed the many little helper functions
that used to do this work.

Added validity checks to ensure that the devices referenced
actually exist.
2008-03-05 15:12:58 +00:00
Aaron Giles
ee0a5642ab Added running_machine * parameter to the front of all read/write handlers.
Updated all call-through handlers appropriately. Renamed read8_handler to
read8_machine_func, replicating this pattern throughout. 

Defined new set of memory handler functions which are similar but which
pass a const device_config * in place of the running_machine *. These are
called read8_device_func, etc. Added macros READ8_DEVICE_HANDLER() for
specifying functions of this type. Note that some plumbing still needs to
happen in memory.c before this will work.

This check-in should remove the need for the global Machine and in turn
"deprecat.h" for a lot of drivers, but that work has not been done. On
the flip side, some new accesses to the global Machine were added in the
emu/ files. These should be addressed over time, but are smaller in
number than the references in the driver.
2008-03-05 07:45:34 +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
Couriersud
7ce83ee92b memory.c: removed further code never to be executed
* removed "return 0" from READWORD & READWORD16/32/64/MASKED since it is unreachable
2008-03-01 11:25:57 +00:00
Couriersud
c5a4ffe291 memory.c: removed some code never to be executed
* removed "return 0" from READBYTE & READBYTE8 since it is unreachable
* removed comparisons of type FPTR < 0 and FPTR >= 0
2008-03-01 01:03:54 +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
85038b85d2 Last minute minor tweaks from 0.123 tag. 2008-02-05 09:33:35 +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
Aaron Giles
877b75ad75 Cleanups and version bump to 0.122u7. 2008-01-25 06:17:54 +00:00
Aaron Giles
5387f8bf52 Fixed compilation problems introduced with last change. 2008-01-18 23:45:54 +00:00
Aaron Giles
806a3de01c Made detection of dynamic attempts to install ROM/RAM handlers more aggressive.
Previous checks would not catch modifications in DRIVER_INIT or MACHINE_START calls.
Also changed one of the cheat calls back to using more generic switch detection so they can be triggered via joysticks.
2008-01-18 19:34:54 +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
f97d37b7e0 Spacing fixes and a version bump to 0.122u3. 2008-01-03 16:11:57 +00:00
Aaron Giles
0738d02527 TMS3203x core updates:
* fixed interrupt handling
 * added support for edge-triggered interrupts on '32
 * expanded interrupt support for the '32
 * updated drivers using TMS3203x core to deassert interrupts
 * added externally accessible functions for converting '3x floating point format
 * updated gaelco3d driver to use new functions

Zeus2 (+related) updates:
 * fixed save states for DCS games
 * cleaned up Zeus2 waveram handling
 * added Zeus2 save state support
 * added preliminary model and quad rendering support for Zeus2
 * added support to timekpr for the ZPRAM used on Zeus2
 * hooked up ZPRAM in Zeus2 games
 * hooked up controls in Zeus2 games
 * updated poly.c to ensure it is idle before saving state
2008-01-01 21:50:08 +00:00
R. Belmont
b66afec386 Minor cleanup to previous GCC 64-bit fix. 2007-12-31 16:10:49 +00:00
R. Belmont
67eec8cf26 Fixed various 64-bit GCC warnings. 2007-12-31 07:38:42 +00:00
Aaron Giles
460437f8d1 (From Atari Ace)
The attached patch adjusts most conditional logging in MAME to use the
idiom "do { if (VERBOSE) logerror x; } while (0)".   This has the
benefit that the compiler checks the syntax of the logging even in the
case it will be eliminated, and in fact a number of cases here needed
adjustments to compile because of this.
2007-12-31 02:04:39 +00:00
Aaron Giles
507ca2d275 Changes for MAME 0.121u4. 2007-12-17 16:41:39 +00:00
Aaron Giles
df34329a47 Changes for MAME 0.121u3. 2007-12-17 16:39:40 +00:00
Aaron Giles
c82a966b3b Changes for MAME 0.121u2. 2007-12-17 16:37:57 +00:00
Aaron Giles
7b77f12186 Initial checkin of MAME 0.121. 2007-12-17 15:19:59 +00:00