flat assembler
Message board for the users of flat assembler.

Index > Windows > need explanation on double and proc

Author
Thread Post new topic Reply to topic
Vasilev Vjacheslav



Joined: 11 Aug 2004
Posts: 392
Vasilev Vjacheslav 23 Dec 2006, 12:59
hello, if someone can explain me this i'll be very happy, thanx. i'am trying to calculate power of x with double precision and return result in st0 (i passing double precision figures to x and y through the stack), but my procedure generate 'retn 8' instead of 'retn 16', what i am doing wrong?

Code:
  proc  _pow, x,y
        fld             QWORD [y]
        fld             QWORD [x]
        fyl2x
        fld1
        fld             st1
        fprem
        f2xm1
        faddp   st1,st0
        fscale
        fxch    st1
        fstp    st0
        ret
  endp
    


ps. sorry for my pure english

_________________
[not enough memory]
Post 23 Dec 2006, 12:59
View user's profile Send private message Reply with quote
Mr_Silent



Joined: 25 Apr 2006
Posts: 30
Mr_Silent 23 Dec 2006, 16:11
FASM.PDF, page 95-96 wrote:

Since any parameters are pushed on the stack as double words when
calling such procedures, the labels for parameters are defined to mark the
double word data by default, however you can you specify the sizes for the
parameters if you want, by following the name of parameter with colon and
the size operator. The previous sample can be rewritten this way, which is
again equivalent:
proc WindowProc, hwnd:DWORD, wmsg:DWORD, wparam:DWORD, lparam:DWORD
If you specify a size smaller than double word, the given label applies to the
smaller portion of the whole double word stored on stack. If you you specify
a larger size, like far pointer of quad word, the two double word parameters
are defined to hold this value, but are labelled as one variable.

Post 23 Dec 2006, 16:11
View user's profile Send private message 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-2023, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.