Calling Assembly Subroutines From C/C++ Programs - Analog Devices VISUALDSP++ 3.5 Manual

C/c++ compiler and library for adsp-219x processors
Hide thumbs Also See for VISUALDSP++ 3.5:
Table of Contents

Advertisement

C/C++ and Assembly Language Interface
Calling Assembly Subroutines from C/C++
Programs
Before calling an assembly language subroutine from a C/C++ program,
create a prototype to define the arguments for the assembly language sub-
routine and the interface from the C/C++ program to the assembly
language subroutine. Even though it is legal to use a function without a
prototype in C/C++, prototypes are a strongly recommended practice for
good software engineering. When the prototype is omitted, the compiler
cannot perform argument type checking and assumes that the return value
is of type integer and uses K&R promotion rules instead of ANSI promo-
tion rules.
The run-time model defines some registers as scratch registers and others
as preserved or dedicated registers. Scratch registers can be used within the
assembly language program without worrying about their previous con-
tents. If more room is needed (or an existing code is used) and you wish to
use the preserved registers, you must save their contents and then restore
those contents before returning.
Do not use the dedicated or stack registers for other than their intended
purpose; the compiler, libraries, debugger, and interrupt routines depend
on having a stack available as defined by those registers.
The compiler also assumes the machine state does not change during exe-
cution of the assembly language subroutine.
Do not change any machine modes (for example, certain registers
may be used to indicate circular buffering when those register val-
ues are nonzero).
The compiler prefaces the name of any external entry point with an
underscore. Therefore, declare your assembly language subroutine's name
with a leading underscore. If you're using the function from assembly pro-
1-170
VisualDSP++ 3.5 C/C++ Compiler and Library Manual
for ADSP-219x DSPs

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the VISUALDSP++ 3.5 and is the answer not in the manual?

Questions and answers

Subscribe to Our Youtube Channel

Related Products for Analog Devices VISUALDSP++ 3.5

Table of Contents