나는 산술 연산을 수행하는 MASM32 프로젝트에서 일하고 있습니다. 부동 소수점 유닛을 사용하려면 코 프로세서 (8087 명령어 세트)를 사용해야합니다. 그래서 내 부동 소수점 한도는 100.0
이고 모든 수는 제한보다 작아야합니다. 두 개의 숫자를 더한 다음 결과를 비교하려고 시도하지만 작동하지 않습니다.float sum을 비교하십시오.
.386
.model flat, stdcall
option casemap :none
include \masm32\include\windows.inc
include \masm32\include\kernel32.inc
include \masm32\include\user32.inc
includelib \masm32\lib\kernel32.lib
includelib \masm32\lib\user32.lib
include c:\masm32\include\masm32rt.inc
.data
;Variables de comparación.
FP_max DD 100
;Variables volcadas de la tabla de símbolos.
_a DD 25
_b DD 80.0
.code
start:
fild _a
fild _b
fadd
fcom FP_max ;compare ST(0) with the value of the real8_var variable
fstsw ax ;copy the Status Word containing the result to AX
sahf ;transfer the condition codes to the CPU's flag register
ja overflow ;when all flags are 0
jmp end_program
overflow:
print "ERROR: overflow.", 13, 10, 0
jmp end_program
end_program:
invoke ExitProcess, 0
end start
제 질문은 : 내가 뭘 잘못하고있는 걸까요? 어떻게 해결할 수 있습니까? 감사!
'fcomi'를 사용하면'fstsw ax' /'sahf'를 사용한 것처럼 플래그를 직접 설정할 수 있습니다. (내가 생각하기에 ppro, 즉 지난 20 년간의 x86이 필요합니다.) –