Solved

ASM to Delphi

Posted on 2006-10-28
4
527 Views
Last Modified: 2013-11-22
I neet to port this ASM function to Delphi because .Net does not support ASM...

Any help would be apprciated...

Thanks!


   function FTan (Angle: Extended): Extended;
     asm
            fld      [Angle]      
            ffree      st(7)      
            fptan                
            fstp      st(0)      
            fwait

     end;
0
Comment
Question by:PaulP
  • 3
4 Comments
 
LVL 4

Expert Comment

by:tobjectpascal
ID: 17827753
Yes, another reason why i don't like .NET you can only use what they give you, it's not really that flexible at all.
0
 
LVL 28

Expert Comment

by:TName
ID: 17828162
Have you tried sinply using Tan() instead? (Presuming the Math library for .Net is similar to the Win32 one...)
Does Delphi for .Net itself use assembler? You might want to look at your Delphi version's tan function (there has to be one) and see if it's similar.

BTW, this is how tan() looks like in D7's Math.pas:

function Tan(const X: Extended): Extended;
asm
        FLD    X
        FPTAN
        FSTP   ST(0)      { FPTAN pushes 1.0 after result }
        FWAIT
end;

0
 
LVL 28

Expert Comment

by:TName
ID: 17828194
>this is how tan() looks like in D7's Math.pas
So the only differences are that here the angle value is passed as a const and that your function frees the last stack register before computing the tangent.
0
 
LVL 28

Accepted Solution

by:
TName earned 250 total points
ID: 17828458
I think System.Math.Tan() should be the .Net equivalent.
0

Featured Post

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

760 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now