Keil Logo

C51: Function of ?C?ICALL and ?C?ICALL2


Information in this article applies to:

  • C51 any Version

SYMPTOMS

When I use function pointers, the compiler outputs code that calls a library routine named ICALL as shown here.

              (*g) ();   // Call func indirectly
0004 AA06          MOV     R2,AR6
0006 A907          MOV     R1,AR7
0008 120000  E     LCALL   ?C?ICALL

What does this routine do and why is it necessary?

CAUSE

The ?C?ICALL library routine performs indirect function calls by:

  • Loading DPL and DPH with the function address,
  • Clearing the Accumulator,
  • Executing JMP @DPTR+A.

Indirect function calls are handled with this function because there are 4 or 5 instructions necessary to execute the call. It is more memory efficient to have this routine if you have several indirect calls.

In addition there is a slightly different entry named ?C?ICALL2. This function expects the function address in DPL/DPH and therefore does not copy the function address.

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.