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

no-image

ST20-C1

Manufacturer Part Number
ST20-C1
Description
Instruction Set Reference Manual
Manufacturer
STMICROELECTRONICS [STMicroelectronics]
Datasheet
4.10 Function and procedure calls
ST20-C1 processors may have a workspace cache which holds a copy of a few words
at the bottom of the work space. This cache is transparent to the programmer but may
substantially improve performance. It is refilled whene ver the Wptr is adjusted, so the
ajw instruction should not be used excessively.
4.10.2 Parameters
It is convenient to load the first three parameters of the procedure or function into the
evaluation stack registers, and to arrange the work space of the calling code so that
the additional parameters can be stored in locations 1, 2, ... of the work space
before the procedure is called. Location zero of the work space is used for the return
address. This is illustrated in Figure 4.2, which shows a possible work space layout for
a function or procedure with six parameters and four local variables.
To enable the procedure to access non-local variables the parameters of a procedure
may include a link to the environment in which the procedure was declared.
4.10.3 Returning results
Up to two results of size less than or equal to the word length of the processor can be
returned from a function in the evaluation stack — the jab instruction uses the third
register. Further results, or results larger than the word length, can be returned by
passing into the function the addresses of locations to store these results as extra
parameters.
50/205
ldl 0;
jab;
Figure 4.2 Example function or procedure workspace
Wptr in function
Wptr in calling
or procedure
code
Return Iptr
variable 1
variable 2
variable 3
variable 4
param 6
param 5
param 4
param 3
param 2
param 1

Related parts for ST20-C1