Solved

ASM to Delphi

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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
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…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

713 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