1

未定义符号:WriteFloat

; Implementation of the following expression:
; (6.0 * 2.0) + (4.5 * 3.2)
; FPU instructions used.

INCLUDE Irvine32.inc    ; 32-bit Protected mode program.
Include Macros.inc

.data
    array REAL4 6.0, 2.0, 4.5, 3.2
    dotProduct REAL4 ?
    val BYTE ?

.code
main PROC

    finit               ; initialize FPU
    fld array           ; push 6.0 onto the stack
    fmul array+4        ; ST(0) = 6.0 * 2.0
    fld array+8         ; push 4.5 onto the stack
    fmul array+12       ; ST(0) = 4.5 * 3.2
    fadd                ; ST(0) = ST(0) + ST(1)
    fstp dotProduct     ; pop stack into memory operand
    call WriteFloat

    exit
main ENDP

END main

我的代码正在运行。问题只是WriteFloat。当我将 WriteFloat 更改为 WriteInt 或 WriteDec 时,没有错误。但我无法得到我的确切结果。我有 Irvine32.lib、Macros.inc,我正在使用 masm615,我的编辑器是 textpad。

4

1 回答 1

0

换行

fstp dotProduct 

fst dotProduct 

WriteFloat 使用堆栈上的值,但 fstp 从堆栈中删除值。fst(没有“p”)让堆栈上的值。

于 2014-09-13T08:26:51.730 回答