ST20-C1 STMICROELECTRONICS [STMicroelectronics], ST20-C1 Datasheet - Page 49

no-image

ST20-C1

Manufacturer Part Number
ST20-C1
Description
Instruction Set Reference Manual
Manufacturer
STMICROELECTRONICS [STMicroelectronics]
Datasheet
A function called using fcall must have a fixed offset at compile time. jab is used for
calling functions and procedures at dynamically calculated addresses, for example
when using function pointers.
The jab instruction is also used to perform the return. The return address must have
been restored with a ldl from the stack into the Areg. A procedure or function that
requires local work space will normally include ajw instructions to allocate and deallo-
cate space.
When the jab instruction is executed, the programmer must ensure that:
The jab instruction uses one word of the evaluation stack, so the other two words can
therefore be used to return up to two values to the calling code, including a pointer to
a block of additional data to be returned.
4.10.1 Adjusting work space
The primary instruction ajw is used to perform a relative adjustment to the stack
pointer Wptr to:
ajw n increases the value of the workspace pointer by the number of words in its
operand value, n . Work space is created at the beginning of a function or procedure
with a negative operand and released before returning with a positive operand.
The amount of extra work space needed will normally include:
For example, a function with w words of local work space might be:
This can be compiled as:
T myfunction (param_1, param_2)
{
}
local variable declarations ;
P;
return (E);
the Areg holds the return address;
any workspace claimed by the procedure should have been released so that
the Wptr has returned to the value it held at the start of the procedure.
create work space on the stack at the beginning of the function and
return the work space pointer at the end of the function.
space to save any parameters passed in the evaluation stack;
space for local variables and temporaries;
space for any hidden system variables such as the static chain.
ajw -w;
stl param_1; stl param_2;
P;
E;
ajw w;
4 Using ST20-C1 instructions
49/205

Related parts for ST20-C1