keil 51编译器问题
{
unsigned char i=0;
char *p=str;
Cmd[i++] = str;
for(;*p!=0;p++)
{
if(*p==':')
{
*p = '\0';
Cmd[i++] = p+1;
}
}
return i;
}
大家帮我看看这段代码有什么问题吗?为什么在keil 51上编译出的代码执行得不对呢?
45: unsigned char SplitStr(char* str,char* Cmd[])
46: {
47: unsigned char i=0;
C:0x0265 E4 CLR A
C:0x0266 FF MOV R7,A
48: char *p=str;
C:0x0267 8B58 MOV 0x58,R3
C:0x0269 8A59 MOV 0x59,R2
C:0x026B 895A MOV 0x5A,R1
49: Cmd[i++] = str;
C:0x026D C003 PUSH 0x03
C:0x026F C002 PUSH 0x02
C:0x0271 C001 PUSH 0x01
C:0x0273 AB55 MOV R3,0x55
C:0x0275 AA56 MOV R2,0x56
C:0x0277 A957 MOV R1,0x57
C:0x0279 0F INC R7
C:0x027A 75F003 MOV B(0xF0),#0x03
C:0x027D A4 MUL AB
C:0x027E F582 MOV DPL(0x82),A
C:0x0280 85F083 MOV DPH(0x83),B(0xF0)
C:0x0283 118F ACALL C?PSTOPTR(C:008F)
50: for(;*p!=0;p++)
C:0x0285 AB58 MOV R3,0x58
C:0x0287 AA59 MOV R2,0x59
C:0x0289 A95A MOV R1,0x5A
C:0x028B 1125 ACALL C?CLDPTR(C:0025)
C:0x028D 6039 JZ C:02C8
51: {
52: if(*p==':')
C:0x028F B43A29 CJNE A,#0x3A,C:02BB
53: {
54: *p = '\0';
C:0x0292 E4 CLR A
C:0x0293 116B ACALL C?CSTPTR(C:006B)
55: Cmd[i++] = p+1;
C:0x0295 AB58 MOV R3,0x58
C:0x0297 E55A MOV A,0x5A
C:0x0299 2401 ADD A,#0x01
C:0x029B F9 MOV R1,A
C:0x029C E4 CLR A
C:0x029D 3559 ADDC A,0x59
C:0x029F FA MOV R2,A
C:0x02A0 C003 PUSH 0x03
C:0x02A2 C002 PUSH 0x02
C:0x02A4 C001 PUSH 0x01
C:0x02A6 AB55 MOV R3,0x55
C:0x02A8 AA56 MOV R2,0x56
C:0x02AA A957 MOV R1,0x57
C:0x02AC AE07 MOV R6,0x07
C:0x02AE 0F INC R7
C:0x02AF 75F003 MOV B(0xF0),#0x03
C:0x02B2 EE MOV A,R6
C:0x02B3 A4 MUL AB
C:0x02B4 F582 MOV DPL(0x82),A
C:0x02B6 85F083 MOV DPH(0x83),B(0xF0)
C:0x02B9 118F ACALL C?PSTOPTR(C:008F)
56: }
57: }
C:0x02BB 7401 MOV A,#0x01
C:0x02BD 255A ADD A,0x5A
C:0x02BF F55A MOV 0x5A,A
C:0x02C1 E4 CLR A
C:0x02C2 3559 ADDC A,0x59
C:0x02C4 F559 MOV 0x59,A
C:0x02C6 80BD SJMP C:0285
58: return i;
59: }
C:0x02C8 22 RET