High-Level Language Interface


There are three methods of connecting C/C++ programs to assembly language programs:
Inline Assembly Code
Inline assembly code is assembly language source code that is inserted directly into high-level language programs.

The __asm Directive
In Visual C++, the __asm directive can be placed at the beginning of a single statement, or it can mark the beginning of a block of assembly language statements (called an asm block). The syntax is

 
   __asm  statement


 
   __asm {

 
     statement-1

 
     statement-2

 
     ...

 
     statement-n

 
   }
(There are two underline characters before “asm.”)

Comments
Comments can be placed after any statements in the asm block, using either assembly language syntax or C/C++ syntax. Here are examples of permissible comments:

 
   mov   esi, buf      ;  initialize index register

 
   mov   esi, buf      // initialize index register

 
   mov   esi, buf      /* initialize index register */


      “I’m not arguing, I’m just explaining why I’m right.”    
      ― Unknown