I haven't looked at what's different in .14 so if it includes any other fixes 
than what I sent you before, it won't be included in the zipped code.

The MECM 40 C code calculates hw[0] differently and seems to work 
better than before so far. The most important things to merge to 
make things easier in the future would be the cpu code, the 
Read/Write memory handlers, the updated hw[0] in MECM 40, and 
the romProvider/romVersion in nagra2-0101.cpp. You'll eventually 
have to add ExecuteRomInit, AddCallbacks, and Rom102Callbacks.

The code will work for both DN and Bev but it's not likely to run 
correctly due to various tricks they're using. In one of the Bev ones 
I saw, it uses memory addresses $0e and $0f, which supposedly has to 
do with CRC/checksumming hardware. 


-----

This might be used more for reference and learning than anything else.

Here are the replacement source files for my implementation of the MECM simulator and 9f updater: http://www.zshare.net/download/5124924b1d19b7/

You'll also need to update system.h with:

Code:

class cKeySnoop {
private:
   cSystem *sys;
   int type, id, keynr;
!   bool ok, noKeyFail;
public:
   cKeySnoop(cSystem *Sys, int Type, int Id, int Keynr);
   ~cKeySnoop();
   void OK(cPlainKey *pk);
+   void SetNoKeyFail();
};


and system.cpp with:

Code:

cKeySnoop::~cKeySnoop()
{
!   if(!ok && !noKeyFail)
      d(sys->KeyFail(type,id,keynr))
}

+void cKeySnoop::SetNoKeyFail()
+{
+   noKeyFail = true;
+}


The zip includes partially updated Rev 10c/248 so the 9f updater can be tested. You'll need to leave it running for a bit until it receives the full 9f update before it can run the execute the proper MECM. You'll also need the 0106 or 0907 keys if you don't already have them.

Some changes I can think of:

cpu:
- added the Read/Write handlers. removed the provider specific read/write hacks in the cpu code and moved them to the provider specific Read/Write handlers
- added clock cycles tallying (not likely to be completely correct but it works with the DN MECM 40)
- added cMapTempRom for temporary ROM mappings that can be updated for the current session. this is used for updating MECM patches without mmaping the original ROM as read/write
- some output display fixes

nagra2:
- added 9f dispatching to the provider

nagra2-0101:
- added the new MECM 40 code
- added ROM initialization
- added MECM dynamic loading/decrypting/execution code
- added 9f manager
- added timer hardware registers to Read/Write
- changed code so provider 0901 won't have to load both 0901 and 0101's ROM to execute
- added some interfaces to make it more similar to Noone's dynamic code


You can turn on/off running under the simulator by changing the first "#if 1" in Algo to "#if 0". Both the static and dynamic code for MECM 40 use the same calculations for the $14 value, which is the same one Rygar had. That one seems to be the best so far.

Noone's goals are more ambitious than mine but he'll need some time to reach it. Once he's done with it, if someone wants to add in his code, it should be much easier to do now than before.
