Table of Contents        Previous topic       Next topic       

C COMPILER->In Line Assembler Code->Accessing Local Variables and Function Parameters->Non-Reentrant Functions Large Memory Model

Non-Reentrant Functions, Large Memory Model

The variables are located in xdata space and must be accessed by the data pointer dptr, except for _bit variables which are located in bit addressable data space.

void func(unsigned char Var1, unsigned char Var2)
    _bit BitVar;
    unsigned char Var3, Var4;
    _asm(     mov dptr,#{Var1});
    _asm(     movx a,@dptr);
    _asm(     mov dptr,#{Var2});
    _asm(     movx a,@dptr);
    _asm(     mov dptr,#{Var3});
    _asm(     movx a,@dptr);
    _asm(     mov dptr,#{Var4});
    _asm(     movx a,@dptr);
    _asm(    mov c,{BitVar});

compiles to:

    mov dptr,#__frame_func-1
    movx a,@dptr
    mov dptr,#__frame_func-2
    movx a,@dptr
    mov dptr,#__frame_func
    movx a,@dptr
    mov dptr,#__frame_func+1
    movx a,@dptr
    mov c,__bit_frame_func

;   Function 'func' Internal Objects
;   unsigned char _xdata Var1      __frame_func-1
;   unsigned char _xdata Var2      __frame_func-2
;   _bit BitVar                               __bit__frame_func+0
;   unsigned char _xdata Var3      __frame_func+0
;   unsigned char _xdata Var4      __frame_func+1