How to move value from the stack to ST(0)?

Posted by George Edison on Stack Overflow See other posts from Stack Overflow or by George Edison
Published on 2010-06-14T03:35:03Z Indexed on 2010/06/14 3:42 UTC
Read the original article Hit count: 188

Filed under:
|
|

I am having trouble believing the following code is the most efficient way to move a value from the stack to ST(0):

.data
var dd 4.2
tmp dd ?

.code
mov EAX, var
push EAX
; top of stack now contains a value

; move it to ST(0)
pop EAX
mov tmp, EAX
fld tmp

Is the temporary variable really necessary? Further, is there an easier way to get a value from the stack to ST(0)?

© Stack Overflow or respective owner

Related posts about assembly

Related posts about floating-point