cProc

cProc procName, <attributes>, <autoSave>

The cProc macro defines the name and attributes of a function.

Parameters

procName

Specifies the name of the function.

attributes

Specifies the function type. This parameter can be a combination of the following types:

Type Description

NEAR Near function. It can be called only from the segment in which it is defined.
FAR Far function. It can be called from any segment.
PUBLIC Public function. It can be externally declared in other source files.

The default attribute is NEAR and private (that is, the function cannot be declared externally in other source files). The NEAR and FAR attributes cannot be used together. If more than one attribute is selected, angle brackets are required.

autoSave

Specifies a list of registers to be saved when the function is invoked and restored when exited. Any 8086 register can be specified.

Comments

If this function is called by a function written in C, it must save and restore the SI and DI registers.

The BP register is always saved, regardless of whether it is present in the list given by the autoSave parameter.

Examples

The following examples demonstrate the usage of the cProc macro:

cProc proc1, <FAR, ds,es>
cProc proc2, <NEAR,PUBLIC>
cProc proc3,,ds