Commit Graph

134 Commits

Author SHA1 Message Date
Aaron Giles
cc03405ca2 Cleanups and version bump. 2008-07-06 23:19:23 +00:00
Nathan Woods
697181c8cd Adding per-device and per-CPU validity checks 2008-07-06 15:02:12 +00:00
Aaron Giles
48332dea92 Added compile-time error if PTR64 is incorrectly set. 2008-06-05 09:41:02 +00:00
Aaron Giles
a5abe031ca It is now an actual error to have duplicate input bits. 2008-06-05 09:36:23 +00:00
Aaron Giles
67db0742f0 Added TOKEN_SKIP_* macros to tokenize.h.
Changed error reporting during input port detokenization to fill a buffer
rather than fatalerror-ing immediately. Should now properly skip over
any invalid tokens.

Enhanced error detection during input port detokenization to catch 
duplicate bits. There are a lot of these!

Updated initialization code to print errors and fatal only if the input
ports were unable to be constructed at all.
2008-05-25 21:24:19 +00:00
Nathan Woods
0a624c8f7a Updates from MESS in response to 0.125u2 2008-05-25 12:58:14 +00:00
Aaron Giles
d5ff8c002a Cleanups and version bump. 2008-05-22 05:19:16 +00:00
Aaron Giles
11b1331d3f Fixed incorrectly sized array that led to stack corruption during validity checks.
Fixes CPS1 no-start issue.
2008-05-22 05:04:14 +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
Wilbert Pol
446e65fb98 Changed the inline validity checks to work around GCC bug #35885. 2008-04-19 18:17:02 +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
d77d9fdb64 Added validity check to ensure input port tags don't have duplicates.
Fixed several drivers where there were duplicates.
2008-03-24 01:33:12 +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
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
Zsolt Vasvari
d0f5196025 - the public screen_state is made to only contain items that are currently accessed by drivers
- populating screen_state is moved from mame.c to video.c
- defstate is gone -- the default screen parameters live in screen_config directly
2008-03-07 12:53:00 +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
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
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
Zsolt Vasvari
2fba8bdb8a - Removes a couple of unused items from the cpuexec_data structure
- Adds one more validty checks -- screenless drivers cannot have a VBLANK
2008-03-01 05:30:22 +00:00
Zsolt Vasvari
f126c9fc26 Most of this descriptions taken directly from an e-mail by Aaron:
- Define a new MDRV_CPU_VBLANK_INT_HACK() (ZV: defined in deprecat.h) which is a copy of the current MDRV_CPU_VBLANK_INT()
- Find all the places where VBLANK_INT is used with something other than 1 interrupt per frame and change it to the new macro
- Remove the "# per frame" parameter from the MDRV_SCREEN_VBLANK_INT() and add a screen tag in its place; updated all callers appropriately.
- ZV: Added some validation of the interrupt setup to validate.c 

The idea behind this is that using a VBLANK interrupt with more than one interrupt per frame in conceptually wrong.
The screen tag will allow us to move the interrupt timing code from cpuexec.c to video.c, where it really belongs.
2008-02-29 15:09:04 +00:00
Aaron Giles
adcdfd3e5b Converted MACHINE_DRIVER definitions from function
constructors to tokenized lists. For the most part
this is a non-invasive change, except for those drivers
using MDRV_WATCHDOG_TIME_INIT. In order to allow for
tokenization of attotimes, a set of new macros is
provided called UINT64_ATTOTIME_IN_x() which follows the
same pattern as ATTOTIME_IN_x() but packs the attotime
down into a single 64-bit value for easier tokenization.

Separated MDRV_DEVICE_CONFIG_DATA into 32-bit and 64-bit
versions. Added floating-point versions with configurable
resolutions.

Fixed several errors in the machine drivers which were
caught by the additional checks now done in the machine
config detokenization code.

Converted speakers into devices. Machine->config no
longer houses an array of speakers; instead they are
iterated through using the new macros (defined in sound.h)
speaker_output_first() and speaker_output_next(). Updated
all relevant code to do this.

Improved game info display with multiple screens. Fixed
bug which caused all screens to display equally.

Added typedefs for all the machine config callback 
functions at the top of driver.h.
2008-02-26 06:31:28 +00:00
Aaron Giles
9a359b370d Added new module: tokenize.h. This centralizes the behavior of
tokenizing data structures, as currently used by the input
port system. Redid the input port tokenization to be more
compact and make use of the new macros.
2008-02-25 01:35:48 +00:00
Aaron Giles
8436bec1e3 Cleanups and version bump for 0.123u2. 2008-02-21 17:43:00 +00:00
Aaron Giles
b7c4a537cd Most important thing to note about this change:
ALL DRIVERS MUST NOW EXPLICITLY DECLARE THEIR SCREENS.

Read on for more detail....

Added device tag as a parameter to the start function for devices.
Updated MC6845 to accept this tag.

Added new functions for iterating through the device list and 
counting devices of a given type. Updated search and iteration
functions to accept DEVICE_TYPE_WILDCARD to work across all
devices.

Added new macro MDRV_DEVICE_CONFIG_DATA() which is used to set a
single item in an inline data structure.

Removed the per-screen palette_base. This was an idea that never
really worked out, nor have we really needed it.

Defined a new device type VIDEO_SCREEN. Currently this has no
live functionality, but merely serves as a placeholder/identifier
for video screens. Eventually some of the screen management code
may move into the start/stop/reset functions.

Changed MDRV_SCREEN_* macros to build up VIDEO_SCREEN devices
rather than storing values in the screen[] array.

Changed MDRV_SCREEN_ADD to specify a screen type (RASTER, VECTOR,
LCD for the moment).

Removed the older VIDEO_TYPE_RASTER and VIDEO_TYPE_VECTOR; this
information is now determined by walking the screen list.

Removed the screen[] array from machine_config. Modified all code 
referencing Machine->config->screen[] and changed it to iterate 
over the devices using the new video_screen_first() and 
video_screen_next() functions.

(The next step will be to add video_* functions that accept a tag
instead of screen index, and then move systems over to always
referencing screens by tag instead of index.)

Removed implicit screen #0. This means that ALL DRIVERS MUST
EXPLICITLY DECLARE THEIR SCREENS. Updated all drivers to do
so. While there, grouped all MDRV_SCREEN_* parameters together.
Also removed unnecessary VIDEO_TYPE_RASTER and VIDEO_TYPE_VECTOR.
Also removed VBLANK and bitmap format information from vector
games. This was painful and very tedious.

Changed game information to display info about all screens.
2008-02-21 08:50:36 +00:00
Aaron Giles
671afc2661 Updated validity.c to current core style. 2008-02-19 18:02:59 +00:00
Aaron Giles
aad4c81ac4 Pulled remaining vestiges of old-style colortables:
* PALETTE_INIT no longer has a colortable parameter
 * removed game_colortable and remapped_colortable from machine_config
 * updated a few stragglers that still referenced these fields
 * removed tile_draw_colortable from tilemap.c

(From Zsolt): Added support for the new colortable object in the palette viewer

Changed the input port tokens to use a union instead of casting everything to FPTR.
In the future, C99-enabled compilers will be able to achieve type safety with
designated initializers.
2008-02-19 17:52:21 +00:00
Aaron Giles
3e34860ccc Removed expand_machine_driver().
Replaced with machine_config_alloc() and machine_config_free().
Updated all call sites.
Normalized info.c style and simplified some of the code.
2008-02-18 05:58:18 +00:00
Aaron Giles
a62870621a It's the end of uitext.c as we know it (and I feel fine) 2008-01-12 03:32:30 +00:00
Aaron Giles
fa3061392e (From Atari Ace)
0. This patch does minor cleanup to existing layouts, trimming/padding
entries as appropriate and reformating a few layouts.

1. This patch introduces a GFXLAYOUT_RAW() macro, and uses it
throughout.  It codifies the requirements for a raw layout in one
place.

2. This patch adds new validation code to the core for some previously
unchecked assumptions about layouts, and reduces the number of
references to the gfx_layout fields in preparation for a change in the
representation.

3. This patch constifies the remaining non-const gfx_layouts in MAME.
It does this by adjusting the code so that the only modification to a
layout ever needed is for the total field, which is then handled by
modifying a stack-based copy of the layout before invoking allocgfx. I
also spent some time consolidating and simplifying the layout code in
konamiic.c.
2008-01-06 01:21:33 +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
507ca2d275 Changes for MAME 0.121u4. 2007-12-17 16:41:39 +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