Slide 13.5: ADDR operator
Slide 13.7: PROTO directive
Home

PROC Directive (Cont.)


   label  PROC [attributes] [USES reglist], parameter_list
parameter_list is
   parameter_1, parameter_2, ..., parameter_n
A single parameter has the following syntax:
     paramName: type
paramName is an arbitrary name you assign to the parameter. Its scope is limited to the current procedure. Type can also be a qualified type, which may be a pointer to an existing type. Examples of qualified types are
   PTR BYTE       PTR SBYTE      PTR WORD       PTR SWORD
   PTR DWORD      PTR SDWORD     PTR QWORD      PTR TBYTE
 An ABS Procedure Using 
 Passing by Value   Passing by Reference 
 INCLUDE Irvine32.inc
 .code
 ;; Find |value|
 abs PROC, val:SDWORD
      cmp   val, 0
      

neg val POS: ret abs ENDP ;; main proc is after abs proc. main PROC LOCAL value:SDWORD mov value, -23 INVOKE abs, value mov eax, value call WriteInt exit main ENDP END main
 INCLUDE Irvine32.inc
 .code
 ;; Find |value|
 abs PROC, ptrVal:PTR SDWORD
      mov   esi, ptrVal
      cmp   SDWORD PTR[esi], 0
      

neg SDWORD PTR[esi] POS: ret abs ENDP ;; main proc is after abs proc. main PROC LOCAL value:SDWORD mov value, -23 INVOKE abs, ADDR value mov eax, value call WriteInt exit main ENDP END main
 Output  Output