◄Up► ◄Contents► ◄Index► ◄Back► ─────C/C++ Language───────────────────────────────────────────────────────── To use macros to insert assembly code into C or C++ code, follow these rules: 1. Enclose the __asm block in braces. 2. Put the __asm keyword in front of each assembly instruction. 3. Use enclosing C comments ( /* comment */ ); if you use C++ single-line comments ( // ), the compiler ignores the rest of the macro. 4. Use the backslash (\) to join the statements into a single line. For example: #define BEEP __asm \ /* Beep sound */ \ { \ __asm mov ah, 2 \ __asm mov dl, 7 \ __asm int 21h \ } This macro expands to a single line: __asm { __asm mov ah, 2 __asm mov dl, 7 __asm int 21h } -♦-