I HAVE ADDED FULL CODE
The issue is that I want to diagnose what is causing line: (fld $Tvalueinc[ecx]) to cause 1#IND after the 1st loop of $repeat.
I just want to utilize fnstenv/fstenv to view the TAG WORD register values to diagnose some issues, I understand its functions based on the Intel manual.
.386
.model flat, stdcall
option casemap :none
includelib \masm32\lib\msvcrt.lib
sprintf proto C :vararg
includelib \masm32\lib\user32.lib
MessageBoxA proto :ptr,:ptr,:ptr,:DWORD
includelib \masm32\lib\kernel32.lib
ExitProcess proto :dword
.data
_title db "Result",13,10,0
$interm db "%0.4f","+","%0.5f",13,10,0
Aval REAL8 1.000
Bval REAL8 -2.000
Cval REAL8 19.000
_fourval REAL8 4.000
$Tvalueinc REAL4 1.0,2.0,3.0,4.0,5.0,6.0,7.0,8.0,9.0,10.0
$sampleval real10 4478784.0
squareroot dq ?
$prevCW dw ?
.code
main PROC
LOCAL szBuf[9]:byte
fstcw $prevCW
fwait
fld Bval ; [loads first instance of b]]
fmul Bval ; [b*b = b^2]
fld Aval ;[Load a (a*c)]
fmul Cval ;(a*c)
fmul _fourval ;[4*a*c]
fsubp;[b^2-4*a*c]
ftst ;compare ST(0) with 0.0
fstsw ax ;[store camparison results in ax]
fwait;wait
sahf ;transfer flags from AH register
mov ecx, 04h
jb _negative ;jump if <0
fsqrt ;sqrt(b^2-4*a*c)
jmp Finished
_negative:
fld $sampleval
$repeat:
mov ax, $prevCW
push eax
fldcw [esp]
fld $Tvalueinc[ecx]
fstenv [esi]
mov eax,[esi+28]
fstsw ax
fdivp
FRNDINT
fldcw $prevCW
pop eax
fincstp
jne $repeat
Finished:
fstp squareroot
mov eax, dword ptr squareroot
mov edx, dword ptr squareroot[4h]
invoke sprintf, addr szBuf, offset $interm, eax, edx
invoke MessageBoxA, 0, addr szBuf, offset _title, 0
invoke ExitProcess, 0
main ENDP
END main