User`s guide

Inline Assembly Language and Intrinsics
Inline Assembly Language
140
Targeting MC56F83xx/DSP5685x Controllers
;pointed to by R0 in P: memory and
;post-increment R0
rts ;return to calling function
ENDSEC ;End of section
END ;End of source program
Listing 7.9 shows the C calling statement for this assembly language function.
Listing 7.9 Sample Code - Calling an Assembly Language Function from C
void pmemwrite( short, short );/* Write a value into P: memory */
void main( void )
{
// ...other code
// Write the value given in the first parameter to the address
// of the second parameter in P: memory
pmemwrite( (short)0xE9C8, (short)0x0010 );
// other code...
}
Calling Functions from Assembly
Language
Assembly language programs can call functions written in either C or assembly
language.
From within assembly language instructions, you can call C functions. For
example, if the C function definition is:
void foot( void ) {
/* Do something */
}
Your assembly language calling statement is:
jsr Ffoot
From within assembly language instructions, you can call assembly language
functions. For example, if
pmemwrite is an assembly language function, the
assembly language calling statement is:
jsr Fpmemwrite