Commit Graph

185 Commits

Author SHA1 Message Date
Aaron Giles
282c1db110 activecpu_count -= 133
Removed mostly silly uses of activecpu from the CPU cores.
2008-12-06 16:56:22 +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
6924ad8120 Changed timer_alloc, timer_set, timer_pulse, timer_call_after_resynch,
and timer_get_time to pass the machine parameter. Moved timer globals
to hang off of the running_machine.
2008-11-26 06:38:08 +00:00
Aaron Giles
ca3478a1fc Removed globals from cpuexec.
Removed ATTOTIME_TO_CYCLES() and ATTOTIME_IN_CYCLES(). Replaced them
with functions in cpuexec: cpu_clocks_to_attotime() and
cpu_attotime_to_clocks(), both of which take CPU devices instead of
indexes. Updated all callers, many of which were using the functions
dubiously.
2008-11-25 06:23:14 +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
f86d66dc97 Removed NO_LEGACY_MEMORY_HANDLERS defines. 2008-11-24 01:42:27 +00:00
Aaron Giles
cd5d467fc8 NEC core converted. 2008-11-22 22:50:58 +00:00
Aaron Giles
7fbd73c60c A few more conversions. 2008-11-22 22:45:11 +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
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
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
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
Aaron Giles
62d7168295 Pointer-ified the R3000 core. 2008-11-04 15:24:49 +00:00
Aaron Giles
4e80367366 Here's another MAME tidy patch. This one adds missing const/statics,
adds/removes entries in header files, and fixes a few potential
multisession issues by explicitly adding initializers.  asic65.c has
significant changes to accomodate using a struct instead of 16
variables, otherwise the changes in this patch are modest and obvious.

[Atari Ace]
2008-11-02 02:40:46 +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
13a3d3fb89 From: Oliver Stoeneberg [mailto:oliverst@online.de]
Subject: Various cleanups

A couple of minor cleanups sitting on my disk for a while:
- removed obsolete ENABLE_DEBUGGER occurance
- removed more unprintable characters in SH-2 disassembler
- memset() usage cleanups
- removed duplicated TMS5110 entry in sound.mak
- use machine in uigfx.c where it's already available
2008-08-19 06:10:43 +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
Derrick Renaud
d5d5d9449b structure, lower-casing functions and re-inclusion updates of the src\emu\cpu headers J - M. 2008-08-12 03:40:09 +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
e376a53661 Cleanups and version bump. 2008-07-03 15:50:46 +00:00
Aaron Giles
32b803dad5 Fixed LWXC1/LDXC1; corrects gauntleg camera. 2008-07-01 08:09:23 +00:00
Aaron Giles
1b941383f0 MIPS recompiler:
* marked IDT instructions for R4650 only
 * accounted for time taken in throwaway likely branch slots
 * fixed jalr to respect the correct link register
 * fixed c.eq, c.lt, c.le to fail if unordered
 * fixed swxc1, sdxc1 to use the correct source register (fixes many Gauntlet problems)
 * fixed CCR31 display in debugger
2008-06-30 08:23:20 +00:00
Aaron Giles
bc5eecc7a2 Stash jump target address before executing delay slot.
Also, don't update link register until delay slot has finished
executing.

Fixes hang in gauntleg, though there are math problems lurking still.
2008-06-29 06:19:59 +00:00
Aaron Giles
96d3879704 Don't generate compare interrupts unless the compare register was written
to. Fixes hangs in blitz, calspeed, and others. Also fixed vegas input
ports.
2008-06-27 14:23:50 +00:00
Aaron Giles
3d1376ed97 Cleanups/version bump. 2008-06-26 16:05:46 +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
25abe2749d Hornet driver:
- connected EEPROM (doesn't seem to affect much)
 - cleaned up system register access

GTI Club driver:
 - altered network IRQ clear to fix several problems
 - added Guru readme
 - fixed crashes due to missing inputs
 - gticlub "works" again

ZR107 driver:
 - added Guru readme
 - cleaned up system register access
 - these games work again with altered network IRQ timing

NWK-TR driver:
 - added Guru readme

DRC frontend:
 - now passes pointer to previous instruction when describing

PPC frontend:
 - attempts to roughly take into account branch and CR logical
    folding in timing computations
2008-06-25 15:02:07 +00:00
R. Belmont
1d2a733d95 Fixed compile where DEBUG=1 and DEBUGGER=0. 2008-06-23 17:00:18 +00:00
Aaron Giles
a4918351e1 Save state support:
* added save state support to the SHARC CPU core
 * added save state support to the PowerPC recompiler
 * added save state support to the virtual TLB system
 * added save state support to the RF5C400 sound core
 * added save state support to konppc module
 * added save state support to K056800 host controller
 * added save state support to the Konami hornet driver

Fixed poor default CLUT handling in the voodoo driver
2008-06-23 16:37:34 +00:00
Aaron Giles
ec54e3911d Save state support:
* added save state support to the MIPS3 recompiler
 * added save state support to CAGE audio system
 * added save state support to the voodoo emulator
 * added save state support to the smc91c9x emulator
 * added save state support to the kinst, seattle, and vegas drivers
 * fixed core video handling of save states with dynamic screen resolutions

SMC91C9x:
 * converted to proper device
 * updated seattle and vegas drivers to allocate devices
 * added separate 91C96 device for eventual 2049 use
 * cleaned up code
2008-06-23 07:58:17 +00:00
Aaron Giles
d4b702bf33 01900: All sets in kinst.c: Mass coin input disables dipswitch access, and thus further coin input during a fight 2008-06-22 01:40:28 +00:00
Aaron Giles
2d035a1c6a Cleanups and version bump. 2008-06-17 15:19:10 +00:00
Aaron Giles
5deab27d6d Created common virtual TLB managment module.
Updated MIPS and PowerPC code to make use of it.
2008-06-16 03:12:49 +00:00
Aaron Giles
2e8eddb648 MIPS3 recompiler:
* added UML comments for common state variables
 * removed some unused fields
 * implemented LL/LLD/SC/SCD (only works single-processor for now)
2008-06-13 07:29:28 +00:00
Aaron Giles
4bc9630265 Turned off logging on the mips core. 2008-06-13 06:43:21 +00:00
Aaron Giles
5a162da3d4 Cleanups and version bump. 2008-06-12 19:59:19 +00:00
Aaron Giles
20ee6bc325 PPC DRC:
* changed SPU receive model to a push model; updated drivers accordingly
 * added macros for setting the SPU transmit handler and sending bytes
 * cleaned up ppc.h
2008-06-12 02:48:11 +00:00
Aaron Giles
7079892d7e Fixed left/right accesses to work with recent memory handler changes. 2008-06-11 13:44:46 +00:00
Aaron Giles
156d61c760 DRC frontend:
* changed from tracking "live" registers to tracking "necessary" registers
 * genericized register tracking to be more flexible
 * added previous instruction pointer to opcode descriptions

PowerPC frontend/DRC:
 * cleaned up register tracking implementation
 * fixed numerous errors and shortcomings in the tracking
 * added support for removing unnecessary XER CA and CR0 computations
 * updated UML logging to output new frontend statistics

MIPS3 frontend/DRC:
 * tweaked register tracking to match new DRC frontend system
 * updated UML logging to output new frontend statistics
2008-06-10 07:34:48 +00:00
Aaron Giles
1c1498b0fc UML:
* Removed explicit flag requests from the shorthand opcodes
 * Added optimization function to drcuml which is called at block end
 * Added logic to compute the necessary flags based on upcoming opcodes
    and only select those flags which are required
 * Updated the PPC and MIPS3 DRCs to no longer explicitly specify flags
2008-06-06 07:36:36 +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
91f55454e4 Fixed Cause register for bad COP instructions. Verified with
mtetrisc and starsldr that they both throw and handle these
exceptions.
2008-05-30 05:59:06 +00:00
Aaron Giles
c852c42952 Cleanups for 0.125u3. 2008-05-29 09:25:51 +00:00
Aaron Giles
7733c26136 Removed obsolete comment. 2008-05-29 08:40:40 +00:00
Aaron Giles
650dfb8a28 Moved implementation-specific state into a pointer hanging off of the core
MIPS3 state.

Removed large context in favor of a pointer to the large context to help
improve context switch times.
2008-05-29 08:22:50 +00:00
Aaron Giles
eeb821032e Several miscellaneous changes:
1. In the MIPS core:
    - renamed struct mips3_config -> mips3_config
    - updated all drivers to the new names
    - removed MIPS3DRC_STRICT_COP0 flag, which is no longer used
    - a few minor cleanups

2. In the CPU interface:
    - added new 'intention' parameter to the translate callback to
       indicate read/write/fetch access, user/supervisor mode, and
       a flag for debugging
    - updated all call sites to pass an appropriate value
    - updated all CPU cores to the new prototype

3. In the UML:
    - added new opcode SETC to set the carry flag from a source bit
    - added new opcode BSWAP to swap bytes within a value
    - updated C, x86, x64 back-ends to support the new opcodes
    - updated disassembler to support the new opcodes

4. In the DRC frontend:
    - fixed bug in handling edge case with the PC near the 0 or ~0
2008-05-29 07:18:35 +00:00
Aaron Giles
40dea6049e Added new front-end flag to tag privileged instructions.
Minor tweaks/cleanups to the MIPS3 drc.
2008-05-25 22:09:21 +00:00
Aaron Giles
d5ff8c002a Cleanups and version bump. 2008-05-22 05:19:16 +00:00
Aaron Giles
a300da2178 From: Atari Ace [mailto:atari_ace@verizon.net]
Subject: [patch] More Machine->machine changes, add machine to irq
callbacks

Hi mamedev,

Here are two more patches to eliminate Machine globals.  The first
patch was autogenerated by the attached fixup script.  That script has
been updated to catch additional cases which it previously missed
(when Machine is the last parameter to a function or Machine is used
in an assignment).  This makes ~50 more files deprecat.h free.

A sizable chunk (~20%) of the remaining uses of the Machine global in
the drivers are due to irq callbacks for sound and machine updates.
Typically such callbacks need to call cpunum_set_input_line, which
requires a machine parameter, so if the callbacks don't pass the
machine parameter, these routines have no choice but to reference the
global variable.

The second patch attempts to address most cases of this by adding the
machine parameter to the callback interfaces.  This allows us to
remove #include "deprecat.h" from ~150 files, at the cost of having to
fix up hundreds of callbacks.

In total, these patches reduced the number of files with deprecat.h
from 783 to 575.

~aa
2008-05-22 03:23:28 +00:00
Aaron Giles
1561edf049 UML changes:
* Added new opcode LZCNT which returns the number of leading zeros in
   a parameter.
 * Added new opcode XTRACT which is a combined rotate/mask (basically
   rlwinm from PowerPC)
 * Added new opcode INSERT which is a combined rotate/mask/blend
   (basically rlwimi from PowerPC). Best. Opcode. Ever.
 * Updated all back-ends to support these new opcodes.
 * Fixed several bugs relating to shifts/rotates and optimizing out
   cases incorrectly.

MIPS3 DRC changes:
 * Updated to use INSERT and XTRACT where appropriate
 * Cleaned up register usage to enable an additional direct mapping;
   this means Linux gets 1 now and Windows gets 3
2008-05-22 03:05:13 +00:00
Aaron Giles
caa2a53c7f Added support in the MIPS recompiler to map a few common registers to
machine registers if the machine supports it. Currently only x64 on
Windows has enough free registers to do so, though PowerPC will almost
certainly be able to take advantage of this. Gives a minor speedup.
2008-05-21 10:59:05 +00:00
Aaron Giles
21920d4e44 Minor cleanup. 2008-05-21 07:54:40 +00:00
Aaron Giles
fdf128e2d7 Implemented IDT instructions. All invalid instruction asserts are now runtime-only. 2008-05-20 00:22:50 +00:00
R. Belmont
071164f3a7 64-bit GCC compile fix. 2008-05-19 17:10:32 +00:00
Aaron Giles
d411c2c74c Numerous MIPS3 DRC updates:
* Fixed front-end so that virtual no-op instructions are still targeted
as branch targets.

* Fixed front-end to mark the beginning of each sequence as needing TLB
validation, since any sequence can be jumped to from anywhere.

* Redid the MIPS3 TLB implementation. Fixed the exception vector and
type handling. Changed the bitfields to directly map from the MIPS TLB
format. Added distinction between TLB fill and TLB valid/modified
exceptions.

* Added separate modes for user, supervisor, and kernel modes. Each mode
does proper verification of addresses now and generates address errors
for invalid accesses.

* Fixed several bugs in the TLB implementation; not everything works
yet but it's a lot closer.

* Made COP0 access checking mandatory in non-kernel modes.

* Fixed several crashes when recompiling virtual no-ops.

* Fixed TLB bug where entries for virtual address 0 were present by 
default.

* Fixed bug in the map variable implementation that would sometimes
result in incorrectly recovered values.
2008-05-19 16:58:42 +00:00
Aaron Giles
969a705508 Added back-end validation mechanism, and a handful of tests as examples.
This will be expanded in the future.

Added two new opcodes: SAVE and RESTORE to save and restore the entire
virtual machine state for examination/setup.

Added new back-end function get_info() which returns information from
the back-end about how many actual registers will be mapped.

Fixed a bug that mapped the high a low parts of registers to the same
address. This should help the C back-end run better on big-endian
architectures.
2008-05-19 00:58:16 +00:00
Aaron Giles
28855e088a Fixed a couple of obvious errors in the TLB implementation. 2008-05-17 19:48:17 +00:00
Aaron Giles
0c1aaf1526 Added some instrumentation for the MMU. To enable it, turn on PRINTF_MMU at the top
of the file. Currently it is left on because none of the MAME games rely on it.
2008-05-17 17:11:12 +00:00
Aaron Giles
5c0e902901 Cleaned up operand sizing in the C core. Should be closer to working
on big-endian systems.
2008-05-17 06:47:25 +00:00
Aaron Giles
271ac2a7a2 Added a quick & dirty attempt at implementing tlb_mismatch. It's likely wrong,
but it's better than nothing. Also added an assertion if you jump to unmapped
code and added handling for compile-time page faults.
2008-05-16 05:21:25 +00:00
Aaron Giles
21a686cf7d Cleanups and version bump. 2008-05-15 08:56:29 +00:00
Aaron Giles
b735b4be6c New universal dynamic recompiler system. The central module
is drcuml.c, which defines a universal machine language
syntax that can be generated by a frontend recompiler and
then retargeted via a generic backend interface to any of
a number of different architectures. A disassembler for the
UML is also included to allow examination of the generated
UML code.

Currently supported backend architectures include 32-bit x86,
64-bit x86, and a platform-neutral interpreted C backend that
can be used as a fallback for platforms without native 
support. The C backend also performs additional validation
to ensure assumptions are met.

Along with the new architecture is a new MIPS III/IV 
recompiler frontend. This frontend has been rewritten from 
the old x64-specific recompiler to generate UML opcodes
instead. This means that the single recompiler can be used
to target multiple backend architectures and should in
theory produce identical results across all of them.

The old 32-bit and 64-bit MIPS recompilers are now officially
retired. The new system provides similar performance (within
5% generally) to the old system and has similar compatibility.
The only currently known issues are some problems with the
two Gauntlet 3D games.
2008-05-11 22:15:13 +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
af71decdb7 D'oh, another accidental checkin. :) 2008-04-21 00:13:37 +00:00
Aaron Giles
ae4002a56d From: Corrado Tomaselli [mailto:corrado.to@tiscali.it]
Subject: ghost and goblins (italian bootleg, harder)

this is an italian bootleg with a really hard gameplay. it's quite 
impossible to say the truth ;)
pics of the board:
http://www.citylan.it/gngitaly/main%20PCB%20component%20side.jpg
http://www.citylan.it/gngitaly/roms%20PCB%20component%20side.jpg

New clones added:
Ghosts'n Goblins (Italian bootleg, harder)
2008-04-21 00:11:19 +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