SUMMARY OF USING ASSEMBLY LANGUAGE WITH C/C++.

SUMMARY

1. The inline assembler is used to insert short, limited assembly language sequences into a C++ program. The main limitation of the inline assembler is that it cannot use macro sequences or conditional program flow instructions.

2. Two versions of C++ language are available. One is designed for 16-bit DOS console applications and the other for 32-bit Windows applications. The type chosen for an application depends on the environment, but in most cases programmers today use Windows and the 32-bit Visual Express version.

3. The 16-bit assembly language applications use the DOS INT 21H commands to access devices in the system. The 32-bit assembly language applications cannot efficiently or easily access the DOS INT 21H function calls even though many are available.

4. The most flexible and often-used method of interfacing assembly language in a C++ program is through separate assembly language modules. The only difference is that these separate assembly language modules must be defined by using the C directive following the .model statement to define the module linkage as C/C++ compatible.

5. The PUBLIC statement is used in an assembly language module to indicate that the procedure name is public and available to use with another module. External parameters are defined in an assembly language module by using the name of the procedure in the PROC statement. Parameters are returned through the EAX register to the calling C/C++ procedure from the assembly language procedure.

6. Assembly language modules are declared external to the C++ program by using the extern directive. If the extern directive is followed by the letter C, the directive is used in a C/C++ language program.

7. When using Visual Studio, we can instruct it to assemble an assembly language module by clicking on Properties for the module and adding the assembler language program (ml /c /Cx / coff Filename.txt) and output file as an object file (Filename.obj) in the Custom Build step for the module.

8. Assembly language modules can contain many procedures, but can never contain programs using the .startup directive.

Leave a comment

Your email address will not be published. Required fields are marked *