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

logical AND getting optimized out?

Hello everyone.
I decided to try out working in C for a change, but this compiler is really getting on my nerves with it's incessant optimization :/
Can anyone please tell me what i'm doing wrong here:
(i'm using optimization level 0)

9: void main()
10: {
11: byte volatile blah;
12:
13: XBYTE[0x7E00] = 0x38;
C:0x8030 907E00 MOV DPTR,#0x7E00
C:0x8033 7438 MOV A,#0x38
C:0x8035 F0 MOVX @DPTR,A
14: while(XBYTE[0x7E01] && 0x80)
C:0x8036 907E01 MOV DPTR,#0x7E01
C:0x8039 E0 MOVX A,@DPTR
C:0x803A FF MOV R7,A
C:0x803B EF MOV A,R7
C:0x803C 6004 JZ C:8042
15: {
16: blah = blah+1;
C:0x803E 0508 INC 0x08
17: }
18:
C:0x8040 80F4 SJMP C:8036


as you can see, the "&& 0x80" bit is optimized out, and thusly this little test program fails..

Cheers, B.A

0