Commit Graph

59 Commits

Author SHA1 Message Date
Aaron Giles
5e04468569 Changed CPU callbacks to use cpu_device, eliminating a bunch of casting. 2010-06-08 17:35:49 +00:00
Aaron Giles
100564d412 WARNING: There are likely to be regressions in both functionality and
performance as a result of this change. Do not panic; report issues to the
list in the short term and I will look into them. There are probably also
some details I forgot to mention. Please ask questions if anything is not
clear.

NOTE: This is a major internal change to the way devices are handled in
MAME. There is a small impact on drivers, but the bulk of the changes are
to the devices themselves. Full documentation on the new device handling
is in progress at http://mamedev.org/devwiki/index.php/MAME_Device_Basics

Defined two new casting helpers: [Aaron Giles]

  downcast<type>(value) should be used for safe and efficient downcasting
  from a base class to a derived class. It wraps static_cast<> by adding
  an assert that a matching dynamic_cast<> returns the same result in 
  debug builds.
  
  crosscast<type>(value) should be used for safe casting from one type to
  another in multiple inheritance scenarios. It compiles to a 
  dynamic_cast<> plus an assert on the result. Since it does not optimize
  down to static_cast<>, you should prefer downcast<> over crosscast<>
  when you can.
  
Redefined running_device to be a proper C++ class (now called device_t).
Same for device_config (still called device_config). All devices and
device_configs must now be derived from these base classes. This means
each device type now has a pair of its own unique classes that describe
the device. Drivers are encouraged to use the specific device types
instead of the generic running_device or device_t classes. Drivers that
have a state class defined in their header file are encouraged to use
initializers off the constructor to locate devices. [Aaron Giles]

Removed the following fields from the device and device configuration
classes as they never were necessary or provided any use: device class,
device family, source file, version, credits. [Aaron Giles]

Added templatized variant of machine->device() which performs a downcast
as part of the device fetch. Thus machine->device<timer_device>("timer")
will locate a device named "timer", downcast it to a timer_device, and
assert if the downcast fails. [Aaron Giles]

Removed most publically accessible members of running_device/device_t in
favor of inline accessor functions. The only remaining public member is
machine. Thus all references to device->type are now device->type(), etc.
[Aaron Giles]

Created a number of device interface classes which are designed to be mix-
ins for the device classes, providing specific extended functionality and
information. There are standard interface classes for sound, execution,
state, nvram, memory, and disassembly. Devices can opt into 0 or more of
these classes. [Aaron Giles]

Converted the classic CPU device to a standard device that uses the
execution, state, memory, and disassembly interfaces. Used this new class
(cpu_device) to implement the existing CPU device interface. In the future
it will be possible to convert each CPU core to its own device type, but 
for now they are still all CPU devices with a cpu_type() that specifies
exactly which kind of CPU. [Aaron Giles] 

Created a new header devlegcy.h which wraps the old device interface using
some special template classes. To use these with an existing device,
simply remove from the device header the DEVICE_GET_INFO() declaration and
the #define mapping the ALL_CAPS name to the DEVICE_GET_INFO. In their
place #include "devlegcy.h" and use the DECLARE_LEGACY_DEVICE() macro.
In addition, there is a DECLARE_LEGACY_SOUND_DEVICE() macro for wrapping
existing sound devices into new-style devices, and a 
DECLARE_LEGACY_NVRAM_DEVICE() for wrapping NVRAM devices. Also moved the
token and inline_config members to the legacy device class, as these are
not used in modern devices. [Aaron Giles]

Converted the standard base devices (VIDEO_SCREEN, SPEAKER, and TIMER) 
from legacy devices to the new C++ style. Also renamed VIDEO_SCREEN to
simply SCREEN. The various global functions that were previously used to
access information or modify the state of these devices are now replaced
by methods on the device classes. Specifically:

  video_screen_configure()             == screen->configure()
  video_screen_set_visarea()           == screen->set_visible_area()
  video_screen_update_partial()        == screen->update_partial()
  video_screen_update_now()            == screen->update_now()
  video_screen_get_vpos()              == screen->vpos()
  video_screen_get_hpos()              == screen->hpos()
  video_screen_get_vblank()            == screen->vblank()
  video_screen_get_hblank()            == screen->hblank()
  video_screen_get_width()             == screen->width()
  video_screen_get_height()            == screen->height()
  video_screen_get_visible_area()      == screen->visible_area()
  video_screen_get_time_until_pos()    == screen->time_until_pos()
  video_screen_get_time_until_vblank_start() == 
                                 screen->time_until_vblank_start()
  video_screen_get_time_until_vblank_end() == 
                                 screen->time_until_vblank_end()
  video_screen_get_time_until_update() == screen->time_until_update()
  video_screen_get_scan_period()       == screen->scan_period()
  video_screen_get_frame_period()      == screen->frame_period()
  video_screen_get_frame_number()      == screen->frame_number()

  timer_device_adjust_oneshot()        == timer->adjust()
  timer_device_adjust_periodic()       == timer->adjust()
  timer_device_reset()                 == timer->reset()
  timer_device_enable()                == timer->enable()
  timer_device_enabled()               == timer->enabled()
  timer_device_get_param()             == timer->param()
  timer_device_set_param()             == timer->set_param()
  timer_device_get_ptr()               == timer->get_ptr()
  timer_device_set_ptr()               == timer->set_ptr()
  timer_device_timeelapsed()           == timer->time_elapsed()
  timer_device_timeleft()              == timer->time_left()
  timer_device_starttime()             == timer->start_time()
  timer_device_firetime()              == timer->fire_time()

Updated all drivers that use the above functions to fetch the specific
device type (timer_device or screen_device) and call the appropriate
method. [Aaron Giles]

Changed machine->primary_screen and the 'screen' parameter to VIDEO_UPDATE
to specifically pass in a screen_device object. [Aaron Giles]

Defined a new custom interface for the Z80 daisy chain. This interface
behaves like the standard interfaces, and can be added to any device that
implements the Z80 daisy chain behavior. Converted all existing Z80 daisy
chain devices to new-style devices that inherit this interface.
[Aaron Giles]

Changed the way CPU state tables are built up. Previously, these were data
structures defined by a CPU core which described all the registers and how
to output them. This functionality is now part of the state interface and
is implemented via the device_state_entry class. Updated all CPU cores
which were using the old data structure to use the new form. The syntax is
currently awkward, but will be cleaner for CPUs that are native new 
devices. [Aaron Giles]

Converted the okim6295 and eeprom devices to the new model. These were
necessary because they both require multiple interfaces to operate and it
didn't make sense to create legacy device templates for these single cases.
(okim6295 needs the sound interface and the memory interface, while eeprom
requires both the nvram and memory interfaces). [Aaron Giles]

Changed parameters in a few callback functions from pointers to references
in situations where they are guaranteed to never be NULL. [Aaron Giles]

Removed MDRV_CPU_FLAGS() which was only used for disabling a CPU. Changed
it to MDRV_DEVICE_DISABLE() instead. Updated drivers. [Aaron Giles]

Reorganized the token parsing for machine configurations. The core parsing
code knows how to create/replace/remove devices, but all device token
parsing is now handled in the device_config class, which in turn will make
use of any interface classes or device-specific token handling for custom
token processing. [Aaron Giles]

Moved many validity checks out of validity.c and into the device interface
classes. For example, address space validation is now part of the memory
interface class. [Aaron Giles]

Consolidated address space parameters (bus width, endianness, etc.) into
a single address_space_config class. Updated all code that queried for
address space parameters to use the new mechanism. [Aaron Giles]
2010-06-08 06:09:57 +00:00
Miodrag Milanovic
d198a773e6 Fixed assert in z80 cpu core when using nsc800 (no whatsnew) 2010-05-25 06:57:29 +00:00
Fabio Priuli
0fb8703972 Added NSC800 CPU emulation to the Z80 core [Sandro Ronco] 2010-05-25 05:33:13 +00:00
Aaron Giles
ec586731b9 Made device->tag and devconfig->tag into private member variables (m_tag).
Added inline tag() function to return a const char * version. Updated
callers to use this instead of directly accessing tag.cstr() which
was awkward.
2010-03-08 17:06:27 +00:00
Aaron Giles
1a2c20441f Remove some aliases between CPUINFO_ and DEVINFO_ to help clarify
usage.

Also converted a few more places to use the new accessors.
2010-01-21 06:05:57 +00:00
Aaron Giles
e738b79785 Correct a long-standing design flaw: device configuration state
is now separate from runtime device state. I have larger plans
for devices, so there is some temporary scaffolding to hold
everything together, but this first step does separate things
out.

There is a new class 'running_device' which represents the
state of a live device. A list of these running_devices sits
in machine->devicelist and is created when a running_machine
is instantiated.

To access the configuration state, use device->baseconfig()
which returns a reference to the configuration.

The list of running_devices in machine->devicelist has a 1:1
correspondance with the list of device configurations in
machine->config->devicelist, and most navigation options work
equally on either (scanning by class, type, etc.)

For the most part, drivers will now deal with running_device
objects instead of const device_config objects. In fact, in
order to do this patch, I did the following global search &
replace:

  const device_config -> running_device
  device->static_config -> device->baseconfig().static_config
  device->inline_config -> device->baseconfig().inline_config

and then fixed up the compiler errors that fell out.

Some specifics:

  Removed device_get_info_* functions and replaced them with
  methods called get_config_*.
  
  Added methods for get_runtime_* to access runtime state from
  the running_device.
  
  DEVICE_GET_INFO callbacks are only passed a device_config *.
  This means they have no access to the token or runtime state
  at all. For most cases this is fine.
  
  Added new DEVICE_GET_RUNTIME_INFO callback that is passed
  the running_device for accessing data that is live at runtime.
  In the future this will go away to make room for a cleaner
  mechanism.
  
  Cleaned up the handoff of memory regions from the memory
  subsystem to the devices.
2010-01-18 09:34:43 +00:00
Aaron Giles
470f843262 Within src/emu, basic conversions:
devtag_get_device ... machine->device()
  memory_find_address_space ... device->space()
2010-01-12 06:54:57 +00:00
Aaron Giles
4498faacd9 First round of an attempted cleanup of header files in the system.
- Created new central header "emu.h"; this should be included
    by pretty much any driver or device as the first include. This
    file in turn includes pretty much everything a driver or device
    will need, minus any other devices it references. Note that
    emu.h should *never* be included by another header file.
 - Updated all files in the core (src/emu) to use emu.h.
 - Removed a ton of redundant and poorly-tracked header includes
    from within other header files.
 - Temporarily changed driver.h to map to emu.h until we update
    files outside of the core.

Added class wrapper around tagmap so it can be directly included
and accessed within objects that need it. Updated all users to
embed tagmap objects and changed them to call through the class.

Added nicer functions for finding devices, ports, and regions in
a machine:

   machine->device("tag") -- return the named device, or NULL
   machine->port("tag") -- return the named port, or NULL
   machine->region("tag"[, &length[, &flags]]) -- return the
      named region and optionally its length and flags
      
Made the device tag an astring. This required touching a lot of 
code that printed the device to explicitly fetch the C-string
from it. (Thank you gcc for flagging that issue!)
2010-01-10 00:29:26 +00:00
Aaron Giles
91a1b8d634 NOTE: This change requires two new osd functions: osd_malloc() and
osd_free(). They take the same parameters as malloc() and free().

Renamed mamecore.h -> emucore.h.

New C++-aware memory manager, implemented in emualloc.*. This is a
simple manager that allows you to add any type of object to a
resource pool. Most commonly, allocated objects are added, and so
a set of allocation macros is provided to allow you to manage
objects in a particular pool:

  pool_alloc(p, t) = allocate object of type 't' and add to pool 'p'
  pool_alloc_clear(p, t) = same as above, but clear the memory first
  pool_alloc_array(p, t, c) = allocate an array of 'c' objects of type
                              't' and add to pool 'p'
  pool_alloc_array_clear(p, t, c) = same, but with clearing
  pool_free(p, v) = free object 'v' and remove it from the pool

Note that pool_alloc[_clear] is roughly equivalent to "new t" and
pool_alloc_array[_clear] is roughly equivalent to "new t[c]". Also
note that pool_free works for single objects and arrays.

There is a single global_resource_pool defined which should be used
for any global allocations. It has equivalent macros to the pool_*
macros above that automatically target the global pool.

In addition, the memory module defines global new/delete overrides
that access file and line number parameters so that allocations can
be tracked. Currently this tracking is only done if MAME_DEBUG is
enabled. In debug builds, any unfreed memory will be printed at
the end of the session.

emualloc.h also has #defines to disable malloc/free/realloc/calloc.
Since emualloc.h is included by emucore.h, this means pretty much
all code within the emulator is forced to use the new allocators.
Although straight new/delete do work, their use is discouraged, as
any allocations made with them will not be tracked.

Changed the familar auto_alloc_* macros to map to the resource pool
model described above. The running_machine is now a class and contains
a resource pool which is automatically destructed upon deletion. If
you are a driver writer, all your allocations should be done with
auto_alloc_*.

Changed all drivers and files in the core using malloc/realloc or the 
old alloc_*_or_die macros to use (preferably) the auto_alloc_* macros 
instead, or the global_alloc_* macros if necessary.

Added simple C++ wrappers for astring and bitmap_t, as these need
proper constructors/destructors to be used for auto_alloc_astring and
auto_alloc_bitmap.

Removed references to the winalloc prefix file. Most of its 
functionality has moved into the core, save for the guard page 
allocations, which are now implemented in osd_alloc and osd_free.
2010-01-08 06:05:29 +00:00
Aaron Giles
bd24fb23c1 Results of running the latest srcclean. 2009-12-28 09:04:00 +00:00
Dirk Best
3cfb47f7dd Z80: Check for NOP in interrupt mode 0. This allows code like ei / halt / di to work correctly. A better solution would be to implement full support for arbitrary opcodes in mode 0. 2009-11-03 16:54:46 +00:00
Michaël Banaan Ananas
7e2794ad21 Fixed IM2 interrupt cycles [eke]
http://www.mameworld.info/ubbthreads/showthreaded.php?Cat=&Number=199853&page=0&view=expanded&sb=5&o=&fpart=1&vc=1
I don't know this z80 emulator well enough to look into his first two points. Juergen?

1/ In the cc_xy[] table which lists instructions with DD or FD prefixes, "illegal" combos are returning 4 cycles when they should return 4 + cc_op (the normal instruction being executed). Another way to handle this correctly is to call EXEC(z80,fd,xx) or EXEC(z80,dd,xx) instead of op_xx(z80) when such pair of opcode is detected, to be sure the correct amount of cycles is used.

2/ According to Sean Young, R register is NOT incremented when chaining multiple DD or FD prefixes: [...]

This one was already fixed, dunno when:
2/ In the cc_ed[] table, INI (ED A2) and IND (ED AA) should return 16 cycles, like other instructions from this group, not 12. This seems to be a typo error.
2009-08-24 11:57:26 +00:00
Michaël Banaan Ananas
06829cb2f7 Z80 changes:
- Fixed X/Y flags in CCF/SCF/BIT, ZEXALL is happy now
- Simplified DAA, renamed MEMPTR (3.8) to WZ (same temp register as the officially named WZ in the 8080), added TODO

the cycle fix by Marshmellow, in the 3.9 z80.c comments was already committed in june, just added there for documentation
2009-08-19 15:27:22 +00:00
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
Brian Troha
e4df878bd1 fix error as pointed out by Laurent 2009-06-07 16:24:15 +00:00
Brian Troha
03945be4d0 Z80 fixes by "Marshmellow" in emails dated 3/8/2009 to Aaron and verified by Juergen.
Changes cycle counts in cc_xy[0x100] from 9 to 11 for:

0xDD2E 0xFD2E - LD IYL/IXL,n
0xDD26 0xFD26 - LD IYH/IXH,n

Also changes interrupt handling default case from:

z80->icount -= z80->cc_op[z80->PCD] + z80->cc_ex[z80->PCD];

to:

z80->icount -= z80->cc_op[z80->0xff] + z80->cc_ex[z80->0xff];
2009-06-07 15:49:22 +00:00
Aaron Giles
09aefa1379 Changed Z80 cycle table definitions to be per-device. Removed
old set_info constants for the tables; they are now set up via
the z80_set_cycle_tables function.
2009-04-04 22:43:56 +00:00
Aaron Giles
46494694d1 CPU cores now compile cleanly. 2009-03-15 17:12:40 +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
8213a7af4f Rewrote 8080/8085 interrupt handling so that it makes sense.
Changed 8080/8085 callbacks to be specified in a config structure.
Converted 8080/8085 core to cpu_state_table.
Changed to a single HAS_808X define for both cores.
Fixed several drivers that used interrupts in odd ways.
Converted warpwarp driver to raw video parameters.
2008-12-22 03:18:03 +00:00
Aaron Giles
9be5d30f20 More cleanup. Added address-space-specific constants for the various
bus width and shift CPU interface constants. Changed all the cores
to use them.

Minor spacing cleanup in Z80, Z180, TMS34010, ADSP21xx cores.

Changed ADSP21xx cores to accept a configuration struct instead of
using set_info to specify serial port callbacks. Simplified the
ADSP21xx get/set info significantly. Removed support for only
including certain variants of the chips; they are now either all
supported or all unsupported.
2008-12-20 02:57:13 +00:00
Aaron Giles
d2d5def542 Oops, swapped import/export on the R register. 2008-12-19 22:29:14 +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
04ae2d8bc7 Removed get context/set context calls from the CPU interface entirely.
Pointer-ified the TMS99xx core (missed that one!)
2008-12-11 10:21:52 +00:00
Aaron Giles
eb43d34725 Re-routed empty get/set context calls to the dummy CPU's, and removed them
from the CPU cores.

Disabled the use of PULSE_LINE for any input lines except NMI and RESET.
Added a helper function generic_pulse_irq_line() for doing a single-cycle
assert/deassert for those few drivers remaining that were trying to use
PULSE_LINE directly.
2008-12-09 06:21:15 +00:00
Aaron Giles
3c6eacc96f Changed save state system to accept machine parameters where
appropriate, and to keep all global variables hanging off the
machine structure. Once again, this means all state registration
call sites have been touched:

  - state_save_register_global* now takes a machine parameter
  - state_save_register_item* now takes a machine parameter
  - added new state_save_register_device_item* which now uses
     the device name and tag to generate the base name

Extended the fake sound devices to have more populated fields.
Modified sound cores to use tags from the devices and simplified
the start function.

Renumbered CPU and sound get/set info constants to align with
the device constants, and shared values where they were perfectly
aligned.

Set the type field in the fake device_configs for CPU and sound
chips to a get_info stub which calls through to the CPU and sound
specific get_info functions. This means the device_get_info()
functions work for CPU and sound cores, even in their fake state.

Changed device information getters from device_info() to
device_get_info() to match the CPU and sound macros.
2008-12-05 08:00:13 +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
Andrew Gardner
d801cf44b3 Moves empty brackets to the same line as CPU_(GET|SET)_CONTEXT calls.
This makes it easy to grep the CPU code to figure out which cores still need pointer-ification.
2008-11-30 16:25:09 +00:00
Aaron Giles
513011179d change_pc? What change_pc? 2008-11-24 02:40:16 +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
1c386d0958 Oops. 2008-11-18 14:22:56 +00:00
Aaron Giles
d83c8320da Cleaned up macro mess in the Z80 core. Switched to using
generic memory calls instead of program_* and io_*.
2008-11-18 06:16:30 +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
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
cbd240d0de This patch replaces the Machine parameter where an running_machine *
is available and removes the deprecat.h where unnecessary.

[Oliver Stoeneberg]
2008-11-13 07:23:50 +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
9407fecd2d Populated tag and static_config parts of fake CPU device. Removed 'config'
parameter from CPU_INIT. Modified CPU cores to pull config from the device
static_config.
2008-11-09 07:12:24 +00:00
Aaron Giles
1e16c45212 Cleanups/version bump. 2008-11-09 01:04:37 +00:00
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