Skip to main content

IAR Embedded Workbench for RL78 5.20

Calling functions in the Near code model

In this section:

A direct call using this code model is simply:

            call n:label16

When a function call is made via a function pointer, this code will be generated:

            name    callFuncPtr
            rseg    CODE:CODE
            extern  funcPtr

            movw    ax, n:funcPtr ; Load function address
            mov     cs, #0        ; clear byte 3
            call    ax            ; Make function call
            end

The address is stored in a register and is then used for calling the function. Calls via a function pointer reach the whole 32-bit address space.