Commit Graph

931 Commits

Author SHA1 Message Date
Aaron Giles
ec8caea251 Completed pointer-izing the 6502 cores. Removed h6280 SET_CONTEXT calls. 2008-12-09 06:36:30 +00:00
Aaron Giles
b164c8a260 From: Atari Ace [atari_ace@verizon.net]
Sent: Monday, December 08, 2008 6:21 PM
To: submit@mamedev.org
Cc: atariace@hotmail.com
Subject: [patch] Pointerify f8/tlcs90 cores

Hi mamedev,

Two more cores converted to pointers.  f8 was very straightforward,
tlcs90 had some extra state that needed to be merged into the register
struct, and needed adjustments to its timers and read/write handlers
which might warrant some scrutiny by the experts.

~aa
2008-12-09 06:26:02 +00:00
Aaron Giles
901d4fc796 Updated z8000 tables [Juergen Buchmueller] 2008-12-09 06:24:15 +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
Andrew Gardner
183b7c9de7 Pointer-ified the h6280 cpu core. [Andrew Gardner]
(Next is the dsp56k)
2008-12-09 05:25:35 +00:00
Aaron Giles
4eb774a033 Minor cleanup for empty SET_CONTEXT handlers. 2008-12-09 04:13:29 +00:00
Wilbert Pol
abb8a04a10 Pointer-ified the PDP1/TX0 core. 2008-12-08 21:49:26 +00:00
Aaron Giles
9369daac34 Fix disassembler compile. 2008-12-08 16:02:40 +00:00
Aaron Giles
0ba81aad17 Pointer-ified the V30MZ core. Untested as nobody is using it. 2008-12-08 11:03:40 +00:00
Aaron Giles
c33c60485b Pointer-ified the V810 core.
Added OG's z8000 fix.
2008-12-08 10:44:00 +00:00
Aaron Giles
fb25927452 Pointer-ified the Z180 core.
Fixed compile issue with the Z8000 disassembler.
2008-12-08 09:40:44 +00:00
Aaron Giles
d4e2eb2472 Pointer-ified the Z8000 core. 2008-12-08 08:41:51 +00:00
Curt Coder
b4470a0bd7 [M6800] Removed the extraneous cpu_pop_context(). 2008-12-08 08:19:37 +00:00
Aaron Giles
b24198a1cd Hi mamedev,
This is a reworked/expanded version of the patch I sent yesterday.
This one is split into three parts:

1.  This introduces function macros for SAMPLES_START,
CUSTOM_{START,STOP,RESET}, and ANTIC_RENDERER.
2.  This introduces running_machine *machine throughout MAME.
Principally it adds running_machine *machine = Machine to the top of
functions, but in some static functions the parameter is added
directly.  Some similar changes in 99xxcore.h, v9938.c, v9938mod.c,
galaxold.c, psx.c, taito_l.c are also made to eliminate Machine
params.  No global API is changed.
3.  This changes the APIs introduced in the first part to pass device
or space as appropriate.  A few similar changes in some other global
apis are made as well.

The net result of this sequence of patches is to remove 40% of the
Machine references and 27 deprecat.h includes.

~aa
2008-12-08 06:53:40 +00:00
Aaron Giles
60febeb3d9 Pointer-ified the v60 core. 2008-12-08 06:35:28 +00:00
Aaron Giles
f0849513d0 From: Atari Ace [mailto:atari_ace@verizon.net]
Sent: Sunday, December 07, 2008 1:48 PM
To: submit@mamedev.org
Cc: atariace@hotmail.com
Subject: [patch] Pointerify sharc core

Hi mamedev,

The attached patch pointerifies the sharc core.  If this has already
been done, no great loss, it only took about an hour and a half to do
this.

~aa
2008-12-08 05:07:54 +00:00
Aaron Giles
65f9ee3d3a From: Atari Ace [mailto:atari_ace@verizon.net]
Sent: Sunday, December 07, 2008 9:43 AM
To: submit@mamedev.org
Cc: atariace@hotmail.com
Subject: [patch] Introduce KONAMI_SETLINES_CALLBACK

Hi mamedev,

Aaron indicated the KONAMI_SETLINES_CALLBACK change from my previous
patch overlapped with work already committed but was otherwise a
desired change, so this patch submits just that change relative to the
committed work.

~aa
2008-12-08 05:03:46 +00:00
Nathan Woods
bb2061763c Updates from MESS 2008-12-08 03:53:26 +00:00
Andrew Gardner
96d40d8969 PPointer-ified the arm. [Andrew Gardner]
(Next cpu I'll look at is the H6280.)
2008-12-07 17:57:18 +00:00
Aaron Giles
872ec20658 From: Atari Ace [mailto:atari_ace@verizon.net]
Sent: Saturday, December 06, 2008 4:52 PM
To: submit@mamedev.org
Cc: atariace@hotmail.com
Subject: [patch] Deprecat.h cleanup

Hi mamedev,

This patch changes some global Machine references to use machine,
device->machine, ... instead, and removes any unneeded #include
"deprecat.h" lines as well (about 10% of them in fact).  It was
generated using the attached script, and then reverting some cases
where it was overzealous.

~aa
2008-12-07 14:51:36 +00:00
Aaron Giles
c5f3e70c14 Made the PCI bus a device. The bus is declared in the machine
config, and the devices attached to it are enumerated there.
Eventually, the PCI config read/write functions should be moved 
to well-known functions within the device, but for now they are
kept separate.

activecpu -= 138
2008-12-07 06:14:33 +00:00
Aaron Giles
63f26b610b Pointer-ified the konami CPU core. Changed setlines callback to
pass a device. Updated and de-deprecat-ed the drivers that used
it. Fixed interrupt handling to follow more recent behavior
expectations (no PULSE_LINE on non-NMI lines).
2008-12-06 21:24:38 +00:00
Aaron Giles
c023001a86 Pointer-ified the PPC DRC. 2008-12-06 20:18:05 +00:00
Aaron Giles
554f86eb65 Pointer-ified the mips3drc. 2008-12-06 19:55:22 +00:00
Andrew Gardner
490880419a Pointer-ified the m6805. [Andrew Gardner]
(Used cpustate naming convention.  Moved iCount into state struct.)
(Tested with arkanoid, bootleg bubble bobble, etc.)
(Next cpu I'll look at is the ARM.)
2008-12-06 19:47:14 +00:00
Aaron Giles
7f9c6cb81f Pointer-ified the DSP32 core. 2008-12-06 19:28:48 +00:00
Aaron Giles
d92a2e0c4e Cleanups/version bump/added missing drivers. 2008-12-06 17:54:42 +00:00
Aaron Giles
fbdff39c21 Fix compile errors. 2008-12-06 17:15:23 +00:00
Aaron Giles
389b25c281 02638: various cpu cores don't compile anymore
(mostly fixed before)
2008-12-06 17:09:02 +00:00
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
d8e17c4e86 Removed cpunum_get_active().
Main important change is that IDE controllers with bus mastering (DMA)
need to specify the target address space in the IDE device configuration.
2008-12-06 06:40:40 +00:00
Aaron Giles
12f71dac82 m68_state -> cpustate 2008-12-05 15:17:40 +00:00
Nathan Woods
3125b5e60e Removed unused variables 2008-12-05 12:08:49 +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
35dfc8bad2 From: Micko [mailto:mmicko@gmail.com]
Sent: Tuesday, December 02, 2008 10:14 AM
To: Aaron Giles
Subject: Another 8080/85 change from me

Hi Aaron,
 
I have noticed that there are some problems in interrupt handling in 8080 implementation. Thing is that there are some cases that made a problem while implementing one 
computer emulation. Thing is that there is same computer with Z80 and 8080 cpu and ROM's are same, but interrupts were not triggered. So I have searched and found 
two problems fixed with this patch.
1. previous implementation cleared interrupt enable bit on interrupt trigger which is wrong since interrupts should stay enabled 
2. serve interrupt number was not cleared after interrupt is executed, so if same one is triggered it will not be catched.
 
I have tested with 8080 MESS drivers, and picked some of MAME drivers using 8080 and 8085, and there were no bad things found.
 
Regards,
Micko
2008-12-04 10:48:35 +00:00
Aaron Giles
2c3a713213 Minor comment fix. 2008-12-04 10:06:25 +00:00
Aaron Giles
9dd0f760aa 02673: All Sets with HuC6280 as Audio Device (PCE-Based titles): Fatal Error after OK 2008-12-04 10:04:22 +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
smf-
2bede4d1ce Makes sure uint is defined. 2008-11-29 08:32:58 +00:00
R. Belmont
cdd72b00bd ARM7 updates
- Pointer-ified ARM7 core
- Added disassembler and execution support for ARMv5 LDRD/STRD instructions.
  39in1 now makes it until it needs the MMU.
2008-11-29 02:59:53 +00:00
R. Belmont
fdc7c5b358 Pointer-ified the SPC700. 2008-11-28 23:29:21 +00:00
R. Belmont
1962ffeaf9 Pointer-ified the 65816. 2008-11-28 22:43:37 +00:00
Nathan Woods
00cf5ec718 F3853 changes from MESS 2008-11-28 00:14:22 +00:00
Aaron Giles
0142411b98 Move cpunum_get_active() removal. 2008-11-27 05:22:51 +00:00
Curt Coder
c35dcd695c Normalized CDP1802 state variables to 'cpustate'. 2008-11-26 20:54:18 +00:00
Aaron Giles
0df0ba2bc4 Removed more cpunum_get_active(). 2008-11-26 20:07:20 +00:00
Aaron Giles
c2ca1ef0cb PowerPC DRC no longer references active CPU. 2008-11-26 19:49:42 +00:00
Aaron Giles
5cfad18a84 Normalized m37710 local CPU state pointers to to 'cpustate'.
Removed need for cpunum in the timers.
2008-11-26 19:42:33 +00:00
Aaron Giles
593e334f08 Normalized mcs48 state variables to 'cpustate'. 2008-11-26 19:39:12 +00:00
Aaron Giles
98b88c617b Removed cpunum_get_active() calls from a number of CPU cores.
Normalized 6502 state variable to the generic 'cpustate' which
makes the macros work more cleanly.
2008-11-26 19:35:58 +00:00
Aaron Giles
e1f5ed6caf Pointer-ified the hyperstone core, and removed all activecpu refs. 2008-11-26 16:23:41 +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
185771534c 02672: Most Sets using MCS48/51.C (intel 80xx family): Fatal Error when using -cheat trigger 2008-11-25 23:06:29 +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
dd87df6926 CCPU and T-11 pointer-ification. 2008-11-25 05:13:20 +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
e117cf26a2 Removed cpu_num info from SH2 in favor of just keeping the device object. 2008-11-24 01:32:29 +00:00
Aaron Giles
5e980fa67b Removed memory context switch. Let the fun begin. 2008-11-24 00:00:18 +00:00
Couriersud
80991da900 Pointer-"ified" the s2650 core
* Used s2650c to identify the state variable. This is unique within the 2650 core and may be renamed using simple replace.
2008-11-23 16:58:41 +00:00
R. Belmont
f778678e3d Removed unused global tokens. 2008-11-23 16:04:49 +00:00
R. Belmont
987696750a Pointer-ified the M377xx. 2008-11-23 02:55:26 +00:00
Aaron Giles
2b5f8f5f0e Removed cpu_read_byte/cpu_write_byte. Fixed a few lingering compiler
issues. Fixed Z8000 crash.
2008-11-23 02:06:51 +00:00
Aaron Giles
3601d8880c Remaining CPU cores updated to new functions. 2008-11-23 01:24:32 +00:00
Aaron Giles
6885dcc750 TMS* CPUs conversion ... almost there. 2008-11-23 00:40:10 +00:00
Aaron Giles
cf2bb4f315 More memory conversions. 2008-11-23 00:05:00 +00:00
Aaron Giles
2d5bd758de More conversions, plus tested CPU cores that were previously disabled. 2008-11-22 23:01:08 +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
R. Belmont
e1c619230f Un-deprecat'ed the H8. 2008-11-22 20:16:52 +00:00
Aaron Giles
0dcc155498 And the 6805 core. 2008-11-22 20:08:41 +00:00
Aaron Giles
5ca71f2d98 Missed a couple in the 68000 core. 2008-11-22 20:06:27 +00:00
Aaron Giles
8b675335b5 More conversion to the new memory functions.
And I will resist the urge to personally throttle those responsible
for copying and pasting the m6502 core 4 times. What a disaster.
2008-11-22 19:29:29 +00:00
Aaron Giles
9ee2f770aa Converted a bunch of CPU cores over to the new memory functions. 2008-11-22 18:38:41 +00:00
davidhay
7f2d2d85cc pointer work on se3208 (although I haven't touched the disassembler..) 2008-11-22 12:51:57 +00:00
Couriersud
42c87ed6c8 Reverted case shifts 2008-11-22 11:55:51 +00:00
davidhay
8ad71d3e2a converted ssp1601 to pointers (still works, tested virtua racing genesis) 2008-11-22 11:53:14 +00:00
Couriersud
8ea1ea748c Optimized two more switch/case 2008-11-22 00:52:29 +00:00
Couriersud
7e59b0b348 Switched adsp21xx to new memory functions
* simplified a few case statements
2008-11-22 00:26:31 +00:00
Couriersud
a0e6e5a2b0 Pointer-ified cpu/nec (V30) 2008-11-21 23:49:08 +00:00
Couriersud
783035dd88 Fix some missing "("s - Aaron, please check 2008-11-21 21:38:29 +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
R. Belmont
c522d198ac Converted H8 CPUs to the new memory functions. 2008-11-21 04:58:27 +00:00
Aaron Giles
9a0493f14a Pointer-ified the TMS32031 core. 2008-11-20 18:20:59 +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
bc79dad8bd Removed global Machine references as well. 2008-11-20 17:09:17 +00:00
Aaron Giles
0bf352e5e8 Pointer-ified the jaguar CPU core. 2008-11-20 17:07:08 +00:00
Aaron Giles
e23c6d6676 Fixed drc-based games. 2008-11-20 11:33:25 +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
Couriersud
2cd2454c39 Switched m6809 and hd6309 to new memory functions
* cleaned up some macros
* aligned code a bit more
* interrupts now checked in cpu_execute instead of set_context
2008-11-19 19:27:04 +00:00
R. Belmont
b95877564a Fixed "H8/3344" to "H8/3334" as per Guru. 2008-11-19 18:00:00 +00:00
Curt Coder
49a90686e8 Refactored the COP400 CPU cores to use the new memory functions. 2008-11-19 17:47:38 +00:00
Curt Coder
e0d6d1323d Refactored the CDP1802 CPU core to use the new memory functions. 2008-11-19 17:46:39 +00:00
R. Belmont
3ac959ef71 Fixed GCC compile errors in h6280 and m6509.
Also fixed the read/write handlers in m6509 to use space->cpu->token instead of the global token.
2008-11-19 14:35:26 +00:00
Aaron Giles
0801d1254c Converted change_pc() into a no-op. Changed memory_set_direct_region() to
return a boolean indicating whether the given address was successfully
located in a bank. Change raw/decrypted access to look at this result, and
if the given address is not in a bank, calls through to the standard read
handlers.

In theory, this should prevent crashes when accessing opcodes. It does in
fact prevent mp_col3 from crashing.

Fixed address space mapping handlers to invalidate direct access regions
if a change is made to the mapping. This is needed to prevent the Sega
dynamic memory mapping chips from falling over.
2008-11-19 06:36:01 +00:00
R. Belmont
6c1655976f Big H8 update
H8:
- Added support for 8-bit H8 family MCUs, starting with the H8/3344
- Pointer-ified all H8 cores
- Some cleanup and renames toward additional future work

System 23:
- Added extremely preliminary support for I/O boards with the H8/3344
- Added new game: Motocross Go! (MG3 Ver. A) [credit Guru]
2008-11-19 03:29:10 +00:00
Couriersud
13bd16a090 Switched m68000 core to new memory functions 2008-11-19 00:32:54 +00:00
Couriersud
3a068d3dfb Switched mcs48 core to new memory functions 2008-11-18 22:45:35 +00:00
Couriersud
56a34c2e5b Switched mcs51 to new memory functions 2008-11-18 21:19:44 +00:00
Curt Coder
a8475e4c1e Pointerized the COP400 CPU cores. 2008-11-18 17:15:40 +00:00
Aaron Giles
09da237dcd Pointer-ified the ASAP core. 2008-11-18 16:33:33 +00:00
Aaron Giles
1c386d0958 Oops. 2008-11-18 14:22:56 +00:00
Aaron Giles
0e44db781f evilngt regressions. 2008-11-18 06:50:30 +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
davidhay
a088d32b1b fix compile 2008-11-17 22:05:39 +00:00
Curt Coder
ce73844036 Pointerized the CDP1802 CPU core. 2008-11-17 21:42:56 +00:00
Couriersud
29d45a2410 Add proper cpu_push_context to callbacks in m6800.c
* fixes crash in namcos1.c drivers
2008-11-17 21:20:13 +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
Nicola Salmoria
f8fcbc764c changed 6809 disassembler to work with kram3 2008-11-17 10:34:44 +00:00
Aaron Giles
5a9c7e2d2d Significantly pared down the 68k core. Merged outer MAME shell
into the core proper and removed unused macros. Changed all
external interfaces to pass the CPU device. Enabled 64-bit
operations by default. Re-derived the interface functions to
cascade and share code more aggressively.

These changes also seem to have cured the taito_f3 issues as
far as I can tell (at least pbobble3 seems right now).
2008-11-17 09:39:11 +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
Couriersud
8aa46743d1 Some -literally- code alignment 2008-11-16 23:40:12 +00:00
Couriersud
8fd2054a6f move ea into state struct 2008-11-16 23:12:23 +00:00
Couriersud
13f4eec454 Fix icount
* m68_icount ==> m68_state->icount
* move ea into state struct
2008-11-16 23:07:17 +00:00
Couriersud
ad3179a0e2 Fix icount: m68_icount ==> m68_state->icount 2008-11-16 22:53:45 +00:00
smf-
ea20c30175 added device_config to the disassembler. 2008-11-16 21:59:16 +00:00
Aaron Giles
893b21cb33 Disassemblers now get the CPU object. 2008-11-16 15:40:41 +00:00
Nicola Salmoria
6aabfb37cb added m6809 config option to control where opcodes 10 and 11 fetch the second byte.
The disassembler needs to respect the setting too but I don't know how to inform it.
2008-11-16 12:21:58 +00:00
Aaron Giles
f326c2c29e More disentangling of the 68000 core. Removed old unused CPS2
encryption junk. Changed encryption interfaces to pass the
CPU core object. Unwound several levels of macros for accessing
memory. Still more to do.
2008-11-16 07:02:39 +00:00
Aaron Giles
1794cfa5a1 Terminology cleanup. "Machine" handlers are now "space" handlers. 2008-11-15 21:36:21 +00:00
Aaron Giles
fd5b836964 Const-ified the return from cpu_get_address_space.
Fixed a few errors.
2008-11-15 03:29:32 +00:00
Couriersud
4f71d0aa98 Fix compile error #2 2008-11-14 19:59:04 +00:00
Couriersud
7749448b1f Fix compile error 2008-11-14 19:54:03 +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
Couriersud
9ad6fe0049 Pointer-ified the 6800, 6809 and hd6309 cpu cores
* temporarily named the state var m68_state in the 68xx cores
* reorganized some code for simpler comparison of 68xx cores
2008-11-14 07:49:20 +00:00
Couriersud
a036befa08 Remove a #if 1 2008-11-13 21:52:38 +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
Nathan Woods
2f64840531 Sync with MESS 2008-11-11 03:58:52 +00:00
Aaron Giles
c3d385fddd Converted TMS340x0 cores to be pointer-based. 2008-11-10 16:49:10 +00:00
Aaron Giles
b5f1e96c98 Removed save_device pattern if favor of just accepting the
device from the reset.
2008-11-10 08:56:38 +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
Couriersud
ce58dbba34 * Renamed mcs51_regs to mcs51_state_t
* Renamed mcs51 to mcs51_state

Shouldn't the state struct just be called cpu_state?
2008-11-09 22:39:33 +00:00
Couriersud
819a970684 Fix deleted CHECK_IRQ_LINES() 2008-11-09 22:38:41 +00:00
Couriersud
e7d938fa2b Formatting, identation
* the hd6309 is very similar to the m6809, cleaned up a bit for windiff & friends.
2008-11-09 22:18:17 +00:00
Couriersud
b8ae0cadbe i960 core switched to pointer state access 2008-11-09 21:51:12 +00:00
Couriersud
d6dedbdedf Converted i8x41 to use pointers for state access
Separated opcodes into i8x41ops.c
2008-11-09 20:38:33 +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
Roberto Zandona
70365a3886 i8x41: fixed missing space at the end of file 2008-11-09 06:23:36 +00:00
Couriersud
a65a044779 UPI-41/42 (still I8x41.c) changes:
* cpu/i8x41 should be renamed to UPI-4x, since UPI-41/42 was an intel chip family
  postponed for now until core moved to pointers.
* removed I8041 definition from mcs48
* removed I8x41 cpu definition and config struct
* added I8041, I8741, I8042, I8242 and I8742 cpus to i8x41.c
* added internal memory maps
* internal ram now uses DATA memory space
* updated drivers
* increased interleave to 70 in decocass. This fixes decocass hanging in countdown around 13
  No idea when this bug was introduced.
2008-11-09 02:09:40 +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
Andrew Gardner
e8ec5637ac Rewrite of the Motorola DSP56k CPU core. (Andrew Gardner, PhilB, RBelmont)
* Added proper clock speed to plygonet.c and internal divider to dsp56k.c
* Fixed up disassembler add/sub, 05xx, and bsr ops.
* Handle mysterious uuuuF instruction found in plygonet add op.
* Partially implemented add, sub, mac, mpy, inc, cmpm, macr, asr16, jscc, lea, and movec ops.
* Added dual X memory read and data move with short displacement parallel moves.
2008-11-08 07:18:03 +00:00
Couriersud
eed3bdac15 Merged DS5002FP into MCS51
* Merged DS5002FP
* Disassembler now uses type specific memory names
* Merged DS5002FP disasm
* added 83C751 memory names to disassembler
* delete DS5002FP specific files
* removed unnecessary cpu callback in wrally
* DATA_MAP ==> IO_MAP in wrally
2008-11-07 22:44:14 +00:00
Aaron Giles
e1aca15f22 More 68000 cleanup. 2008-11-07 14:46:20 +00:00
Aaron Giles
127f85b517 Fixed 68020+ 2008-11-07 14:30:45 +00:00
Aaron Giles
c9d4c8dad4 Minor fixes. 2008-11-07 06:17:58 +00:00
Couriersud
e6b9dd6ef7 Fix a reg-ex replace issue - Thx Andrew Gardner! 2008-11-07 00:37:41 +00:00
Couriersud
e4550f0b66 "Pointer"-ified the 6502
* a perfect candidate for a code merge. Replication all over the place.
2008-11-07 00:07:57 +00:00
davidhay
42c486632b i386 seems to already be defined by the compiler? changed to _i386 2008-11-06 22:59:43 +00:00
Couriersud
bc35b2d9e9 Some more gcc 64bit tranquilizers 2008-11-06 22:53:42 +00:00
Couriersud
552fc58ce5 Fix 64 bit compile
* Aaron, please review my change.
2008-11-06 20:44:41 +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
1228d0ad9e Fixed a few issues caught by an MSVC compile (why doesn't gcc complain??) 2008-11-06 15:44:58 +00:00
Aaron Giles
bf2501e3b7 Removed a bunch of useless macros. Consolidated several others.
Standardized on MAME types. Defined uint/sint to be 32-bits
rather than all this target platform guessing about how many
bits are in an int.
2008-11-06 10:38:54 +00:00
Aaron Giles
67db279bb2 Fixed compilation issues with 68000 changes.
Began the process of pruning options from the 68000 core, hard-coding it
for MAME's needs. We've hacked on it sufficiently that it is no longer
generic, so this is a good opportunity to simplify the code so that it
can actually be followed.
2008-11-06 10:17:31 +00:00
Aaron Giles
31ae2af798 "Pointer"-ified the 68000. What a mess!
There are a few remaining globals; we'll get them later.
2008-11-06 09:32:27 +00:00
Aaron Giles
2e8af3ea7e "Pointer"-ified the ADSP-21xx core. 2008-11-06 07:01:14 +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
Couriersud
82c3ffc153 "Pointer-ified" the mcs51 core 2008-11-05 00:10:21 +00:00
Couriersud
94e16603c5 "Pointer-ified" the mcs48 core 2008-11-04 23:19:16 +00:00
Aaron Giles
62d7168295 Pointer-ified the R3000 core. 2008-11-04 15:24:49 +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
Couriersud
bf4bfe8b86 Removed some printf debugging and added some more DS5002FP code 2008-11-03 23:08:38 +00:00
Aaron Giles
ffc97bd35d Cleanups and version bump. 2008-11-02 03:11:19 +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
d08215d8ee [Pugsy]
There's an issue with the debugger handling of the 6502 instructions as
there's a mismatch between the core and what the debugger shows.
The changes are detailed in the spreadsheets that I've attached that
compares the core to the dasm.


Attachments:

m6502fix.zip contains the diff file
6502 debugger disassembly changes.zip   contains an excel spreadsheet
(in both xls and xml formats) detailing the reasons/changes.
2008-11-02 02:38:50 +00:00
Couriersud
10b85f1efe More changes to timer 0 split mode 3 and how timer 1 operates than
* Quotes from the documentation added to the source as well
* Started DS5002FP integration
2008-10-31 22:49:33 +00:00
Andrew Gardner
c33d3a4f52 Rewrite of the Motorola DSP56k CPU core. (Andrew Gardner)
* Partially implemented move, asr4, and mpy ops.
2008-10-30 05:21:45 +00:00
Couriersud
7dd6c89221 Finally move cpu/i8051 to cpu/mcs51, rename files and some constants 2008-10-29 23:41:31 +00:00
Couriersud
e60a8d7bfe Fixed INT0 & INT1 interrupt line handling 2008-10-29 21:58:19 +00:00
Couriersud
a9afec7df4 More NEC V30 changes
* improved prefetch timing calculation
* prefetch timing now also used by V20 and V33
* moved some static variables into cpu context
* nec_reset now explicitly clears context variables
* all cpus now share nec_execute
2008-10-29 21:52:51 +00:00
Couriersud
ed56a340c0 Prefetch timing
* currently only for V30
* necessary to get lohtb2 working - somebody virtually counted cycles here
2008-10-29 03:11:17 +00:00
Couriersud
0a82f62644 Removed another speed hack and renamed "FETCH" to "FETCH()"
* Macros used as functions should look like functions
* Preparation for opcode prefetch timing
2008-10-29 01:22:59 +00:00
Andrew Gardner
5b5edd9eb9 Rewrite of the Motorola DSP56k CPU core. (Andrew Gardner)
* Partially implemented tfr op.
* Polygonet now allows test mode to be run for a few seconds.  Most IO is now known, though coin2 is still a mystery.
2008-10-28 14:44:07 +00:00
Andrew Gardner
db51d2ca3c Rewrite of the Motorola DSP56k CPU core. (Andrew Gardner)
* Partially implemented inc24, asl4, bcc, brkcc, and doForever ops.
* Added code for parallel address register update.
2008-10-27 03:53:23 +00:00
Couriersud
76182c3f9c MCS51 additions
* Implemented cmos features: powerdown & idle
* Added comments about special function registers on Philips 80C52
* cleaned up reset routines
2008-10-26 12:35:47 +00:00
Couriersud
9be049b4b2 According to Philips, 80C31 is a 80C52 family member with 128K internal ram and no rom 2008-10-24 21:53:09 +00:00
Couriersud
b1e8ff0a3e Implemented 80C52 interrupt handling
* mcs51 core now supports 4 interrupt levels depending on cpu type
2008-10-24 21:23:41 +00:00
Couriersud
a4059f19ad Fixed split timer mode
* Credit: Jim Stolis
* No interrupts for timer 0 modes 0,1,2 while timer 1 in mode 3
2008-10-24 17:45:42 +00:00
Aaron Giles
7f39a3503c Cleanups and version bump. 2008-10-23 09:15:58 +00:00
Aaron Giles
410a99b10d From: Phill Harvey-Smith [mailto:afra@aurigae.demon.co.uk]
Sent: Fri 10/17/2008 11:45 AM
To: submit@mamedev.org
Subject: 65c02 core bugfix
Hi,

This patch fixes a subtle bug in the 65c02 emulation where the result of
the BIT instruction  differs on the 65c02 (from the 6502), when executed
in immediate mode.

Cheers,

Phill.
2008-10-23 08:47:52 +00:00
Aaron Giles
c97fe8b6bb 01722: sokonuke: Game hangs after you choose stage 2008-10-23 08:44:21 +00:00
Andrew Gardner
40a5d0c543 Rewrite of the Motorola DSP56k CPU core. (Andrew Gardner)
* Implemented tst, or, jsr, rti, tst2, and 2 new movec ops.
* Added opbase handler to plygonet.c
2008-10-22 04:15:30 +00:00
Phil Bennett
40520a87cd Fix MT 02140: "cube quest crashes mame when saving state" 2008-10-21 20:42:56 +00:00
Couriersud
8eecd6745c More mcs51 updates
* Remaining games checked and adapted to changes in cpu core 
 * Cardline still broken. I need the exact and complete cpu name.
 * Added more variants 803X, 80CXX, AT89C4051
 * Fix segas18.c (segaic16.c) mcu maps. 
 * Fix sslam.c 
 * Fix limenko.c videopkr.c : Issue with core allocation of ram (duplicate savestate)
2008-10-20 23:42:09 +00:00
Couriersud
3b0ee27f97 mcs51/i8051 - please credit Jim Stolis as well
* fix timer 2 interrupts
* implement serial mode 2/3 rx and tx clock handling
2008-10-20 19:23:58 +00:00
Couriersud
a7da02e00e MCS51/I8051 overhaul, micro3d improvements and full m72 protection emulation for lohtb2
* improved serial port timing (f15se (micro3d.c) sound board now works)
 * better infrastructure for adding more variants like DS5002
 * Fixed port reading
 * Rewrote Macros for better readibility
 * Fixed and rewrote Interrupt handling
 * Now returns INTERNAL_DIVIDER, adjusted cycle counts
 * Remove unnecessary and duplicated code
 * Remove unnecessary functions
 * Rewrite to have sfr-registers stored in int_ram. 
 * Debugger may now watch sfr-registers as well.
 * implemented interrupt callbacks (HOLD_LINE now supported)
 * Runtime switch for processor type - remove ifdefs
 * internal memory maps for internal rom versions (internal ram now displayed in debugger)
 * more timer cleanups from manual
 
micro3d:
 * serial port communication between main cpu and sound board works
 * sound board now works
 
m72 - lohtb2:
 * full emulation of protection device
 * Samples are now piped through the mcu
2008-10-19 22:06:47 +00:00
Andrew Gardner
9014e91a62 Rewrite of the Motorola DSP56k CPU core. (Andrew Gardner)
* Added additional branch, move and bitfield ops.
* Plygonet now passes its memory test and uploads a new program.


[[Next step is to install an opbase handler and let the dsp56k run further into its new proggie.]]
2008-10-19 17:14:14 +00:00
Andrew Gardner
e138837002 Rewrite of the Motorola DSP56k CPU core. (Andrew Gardner)
* Complete rewrite focusing on legibility and extensibility.
* 27/121 opcodes (mostly) implemented.
* Bugfix for reset status of interrupt priority bits.
* Bugfix for disassembly of register-to-register parallel data move.


[[These changes bring the driver up to the point where the plygonet hardware begins banking memory.  The behavior is understood, so I should have the driver back to where it was before the rewrite soon.  Then real progress can be made.]]
2008-10-18 18:10:59 +00:00
davidhay
090ab6fe44 Removed per-game hacks from CPS3 (moved to DMA callback in SH2 core)
(also added a to-check note, 16-bit wide DMA is currently using 32-bit functions, is this correct?)

Removed Speedups from CPS3 / PsikyoSH, while they do still give a decent speed boost they're not really needed with the DRC and just clutter the code.
2008-10-18 14:44:20 +00:00
Aaron Giles
0fddfa1a44 Cleanups and version bump. 2008-10-13 08:38:32 +00:00
R. Belmont
864820d8ad Fix Mantis #02211
PsikyoSH: hook up VBL IRQ ack
SH2: fix DRC's handling of internally generated IRQs
SH2: fix compiling in interpreter mode
2008-10-12 00:05:13 +00:00
Aaron Giles
d3ab17e0e3 Cleanups and version bump. 2008-10-09 15:29:22 +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
Couriersud
7494be5525 Removed speed hack - this would break the protection for lohtb2 2008-10-07 23:07:09 +00:00
Roberto Fresca
c6ec8026bc Fixed the i8051 AJMP opcode to take 2 bytes instead of 3.
Please also credit Grull Osgo.
2008-10-06 21:57:27 +00:00
Roberto Fresca
d3cc1b9742 Fixed timers in i8051 core. [Grull Osgo] 2008-10-06 21:36:30 +00:00
Aaron Giles
5123b07115 Cleanups and version bump. 2008-10-02 05:34:21 +00:00
Aaron Giles
cf63e2baa8 Fixed handling of interrupts when the CPU was in the STOP state. 2008-10-02 05:31:24 +00:00
Aaron Giles
adaaf55595 From: Matt Ownby [mailto:matt.ownby@gmail.com]
Sent: Fri 9/26/2008 10:15 AM
To: submit@mamedev.org
Cc: Philip Bennett
Subject: fix for Cube Quest Line CPU emulation
I found a bug in the emulation of the Cube Quest Line CPU.

Proof of bug:
After looking at .diff,
Assume 'ci' is 1, and assume 'r' and 's' are both 0xFFF 
(0xFFF equals -1, as these numbers are 12-bit signed).
The result should be mathematically equivalent to -1 - (-1) 
which is 0.
~0xFFF is 0xF000, so you'd have 0xF000 + 0x0FFF + 1 which equals 
0x10000 but since 'res' is 16-bits this is truncated to 0x0.  
'C' then becomes 0 and 'V' becomes 1 (as I recall).  The result of 
0 is correct, but the flags are wrong; V should be 0 and C should 
be 1.

Under my proposed fix, you'd have 0x000 + 0x0FFF + 1, which equals 
0x1000, so the lower 12 bits are 0 (correct) and C is 1 and V is 0 
(correct).

I discovered this bug while disassembling the line CPU's ROM.
2008-10-02 05:04:06 +00:00
Aaron Giles
ce465cb509 Changed 68000 interrupts to only trigger during execution. This
means that multiple changes without any execution will be seen as
atomic. It also means that PULSE_LINE no longer works for signalling
IRQs.

Added checks in the debug build to catch people who try to use
PULSE_LINE for non-NMI and non-RESET input lines on CPUs that no
longer support direct interrupt generation. Over time expect this
list to increase.
2008-10-01 17:09:11 +00:00
Andrew Gardner
8515504a7b Added additional Motorola DSP56k reset behavior. (Andrew Gardner) 2008-10-01 04:24:46 +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
229d598989 Cleanups and version bump. 2008-09-26 13:42:51 +00:00
Aaron Giles
3d65b57f77 From: Micko [mailto:mmicko@gmail.com]
Sent: Tuesday, September 23, 2008 4:46 AM
To: Aaron Giles
Subject: 8080 bug

To fix this bug : http://mametesters.org/mantis/view.php?id=2322
 
a part of my code should be removed.
 
It seams that this feature I have added is only available on KP580BM80A (Russian clone of this processor).
 
So until I make a new patch (that support this clone processor)  please apply this to fix MAME drivers.
 
Thanks,
Miodrag
2008-09-26 05:27:00 +00:00
Aaron Giles
0f3e79564d From: Atari Ace [mailto:atari_ace@verizon.net]
Sent: Sunday, September 21, 2008 10:45 AM
To: submit@mamedev.org
Cc: atariace@hotmail.com
Subject: [patch] More static qualifiers

Hi mamedev,

Another static function update from yours truly, almost entirely
affecting code added in the last few months to MAME.  The fixes are
the usual lot, changing enum definitions so they aren't declared,
decorating dead code/declarations with #if...#endif, and of course,
adding static where appropriate.  In addition, I fixed a bunch of
UNUSED_FUNCTON symbols to be spelled correctly (I didn't introduce
this).

~aa
2008-09-26 05:25:11 +00:00
Aaron Giles
fad77cb08e Fixed AF calculation in mcs48. 2008-09-24 15:54:13 +00:00
R. Belmont
8e3cd1573d 65816/377xx: fix disassembly of BRL [ShimaPong] 2008-09-24 03:25:11 +00:00
Andrew Gardner
49c8293fd9 Rewrite of the Motorola DSP56k disassembler. (Andrew Gardner)
(Same changelog as before - found another couple - not worth adding to whatsnew)
2008-09-19 02:49:18 +00:00
Andrew Gardner
66954044d1 Rewrite of the Motorola DSP56k disassembler. (Andrew Gardner)
* Fixes branch relative offset decoding.
2008-09-19 02:28:20 +00:00
Andrew Gardner
e5efb8a895 Rewrite of the Motorola DSP56k disassembler. (Andrew Gardner)
* Removes arbitrary opcode groupings in favor of flat decode model.
* Fixes a number of small issues with unknown opcodes.
* Added the final ALU parallel move ops.
2008-09-19 02:07:52 +00:00
Aaron Giles
1eb3c2d964 Changed requirements for laserdisc CHDs to require a new chunk of
metadata with pre-decoded frame information. Modified chdman to
automatically produce this for CHDs that are of the appropriate
parameters. To fix up existing CHDs, use chdman -fixavdata on the
CHD.

Modified the laserdisc core to leverage the pre-decoded frame
metadata, which is now required. This improves seek times when
searching and allows the player-specific emulation access to the
VBI data as soon as it would really be available. Changed update
callback timing to fire just before the first line of VBI data
would be read; at that point, the frame selection is assumed to
be committed. 

Converted PR-8210 emulation over to using the actual MCU from the
laserdisc player. This MCU controls low-level functions such as
slider position and laser on/off, and receives decoded vertical
blanking data in order to make decisions. Removed old HLE behavior.
Note that the overlay text is displayed via the UI; this is
temporary and will be fixed shortly.

Converted Simutrek-hacked laserdisc emulation to using the actual
MCU from the game, which in turn hands off commands to the PR-8210
MCU. This is still not 100% but is pretty close at this point and
achieves the correct behaviors in most cases.

Fixed Cube Quest overlay scaling to cover the whole screen.

Changed laserdisc video parameters to position the screen area at
the bottom rather than the top, since this corresponds more closely
to standard line numbering.

Extended the vbiparse code to support pack/unpack, and to more
fully document all the meanings of the VBI codes.

Updated ldplayer to support slow/fast forward movement, frame/chapter
display, and separate controls for scanning/stepping.

Added new built-in variable "frame" to the debugger.

Fixed device-based ROM loading to support loading ROMs from the
game's ZIP as well.
2008-09-18 15:17:42 +00:00
Aaron Giles
3d1dbafcc2 From: Oliver Stoeneberg [mailto:oliverst@online.de]
Subject: Machine -> machine

This is a big patch adding running_machine* parameters and using 
"machine" where available.
2008-09-11 15:57:52 +00:00
Aaron Giles
b10a182054 From: Atari Ace [mailto:atari_ace@verizon.net]
Subject: [patch] Even more reset/multisession cleanup

Hi mamedev,

These two patches try to reduce the amount of variable in .data, which
usually point to multisession/reset bugs or missing const qualifiers.
The first patch just adds const to a number of items, moving them from
.data to .rdata.  The second patch sets other items to zero (moving
them to .bss), adding reset/init code where appropriate.

~aa
2008-09-11 15:14:39 +00:00
Aaron Giles
746ab44148 Hello,
Found few things not right in 8080/8085 implementation.
 
1. ANA/ANI instruction, HF flag was not set right because error in calculation of it (missing brackets)
2. 8080 have NF flag always set (it is not used flag but bit is always set)
3. On unused ports/not connected memory values from status word were readed not 00 or FF, that is why I add it as a new internal register, it can also be buffered by some external hardware, so this could help other implementations too.
 
Regards,
Miodrag Milanovic
2008-09-11 15:10:41 +00:00
Aaron Giles
2398d51941 Fixed memory handling of internal banks. They should be LOWER priority than
the driver's memory maps.

Reverted recent changes to MCS-48 core that were very hacky and which crashed
many games. You can now properly override the internal memory map and do
your own banking.

Also fixed 02204: masao: Memory bank error.
2008-09-11 14:33:52 +00:00
Aaron Giles
4c8f0225a7 Added missing include. 2008-09-04 16:52:36 +00:00
Aaron Giles
a4bca37f81 Cleanups and version bump. 2008-09-04 15:31:56 +00:00
Aaron Giles
05915406d0 Missing include. 2008-09-04 15:11:10 +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
Curt Coder
960126c596 [COP410] Enabled internal program map. 2008-09-01 19:37:46 +00:00
Aaron Giles
2c888574b1 Changed all MCS-48 chips to have a 12-bit address space, regardless
of internal ROM size.
2008-09-01 16:50:45 +00:00
R. Belmont
2db405979c [ARM7] Remove unnecessary hooks so MRC and MCR disassemble properly. 2008-08-31 20:30:29 +00:00
R. Belmont
ea2944f2a4 [M377xx] - Fixed: 8-bit I/O port reads no longer cause bogus reads of neighboring ports. 2008-08-31 20:29:08 +00:00
Couriersud
287bc79dfc mcs48.c: Use banking to handle ea line.
* Adds MCS48_INTERNAL_ROMBANK define to header
* Drivers which need to control the ea line have to initialize banking for internal/external rom

This is not yet optimal but works as expected with existing drivers and modified mario.c
2008-08-30 17:59:06 +00:00
Couriersud
7d6a80c480 mcs48: EA line / MB8884
* MB8884 is a I8035 ==> 12 addr, no internal rom map
* EA line high: external access - this is "default"

The whole EA implementation is as Aaron named it, cheeky. EA=1 external rom access, EA=0 internal rom access.
But all variants are treated the same, i.e. for i8035, MB8884, I8039, the external rom is used in the same
way as the internal.
2008-08-30 00:36:56 +00:00
Couriersud
299fc7ec1a mcs48.c: Write p1 and p2 on reset
These ports are actually ports which sink current on logical 0. With a logical 1, they are in high impedance mode and may be read. The high impedance is treated as logical 1 by TTL gates connected to them.
2008-08-29 22:52:26 +00:00
Aaron Giles
c3f7d110df 02174: dkongjr and clones + mario and clones + pestplce: Music speed regression 2008-08-29 06:01:09 +00:00
Aaron Giles
a2caa558e2 Cleanups and version bump. 2008-08-28 15:26:11 +00:00
Aaron Giles
f8f9678387 From: Atari Ace [mailto:atari_ace@verizon.net]
Sent: Monday, August 25, 2008 8:16 AM
Subject: [patch] Remove useless backslashes

Hi mamedev,

I've been using pmd 4.2.2 to analyze the MAME codebase for duplicate
code, and it's C parser complains about useless backslashes and
dangling defines in #if...#endif sections.  Here's a patch that fixes
this, and additionally fixes one real bug, a string in djmain.c was
malformed, it's curious it compiled.

~aa
2008-08-28 08:50:34 +00:00
Aaron Giles
951ab24aaa From: Christophe Jaillet [mailto:christophe.jaillet@wanadoo.fr]
Subject: Profiler related #2 (v2)
Hi, this a revised version of a patch I sent yesterday.

This one is much more cleaner, and the speed improvement is now significant
enough to come out of the profiling noise.
More over, this one compiles correctly... ;-)

Best regards,
Christophe Jaillet
2008-08-28 08:41:56 +00:00
Aaron Giles
c71fbfc625 Changed slider controls into a menu. For now, removed the old direct access
mechanism; instead, you must access the sliders via the main menu. While in
the menu, you can use the ~ key to turn off the menu display and leave only
the bar display, in order to see more of the screen.
2008-08-28 08:25:06 +00:00
R. Belmont
dae4b631d7 SH4, Naomi, and Hikaru updates [Samuele Zannoli]
- Fixed SH-4 core to support multiple SH-4s
- Fixed LDCSR instruction
- Fixed SH-4 I/O ports
- Skeleton Hikaru driver with memory maps and both SH-4s
- Fixed JVS/Maple translation so Naomi 2 BIOS runs
2008-08-27 02:22:58 +00:00
Aaron Giles
cd299d9f8e Significant cleanup/rewrite of the MCS-48 CPU core:
* removed redundant and unused definitions from header file
 * renamed constants and functions to be MCS48* prefixed
 * re-verified all opcode behaviors and timing
 * changed illegal opcodes to count 1 cycle to avoid infinite loops
 * changed EA behavior so that it is a push from the driver instead of a pull on each opcode fetch 
    (this may change further in the future). 
 * reimplemented IRQ generation and timer behavior according to documentation
 * updated all drivers accordingly
 * fixed several uses of PULSE_LINE, which no longer works
2008-08-26 22:58:45 +00:00
Aaron Giles
ba60161f97 i8039 -> mcs48 2008-08-26 04:38:50 +00:00
Roberto Zandona
58be08f089 fix TSY instruction in M4510 cpu (used in MESS) 2008-08-25 19:32:46 +00:00
Aaron Giles
3d339e51f7 Changed i8039 core to use the data address space for internal RAM.
Register access is still performed using direct memory accesses,
but the pointers are fetched through the memory system. Now you can
see i8039 RAM in the debugger. Added internal memory maps of the
appropriate size so that drivers don't need to declare this RAM.

Added a number of variants from the MCS-48 family as it was not
clear which variants had what capabilities. All documented variants
now have internal memory maps for internal ROM and RAM. Removed
memory maps from drivers using embedded ROM/EPROM/OTPROM since
they are defined by the core now.

Added some initial logic to boot and run the PR-8210 ROM (i8049)
in ldplayer.c. Currently this is disabled behind a compile-time
switch. Once this is working, the plan is to incorporate this into
the existing PR-8210 emulation, but we're not there yet.
2008-08-25 15:32:14 +00:00
Roberto Zandona
65a96e4f7a some fix for m4510 core 2008-08-24 11:55:22 +00:00
Roberto Zandona
bfc0c6a5b2 some fix for m4510 core:
- banking in read and write operations
- jsr and jsrx instruction
2008-08-23 10:00:59 +00:00
Nicola Salmoria
12269d8aa7 added 8303 ROM to the games using it and updated MCU simulation to match the new findings 2008-08-20 12:00:14 +00:00
Aaron Giles
0941eb004e Fix m68k irq line support.
Before this patch a:
      cpunum_set_input_line(5, ASSERT_LINE);
      cpunum_set_input_line(3, ASSERT_LINE);
      cpunum_set_input_line(3, CLEAR_LINE);
    
    loses the state of line 5.  This patch fixes it by adding an explicit
    but optional "virtual irq line" support to the 68k interface.

    Fix m68k interrupt handling by some drivers.
    
    Clearing the NMI line to clear all the IRQ lines worked, but it just
    doesn't make sense.  Now that the irq lines are really independant,
    the handling can be simplified.
2008-08-20 02:11:14 +00:00
Aaron Giles
0523e9feb7 Cleanups and version bump. 2008-08-19 07:31:55 +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
Aaron Giles
2e422e5b72 Final SHA1 for Cube Quest. 2008-08-19 02:13:32 +00:00
smf-
e334a63782 reverted unit mask changes and removed the unused & unsafe memory_install functions. 2008-08-18 12:08:08 +00:00
Aaron Giles
284b5a0d95 Added new generic laserdisc VIDEO_UPDATE handler to the laserdisc code.
This handler works for both disc-only games and those with overlays. 
For disc-only games, the base macro is sufficient. For games with 
overlays, an additional set of configuration macros are provided:

   MDRV_LASERDISC_OVERLAY - specifies update function, width, height,
      and bitmap format of the overlay
   MDRV_LASERDISC_OVERLAY_CLIP - specifies the visible area of the
      overlay bitmap
   MDRV_LASERDISC_OVERLAY_POSITION - specifies default x,y position
   MDRV_LASERDISC_OVERLAY_SCALE - specifies default x,y scale factors

The update function provided to MDRV_LASERDISC_OVERLAY is identical to
a normal VIDEO_UPDATE callback, so a standard one can be used. All
existing laserdisc drivers have been updated to support this new
rendering mechanism, removing much duplicated code.

Added the ability to configure the overlay position and scale 
parameters at runtime. Added OSD menus to control them. Added logic
to save/restore the data in the game's configuration file.

Added new macros MDRV_LASERDISC_SCREEN_ADD_NTSC and _PAL, which
defines a standard screen with the correct video timing characteristics
and update function for laserdiscs. Updated all drivers to use these
macros instead of defining their own screens.

Added DISK_REGIONS to all laserdisc drivers.

Added DISK_IMAGE_READONLY_OPTIONAL to support games (like Cube Quest)
where the disk is non-essential to the game's operation.

Fixed bug in identifying the custom sound driver for the laserdisc.

Updated ldverify to identify blank regions of the disc for post-
processing.

Fixed rendering 16bpp with alpha using bilinear filters (fixes
screenshots of laserdisc games with overlays).

Included support for parsing .gdi files in chdman. [ElSemi]

Added new driver for Cube Quest. This includes CPU cores for the three
bitslice processors, as well as laserdisc support for the hacked
laserdisc that was used to drive the games. 
[Philip Bennett, Joe Magiera, Warren Ondras]

Note that the SHA1/MD5 for the laserdisc will likely undergo at least
one more change before being finalized.
2008-08-18 04:31:08 +00:00
Roberto Zandona
0a0a3ef383 fixed INT_ACK initialization 2008-08-17 17:24:55 +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
R. Belmont
f118954dc5 Split out SH-4 non-interpreter-specific stuff to sh4comn.c. 2008-08-17 04:44:02 +00:00
R. Belmont
a6210713da SH-2 DRC updates:
- Moved IRQ handling front-end into recompiled code
- Added TSTM/ANDM/XORM instructions
- Added SH-1 CPU support, including lower precision on MAC.W and locking out SH-2 only instructions
2008-08-16 16:50:41 +00:00
R. Belmont
9c671d6ecf 64-bit GCC fix. 2008-08-16 16:47:03 +00:00
R. Belmont
d8a88c5084 Added save states to 65816 CPU. 2008-08-16 16:46:24 +00:00
R. Belmont
4303262b04 Another 64-bit GCC fix. 2008-08-14 13:14:46 +00:00
R. Belmont
06c0d541ed Another one... 2008-08-14 13:13:40 +00:00
Aaron Giles
2ec0fea9c2 From: Atari Ace [mailto:atari_ace@verizon.net]
Subject: [patch] Collapse timer callbacks

Hi mamedev,

The following patch collapses timer callbacks in some cases to avoid
duplicating code.  In the case of crystal.c, it also refactors two DMA
handlers and shuffles the init/reset code around a bit.  I noticed
while doing this that h8_itu_read8 is missing cases 0x96,0x97 which is
almost certainly a bug, but I left it alone.

~aa
2008-08-14 06:27:52 +00:00
Aaron Giles
0921968934 From: Atari Ace [mailto:atari_ace@verizon.net]
Subject: [patch] Fix i386 bsr implementation

Hi mamedev,

The i386 cpu emulator will return the wrong result for bsr when the
highest bit is set (0 instead of 15 or 31).  The attached patch fixes
this.

~aa
2008-08-14 06:21:31 +00:00
Aaron Giles
51c1079953 From: Atari Ace [mailto:atari_ace@verizon.net]
Subject: [patch] Fix 1802 cybrcomm, raveracw, raveracj, raveraja,
ridgerac, ridgerab, ridgeraj, acedrvrw, victlapw: No sound in games
after reloading via the MAME UI

Hi mamedev,

The problem with namcos22 games losing sound when running multisession
is actually an m37710 cpu initialization bug.  The attached patch
fixes it, and also collapses all the timer callbacks together as an
unrelated code cleanup.

Note: namcos22 has a lot of uninitialized state, so I wouldn't be
surprised if there are other multisession issues.
2008-08-14 06:13:56 +00:00
R. Belmont
04239409b0 SH2DRC: Allow delay slot of a BSR to trash the PR if it wants. (Manis 2059) 2008-08-13 03:58:02 +00:00
Derrick Renaud
1daf41e218 Final CPU header updates. Mostly just re-naming the re-inclusions.
The structures/names were getting too complex for my macros to handle.  They would require hand editing and my computer is too slow to keep re-compiling.

Passes a clean compile.
2008-08-13 02:48:52 +00:00
Nicola Salmoria
82494e9da3 updated Alpha 8302 MCU simulation to match newly dumped internal ROM.
Added the ROM to Champion Baseball 2.
2008-08-12 14:50:34 +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
Derrick Renaud
3c2b00d332 structure, lower-casing functions and re-inclusion updates of the src\emu\cpu headers up to I.
It's mostly just re-inclusion renaming, but there are few other re-nameings.
2008-08-11 03:06:59 +00:00
Aaron Giles
b40a4f5531 Cleanups and version bump. 2008-08-07 16:02:05 +00:00
R. Belmont
661aae28dc Changes to avoid collisions with system globals on OpenSolaris. (qmc2) 2008-08-06 03:25:58 +00:00
Wilbert Pol
1c0a7fce3a Fix compile errors. 2008-08-04 15:41:01 +00:00
Andrew Gardner
d20e6b6151 Improved Dsp56k CPU interrupt handling. Polygonet Commanders now advances past its first dsp handshake. 2008-08-04 04:07:29 +00:00
Couriersud
82eff3f75c Revert accidentially commited changes. Sorry! 2008-08-03 19:02:28 +00:00
Couriersud
54da9f29bd 8257dma and z80dma devices now require device callback handlers instead of machine handlers.
Updated affected drivers accordingly.
2008-08-03 18:54:39 +00:00
Aaron Giles
57bd1856b5 Cleanups/version bump. 2008-07-31 09:00:13 +00:00
Aaron Giles
e8f2759a0c (From Atari Ace. Note that I only took the first patch, which applied
to whole functions. The other one I'm not so sure about. Commented
code is usually hilighted differently, making it very easy to spot.)

Hi mamedev,

This set of patches has one aim only, to identify chunks of code that
have been disabled by the use of C/C++ comments, and to disable them
instead by using the preprocessor.  The C comment approach to
disabling code isn't safe (embedded comments will trip it up), and the
C++ comment approach isn't elegant (you shouldn't need to touch every
line to disable a chunk of code).  Using #if...#endif is preferable
always, excepting perhaps if (0) { ... }.

The patch has three parts.  The first only handles cases where full
functions were disabled.  The second handles cases where parts of
functions were disabled.  The third then tries to restore the
whitespace that the use of comments converted from tabs to spaces via
srcclean.exe.  It also cleans up the whitespace in a handful of the
files in areas outside of the original two patches.

~aa
2008-07-31 08:30:22 +00:00
Aaron Giles
e0409bc7b1 From: Oliver Stoeneberg [mailto:oliverst@online.de]
Subject: a few cleanups

This patch contains:
- removal of unprintable chars (newlines) in SH-2 disassembler (I 
submitted this in the past nd it wasn't included)
- a few unnecessary checks after malloc_ort_die() calls
- changes two romload.c warnings to use GAMENOUN instead
- adds "deprecat.h" in a  few src/mame/drivers files (would be 
necessary, if the debugger.h one would be removed)
- cleans up the mame.mak by adding all missing defines and grouping 
them based on cpu.mak
- renamed video_exit() to winvideo_exit() for consistency in function 
names
2008-07-31 08:26:39 +00:00
Aaron Giles
5a17b8a274 Changed symbol table reference parameters to void * from UINT32. 2008-07-31 00:19:30 +00:00
Aaron Giles
975eccb12c Simplified shift/rotate instruction implementations.
The ROL/ROR/SHL/SHR opcodes provide the carry flags typically generated by
almost all CPUs. The RORC/ROLC opcdes map directly to the rotate through 
carry of most CPUs as well.
2008-07-30 14:49:40 +00:00
Wilbert Pol
c67737a40c i8051 cpu core timer updates:
- Added support for timer mode 0 (13 bit timer)
- Cleaned up timer code a bit, fixing some off-by-one errors when timers overflow.
2008-07-29 18:29:01 +00:00
Aaron Giles
25e1504511 Oops, should have been using SETc versus GETFLGS in this case. 2008-07-29 05:52:05 +00:00
Aaron Giles
962daf6607 Implemented ADDV/SUBV with flags. Kept C versions behind a compile-time define
for comparison.
2008-07-29 05:16:02 +00:00
R. Belmont
76d5ed12a3 SH2DRC: add SUBV, replace ADDV with C version as a precaution. (Fixes most of Mantis #2026, except the part which is a separate bug). 2008-07-28 23:12:47 +00:00
Aaron Giles
4a6fc8d5e5 Region classes go bye-bye. 2008-07-28 16:22:20 +00:00
Aaron Giles
27fed1ec97 Changed the way memory regions are referenced. Instead of a single
integer value, regions are now referred to by a region class and
a region tag. The class specifies the type of region (one of CPU,
gfx, sound, user, disk, prom, pld) while the tag uniquely specifies
the region. This change required updating all the ROM region
definitions in the project to specify the class/tag instead of
region number.

Updated the core memory_region_* functions to accept a class/tag
pair. Added new memory_region_next() function to allow for iteration
over all memory regions of a given class. Added new function
memory_region_class_name() to return the name for a given CPU
memory region class.

Changed the auto-binding behavior of CPU regions. Previously, the
first CPU would auto-bind to REGION_CPU1 (that is, any ROM references
would automatically assume that they lived in the corresponding
region). Now, each CPU automatically binds to the RGNCLASS_CPU region
with the same tag as the CPU itself. This behavior required ensuring
that all previous REGION_CPU* regions were changed to RGNCLASS_CPU
with the same tag as the CPU.

Introduced a new auto-binding mechanism for sound cores. This works
similarly to the CPU binding. Each sound core that requires a memory
region now auto-binds to the RGNCLASS_SOUND with the same tag as the
sound core. In almost all cases, this allowed for the removal of the
explicit region item in the sound configuration, which in turn 
allowed for many sound configurations to removed altogether.

Updated the expression engine's memory reference behavior. A recent
update expanded the scope of memory references to allow for referencing
data in non-active CPU spaces, in memory regions, and in EEPROMs.
However, this previous update required an index, which is no longer
appropriate for regions and will become increasingly less appropriate
for CPUs over time. Instead, a new syntax is supported, of the form:
"[tag.][space]size@addr", where 'tag' is an optional tag for the CPU
or memory region you wish to access, followed by a period as a 
separator; 'space' is the memory address space or region class you
wish to access (p/d/i for program/data/I/O spaces; o for opcode space;
r for direct RAM; c/u/g/s for CPU/user/gfx/sound regions; e for 
EEPROMs); and 'size' is the usual b/w/d/q for byte/word/dword/qword.

Cleaned up ROM definition flags and removed some ugly hacks that had
existed previously. Expanded to support up to 256 BIOSes. Updated
ROM_COPY to support specifying class/tag for the source region.

Updated the address map AM_REGION macro to support specifying a
class/tag for the region.

Updated debugger windows to display the CPU and region tags where
appropriate.

Updated -listxml to output region class and tag for each ROM entry.
2008-07-28 09:35:36 +00:00
R. Belmont
1b81188229 SH2DRC: Add PC-relative load optimization and ability to disable if necessary [R. Belmont, based on an idea by Mariusz Wojcieszek] 2008-07-28 05:57:29 +00:00
Andrew Gardner
6e13a53ff7 DSP56156 CPU Core updates.
- Rewrote core logic, communications, and interfaces.
- Added three parallel memory moves to the disassembler.
- Initial interrupt logic in place.

Plygonet.c updates.
- All communication hacks have been removed.
- Memory maps have been temporarily reverted while new DSP56k cpu core catches up.
2008-07-28 01:19:21 +00:00
Aaron Giles
7a14f21c15 Cleanups and version bump. 2008-07-24 09:07:49 +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
9b63c42203 From: Atari Ace [mailto:atari_ace@verizon.net]
Subject: [patch] .data removals to fix reset/multisession bugs

Hi mamedev,

One nice artifact of properly constifying data structures in MAME is
that it makes it relatively easy to spot a class of reset/multisession
bugs, namely that almost any object in .data is probably in error.
Unless the value is properly initialized in a reset routine the
initial non-zero value can't be relied upon, so there's no need to
have a non-zero value to begin with.

With that in mind, here's a patch to move more items out of .data by
either applying const, removing the non-zero initializer (if its
overwritten by init/reset) or by adding appropriate initialization
code.  In most cases I tried to add initialization code to a reset
routine, but in some cases I chose an init routine, possibly leaving a
reset bug intact.

Some interesting bits:
1.  tms9900 core.  The use of .data to initialize the irq_level wasn't
correct in some cases as the layout of the structure was core
dependent.
2.  bfcobra.c.  By introducing a VIDEO_START routine a hack in
VIDEO_UPDATE could be removed.

~aa
2008-07-24 06:18:01 +00:00
Aaron Giles
8e7a1a2553 Added new functions attotime_to_ticks() and ticks_to_attotime() to
convert between attotimes and a clock tick at an integral frequency.

Changed the 6532 RIOT device into a proper device. Rewrote the
logic to be simpler and leverage the new attotime functions. Changed
the I/O port setters to specify a mask, and changed the I/O port
callbacks to pass in the previous value. Updated tourtabl and
gameplan drivers to use the new device interface.

Converted audio/starwars.c, audio/exidy.c, and audio/gottlieb.c to 
use the new RIOT implementation instead of rolling their own.

Began gottlieb.c cleanup. Converted palette calculations to resistor
weights. Corrected video timing. Reduced the number of separate
machine drivers. Fixed incorrect spriteram sizes. Populated full
memory maps for the main CPU and the rev 1 sound board. More to
come.
2008-07-24 03:49:19 +00:00
Andrew Gardner
6a3af45257 Dsp56156 Disassembler rewrite.
- Rearranged decoding behavior.
 - Updated code style to MAME standards.
 - Tested each single-word opcode with custom ROMs.


(This is a precursor to other major dsp56k changes I have made.  I just gotta' get plygonet commanders up and running to do some tests)
2008-07-19 16:09:10 +00:00
davidhay
cce1d8b88e TGP / Model 2 fixes [ElSemi]
- TGP now correctly uses table roms (model1/2 updated accordingly)
 - removed FIFO hack on srallyc (game now runs)
 - added analog ports reading for model 2A/B/C
 - fixed some loading instructions in the TGP. that fixes srallyc automatic transmission bug
2008-07-19 09:58:31 +00:00
Brian Troha
b3b2c01fe5 ElSemi's fix for the i960 issue:
well, the fix is not that but changing them this way:
 
 program_write_dword_32le(i960.r[I960_FP]-16, i960.PC);
 program_write_dword_32le(i960.r[I960_FP]-12, i960.AC);

in take_interrupt.
 
It seems it came from a partial fix in the ret instruction. the manual says that PC is saved at FP-16 and AC at FP-12
it was reversed in mame, so when trying to fix it, i suppose Ernesto forgot to change the push too.
 
I've tested this fix and apart from having daytona working, pilot kids 2A works too (that I think has been broken for ages).
2008-07-18 19:53:37 +00:00
Aaron Giles
5244807bf3 Cleanups. 2008-07-17 08:09:52 +00:00
Aaron Giles
b5f2aa1240 Changed direct access EEPROM interface to return the "bus width" of the
EEPROM data, and the size is in terms of units, not bytes. Updated all
drivers accordingly.

Changed the ROM loading code to actually alter the region flags based
on the CPU endianness and bus width when creating the region, rather
than fixing them up on the fly. This means that callers to
memory_region_flags() will get the correct results.

Changed the expression engine to use two callbacks for read/write rather
than relying on externally defined functions.

Expanded memory access support in the expression engine. Memory accesses
can now be specified as [space][num]<size>@<address>. 'space' can be
one of the following:

   p = program address space of CPU #num (default)
   d = data address space of CPU #num
   i = I/O address space of CPU #num
   o = opcode address space of CPU #num (R/W access to decrypted opcodes)
   r = direct RAM space of CPU #num (always allows writes, even for ROM)
   e = EEPROM index #num
   c = direct REGION_CPU#num access
   u = direct REGION_USER#num access
   g = direct REGION_GFX#num access
   s = direct REGION_SOUND#num access

The 'num' field is optional for p/d/i/o/r, where is defaults to the
current CPU, and for e, where it defaults to EEPROM #0. 'num' is required
for all region-related prefixes. Some examples:

   w@curpc = word at 'curpc' in the active CPU's program address space
   dd@0    = dword at 0x0 in the active CPU's data address space
   r2b@100 = byte at 0x100 from a RAM/ROM region in CPU #2's program space
   ew@7f   = word from EEPROM address 0x7f
   u2q@40  = qword from REGION_USER2, offset 0x40
   
The 'size' field is always required, and can be b/w/d/q for byte, word,
dword, and qword accesses.
2008-07-17 08:07:12 +00:00
R. Belmont
b859963772 SH2DRC: cleanups and tweeks from Aaron's suggestions. 2008-07-17 03:46:51 +00:00
R. Belmont
847b927e8d Fixed simple but deadly typo in previous update. 2008-07-15 16:44:25 +00:00
R. Belmont
837d59500a i960: respect the rounding mode for CVTRI [ElSemi] 2008-07-15 16:42:05 +00:00
R. Belmont
a0ae9b4bb6 SH-4 update [Samuele Zannoli]
- Fixed TRAPA and some versions of FMOV
- Improved disassembly for MOV.W, MOVA, MOV.L, FIPR, and FSCA.
2008-07-14 23:27:27 +00:00
Nicola Salmoria
89675377ca added save state suport to Konami CPU & Aliens 2008-07-14 14:56:20 +00:00
Aaron Giles
484efe776b Added an exit function to the SH2 drc so that it doesn't leak
memory like crazy.
2008-07-14 14:53:08 +00:00
R. Belmont
a18b3c3eeb [SH2DRC] Removed remnant of outdated interrupt design. 2008-07-14 01:55:02 +00:00
R. Belmont
1f9a29d7fa UDRC-based SH-2 dynamic recompiler.
- All games on all drivers should work as before except "colmns97" and "stress" which crash due to sound system trouble.
- All idle skips are still included.  They are quite a bit less effective than they were on the interpreter, but they still give a boost.
- Fast RAM bypass is not included yet so this does not represent final performance.  That said, it's consistently faster than the interpreter even now.  Example: sfiii3 on 0.126 gets 609% on the interpreter and 961% on the DRC.

Major thanks to Aaron for his assistance with several sticky core bugs and other issues encountered writing this.
2008-07-13 23:40:54 +00:00
Aaron Giles
c4e5ae4e41 Fixed edge case in the DRC front-end that would incorrectly tag the
end of a sequence as "return to start" even if the last instruction
did not abet the starting instruction.
2008-07-13 07:03:30 +00:00
Nathan Woods
697181c8cd Adding per-device and per-CPU validity checks 2008-07-06 15:02:12 +00:00
Aaron Giles
e376a53661 Cleanups and version bump. 2008-07-03 15:50:46 +00:00
Aaron Giles
b82b111e69 Lighter weight debugger optimization for ADSP2100. 2008-07-03 15:34:27 +00:00
Wilbert Pol
8b8ff45369 I80286: Fixed POP ES in protected mode. 2008-07-01 18:16:42 +00:00
Aaron Giles
fc9f7d2fa6 01942: All konamim2.c sets: hang
heatof11 gets to the color bars but only if you enable the debugger.
Not sure why.
2008-07-01 16:49:23 +00:00
Aaron Giles
fc20a0e0c3 Fixed sense of debugger flag in ADSP-2100 optimization. 2008-07-01 09:05:22 +00:00
Aaron Giles
32b803dad5 Fixed LWXC1/LDXC1; corrects gauntleg camera. 2008-07-01 08:09:23 +00:00
Aaron Giles
0773e2550d Fixed 64-bit writes in C back-end. 2008-07-01 07:38:42 +00:00
Aaron Giles
10bca54ab0 Fixed incorrect assumption in HASHJMP that the base table for a mode
will always be allocated when a fixed mode is first used.
2008-07-01 04:40:25 +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
df4f70a0a7 Split ADSP2100 execution loop between debug/non-debug. 2008-06-29 16:45:55 +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
66360324c1 Fixed 32031 so that it doesn't call the debugger if not enabled. 2008-06-28 21:04:16 +00:00
R. Belmont
7a3449f968 SH2: convert context struct to go through a pointer 2008-06-27 19:42:58 +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
R. Belmont
f6c3274df2 Refactor SH2 to separate out things that aren't part of the interpreter. 2008-06-27 05:33:54 +00:00
Aaron Giles
3d1376ed97 Cleanups/version bump. 2008-06-26 16:05:46 +00:00
Aaron Giles
652fc279ae From: Oliver Stoeneberg [mailto:oliverst@online.de]
Subject: another Machine -> machine cleanup
This cleans up most of the Machine stuff in src/emu/machine. There is
a bit left to clean up, but it's mostly stuck at some interfaces now.
2008-06-26 15:34:42 +00:00
Aaron Giles
ba2fb8554b From: Atari Ace [mailto:atari_ace@verizon.net]
Subject: [patch] make MSVC_BUILD=1 -j<n> build fix

Hi mamedev,

The following build tweak fixes make MSVC_BUILD=1 -j2.  It also fixes
an oversight in the cross-build support.

~aa
2008-06-26 15:27:12 +00:00
Aaron Giles
ea3780417a From: Atari Ace [mailto:atari_ace@verizon.net]
Subject: [patch] Fix minor CPU/SOUND core build issues

Hi mamedev,

This small patch fixes a few build problems with the cpu/sound cores
M65CE02, ALPHA8201, TMC0285, TMS5200 and corrects the dependencies for
the mips core.

~aa
2008-06-26 15:24:55 +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
davidhay
1ab9a6bd40 Promoted to Working
-------------------

Survival [nuapete]
2008-06-24 20:17:59 +00:00
Wilbert Pol
88e208dce0 Fixed typo in changelog 2008-06-24 20:03:08 +00:00
Wilbert Pol
9a76a3e65d i8x41 cpu core changes:
- Updated the ram sizes. 8041 uses 128 bytes, 8042
    8042 uses 256 bytes.
  - Added support for re-enabling interrupts inside
    an interrupt handler.
  - Fixed cycle count for DJNZ instruction.
2008-06-24 19:36:34 +00:00
Aaron Giles
870607fe7b 01886: gradius4: 3D gfx problem
Fixed LZCNT opcode in x86 and x64 back-ends
Added support for flags in LZCNT and BSWAP opcodes on x86 and x64 back-ends
2008-06-24 16:05:36 +00:00
Aaron Giles
2ac4c9da66 01901: kinst13, kinst14, kinstp: Attract mode graphics regression
Fixed DCMP opcode on the 32-bit back-end
2008-06-24 05:22:30 +00:00
Aaron Giles
2be66a245c Fixed WRITEM opcode on 64-bit to call through memory instead of directly. 2008-06-24 04:46:15 +00:00
Wilbert Pol
6f4b3add14 I8x41 cpu core fixes:
- Added configurable i8x41/i8x42 subtype support.
- Fixed carry flag handling in ADDC A,#N instruction.
- Fixed carry flag handling in RLC A instruction.
2008-06-23 18:52:12 +00:00
Wilbert Pol
f4f26cdd1a i8x41: Fixed disassembly for opcode 0x67. 2008-06-23 17:59:03 +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
57c35a0efc From: Atari Ace [mailto:atari_ace@verizon.net]
Subject: [patch] memory_region madness reloaded
Hi mamedev,

The memory_region and memory_region_length functions are probably the
two most common functions in MAME that don't take a machine parameter
but should given the syntax of the related apis memory_region_type and
memory_region_flags.  Clearly they didn't get the parameter because of
the sheer number of changes needed to change the apis.  This pair of
patches makes the change, and deals with the consequences.

The second patch then changes the api for memory_region and
memory_region_length, and fixes the fallout.  It generally plumbs
through machine parameters where needed, except for the case of sound
apis which I deferred doing so till later.  This increased the number
of deprecat.h includes by ~50.  Given it is a massive patch, there are
bound to be a few mistakes in it (I had to make ~20% of the changes by
hand), but I exercised care and reviewed the patch several times to
minimize the problems.
2008-06-23 08:32:42 +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
Wilbert Pol
a01d5624a3 Removed i8x41.ram hack from the i8x41 cpu core. 2008-06-22 20:21:51 +00:00
Couriersud
0bee46b0ac x86emit.h: Back out commit #2007 which accidentally commited this file as well 2008-06-22 11:44:26 +00:00
Couriersud
b85a4f86e5 Cleaned up z80dma interface - missing files from last commit)
* removed compatibility to old z80dma driver
* now uses std. callbacks (READ8_HANDLER, WRITE8_HANDLER)
* updated mario and dkong3 accordingly
2008-06-22 11:41:50 +00:00
Aaron Giles
8138105277 01916: srmvs: Assertion
Removed erroneous assertion.
2008-06-22 03:03:43 +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
8628f1dafe UML:
- reactivated back-end validation mechanism
 - added back-end validation for ADD/SUB/MUL/DIV/CMP forms
 - fixed several errors in dealing with more obscure flag combinations
2008-06-17 09:19:07 +00:00