flat assembler
Message board for the users of flat assembler.

Index > Main > function call in vb...3dnow

Author
Thread Post new topic Reply to topic
jmcclane



Joined: 17 Feb 2013
Posts: 14
jmcclane
Hi....,

I'm trying to make this function "VectorScale" using 3DNow... in Fasm

In vb.net... that goes

Public Shared Sub VectorScale(ByRef vDest As vec3_t, _
ByVal vVec As vec3_t, _
ByVal fScale As Single)

vDest.x = vVec.x * fScale
vDest.y = vVec.y * fScale
vDest.z = vVec.z * fScale

End Sub

In Fasm...

proc VectorScale vDest, vVec, fScale

;femms ;3DNow

movd MM0, [fScale]
mov ecx, [vVec]

punpckldq MM0, MM0 ; {s s}
mov eax, [vDest] ; Vector Destination

movq MM1, [ecx+0] ; vA.xy {Ay Ax}
movd MM2, [ecx+8] ; vA.z0 {0 Az}

pfmul MM1, MM0 ;{ Ays Axs}
pfmul MM2, MM0 ; {0*s Azs}

movq [eax], MM1 ; {Ays Axs}
movd [eax+8], MM2 ; {0 Azs}

femms
ret

endp

After I call function in vb.net I must declare like this

Public Shared Sub VectorScale(ByRef vDest As vec3_t, _
ByRef vVec As vec3_t, _
ByVal fScale As Single)
End Sub

...and it work's fine.... but I want to call function like this..

Public Shared Sub VectorScale(ByRef vDest As vec3_t, _
ByVal vVec As vec3_t, _
ByVal fScale As Single)
End Sub

......(ByRef, ByVal, ByVal) then I have error...please help
Post 17 Feb 2013, 21:47
View user's profile Send private message Reply with quote
baldr



Joined: 19 Mar 2008
Posts: 1651
baldr
jmcclane,

Parameters that are passed by value become local copies on stack (instead of pointers). You may need something like proc VectorScale pvDest, vX, vY, vZ, v0, fScale — use debugger to be sure.
Post 18 Feb 2013, 05:58
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-2020, Tomasz Grysztar. Also on GitHub, YouTube, Twitter.

Website powered by rwasa.