Slide 13.4: INVOKE directive
Slide 13.6: PROC directive
Home

ADDR Operator and PROC Directive


ADDR Operator
The ADDR operator can be used to pass a pointer when calling a procedure using INVOKE. Passing an address as a procedure argument is called passing by reference. For example, the Code I is the same as the Code II assuming STDCALL is used:

Code I Code II
 .data
 Array  DWORD  20 DUP(?)
 .code
 ...
 INVOKE  Swap,
   ADDR  Array,
   ADDR  [Array+4]
 .data
 Array  DWORD  20 DUP(?)
 .code
 ...
 push  OFFSET Array+4
 push  OFFSET Array
 call  Swap

PROC Directive
The PROC directive permits you to declare a procedure name with a list of named parameters, as the following simplified syntax shows:
   label  PROC [attributes] [USES reglist], parameter_list
Attributes refers to any of the following:
   [distance] [langtype] [visibility] [prologue]
Attribute Description
distance NEAR or FAR. Indicates the type of RET instruction generated by the assembler.
langtype Specifies the calling convention such as C, PASCAL, or STDCALL. Overrides the language specified in the .MODEL directive.
visibility Indicates the procedure's visibility to other modules. Choices are PRIVATE, PUBLIC (default), and EXPORT.
prologue Specifies arguments affecting generation of prologue and epilogue code.

The attribute values are for advanced assembly programming and will not be detailed in this course.