EasyManuals Logo
Home>Texas Instruments>Computer Hardware>TMS34010

Texas Instruments TMS34010 Reference Guide

Texas Instruments TMS34010
181 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Page #59 background imageLoading...
Page #59 background image
Runtime
Environment
-
Function
Structure
and
Calling
Conventions
pc.
STK
is
accessed
as
*SP(offset), where the offset = [number
of
saved registers +
1]
times 32.
If
the calling
function
saved three
registers,
it
would
restore STK
with
the
following
instruction:
MOVE
*SP(128),
STK, 1
b) It restores the saved registers.
If
local variables were allocated, it
must also restore the
FP
along
with
the other registers.
If
the
called function must restore mUltiple registers,
it
can
use the
MMFM
instruction
as
shown below:
MMFM
SP,
AS,
A7,
FP
It
is
not necessary
to
restore the status register; however,
if
FS1
has
been
changed,
it
must
be
restored to the value 32 and
FEO
must equal
O.
5) It executes
an
RETS
instruction.
If
the function
has
arguments or returns
a value on the stack,
it
executes
an
RETS 2 instruction; this pops both
the return address and the caller's old
STK
off
the stack.
If
the function
has
no arguments and doesn't return a float or a double, it
can
execute
an
RETS
0 instruction.
5.3.3
Setting
up
the
Local
Frame
In
addition to the actions listed
in
Section 5.3.2, a called C function that
has
arguments or local variables must perform the following actions
to
setup the
local frame. These additional steps
are
performed immediately
following
step
1 above.
1)
It
sets the new frame pointer
to
the current program stack pointer (A14):
MOVE
STK, FP
2)
It
allocates the frame by adding its size to the program stack pointer:
ADDI
128,
STK
If
the called function
has
no local variables or arguments, then it
has
no need
for local temporary storage and these steps
are
not necessary.
5.3.4
Accessing
Arguments
and
Local
Variables
5-10
A function accesses its arguments and local variables indirectly through the
FP
(A13). The
FP
always points
to
the bottom
of
the local frame (where the
first local variable is). The first local variable
is
accessed
as
*FP
(0).
Other
local variables
are
addressed
with
increasing offsets, up to a maximum
of
32,768. Arguments
are
accessed similarly, but
with
negative offsets from the
FP
(up
to
a maximum
of
-32,767). The first argument
is
accessed
as
*FP
(-32).

Table of Contents

Other manuals for Texas Instruments TMS34010

Questions and Answers:

Question and Answer IconNeed help?

Do you have a question about the Texas Instruments TMS34010 and is the answer not in the manual?

Texas Instruments TMS34010 Specifications

General IconGeneral
BrandTexas Instruments
ModelTMS34010
CategoryComputer Hardware
LanguageEnglish

Related product manuals