 |
A251 User's Guide |
 |
|
|
|
|
PROC Assembler Statement
| Arguments |
name PROC 〚type〛
... ; instructions and comments
RET
name ENDP
|
| Description |
The directives PROC and ENDP are used to define a
label for a sequence of machine instructions called a procedure. For
the NXP MX Devices and Intel 251 architecture a procedure can have
either the type NEAR or FAR, depending on the type with which
it is called - LCALL or ACALL (for NEAR); ECALL (for FAR). Unlike C
functions, assembler procedures do not provide local scopes for
labels. Identifiers must be unique in A251, because the visibility is
module wide.
Where:
| name |
Specifies the name of the procedure. |
| PROC |
Specifies that this is a procedure function. |
| type |
Specifies that the procedure is near or far and must be one of
the following:
- none: The type defaults to NEAR.
-
NEAR: Defines a near procedure; called with
LCALL or ACALL.
-
FAR: Defines a far procedure; called with
ECALL. You should specify FAR if the procedure is called from
a different 64KByte segment.
|
| RET |
A procedure ends normally with a RET instruction. The
software instruction RET will be converted automatically
to an appropriate machine return instruction. For example:
- RET: Return from a near procedure.
- ERET: Return from a far procedure.
|
| ENDP |
Procedures defined with the PROC statement must be
terminated by the ENDP statement, preceded by the
procedure name, name. |
|
| See Also | ENDP |
| Example |
P101 PROC NEAR
RET ; near return
P101 ENDP
P102 PROC FAR
RET ; far return (ERET)
P102 ENDP
P103 PROC NEAR
CALL P101 ; near call for P101 (LCALL)
CALL P102 ; far call for P102 (ECALL)
RET ; near return
P102 ENDP
END
|
|
|
|