C Language and Libraries Help (clang.hlp) (Table of Contents; Topic list)
Important Notice
The pages on this site contain documentation for very old MS-DOS software, purely for historical purposes. If you're looking for up-to-date documentation, particularly for programming, you should not rely on the information found here, as it will be woefully out of date.
Preserving Registers with the Inline Assembler
                                             Up Contents Index Back
─────C/C++ Language─────────────────────────────────────────────────────────
 
     An __asm block inherits whatever register values happen to result
     from the normal flow of control. Within a function, you do not
     need to preserve the AX, BX, CX, DX, or ES registers. You
     should preserve DI, SI, DS, SS, SP, and BP.
 
     If your function changes the direction flag using the STD or CLD
     instructions, you should restore the flag to its original value.
 
     If the return value is a char, int, or near pointer, use the AX
     register. If the return value is a long or a far pointer, place
     the high word in DX and the low word in AX. To return a value
     longer than that, store the value in memory and return a pointer
     to it.
                                    -♦-