|
以下C代码:
switch (k)
{
case 1:
h++;
h++;
break;
case 2:
h++;
h++;
break;
case 3:
h++;
h++;
break;
default:
break;
}
编译成汇编:
207: switch (k)
C:0x0FDA 900012 MOV DPTR,#0x0012
C:0x0FDD E0 MOVX A,@DPTR
C:0x0FDE FE MOV R6,A
C:0x0FDF A3 INC DPTR
C:0x0FE0 E0 MOVX A,@DPTR
C:0x0FE1 FF MOV R7,A
C:0x0FE2 EE MOV A,R6
C:0x0FE3 70F5 JNZ C:0FDA
C:0x0FE5 EF MOV A,R7
C:0x0FE6 24FE ADD A,#0xFE
C:0x0FE8 6009 JZ C:0FF3
C:0x0FEA 14 DEC A
C:0x0FEB 6011 JZ C:0FFE
C:0x0FED 2402 ADD A,#0x02
C:0x0FEF 70E9 JNZ C:0FDA
208: {
209: case 1:
210: h++;
211: h++; <-------|
212: break; |
C:0x0FF1 8000 SJMP C:0FF3 |
|--------------------出现错误
213: case 2:
214: h++;
C:0x0FF3 900011 MOV DPTR,#0x0011
C:0x0FF6 E0 MOVX A,@DPTR
C:0x0FF7 04 INC A
C:0x0FF8 F0 MOVX @DPTR,A
215: h++;
C:0x0FF9 E0 MOVX A,@DPTR
C:0x0FFA 04 INC A
C:0x0FFB F0 MOVX @DPTR,A
216: break;
C:0x0FFC 80DC SJMP C:0FDA
217: case 3:
218: h++;
C:0x0FFE 900011 MOV DPTR,#0x0011
C:0x1001 E0 MOVX A,@DPTR
C:0x1002 04 INC A
C:0x1003 F0 MOVX @DPTR,A
219: h++;
C:0x1004 E0 MOVX A,@DPTR
C:0x1005 04 INC A
C:0x1006 F0 MOVX @DPTR,A
220: break;
C:0x1007 80D1 SJMP C:0FDA |
|