You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Turbo Assembler中FPU栈弹出TWORD类型数据报错的问题求助

Fixing Turbo Assembler's TWORD (LONG DOUBLE) fstp Error

Hey, I’ve dealt with this exact TWORD issue in Turbo Assembler before—those error messages are super frustrating when you know your logic is right. Let’s walk through the fixes that worked for me:

1. Swap TWORD PTR for DT PTR

Older versions of TASM have better support for DT (the define-type pseudo-instruction for 10-byte long doubles) than the TWORD alias when used as a type override. Change your problematic line to:

fstp dt ptr [BX]

This should immediately get rid of the "Undefined symbol: TWORD" error, since DT is a native TASM identifier for long double storage.

2. Enable x87 Coprocessor Support

Long double operations depend on x87 floating-point instructions, and TASM might not recognize these by default. Add one of these pseudo-instructions at the top of your code:

.8087  ; For older TASM versions targeting 8087 coprocessors
; OR
.387  ; If you're targeting 386+ systems with extended coprocessor features

Without this, TASM can’t parse x87-specific types and instructions, leading to that "Argument needs type override" message.

3. Explicitly Define TWORD as DT (For Stubborn Versions)

If the first two fixes don’t stick, your TASM version might not have TWORD pre-defined. Add this line near the top of your code to alias it:

TWORD EQU DT

Now you can use TWORD PTR [BX] if you prefer that syntax, and TASM will recognize it as the 10-byte long double type.

Here’s Your Modified Working Code Snippet

To put it all together, your string_to_float proc should look like this:

locals __
...
string_to_float proc near
arg __ARGS:word:4 = __ARGSIZE
__ARG struc
__BP dw ?
__IP dw ?
__STRING dw ? ; String address
__DT dw ? ; LONG DOUBLE number address
__ARG ends
...
.8087  ; Make sure coprocessor support is enabled
mov BX, __DT[BP]
fstp dt ptr [BX]  ; Use DT PTR for the type override
...
string_to_float endp

That should get your long double operations compiling without errors!

内容的提问来源于stack exchange,提问作者BEEET Hvcw

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.28 03:59:42