2011-12-11 97 views
0

相當於C代碼,我想知道下面的彙編代碼的相應的C代碼,如果可以的彙編代碼尋找ASM

PUBLIC fonction2 
_tab DW 0aH DUP (?) 
_idx$ = 8    ; size =4 
_value$ = 12    ; size =2 
fonction2 PROC 
     push ebp 
     mov ebp, esp 

     mov eax, DWORD PTR _idx$[ebp] 
     mov cx, WORD PTR _value$[ebp] 
     mov word PTR _tab[eax*2], cx 

     pop ebp 
     ret 0 
fonction2 ENDP 

什麼_idx$_value$的解釋。 感謝您的幫助提前。

回答

7
void fonction2 (int idx, short value) 
{ 
    tab [idx] = value; 
} 
+0

感謝您的答案;)。參數確實完成$?我不明白idx $ [ebp]和_value $ [ebp] – mauriyouth

+0

它是'[ebp + 8]','[ebp + 12]'分別爲 – chill

+0

爲什麼我們使用_tab [eax * 2]我不明白2,順便說一句這裏是一個很好的文章解釋堆棧框架的東西http://eli.thegreenplace.net/2011/02/04/where-the-top-of-the-stack-is-on-x86/#id7 – mauriyouth