【发布时间】:2015-02-28 19:54:07
【问题描述】:
以下是我的汇编语言代码。我可以使用“push [edi]”传递堆栈参数值,但我似乎无法使用“push OFFSET [edi]”通过引用传递。在这种情况下,通过引用传递某些东西的正确语法是什么?
sortList PROC
;Parameter memory addresses:
;numbers @ [ebp+8]
;list @ [ebp+12]
;Used to access stack parameters
push ebp
mov ebp, esp
;Sets up the array
mov edi, [ebp+12] ;Puts in the address of the list array
mov ecx, [ebp+8] ;Sets up the loop counter for the array
;Testing swapNumber function
push [edi] ;array 1 pushed will be ebp+12
add edi, 4
push [edi] ;array 2 pushed will be ebp+8
call swapNumber
pop ebp
ret 8
sortList ENDP
【问题讨论】:
-
推送指针而不是内存操作数。即
push edi而不是push [edi] -
哦哇...这是一个简单的修复。非常感谢!
标签: assembly x86 pass-by-reference