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

A pointer of array (byte *) passing in fixed memory location

Hi,
A C function tries to call a assembly function via the interfacing way of c programs-to-assemnly interface. Founded it's failed and can't use step-into to watch the status of assembly function.
The codes is as follows. Please give some comments for the issue. Tks!


The codes in C.

BYTE show1[3] ={0x0ff,0x02,0x03};
BYTE t_dat[3];

#pragma NOREGPARMS
int wrxdata(
        BYTE    *pDs, /* R1-R3*/
        BYTE    *pSr /*Fixed memory*/
);
main(){
wrxdata(&t_dat[0], &show1[0]);
}



The assembly function.

NAME    LB_LIBRARY
?PR?_WRXDATA?LB_LIBRARY         SEGMENT CODE
?PD?_WRXDATA?LB_LIBRARY         SEGMENT DATA    OVERLAYABLE

PUBLIC _WRXDATA, ?_WRXDATA?BYTE

RSEG ?PD?_WRXDATA?LB_LIBRARY    ; Segment for local variables
?_WRXDATA?BYTE:                 ; Start of the parameter passing seg

pSr:    DS  2   ; byte pointer variable: pSr
pDs:    DS      2

; Additional local variables from 'function'

RSEG    ?PR?_WRXDATA?LB_LIBRARY ; Program segment

_wrxdata:
                MOV             DPTR,#?_WRXDATA?BYTE+0
                MOVX    A,@DPTR
                MOV             DPTR,#?_WRXDATA?BYTE+2
                MOVX    @DPTR,A

                RET                             ; Return

                END

Parents
  • In particular, "generic" pointers (those without a specific memory space specifier) are three bytes long, not two. They include a tag byte for the address space. (That's why they're passed in R1-R3, using three bytes of register space instead of two.)

    You don't show the defintion of BYTE, but I assume it's just "unsigned char" or similar, and not something like "unsigned char xdata".

Reply
  • In particular, "generic" pointers (those without a specific memory space specifier) are three bytes long, not two. They include a tag byte for the address space. (That's why they're passed in R1-R3, using three bytes of register space instead of two.)

    You don't show the defintion of BYTE, but I assume it's just "unsigned char" or similar, and not something like "unsigned char xdata".

Children
No data