2011-12-11 104 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