Writing the Assembly-Language Procedure

You must write your assembly-language procedure so that it uses the same call-ing conventions and naming conventions as your C program. If you follow these conventions, you will be able to write recursive procedures (procedures that call themselves), and you will be able to use the CodeView debugger to locate errors in the code.

Note:

This section discusses only the simplified segment directives provided with the Microsoft Macro Assembler, version 5.0 or later. If you are using a version prior to 5.0, you have to specify complete SEGMENT directives.

The standard assembly-language interface method consists of the following steps:

1.Set up the procedure

2.Enter the procedure

3.Allocate local data (optional)

4.Preserve register values

5.Access parameters

6.Return a value (optional)

7.Exit the procedure

The next sections describe each of these steps in detail.