简体   繁体   English

DOS中的asm(“ fldl%0”…),Intel语法?

[英]asm (“fldl %0”…) in DOS, Intel syntax?

I'm working on a retro project trying to compile some test code in Borland Turbo C++/DosBox. 我正在做一个复古项目,试图在Borland Turbo C ++ / DosBox中编译一些测试代码。

I have this function: 我有这个功能:

double sin(double x){
   asm ("fldl %0;"
        "fsin;"
        "fstpl %0" : "+m"(x));
   return x;
}

I figure it returns the sin value of x, but I'm otherwise lost. 我认为它返回x的正弦值,但否则我就迷失了。

The error is: Undefined symbol 'fldl' 错误是:未定义符号'fldl'

Can anyone explain this function in Intel asm syntax? 谁能用Intel asm语法解释此功能?

I can't figure it out, I've only ever coded 16bit DOS asm code and no floating point. 我不知道,我只编码过16位DOS asm代码,没有浮点数。

Kind Regards /Jacob 亲切的问候/雅各布

The problem is that the target CPU must be at least 386. 问题是目标CPU必须至少为386。

so the function should be: 所以函数应该是:

double sin(double x){
    asm{
        fld qword ptr [x]
        fsin
        fstp qword ptr [x]
    }
    return x;
}

I've gotten similar code to compile in TASM with .386 after .MODEL "size" 我已经获得了类似的代码,可以在.MODEL“ size”之后使用.386在TASM中进行编译

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM