indirect call

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

indirect call

Jump to solution
609 Views
Eric_t
Contributor III

Hi, everybody

 

I have to make an indirect call or jump but i do not know how to do it.

 

For example i have to make the following jump or call: 

 

                               Address FE00: CA 00 54 78 53 FA ....

                                  

                              I have to make a jump or call at the address which

                              contained in address FE00 (jump to CA00 address). 

 

Can anyone tell me how can i do it in assemby or C?

I am using the mc9s12dg256 controller and codewarrior v3.1. 

 

Thanks

Nikos 

Labels (1)
Tags (1)
0 Kudos
1 Solution
408 Views
kef
Specialist I

asm:

asm{

   LDX   0xFE00

   JMP   0,X

}

 

C:

typedef void (** near pfptr)(void);

 

{

   (*((pfptr)(void*)0xFE00))(); // jump to subroutine, whose 16bit address is stored at 0xFE00

}

View solution in original post

0 Kudos
2 Replies
409 Views
kef
Specialist I

asm:

asm{

   LDX   0xFE00

   JMP   0,X

}

 

C:

typedef void (** near pfptr)(void);

 

{

   (*((pfptr)(void*)0xFE00))(); // jump to subroutine, whose 16bit address is stored at 0xFE00

}

0 Kudos
408 Views
Eric_t
Contributor III

Thank you for your help, kef

 

 

 

0 Kudos