Solved

ASM to Delphi

Posted on 2006-10-28
4
541 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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

792 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