Commit Graph

54 Commits

Author SHA1 Message Date
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
1d05ea6089 Cleanups and version bump for 0.128u4. 2008-11-24 04:10:18 +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
smf-
fae2eb291a changed bios call logging to read registers directly & all other accesses to Machine have been removed. 2008-11-20 17:29:11 +00:00
Aaron Giles
ba6a03d734 Memory banking now requires a machine object. This makes the memory
system fully global-free, apart from the "active_address_space"
which will eventually go away.

Also fixed compiler errors from last checkin.
2008-11-20 11:14:38 +00:00
smf-
3dcbbe190e pedantic, probably should number from 1 instead of 0... 2008-11-20 10:18:05 +00:00
smf-
6d15316659 removed excessive casts and fixed mvmva bug introduced in last commit. 2008-11-20 10:13:45 +00:00
Aaron Giles
371cd0a56d Another big one.
Moved memory global state into a struct hanging off of the machine.
Updated almost all memory APIs to take an address_space * where
appropriate, and updated all callers. Changed memory internals to
use address spaces where appropriate. Changed accessors to point
to the memory_* functions instead of the address space-specific
functions. Improved internal handling of watchpoints.

Added cputag_* functions: cputag_reset(), cputag_get_index(),
cputag_get_address_space(). These just expand via macros to an
initial fetch of the CPU via cputag_get_cpu() followed by the
standard CPU call.

Added debugger_interrupt_hook() and debugger_exception_hook() calls
which intelligently look at the debugger flags before calling.

Did minimal cleanup of debugger, mainly moving CPU-specific data
to hang off of the CPU classdata for more direct access.
2008-11-20 09:50:31 +00:00
smf-
24022b72ca pointerified the psx cpu core & switched it to the new memory functions. Changed some MIPS_* to PSXCPU_* 2008-11-19 19:32:44 +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
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
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
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
096529d2d8 From: Atari Ace [mailto:atari_ace@verizon.net]
Sent: Wednesday, November 05, 2008 8:22 AM
To: submit@mamedev.org
Cc: atariace@hotmail.com
Subject: [patch] Add ADDRESS_MAP_NAME macro

Hi mamedev,

In theory, MAME's interface macros should completely hide the naming
conventions from the drivers and sound/cpu cores.  So as an
experiment, I renamed all the core apis and looked to see what broke.
The most common api coupling was with address maps in the CPU cores,
which this patch addresses by introducing a new macro,
ADDRESS_MAP_NAME (mimicing what is done in devintrf.h).  There were a
handful of related problems in some drivers which this patch also
fixes.  Some remaining issues I left alone (laserdisk apis reference
rom, video_update, machine_config, ksys573 use of nvram_handler,
megadriv use of ipt), in principle all the apis need _NAME variants to
encode the conventions.

~aa
2008-11-08 21:06:35 +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
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
0b77a69691 From: Atari Ace [mailto:atari_ace@verizon.net]
Subject: [patch] Conditional code cleanup resubmit

Hi mamedev,

This is a resubmit of a previous patch.  The earlier version would not
compile with 32-bit MSVC, due to the fact that its linker required
external dependencies in dead code to be met before dead code
elimination was done, causing linker errors.  The proper fix for this
would be to add the necessary dependencies, so I instead simply left
the conditional code in place in winalloc.c and chd.c.

~aa

Original submission email below:
----
Conditionally compiled code tends to bitrot, so MAME should try to
avoid it as much as possible.  I sent a patch six months ago to
eliminate conditional code associated with logging, here's another
patch that does more of this.  Some notes:

1.  drc_ops.c: I couldn't find a LOG_CODE anywhere, so I used if (0).
2.  romload.c: I converted all the users of debugload to use
LOG((...)) instead, following the traditional conditional logging
pattern.
3.  windows/sound.c: I eliminated the separate sound log and directed
the few outputs to the error log.

~aa
2008-07-24 06:26:47 +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
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
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
smf-
59b480f561 fixed calculation of bit 31 of GTE FLAG register, when writing to it directly.
added lm mode to OP and fixed the calculation.
added lm mode to SQR.
2008-04-13 16:02:16 +00:00
smf-
6d87810b1f added sf/lm support to INTPL, improved flag calculation & calculates correct rgb
tidied up DPCS a bit.
2008-04-12 21:51:38 +00:00
smf-
d713e9cce6 tidied up DPCS, improved flag calculation and added support for lm/sf fields. 2008-04-12 18:08:27 +00:00
smf-
303caf3f8b removed casts and removed unnecessary decoding from NCLIP.
added signed values to PAIR & PAIR64.
renamed PAIR64.lw to PAIR64.q
2008-04-12 10:47:39 +00:00
Aaron Giles
439dbe872a Cleanups and version bump to 0.124u2. 2008-04-12 05:16:26 +00:00
smf-
5f75c62fb9 fixed avsz3 & avsz4 flag & otz calculation. 2008-04-11 23:10:07 +00:00
smf-
5ed8b1252b fixed flag calculation in F macro. 2008-04-11 21:42:05 +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
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
smf-
ee9ce122a9 removed useless casts in BLEZ/BGTZ 2008-04-07 23:49:48 +00:00
smf-
af97c741b3 fixed OTZ sign extension
fixed reading from SXYP
fixed reading from IRGB
fixed writing to LZCR
fixed sign extension of GTE control registers
fixed writing to FLAG

New games added or promoted from NOT_WORKING status
---------------------------------------------------
1 on 1 Government (JAPAN)
2008-04-07 23:20:31 +00:00
smf-
4d21cff799 added IR1/IR2/IR3 saturation when calculating ORGB
fixed spelling mistake.
2008-04-06 22:48:25 +00:00
smf-
be21ac9e08 fixed IRGB truncation and conversion to IR1/IR2/IR3 2008-04-06 21:38:25 +00:00
smf-
3d05dc8d91 fixed SZ0 truncation. 2008-04-06 21:12:02 +00:00
smf-
d485e8ed3c Fixed the SR masks for MTC0.
Added ability to test the instruction/data cache ram. The scratchpad and BIU register are now handled internally to the CPU.

All writes are performed with masks. SWL/SWR used to be implemented with two writes ( one byte and one word ) when writing three bytes, now it only ever performs one. Byte and Word writes use masks as they leave the rest of the register on the bus, which can be picked up by larger registers.

The read/write functions to use are cached when the SR bits are updated, as are the bad address masks.

Added coprocessor 1 & 3 support, though they don't do anything useful.

All loads now go through the delay pipeline, a lwl/lwr will grab the value out of the pipeline if it's updating the same register.

Added undocumented behaviour of BLEZ/BGTZ. The comparison for zero can be changed by specifying an alternate register in the RT field ( the documentation says you should always use register 0 ).

Restricted to 16 COP0 registers & generate an exception if any of the 5 for the MMU are used.

Added BCF/BCT instructions, although I have found no conditions that affect them yet.

Generates an exception if any MMU instructions are executed.

Sets the CE instruction for all exceptions, not just those involving a coprocessor. The bits of the opcode that specify the coprocessor are grabbed no matter what the instruction.

Added TAR register and BT bit in SR. When an exception occurs during a branch, BT determines whether it was taken or not. The TAR register gets set to the destination of the branch.

Fixed the BD bit when you are in a branch delay slot and you didn't take the branch, this shows up in the pipeline as !pc.

Fixed branches within a branch delay slot.

Multiply & divide instructions can be aborted if you write to HI/LO before reading the result.
Added data breakpoints, you don't appear to be able to set breakpoints on any of the addresses internal to the CPU.

Multiply/divide/GTE instructions can execute when an exception is taken, although the EPC indicates that it hasn't. The BIOS avoids rerunning GTE instructions as they are destructive, so you have to make sure they run.

Added bus error handling, PSXCPU is limited to 8mb of ram & any access outside this range will trigger an exception. I believe this is to be an internal limit.

Added CXD8611R as a specific CPU type, System 12 appears to allow more than 8mb of ram & it's possible that this is different.

Mapped out all instructions to either generate an exception or ignore bits.

Updated the disassembler to match the decoding.

Fixed disassembling of branch instructions in a branch delay slot.

Lui checks for a ori/addiu following and will show you the result.

Added step over/out support.

Fixed standalone disassembler.
2008-04-06 16:42:10 +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
smf-
819dd27efc Changed the clocks to reflect the actual frequency that is supplied to the chips, because the clock is divided in the CPU package.
I have changed the divide in the CPU core to 4, so apart from system 10 & 12 the speed should remain the same as before.
2008-01-16 08:16:32 +00:00
smf-
0b0153c45e First pass at fixing the cpu clock speeds on the playstation based hardware.
The system 10 & 12 clock speeds have been raised as they run on an upgraded chipset.
All clocks are currently set to divide by 2 externally, I don't know if this is correct.
The clock is also divided internally as we have no wait states, incorrect dma timing, no gpu timing, no dma bus stealing and no gte timing.
2008-01-15 13:19:39 +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
422ccce762 (From Oliver Stoneberg)
This is an updated version of my earlier ATTR_PRINTF patch. It was 
reviewed by Atari Ace to use ATTR_PRINTF properly and fixes even more 
format errors. I also reviewed the whole source again and it is now 
used in all possible places.
2008-01-03 05:37:18 +00:00