Topic : Relative subroutine call?

Forum : 8051

Original Post
Post Information Post
November 6, 2009 - 3:20pm
Guest

Hi,

For test purposes I need a piece of relative assembler code that blinks some Leds.

I use the 'sjmp' instruction for relative jumps but I would also like to execute some relative (versus absolute) function calls.

As far as I know there is no such command.

I can think of pushing some return values on stack, then jumping to (not calling) a function and exiting this function with a return.

How can I achieve this in a simple way?

Thanks

Henk

Replies
Post Information Post
+1
0
-1
November 6, 2009 - 4:51pm
Raisonance Support Team

It can be achieved with the SRC mode:

#pragma SRC
#include

void test( void )
{
printf( "Here I am!\n" );
}

void main( void )
{
#pragma asm
LCALL test
#pragma endasm

while( 1 );
}