Keywords: sdccman

## 4.7.13 Functions

In addition to the standard SDCC function keywords, PIC16 port makes available two more:

__wparam
  Use the WREG to pass one byte of the first function argument. This improves speed but you may not use this for functions with arguments that are called via function pointers, otherwise the first byte of the first parameter will get lost. Usage:

  void func_wparam(int a) __wparam

  {

  /* WREG hold the lower part of a */

  /* the high part of a is stored in FSR2+2 (or +3 for large stack model) */

  ...

  }

__shadowregs
  When entering/exiting an ISR, it is possible to take advantage of the PIC18F hardware shadow registers which hold the values of WREG, STATUS and BSR registers. This can be done by adding the keyword __shadowregs before the __interrupt keyword in the function's header.

  void isr_shadow(void) __shadowregs __interrupt (1)

  {

  ...

  }

__shadowregs instructs the code generator not to store/restore WREG, STATUS, BSR when entering/exiting the ISR.