Commit Graph

68 Commits

Author SHA1 Message Date
Aaron Giles
2ba1a99283 Added macros for all CPU callbacks to ease future changes.
Updated all CPU cores to use them.
2008-11-08 09:20:43 +00:00
Aaron Giles
b44da3b748 WARNING: This is a significant change. If you are risk-averse and
working on something, hold off syncing.

Defined macros for core CPU functions: CPU_INIT, CPU_RESET, CPU_EXIT,
CPU_EXECUTE, along with macros for the name and for calling, in the
spirit of the devintrf.h macros. More will come later.

Changed init, reset, exit, and execute interfaces to be passed a
const device_config * object. This is a fake object for the moment,
but encapsulates the machine pointer and token. Eventually this will
be a real device.

Changed the CPU IRQ callbacks to a proper type, and added a device
parameter to them.

Updated all CPU cores to the new macros and parameters.

Note that this changes the way we "pointer"-ify cores. I'll send an
update shortly.
2008-11-06 18:42:37 +00:00
Aaron Giles
a33640f46d Added concept of scheduling quanta to the timer system. Also added
means of setting the minimum useful scheduling quantum, and clamping
all quanta to that value.

Changed interleave/boost handling to use scheduling quanta instead
of timers.

Added machine parameter to cpu_boost_interleave.

Updated cpuexec to compute the "perfect" interleave value taking into
account the minimum number of cycles per instruction specified by the
CPU core. Updated Z80 core to indicate that the minimum cpi is 2. Fixed
incorrect minimum cpi in the 68020+ cores.

Simplified a bit of logic in cpuexec_timeslice.
2008-11-05 16:04:56 +00:00
Aaron Giles
d060c4694b "Pointer-ified" the Z80 core as an example for testing. 2008-11-04 14:57:03 +00:00
Aaron Giles
79f8cc1cf8 From: Micko [mailto:mmicko@gmail.com]
Sent: Sunday, November 02, 2008 1:04 AM
To: Aaron Giles
Subject: Z80 CPU change

Hello Aaron,
 
For a long time there was undiscovered internal register (MEMPTR) inside Z80 CPU which was visible by using BIT n,(HL) instruction in undocumented bits of flag, in
last few months lot of things have been discovered by team of Russian programmers. There was a test on real machine which showed status of flags after each instruction.
I am sending you now patch for Z80 with MEMPTR implemented, there is also one more bug fixed (BIT 6,(XY+o) was not implemented good it used BIT 4,(XY+o) code).
 
As a proof that things are now valid, I am sending screens before patch on Z80 cpu core, and after with compare of results on real machine.
I am also sending you a TZX file (for ZX Spectrum) since tests are done inside that driver.
 
Please inform me about status. Hope this could fix some issues in drivers using Z80, since some games used this flags.
 
Regards,
Miodrag Milanovic
2008-11-04 06:10:20 +00:00
Aaron Giles
2d6453c98a Made the Z80 daisy chain aware of referencing device-specific devices.
Added preliminary LD-V1000 emulation. Not fully working yet, but mostly
there.

Cleaned up and normalized the three existing laserdisc emulations.
Removed obsolete code from the laserdisc core.
2008-10-09 05:31:15 +00:00
Aaron Giles
f4dc7a2f36 Converted Z80 CTC to a proper device. Updated all drivers.
Added new item to the interface which is the tag of a CPU
to take the base clock from. Are there any known cases
where the base clock does NOT come from the CPU directly?

Changed Z80 daisy chain interface to simply be a list of
devices in the chain. Interrupt callback functions are now
fetched via the standard device interface and referenced by
the daisy chain code.

Changed Z80 PIO interrupt callback to pass a device instead
of the machine. All device callbacks should provide the
device.
2008-09-29 17:20:58 +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
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
6a955fc076 From: Atari Ace [mailto:atari_ace@verizon.net]
Subject: [patch] Remove more Machine globals, #include "deprecat.h"

Hi mamedev,

The attached patch goes through and converts a number of Machine
globals to machine locals, and then removes #include "deprecat.h" if
appropriate.  The script that generated it is included, since the
patch itself is rather large and would have been time consuming to
produce otherwise.

The script doesn't convert cases of Machine that aren't in common
macros.  I'll try to tackle those later if someone doesn't beat me to
it.

~aa
2008-04-24 06:15:00 +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
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
fe41f9bd01 Added CPUINFO_INT_CLOCK_MULTIPLIER to support CPU clock multipliers.
Updated all CPU cores to return a CPUINFO_INT_CLOCK_MULTIPLIER of 1.

Changed the core to actually respect both CPUINFO_INT_CLOCK_MULTIPLIER and CPUINFO_INT_CLOCK_DIVIDER.

Updated a number of drivers to use cpunum_get_clock() instead of Machine->drv->cpu[x].clock.

***** Raw input clock speeds should now be specified for all CPUs in the MACHINE_DRIVER. *****

Removed explicit divisors from all drivers using the following CPU types, 
which were already specifying non-1 values for CPUINFO_INT_CLOCK_DIVIDER:
 * COP4x0
 * I8039/8048 families
 * M68(7)05, HD63705
 * M6809E
 * PIC16C5X
 * TMS32010
 * TMS340x0

In a few cases, it appears that the divisor was not being used, so I guessed in those cases whether or not
the specified clock speed was raw.
2008-01-14 00:42:14 +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
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
625c8308b9 (From Barry Rodewald)
Here is a fix I've done to the Z80 CPU core that removes the increasing 
of the R register from each IX/IY related (FD xx or DD xx) instruction.

This corrects the amount the R register should increased to to 2, 
instead of 3.  Documentation I've read suggests that the R register is 
increased by 1 for each instruction with no prefix, and by 2 for each 
instruction with a prefix (DD, FD, ED, CB, DD CB and FD CB).  This fixes

some protected cassette loaders in the MESS Amstrad CPC driver, and 
maybe others, which require the R register to be correct for the next 
routine to be decoded correctly.  I'd doubt that there is much, if any, 
noticeable impact for MAME, as the R register is really only useful to a

program as a simple random number generator (or seed).

I've tested the fix with Pacman, in MAME, and when it comes across a LD 
IX,xxxx or ADD IX,xx it will increase R by 2, whereas previously, it 
increased R by 3.
2007-12-31 01:58:34 +00:00
Aaron Giles
7b77f12186 Initial checkin of MAME 0.121. 2007-12-17 15:19:59 +00:00