Keil Logo

C166: Generating a Call to an Absolute Memory Location


Information in this article applies to:

  • C166 Version 4.20 and later

QUESTION

I need to call a routine at address 0x100000. Is there a way to do this in C?

ANSWER

Yes. The following statement generates call to a function at address 0x100000.

((void (far *) (void)) 0x100000) ();

The function called is a far function and must return with a RETS instruction. In the SMALL and COMPACT memory models, you must declare this function as a far function. For example:

void far func (void)  {
  // your code goes here
}

SEE ALSO


Last Reviewed: Thursday, February 25, 2021


Did this article provide the answer you needed?
 
Yes
No
Not Sure
 
  Arm logo
Important information

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies.

Change Settings

Privacy Policy Update

Arm’s Privacy Policy has been updated. By continuing to use our site, you consent to Arm’s Privacy Policy. Please review our Privacy Policy to learn more about our collection, use and transfers
of your data.