Keil Logo

PROC Assembler Statement

Arguments
<[>name<]> PROC type
Description

The PROC statement defines a procedure.

Where:

name specifies the name of the procedure.
PROC specifies that the procedure is a standard procedure function.
type specifies the instruction coding. A type of CODE16 or THUMB specifies Thumb mode instructions. A type of CODE32 or ARM specifies ARM mode instructions. The assembler uses the procedure type to encode instructions.

Procedures defined with the PROC statement must be terminated by the ENDP statement.

Note

  • Unlike procedures and functions created in high-level languages (like C and C++), identifier scope in assembly language is module-wide. For this reason, identifiers used in assembly procedures must be unique.
  • The assembler does not verify whether or not a return instruction was used in a procedure. This is the responsibility of the programmer.
See Also

ENDP

Example
$SEGMENTED

MyBank1 REGBANK ; Register bank for Standard Proc
MyBank2 REGBANK ; Register bank for Interrupt Proc


C100    SECTION CODE

int10 PROC INTERRUPT I10=10 USING MyBank2
        MOV     MyBank2,R0
        SCXT    CP,#MyBank2
        NOP
        ; ...
        POP CP
        RET
int10 ENDP

proc1 PROC USING MyBank1
        MOV     MyBank1,R0
        SCXT    CP,#MyBank1
        NOP
        ; ...
        POP     CP
        RET
proc1 ENDP

C100    ENDS



C101    SECTION CODE

P101 PROC NEAR
        CALL    P102 ; far call for P102
        RET          ; near return
P101 ENDP

P102 PROC FAR
        CALL    P101 ; near call for P101
        TRAP    #I10 ; call int10
        RET          ; far return
P102 ENDP

C101    ENDS


C102    SECTION CODE
P103 PROC TASK TG1 INTNO I20=20
        NOP
        ; ...
        RET
P103 ENDP
C102    ENDS

        END
  Arm logo
Important information

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies.

Change Settings

Privacy Policy Update

Arm’s Privacy Policy has been updated. By continuing to use our site, you consent to Arm’s Privacy Policy. Please review our Privacy Policy to learn more about our collection, use and transfers
of your data.