News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

Learning about the FPU

Started by Druesukker, April 24, 2011, 05:35:06 PM

Previous topic - Next topic

Druesukker

Hello it's me again hehe  :U

Now I'm learning about the FPU and i have a problem with the control register.
I'm setting the Invalid operation flag to 0, and when I'm invoking a stack overflow i
can not catch the exception with the HLA exception ex.fInvalidOperation it just get the
windows message "The program has stopped working".

When I'm only using the status register i can find out about the overflow,
but i want to learn how to use the control register too  :bg

I have my code right here:

program MyProgram;
#includeonce( "stdin.hhf" )
#includeonce( "stdout.hhf" )
#includeonce( "excepts.hhf" )

static
number: real80 := 1.523;
controlWord: word;

begin MyProgram;

fstcw( controlWord );
mov( controlWord, ax );
and( $FE, ax );
mov( ax, controlWord );
fldcw( controlWord );

try

for( mov( 0, cl ); cl < 10; inc( cl ) ) do

fld( number );

endfor;

exception( ex.fInvalidOperation )
stdout.put( "Invalid operation!" nl );

endtry;

end MyProgram;