C Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsProgramming LanguagesC Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old October 3rd, 2012, 04:52 AM
wren11 wren11 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2012
Posts: 4 wren11 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 52 m 17 sec
Reputation Power: 0
Need help converting a function in asm.

Hello guys, I'm hoping somebody can help me convert this asm function into a psuedo.

The function ia just be a simple cubic interpolation.




void __cdecl NAVDATA__CubicInterpolate(int a1, int a2, double a3)
{

__asm
{
fld [ebp+arg_8]
fld st
fmul st, st(1)
}

_EAX = *(_DWORD *)a2;

__asm
{

fld qword ptr [eax+44h]
fld qword ptr [eax+0Ch]
fld qword ptr [eax+28h]
fld qword ptr [eax+60h]


fsub st, st(3)
fsub st, st(2)
fadd st, st(1)


fld st(5)
fmul st, st(1)
fmul st, st(5)


fld st(3)
fsub st, st(3)
fsubrp st(2), st


fxch st(5)
fmulp st(1), st
faddp st(4), st
fxch st(2)

fsubrp st(1), st
fmulp st(3), st
fxch st(1)

faddp st(2), st
faddp st(1), st
}
}


I'm guessing the function is actually quite alot like this one below but i would like some help with the converting if theres any asm experts here.

double CubicInterpolate(double y0, double y1,double y2, double y3, double mu)
{
double a0, a1, a2, a3, mu2;

mu2 = mu * mu;
a0 = y3 - y2 - y0 + y1;
a1 = y0 - y1 - a0;
a2 = y2 - y0;
a3 = y1;

return (a0 * mu * mu2 + a1 * mu2 + a2 * mu + a3);
}



This is what i've done so far but im uncertain if it's correct:

var v = val * val; // fld st
// fmul st, st(1)

var a0, a1, a2, a3; //fld qword ptr [eax+44h]
//fld qword ptr [eax+0Ch]
//fld qword ptr [eax+28h]
//fld qword ptr [eax+60h]

a0 = y3 - y0 - y2 + y1; //fsub st, st(3)
//fsub st, st(2)
//fadd st, st(1)

a1 = y1 - y0; //fmul st, st(1)
a2 = a0 - y0; //fmul st, st(5)

a3 = (y3 - y0) - (y0 - y2); //fsub st, st(3)
//fsubrp st(2), st



any help appreciated, thanks

Reply With Quote
  #2  
Old October 3rd, 2012, 05:05 AM
Edward25 Edward25 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2012
Posts: 12 Edward25 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 4 h 11 m 21 sec
Reputation Power: 0
Sorry can't help you,i'm a newbie and still learning a lot as possible.

Reply With Quote
  #3  
Old October 3rd, 2012, 05:21 AM
wren11 wren11 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2012
Posts: 4 wren11 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 52 m 17 sec
Reputation Power: 0
That's alright, hopefully someone can figure it out!

Reply With Quote
  #4  
Old October 3rd, 2012, 12:15 PM
b49P23TIvg's Avatar
b49P23TIvg b49P23TIvg is offline
Contributing User
Dev Shed Loyal (3000 - 3499 posts)
 
Join Date: Aug 2011
Posts: 3,389 b49P23TIvg User rank is Major (30000 - 40000 Reputation Level)b49P23TIvg User rank is Major (30000 - 40000 Reputation Level)b49P23TIvg User rank is Major (30000 - 40000 Reputation Level)b49P23TIvg User rank is Major (30000 - 40000 Reputation Level)b49P23TIvg User rank is Major (30000 - 40000 Reputation Level)b49P23TIvg User rank is Major (30000 - 40000 Reputation Level)b49P23TIvg User rank is Major (30000 - 40000 Reputation Level)b49P23TIvg User rank is Major (30000 - 40000 Reputation Level)b49P23TIvg User rank is Major (30000 - 40000 Reputation Level)b49P23TIvg User rank is Major (30000 - 40000 Reputation Level) 
Time spent in forums: 1 Month 2 Weeks 3 Days 14 h 22 m 25 sec
Reputation Power: 383
Don't you think that cubic interpolation based on 4 points is a bit risky?
I'd go with 2 points and slopes or two points and concavities.
__________________
[code]Code tags[/code] are essential for python code!

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesC Programming > Need help converting a function in asm.

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap