case CSL: switch(key) { case KENTER: single_weight = 0; display_weight(); status = WORK; key_sound(); break; case KSET: point = 0; display_sap(); status = SETL_SAPN;
--------------------------------------------------------------------
case PERCENT_CSL: switch(key) { case KENTER: percent_weight = 0; display_weight(); status = WORK; key_sound(); break;
****************************************************
case CSL: switch(key) { case KENTER: single_weight = 0; display_weight(); status = WORK; key_sound(); break; 反汇编如下: 019B: MOV R0,#87H 019D: LCALL 0FE0H 01A0: AJMP 0267H
.... 0FE0H: POP DPH POP DPL CLR A MOVC A,@A+DPTR MOV @R0,A INC R0 MOV A,#01H MOVC A,@A+DPTR MOV @R0,A INC R0 MOV A,#02H MOVC A,@A+DPTR MOV @R0,A INC R0 MOV A,#03H MOVC A,@A+DPTR MOV @R0,A MOV A,#04H JMP A,@A+DPTR
case PERCENT_CSL: switch(key) { case KENTER: percent_weight = 0; display_weight(); status = WORK; key_sound();
反汇编如下: 0262: MOV R0,#C8H 0264: LCALL 0FF9H 0267: NOP NOP NOP NOP ...... 0FF9H: POP DPH POP DPL CLR A MOVC A,@A+DPTR MOVX @R0,A INC R0 MOV A,#01H MOVC A,@A+DPTR MOVX @R0,A INC R0 MOV A,#02H MOVC A,@A+DPTR MOVX @R0,A INC R0 MOV A,#03H MOVC A,@A+DPTR MOVX @R0,A MOV A,#04H JMP A,@A+DPTR
问题: single_weight = 0; 反汇编用LCALL 0FE0H 实现,通过查表赋值,用POP DPH POP DPL 弹出查表地址,01A0后面应该放表格 NOP NOP NOP NOP (0,0,0,0)
由于同0267处放的表格一样,表格后面的程序也一样,程序用AJMP 0267H 直接跳过去了,结果造成POP DPH, POP DPL弹出的不是表格地址,程序运行出错。
我这样理解对吗,望高手指点。 有点长,请大家耐心看完。谢谢
|