- Updated all devices containing ROM regions to have short names and all modern devices too
- Created new validation to check existence of short name if device contain ROM region defined
are still intact. The new state_manager class has templatized methods
for saving the various types, and through template specialization can
save more complex system types cleanly (like bitmaps and attotimes).
Added new mechanism to detect proper state save types. This is much
more strict and there will likely be some games/devices that fatalerror
at startup until they are remedied. Spot checking has caught the more
common situations.
The new state_manager is embedded directly in the running_machine,
allowing objects to register state saving in their constructors now.
Added NAME() macro which is a generalization of FUNC() and can be
used to wrap variables that are registered when directly using the
new methods as opposed to the previous macros. For example:
machine->state().save_item(NAME(global_item))
Added methods in the device_t class that implicitly register state
against the current device, making for a cleaner interface.
Just a couple of required regexes for now:
state_save_register_postload( *)\(( *)([^,;]+), *
\3->state().register_postload\1\(\2
state_save_register_presave( *)\(( *)([^,;]+), *
\3->state().register_presave\1\(\2
No-whatsnew explanation: this takes OPTIMIZE=3 compile time for this core from
over 1 hour down to about 2 minutes on PS3 Linux. (Yes, the tms57002 itself
took over an hour to compile before - the thing has 256 MB of RAM and
a very slow HDD so when it hits swap, swap hits back).
timers into the scheduler. Retain TIMER devices as a separate wrapper
in timer.c/.h. Inline wrappers are currently provided for all timer
operations; a future update will bulk clean these up.
Rather than using macros which hide generation of a string-ified name
for callback functions, the new methods require passing both a function
pointer plus a name string. A new macro FUNC() can be used to output
both, and another macro MFUNC() can be used to output a stub-wrapped
class member as a callback.
Also added a time() method on the machine, so that machine->time() gives
the current emulated time. A wrapper for timer_get_time is currently
provided but will be bulk replaced in the future.
For this update, convert all classic timer_alloc, timer_set,
timer_pulse, and timer_call_after_resynch calls into method calls on
the scheduler.
For new device timers, added methods to the device_t class that make
creating and managing these much simpler. Modern devices were updated
to use these.
Here are the regexes used; some manual cleanup (compiler-caught) will
be needed since regex doesn't handle nested parentheses cleanly
1. Convert timer_call_after_resynch calls
timer_call_after_resynch( *)\(( *)([^,;]+), *([^,;]+), *([^,;]+), *([^);]+)\)
\3->scheduler().synchronize\1\(\2FUNC(\6), \5, \4\)
2. Clean up trailing 0, NULL parameters
(synchronize[^;]+), 0, NULL\)
\1)
3. Clean up trailing NULL parameters
(synchronize[^;]+), NULL\)
\1)
4. Clean up completely empty parameter lists
synchronize\(FUNC\(NULL\)\)
synchronize()
5. Convert timer_set calls
timer_set( *)\(( *)([^,;]+), *([^,;]+), *([^,;]+), *([^,;]+), *([^);]+)\)
\3->scheduler().timer_set\1\(\2\4, FUNC(\7), \6, \5\)
6. Clean up trailing 0, NULL parameters
(timer_set[^;]+), 0, NULL\)
\1)
7. Clean up trailing NULL parameters
(timer_set[^;]+), NULL\)
\1)
8. Convert timer_set calls
timer_pulse( *)\(( *)([^,;]+), *([^,;]+), *([^,;]+), *([^,;]+), *([^);]+)\)
\3->scheduler().timer_pulse\1\(\2\4, FUNC(\7), \6, \5\)
9. Clean up trailing 0, NULL parameters
(timer_pulse[^;]+), 0, NULL\)
\1)
10. Clean up trailing NULL parameters
(timer_pulse[^;]+), NULL\)
\1)
11. Convert timer_alloc calls
timer_alloc( *)\(( *)([^,;]+), *([^,;]+), *([^);]+)\)
\3->scheduler().timer_alloc\1\(\2FUNC(\4), \5\)
12. Clean up trailing NULL parameters
(timer_alloc[^;]+), NULL\)
\1)
13. Clean up trailing 0 parameters
(timer_alloc[^;]+), 0\)
\1)
14. Fix oddities introduced
\&m_machine->scheduler()
m_machine.scheduler()
global functions which are now superceded by the operators and
methods on the class. [Aaron Giles]
Required mappings are:
attotime_make(a,b) => attotime(a,b)
attotime_to_double(t) => t.as_double()
double_to_attotime(d) => attotime::from_double(d)
attotime_to_attoseconds(t) => t.as_attoseconds()
attotime_to_ticks(t,f) => t.as_ticks(f)
ticks_to_attotime(t,f) => attotime::from_ticks(t,f)
attotime_add(a,b) => a + b
attotime_add_attoseconds(a,b) => a + attotime(0, b)
attotime_sub(a,b) => a - b
attotime_sub_attoseconds(a,b) => a - attotime(0, b)
attotime_compare(a,b) == 0 => a == b
attotime_compare(a,b) != 0 => a != b
attotime_compare(a,b) < 0 => a < b
attotime_compare(a,b) <= 0 => a <= b
attotime_compare(a,b) > 0 => a > b
attotime_compare(a,b) >= 0 => a >= b
attotime_mul(a,f) => a * f
attotime_div(a,f) => a / f
attotime_min(a,b) => min(a,b)
attotime_max(a,b) => max(a,b)
attotime_is_never(t) => t.is_never()
attotime_string(t,p) => t.as_string(p)
In addition, some existing #defines still exist but will go away:
attotime_zero => attotime::zero
attotime_never => attotime::never
ATTOTIME_IN_SEC(s) => attotime::from_seconds(s)
ATTOTIME_IN_MSEC(m) => attotime::from_msec(m)
ATTOTIME_IN_USEC(u) => attotime::from_usec(u)
ATTOTIME_IN_NSEC(n) => attotime::from_nsec(n)
ATTOTIME_IN_HZ(h) => attotime::from_hz(h)
Also removed redundant m_machine from the state and execute
interfaces to fix ambiguity when using m_machine from within
a device that inherits from these.
Notes out of whatsnew.txt
* It's sure to have bugs, but it should get the job done for now.
* It's unbelievable how many typos (major or otherwise) docs like this have.
* I haven't heard from s_bastian about making the ROM images available in the
monkey project, but we'll have 'em up as soon as he pops up again.
* Does anyone know of any hardware that incorporated one of these? I'm looking
for things to disassemble in the meantime :).
Notes out of whatsnew.txt
* This uses modern devices, but has not been tested in a driver yet, so I may
have done something wrong. I will fix it when the time comes.
* 60% of the disassembler is complete. I will finish it over the next few days.
* There are many similarities in execution to the dsp32, and the existing 32 code
will come in handy when it's time to write the execution engine.
* This thing is a pleasure compared to the dsp56k.
- Now supports uPD7725 and uPD96050
- Hooked up SNES common code to use uPD96050 for ST-010/011
- Removed ST-010 HLE simulation
Non-whatsnew: ST-010 is also found in some ssv.c games so this will be
hooked up there soon.
Instructions:
- Enable SHOW_AARON_BUG and compile
- Run any Naomi game with -debug (e.g. toyfight)
- Step to the MOV.L at 00000018
- Thrill to an aligned 32-bit write causing 2 incorrect writes to a 32-bit handler, complete with wrong offset. The memory system appears to think the 32-bit handler is a 16-bit handler or something.
-Found a few more fixeight opcodes, by matching code in the interrupt routines with batsugun [Alex Jackson]
-Corrected fixeight V25 address map (the YM2151 and OKI6295 are at a different location than the other games) [Alex Jackson]
-Preliminary implementation of V25/V35 port output [Alex Jackson]
* immediates can be passed raw, no IMM() wrapper required (and it's gone now)
* fixed integer registers now use constants I0,I1,I2,etc instead of IREG(0),...
* same for float registers F0,F1,F2,etc instead of FREG(0)
* dynamic integer/float regs use inline functions ireg(),freg()
* MEM macro is now a lower-case inline function mem()
One further change on the horizon is to remove the UML_* macros in favor of
inlines.
Yes, it is intentional that the x86/x64 backends compile everywhere.
Backends are now derived from drcbe_interface and implement several
required overrides.
x86emit.h now uses namespaces so that the x86/x64 emitters can co-exist.
New file uml.h/uml.c actually describes the UML language, separating
out several concepts from drcuml.c.
Lots of other changes/fixes.
an empty entry, we re-dispatch to previously compiled code instead
of always recompiling the target. This greatly reduces the DRC
overhead on 603-based games.
frontend by deriving from drc_frontend and implementing the
describe method.
RB, if you send me your latest SH4 WIP, I'll convert it for you
if this makes you cranky. :)
- Added GAME_MECHANICAL flag to mark games having mechanical interface (such as pinball,redemption, bowling games ...)
- Imported games from PinMAME as skeletons
that manually XORed addresses to pass the XOR instead.
This improves behavior when direct accessors hit non-RAM regions, or
when watchpoints are used, because we now know the original, un-xored
address and can fall back to standard read/write handlers properly.
Also fixes glitched disassembly when read watchpoints are enabled.
- Enhanced MMU with page fault support
- Preliminary 26-bit mode support
- Fixed bugs with S-flag operations on R15
- Fixed STRH involving R15
- Support for ARM models 7500 and 920T.
---------- Forwarded message ----------
From: Alex Jackson <awj_in_japan@hotmail.com>
Date: Mon, Dec 20, 2010 at 3:37 AM
Subject: MT bug 04147 fix; trivial debugger fix
To: submit@mamedev.org
i86length.diff fixes MT bug 04147: raiden: crashes if you use -debug switch. My patch makes the i386 and nec disassemblers enforce the same maximum instruction length as CPUINFO_INT_MAX_INSTRUCTION_BYTES (previously the disassemblers always enforced a maximum length of 15 bytes, but the value of CPUINFO_INT_MAX_INSTRUCTION_BYTES varied between CPUs... this was my fault, sorry)
The maximum legal instruction length on the 80286 is 10 bytes, and on the 80386 and all later Intel and clone CPUs it's 15 bytes. Exceeding the limit causes an illegal instruction exception. Intel CPUs prior to the 80286, and NEC-V CPUs, don't enforce a maximum instruction length (they don't even have an "illegal instruction" exception), but the longest possible instruction without redundant prefixes is 8 bytes on both, so I've made that the maximum instruction length for disassembly purposes.
debugger.diff fixes a trivial bug in the debugger dump commands. 0x7f is not a printable character in either ASCII or UTF-8... so don't print it in the "ASCII" column when hex dumping.
--AWJ
Added a function to SH2 to allow the 32x to tell it when data is available to DMA, prevents excessive polling with high frequency timer in Chaotix, and improves performance in said game.
Haze: "I need to review save state support in the core again, a few extra things probably need saving now.
It might be possible to avoid the high frequency timer if it causes too many performance issues by moving the update of the DMA to the EXECUTE loop instead.
(I want to experiment with this before updating the save state support, however if somebody else wants to fix savestates in the meantime they're welcome,
as long as they don't get offended if their code gets changed...)"
create a stack class that started the profiler in the constructor
and stopped it in the destructor). Sadly, doing that causes gcc to
call out to hook up the unwind chain, and this tanks performance
quite badly, even when the profiler is off.
Since I had already class-ified profiler.c, I decided to keep the old
way of doing things but wrap it in the newer classes. So at least it
wasn't a complete waste of my time.
Search & replace:
profiler_mark_start -> g_profiler.start
profiler_mark_end -> g_profiler.end
address_space. Also added unaligned variants that can read
unaligned values. Rewrote the core handler as a template that
handles all cases, along with a simple unit test to verify that
everything is correct.
Updated 68k, v60, i86, and nec cores to use unaligned read/
write instead of their own stubs for handling misalinged reads.
Fixed memory management of ga2 decryption.
The purpose of making it const before was to discourage direct tampering,
but private/protected does a better job of that now anyhow, and it is
annoying now.
s/const[ \t]+address_space\b/address_space/g;
Is basically what I did.
supporting cleaner implementations of drivers in the explicitly OO world.
Expect a follow-on of several more changes to clean up from this one, which
deliberately tried to avoid touching much driver code.
Converted address_space to a class, and moved most members behind accessor
methods, apart from space->machine and space->cpu. Removed external references
to 8le/8be/16le/16be/32le/32be/64le/64be. All external access is now done via
virtual functions read_byte()/read_word()/etc. Moved differentiation between
the endianness and the bus width internal to memory.c, and also added a new
axis to support small/large address spaces, which allows for faster lookups
on spaces smaller than 18 bits.
Provided methods for most global memory operations within the new address_space
class. These will be bulk converted in a future update, but for now there are
inline wrappers to hide this change from existing callers.
Created new module delegate.h which implements C++ delegates in a form that
works for MAME. Details are in the opening comment. Delegates allow member
functions of certain classes to be used as callbacks, which will hopefully
be the beginning of the end of fetching the driver_data field in most
callbacks. All classes that host delegates must derive from bindable_object.
Today, all devices and driver_data do implicitly via their base class.
Defined delegates for read/write handlers. The new delegates are always
passed an address_space reference, along with offset, data, and mask. Delegates
can refer to methods either in the driver_data class or in a device class.
To specify a callback in an address map, just use AM_READ_MEMBER(class, member).
In fact, all existing AM_ macros that take read/write handlers can now accept
delegates in their place. Delegates that are specified in an address map are
proto-delegates which have no object; they are bound to their object when
the corresponding address_space is created.
Added machine->m_nonspecific_space which can be passed as the required
address_space parameter to the new read/write methods in legacy situations
where the space is not provided. Eventually this can go away but we will
need it for a while yet.
Added methods to the new address_space class to dynamically install delegates
just like you can dynamically install handlers today. Delegates installed this
way must be pre-bound to their object.
Moved beathead's read/write handlers into members of beathead_state as an
example of using the new delegates. This provides examples of both static (via
an address_map) and dynamic (via install_handler calls) mapping using delegates.
Added read/write member functions to okim6295_device as an example of using
delegates to call devices. Updated audio/williams.c as a single example of
calling the device via its member function callbacks. These will be bulk
updated in a future update, and the old global callbacks removed.
Changed the DIRECT_UPDATE_CALLBACKs into delegates as well. Updated all users
to the new function format. Added methods on direct_read_data for configuring the
parameters in a standard way to make the implementation clearer.
Created a simple_list template container class for managing the common
singly-linked lists we use all over in the project.
Many other internal changes in memory.c, mostly involving restructuring the code
into proper classes.
---------- Forwarded message ----------
From: Atari Ace <atari_ace@frontier.com>
Date: Sat, Aug 7, 2010 at 9:38 PM
Subject: [patch] Eliminate more exported non-const globals from MAME core
To: submit@mamedev.org
Cc: atariace@hotmail.com
- Hide quoted text -
Hi mamedev,
This patch eliminates a few more non-const global vars coming out of
the MAME core. Vectorram/vectorram_size from vector.h in fact is
unused by the core, it's really for avgdvg support, and is also
confusingly used by segag80, so most of the patch is disentangling
those uses.
~aa
up the definition, rather than the whole tokenizing system, which lost type
checking. Added a new module addrmap.c which implements the address map
classes, and changed the macros to call methods on the address_map and
address_map_entry classes which are strongly typed.
Fixed a few incorrectly specified memory map entries along the way. Please
double-check to make sure the behavior is expected in: twincobr.c, lordgun.c,
galaxold.c.
This change also means that since the address_maps are now constructor
functions, they are detected when not used, so a number of #ifdef UNUSED_CODE
were added around dangling address map definitions.
Also included with this change:
- removed cputag_clocks_to_attotime() and cputag_attotime_to_clocks() in
favor of just expanding the class
- same for cputag_suspend() and cputag_resume()
---------- Forwarded message ----------
From: Sandro Ronco <sandro.ronco@gmx.com>
Date: Mon, Jul 26, 2010 at 6:07 PM
Subject: [HD63701]Fix slp opcode
To: submit@mamedev.org
Fixed SLP opcode basing on HD63701 and HD6303 datasheet.
This is need for psion driver in MESS, but I did some testing in MAME
and I have not seen regressions.
Probably nobody noticed this before because this opcode is almost
unused in arcade machine.
If you want have a confirmation of this you can see the diagram at
page 14 of the HD63701 datasheet or at page 24 of the HD6303
datasheet, where it is clear that the "sleep cancel signal" is not
conditional at the IRQ mask.
Regards
Sandro Ronco
(controlled by a #define like the SH-2 core) [Atari Ace]
---------- Forwarded message ----------
From: Atari Ace <atari_ace@verizon.net>
Date: Mon, Jul 5, 2010 at 3:50 PM
Subject: [patch] Fixup non-DRC rsp core
To: submit@mamedev.org
Cc: atariace@hotmail.com
Hi mamedev,
This patch fixes the non-DRC rsp core to be buildable again
(controlled by a #define like the sh2 core). It also cleans up the
whitespace/commented-out code in that core as well.
~aa
devices. Debugger now creates one for each device. C++-ified most
debugger operations to hang off the debugging class, and updated
most callers. This still needs a little cleanup, but it fixes most
issues introduced when the CPUs were moved to their own devices.
Got rid of cpu_count, cpu_first, cpu_next, etc. as they were badly
broken. Also removed cpu_is_executing, cpu_is_suspended,
cpu_get_local_time, and cpu_abort_timeslice.
Some minor name changes:
state_value() -> state()
state_set_value() -> set_state()
DECLARE_LEGACY_CPU_DEVICE and DEFINE_LEGACY_CPU_DEVICE. Changed CPUs
to be their own device types, rather than all of type CPU with a
special internal subtype. Note that as part of this process I removed
the CPU_ prefix from the ALL-CAPS device name, so CPU_Z80 is just
plain old Z80 now. This required changing a couple of names like
8080 to I8080 so that there was an alphabetic first character.
Added memory interfaces to the list of fast-access interfaces. To do
this properly I had to add a separate method to devices which is
called immediately after construction, when it is possible to perform
dynamic_casts on fully-constructed objects. (This is just internal,
no changes necessary to the devices themselves.)
Some additional notes:
* SH2 and SH4 had typedefs that conflicted with their CPU_-less names
so I bulk renamed to structures to sh2_state and sh4_state; RB, feel
free to choose alternate names if you don't like 'em
* SCSP was caught doing something to the 3rd indexed CPU. Since several
systems that use SCSP don't even have 3 CPUs, I had no idea what
this was supposed to do, so I changed to it reference "audiocpu"
assuming that stv was the assumed target. This is really gross and
should be a configuration parameter, not a hard-coded assumption.
cpu_get_total_cycles() == cpudevice->total_cycles()
cpu_clocks_to_attotime() == cpudevice->cycles_to_attotime()
cpu_attotime_to_clocks() == cpudevice->attotime_to_cycles()
In some cases, I updated existing code that fetched and cached
devices to fetch them as cpu_device so that these can be called
without casting.
In other cases, I did the quick & dirty thing which was to downcast
a generic device to a cpu_device and then call the function.
Note that cpu_clocks_to_attotime() and cpu_attotime_to_clocks()
were previously mapping to the device-level functions
clocks_to_attotime() and attotime_to_clocks(). This was different
behavior than before the big devices change, so with this update
I have fixed it to match the previous behavior (i.e., map cycles
not clocks).
This may impact timing of drivers that used these functions on
CPUs that have clock dividers or multipliers.