This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Reentrant function whose arguments are located to absolute addr

I defined a reentrant function with 4 long arguments like this (excerpt from the lst)

  21          unsigned long func0(unsigned long a, unsigned long b, unsigned long c, unsigned long d) large reentrant
  22          {
  23   1              printf("--- Now in func 0 Calling bank A\n");
  24   1              func5A(a,b,c,d);
  25   1              printf("--- Calling bank B\n");
  26   1              func8B(d,c,b,a);
  27   1              return a+b+c+d;
  28   1      }

Parents
  • And part of its translated form in assembly is

                 ; FUNCTION _?func0 (BEGIN)
                                               ; SOURCE LINE # 21
    0000 90FFFC            MOV     DPTR,#0FFFCH
    0003 120000      E     LCALL   ?C?ADDXBP
    0006 120000      E     LCALL   ?C?LSTXDATA
                                               ; SOURCE LINE # 23
    0009 7BFF              MOV     R3,#0FFH
    000B 7A00        R     MOV     R2,#HIGH ?SC_120
    000D 7900        R     MOV     R1,#LOW ?SC_120
    000F 120000      E     LCALL   _printf
    
    The first MOV is to get the argument values (?) from $FFFC, however it happens to be an "empty" address in my chip. How does it happen? I supposed the argument address are determined only when linking, rather than compiling.

Reply
  • And part of its translated form in assembly is

                 ; FUNCTION _?func0 (BEGIN)
                                               ; SOURCE LINE # 21
    0000 90FFFC            MOV     DPTR,#0FFFCH
    0003 120000      E     LCALL   ?C?ADDXBP
    0006 120000      E     LCALL   ?C?LSTXDATA
                                               ; SOURCE LINE # 23
    0009 7BFF              MOV     R3,#0FFH
    000B 7A00        R     MOV     R2,#HIGH ?SC_120
    000D 7900        R     MOV     R1,#LOW ?SC_120
    000F 120000      E     LCALL   _printf
    
    The first MOV is to get the argument values (?) from $FFFC, however it happens to be an "empty" address in my chip. How does it happen? I supposed the argument address are determined only when linking, rather than compiling.

Children