flat assembler
Message board for the users of flat assembler.

Index > Main > FPU: Load constant floating point value

Author
Thread Post new topic Reply to topic
flona



Joined: 05 Nov 2008
Posts: 7
Location: Germany
flona 14 Jan 2009, 21:16
Hello,
I was wondering if there's a way to load a constant FP to st0. The following code doesn't work:
Code:
fld 123.456    


thanks

_________________
My english is not very well. Pardon.
Post 14 Jan 2009, 21:16
View user's profile Send private message Visit poster's website ICQ Number Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20343
Location: In your JS exploiting you and your system
revolution 14 Jan 2009, 21:41
Code:
value dd 123.456 ;or DQ/DT if you want more precision.
...
fld [value]    
Post 14 Jan 2009, 21:41
View user's profile Send private message Visit poster's website Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid 14 Jan 2009, 22:56
if you REALLY want to have it in one place, and 32bit precision is enough, easiest you can do is probably something like
Code:
push dword 123.456   ;FASM supports this
fld [esp]    ;FLD from stack
add esp, 4   ;remove value from stack 
    


but i would suggest revolution's version.
Post 14 Jan 2009, 22:56
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20343
Location: In your JS exploiting you and your system
revolution 14 Jan 2009, 23:02
One thing to note with vid's suggestion is that you need a type override.
Code:
push dword 123.456
fld dword [esp]    ;add the operand size override
add esp, 4    
Post 14 Jan 2009, 23:02
View user's profile Send private message Visit poster's website Reply with quote
flona



Joined: 05 Nov 2008
Posts: 7
Location: Germany
flona 15 Jan 2009, 13:01
Very Happy thank you Exclamation

_________________
My english is not very well. Pardon.
Post 15 Jan 2009, 13:01
View user's profile Send private message Visit poster's website ICQ Number Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.