English
Language : 

ST20-C1 Datasheet, PDF (50/205 Pages) STMicroelectronics – Instruction Set Reference Manual
4.10 Function and procedure calls
ldl 0;
jab;
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.
Wptr in calling
code
Wptr in function
or procedure
param 6
param 5
param 4
Return Iptr
param 3
param 2
param 1
variable 1
variable 2
variable 3
variable 4
Figure 4.2 Example function or procedure workspace
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
®