additional defines for VS 2005 
_CRT_SECURE_NO_DEPRECATE;_CRT_SECURE_NO_WARNINGS


**** stdafx.h ******
 #define strnicmp   _strnicmp   // for VS2005 
 #define stricmp    _stricmp        // for VS2005
 #define filelength _filelength  // for VS2005

***** main.cpp *****
void ExtractFileDir (const char* path, char* dir)  //#as  added  
 int main(int argc, char * argv[])    /#as extended  to use a loop with _findfirst & _findnext to deal with wildcards 
 
 cmain::go   :    FileType=0;  //#as added
 
 
 **** commandline.h ****
 #define CMDL_STATISTICS             0      // no instruction statistics  //#as 
 #define CMDL_GENFDOFILE           0      // no Generation of Profiling File //#as

class CCommandLineInterpreter 
public 
     void ResetOutput();                       // #as added Clear Output Variables & Counters     
     struct _finddata_t fileinfo;       // #as added: Input fileinfo ( only 32 Bit Size)     
     int    DoStatistics;                             //# as added                 
  
****commandline.cpp *****
CCommandLineInterpreter::CCommandLineInterpreter()   
  DoStatistics   = CMDL_STATISTICS;          // Instruction Statistics // #as   added 
  
 void CCommandLineInterpreter::ResetOutput()  //#as added to clean up  all values for next File (if wildcards are used),  
                                                                                                                        //but doesn't clean up Responsefiles & buffers  so may be  is incomplete now, has to be checked
  

void CCommandLineInterpreter::InterpretCommandOption(char * string)
    case 's': case 'S':   // Statistics on                // # as added    Commandline parameter "s"    
   case 'p': case 'P': GenerateFDOFile = 1; // #as  added   Commandline parameter "p"  
   
   
void CCommandLineInterpreter::Help()
   printf("\n-sN        Instruction Statistic options. Values of N:");   //#as
   printf("\n           0: None, 1: Summarize, 2:Instr.Length & Typ in Output+ summerize .\n");    //#as
   printf("\n-p         Generate Info File for Profiling \n");   //#as

   
  ****opcodes.h ****
  defines of the instructionsets and some  statistical stuff .  For this I rearranged the assignments. 
  There are now six categories:  icat86 (0..1F),  icatFPU(20..3F), icatMMX(40..5F), icatSSE  (60..7F), icatMem (80..9F)  and icatAMD (a0--bf) 
  with some headroom for the future.  The values  relative to the first value in each categorie  are choosen so, that they correspond 
  to the base instruction set  of  icat86,  for example  iFPUP6  has 0x26, P6 has 0x06.   
   
   
 ****opcodes.cpp **** 
 I renamed all tables to the represented opcode(s) but  I'm not shure  whether this was really a good idea. I thought to arrange this huge amount of tables a little bit 
 more  clearly. But you need a sorted  enumeration of the names of all tables at the beginning. 
 But  I'm  quite convinced  that rearranging the numbers for the instructionsets was a good idea -- and it does not really cause a much bigger size  for the tables .
 
You find The sse4a extension in the four tables  
 
 SOpcodeDef OpcodeMap0F2B[4] 
 SOpcodeDef OpcodeMap0F78[4] 
 SOpcodeDef OpcodeMap0F79[4]                                                                                                                                                                                                                         
 SOpcodeDef OpcodeMap0FBD[4]
 
For EXTRQ V[63:0],ib,ib     and  INSERTQ V[63:0],V[63:0],ib,ib  are very special
I used as preliminary  Format: 0x31 for  0x11 || 0x20   Has mod/reg/rm byte and one register/memory operand  || Has 2 bytes immediate operand (ret i)
and as  Source/dest:  0x20   packed integer xmm, unknown size or 128 bits
but both choices are not really adequate so we shoule invent something new ...  

You find some corrections in the comments, marked as  #as comment fix 
here and there are some other assignments to the instruction sets  (like  fcmovb from i87 to iFPUP6)   all marked with #as ...  
and the vmread   in 0F 79 should be vmwrite 


****disasm.h ****
class CDisassembler 
   uint8   InstructionSetMAX[7];                         // #as added: Highest instruction set encountered in max 7 categories #as added 
   int32   InstructionCount;                                     // #as count number of instructions 
   int32   TotalLen;                                                          // #as count number of instructionbytes
   FILE*   hfdo;                                                                    // #as Handle for Feedback File  
   char    fdofile[_MAX_PATH];                               // #as Name for Feedback File
   uint32  fdobuffer[4];                                                  // #as buffer for fdo output
   void    PutinInstruction(bool doprint);       // #as Analyse Instruction for statistics   
   void    ResetInstructionStatistics();              // #as Reset Statistic Counters 
   void    WriteStatistics();                                          // #as Write Statstics at End of File;



***disasm1.cpp***
void CDisassembler::Pass2() {
  if (hfdo) WriteAllCodeSegmentstoFdoFile ();        //#as segment info for fdo (only for code Segments) 
  if (cmd.DoStatistics) WriteStatistics();                      //#as	

void CDisassembler::CountMapInstructions() { // #as extended (debug only) 
 extended to support all newer instructionssets 
 
void CDisassembler::FindOperands()  
  //correction for s.OperandSize  
   if (((s.OpcodeDef->Destination & 0xff)==1) || (s.OpcodeDef->Source==0xA1)||(s.OpcodeDef->Destination==0xA1)) s.OperandSize =8; //#as added, 8 Bit stays always 8 Bit!   

CDisassembler::FindInstructionSet() 
// some more  instructions change the set with prefix, i.e. some from SSE to SSE2 etc.   
// InstructionSetMAX is now determined in every instructionset categorie

void CDisassembler::CheckLabel()
 if (hfdo) WriteTargettoFdoFile(DataType);   // #as   

CDisassembler::Go () 
 Initfdo() 


 
 ***disasm2.cpp***
 
 void CDisassembler::WriteFileBegin()
//#as changed this part ************************************* from here 
// Interpretation of   InstructionSetMAX[0..6]  for the assembler output 

void CDisassembler::WriteSegmentBegin()

if ((hfdo) &&((Sections[Section].Type & 0xFF)==1)) //#as added only if Code Segment   
	WriteSegmenttoFdoFile (Section,0x3);           //#as added Section/Segment info for fdo 
//#as this info is redundant because sections are already listed at the beginning, just to mark the limits between segments  

void CDisassembler::WriteCodeComment()

InstructionLen +=FieldSize;                // #as  
 
  if (CodeMode==1) {                           //# as added,  only if not dubios Code       
  if (hfdo) AnalyzeInstructionforFdo();      //# as added,  Store Branches in FDO File    
  if (cmd.DoStatistics) UpdateStatistics (); //# as added,  Update instructionsetstats 
 
 ****diasasm3 **** 
as  CDisassembler   Extensions  for statistics & FDO File Generation, with  Format Specification of FDO file 
 
                                  