flat assembler
Message board for the users of flat assembler.

Index > Main > push signleprecision st0?

Author
Thread Post new topic Reply to topic
edfed



Joined: 20 Feb 2006
Posts: 4330
Location: Now
edfed 11 Mar 2010, 13:56
i seek a way to push a floating-point dword onto the stack after a computation with FPU.

maybe the answer is with fist [ss:ebp] but i don't know
Post 11 Mar 2010, 13:56
View user's profile Send private message Visit poster's website Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20299
Location: In your JS exploiting you and your system
revolution 11 Mar 2010, 14:00
Code:
sub esp,4
fst dword[esp]    
Or use fstp.
Post 11 Mar 2010, 14:00
View user's profile Send private message Visit poster's website Reply with quote
edfed



Joined: 20 Feb 2006
Posts: 4330
Location: Now
edfed 11 Mar 2010, 16:20
cool! yes, of course, i am dumb!
thank you! Very Happy
Post 11 Mar 2010, 16:20
View user's profile Send private message Visit poster's website Reply with quote
Borsuc



Joined: 29 Dec 2005
Posts: 2465
Location: Bucharest, Romania
Borsuc 12 Mar 2010, 13:42
Why sub esp, 4????? use "push reg" (any register) it's much smaller.

Code:
push eax
fst dword[esp]    
Post 12 Mar 2010, 13:42
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20299
Location: In your JS exploiting you and your system
revolution 12 Mar 2010, 13:46
Borsuc wrote:
Why sub esp, 4????? use "push reg" (any register) it's much smaller.
... but not necessarily faster. "any" register may have a pending result waiting, the write buffer may need to be drained before the store can take place. It depends upon the application edfed has as to whether smaller or faster is the main target requirement.
Post 12 Mar 2010, 13:46
View user's profile Send private message Visit poster's website Reply with quote
Borsuc



Joined: 29 Dec 2005
Posts: 2465
Location: Bucharest, Romania
Borsuc 12 Mar 2010, 13:48
yeah but i thought he was doing some FPU computations so that should be enough... anyway, you can use 'push esp' instead.
Post 12 Mar 2010, 13:48
View user's profile Send private message Reply with quote
edemko



Joined: 18 Jul 2009
Posts: 549
edemko 12 Mar 2010, 13:51
i think push'es are more consumptive than simple sub's
it depends on the situation you have
Post 12 Mar 2010, 13:51
View user's profile Send private message Reply with quote
edfed



Joined: 20 Feb 2006
Posts: 4330
Location: Now
edfed 12 Mar 2010, 13:57
it is in order to work with opengl and computes coordinates with FPU.
Code:
quad:
.call=0
.p1=4
.p2=8
.p3=12
.p4=16
.c=20
.x=0
.y=4
.z=8
.r=0
.g=4
.b=8
        invoke glBegin,[edi+.call]
        mov esi,[edi+.c]
        invoke glColor3f ,[esi+.r],[esi+.g],[esi+.b]
        mov esi,[edi+.p1]
        invoke glVertex3f,[esi+.x],[esi+.y],[esi+.z]
        mov esi,[edi+.p2]
        invoke glVertex3f,[esi+.x],[esi+.y],[esi+.z]
        mov esi,[edi+.p3]
        invoke glVertex3f,[esi+.x],[esi+.y],[esi+.z]
        mov esi,[edi+.p4]
        invoke glVertex3f,[esi+.x],[esi+.y],[esi+.z]
        invoke  glEnd
        ret
    


for the moment, the quad is extracted from a struture like this:
Code:
quad1:  dd GL_QUADS,.dot1,.dot2,.dot3,.dot4,.c
.dot1:  dd  0.0  , 0.0  , 0.0
.dot2:  dd  1.0  , 0.0  , 0.0
.dot3:  dd  0.707, 0.707, 0.0
.dot4:  dd  0.0  , 1.0  , 0.0
.c   :  dd  0.0  , 1.0  , 0.0
    

and then, i will simplify the structure with ints, forced to the XY plane, then, only 2D.
and colors will be simplified with a unique dword AARRGGBBh

the battle is starting! Very Happy
Post 12 Mar 2010, 13:57
View user's profile Send private message Visit poster's website 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.