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

Why does compiler produce different code for 46: Disp=DispData8; C:0x02DD 908082 MOV DPTR,#Disp(0x8082) C:0x02E0 7438 MOV A,#0x38 C:0x02E2 F0 MOVX @DPTR,A 47: wait(22); C:0x02E3 7F16

Compiler produces different code for same line

Parents
  •  3 consecutive lines of code

        Disp=DispData8;
        wait(22);       
        Disp=DispData8;

    the compiler produces

        46:         Disp=DispData8;
    C:0x02DD    908082   MOV      DPTR,#Disp(0x8082)
    C:0x02E0    7438     MOV      A,#0x38
    C:0x02E2    F0       MOVX     @DPTR,A
        47:         wait(22);        
    C:0x02E3    7F16     MOV      R7,#0x16
    C:0x02E5    7E00     MOV      R6,#0x00
    C:0x02E7    120546   LCALL    wait(C:0546)
        48:         Disp=DispData8;
    C:0x02EA    7438     MOV      A,#0x38

    The second write to Disp should be the same as the first.

    Disp is defined as

    char xdata Disp       _at_ 0x8082;

    Seems to me to be a bug.

Reply
  •  3 consecutive lines of code

        Disp=DispData8;
        wait(22);       
        Disp=DispData8;

    the compiler produces

        46:         Disp=DispData8;
    C:0x02DD    908082   MOV      DPTR,#Disp(0x8082)
    C:0x02E0    7438     MOV      A,#0x38
    C:0x02E2    F0       MOVX     @DPTR,A
        47:         wait(22);        
    C:0x02E3    7F16     MOV      R7,#0x16
    C:0x02E5    7E00     MOV      R6,#0x00
    C:0x02E7    120546   LCALL    wait(C:0546)
        48:         Disp=DispData8;
    C:0x02EA    7438     MOV      A,#0x38

    The second write to Disp should be the same as the first.

    Disp is defined as

    char xdata Disp       _at_ 0x8082;

    Seems to me to be a bug.

Children