本帖最后由 greatwgb 于 2012-10-30 13:11 编辑
void main()
{
unsigned char iii;
int k,m,p;
i=0x2f;
k=700;
m=255;
p=iii*k/255;
}
对于gcc编译器来说是没有问题的,但是对于picc编译器就出错,我测试了下,发现0x00-0x2e是没有问题的,0x2f以上就有问题了,好奇怪,反汇编代码如下:1002: unsigned char iii;
1003: int k,m,p;
1004: i=0x2f;
096E 0E2F MOVLW 0x2f
0970 0101 MOVLB 0x1
0972 0101 MOVLB 0x1
0974 6F05 MOVWF 0x5, BANKED
0976 0E00 MOVLW 0
0978 0101 MOVLB 0x1
097A 6F06 MOVWF 0x6, BANKED
1005: k=700;
097C 0EBC MOVLW 0xbc
097E 0101 MOVLB 0x1
0980 0101 MOVLB 0x1
0982 6F07 MOVWF 0x7, BANKED
0984 0E02 MOVLW 0x2
0986 0101 MOVLB 0x1
0988 6F08 MOVWF 0x8, BANKED
1006: m=255;
098A 0EFF MOVLW 0xff
098C 0101 MOVLB 0x1
098E 0101 MOVLB 0x1
0990 6F01 MOVWF 0x1, BANKED
0992 0E00 MOVLW 0
0994 0101 MOVLB 0x1
0996 6F02 MOVWF 0x2, BANKED
1007: p=iii*k/255;
0998 C107 MOVFF 0x107, 0x10f
099A F10F NOP
099C C108 MOVFF 0x108, 0x110
099E F110 NOP
09A0 0101 MOVLB 0x1
09A2 0101 MOVLB 0x1
09A4 C100 MOVFF 0x100, 0x10d
09A6 F10D NOP
09A8 0101 MOVLB 0x1
09AA 0101 MOVLB 0x1
09AC 6B0E CLRF 0xe, BANKED
09AE EC91 CALL 0xf22, 0
09B0 F007 NOP
09B2 C10D MOVFF 0x10d, 0x10d
09B4 F10D NOP
09B6 C10E MOVFF 0x10e, 0x10e
09B8 F10E NOP
09BA 0EFF MOVLW 0xff
09BC 0101 MOVLB 0x1
09BE 0101 MOVLB 0x1
09C0 6F0F MOVWF 0xf, BANKED
09C2 0E00 MOVLW 0
09C4 0101 MOVLB 0x1
09C6 6F10 MOVWF 0x10, BANKED
09C8 EC68 CALL 0x6d0, 0
09CA F003 NOP
09CC C10D MOVFF 0x10d, 0x103
09CE F103 NOP
09D0 C10E MOVFF 0x10e, 0x104
09D2 F104 NOP |