嗨,那里。我想问一下,阅读汇编代码有什么技巧吗?例如:这个C代码:翻译成:我试着读这个小片段,但是它很难理解。1。Goto 0xC12。XORLW 0x0(任何值XOLD与0是相同的值,如果W是0和gt;z=1;否则Z=0)3。BTFSC状态,0x2(我不知道Z中现在是什么值,因为我不知道W),如果Z=0∶1。XOLLW 0x6(我不知道这是怎么做的,为什么XOR可以在操作数0x6上做?)如果Z!= 0∶1。在这种情况下,这个变量Ledii i与函数KEY,ununki
ti化完全无关,我不知道如何挖掘。请给我一些阅读汇编的提示,谢谢。
以上来自于百度翻译
以下为原文
Hi, there. I want to ask that is there any skill to read assembly code?
For example:
This C code:
void KEY_UnlockInitialization(void){
while(KEYbits.INITIALIZATION != ON);
KEYbits.INITIALIZATION = OFF;
}
is translated to:
10: void KEY_UnlockInitialization(void){
11: while(KEYbits.INITIALIZATION != ON);
08C0 28C1 GOTO 0xC1
08C1 0020 MOVLB 0x0
08C2 1C4C BTFSS KEYbits, 0x0
08C3 28C5 GOTO 0xC5
08C4 28C6 GOTO 0xC6
08C5 28C1 GOTO 0xC1
12: KEYbits.INITIALIZATION = OFF;
08C6 104C BCF KEYbits, 0x0
13: }
08C7 0008 RETURN
86: case TEMP_TOO_HIGH_DURING_CHARGE:
87: switch(led_i){
009E 28BF GOTO 0xBF
00BF 0020 MOVLB 0x0
00C0 0845 MOVF 0x45, W
00C1 3A00 XORLW 0x0
00C2 1903 BTFSC STATUS, 0x2
00C3 28C8 GOTO 0xC8
00C4 3A06 XORLW 0x6
00C5 1903 BTFSC STATUS, 0x2
00C6 28D0 GOTO 0xD0
00C7 28B7 GOTO 0xB7
00C8 0844 MOVF led_i, W
00C9 3A00 XORLW 0x0
00CA 1903 BTFSC STATUS, 0x2
00CB 289F GOTO 0x9F
/*code Omitted*/
I tried to read this small snippet but it's so hard to understand.
1. GOTO 0xC1
2. XORLW 0x0 (any value XORed with 0 is the same value, if w is 0 -> z = 1; otherwise z = 0)
3. BTFSC STATUS, 0x2 (I don't know what value is in z now, because I don't know w)
if z = 0:
1. XORLW 0x6 (I don't know what this doing, why XOR can do on operand 0x6?)
if z != 0:
1. MOVF led_i, W(this variable led_i is totally not related to function KEY_UnlockInitialization)
In this situation, I don't know how to dig in. Please give me some hint to read assembly, thank you.