Please advice me in how to use the FPU. I can use FPU but I cant use FADD.

I know fpu a an 80 bit register. but I dont know how to load to REAl8 values in the fpu and how to return to my c program
Posted on 2005-04-18 21:17:16 by luisvalencia
Use fld to load a real value (the assembler will adjust according to the type being loaded).
Use fchs to change the sign
Use fsub to subtract.
Use fstp to store and pop the result of the floating point stack.

Mirno
Posted on 2005-04-19 07:36:24 by Mirno
1. Can I put many real4 values on the fpu registers??


I can use FPU registers the only thing I cant use its FADD and FSUB for addition and substraction

If I have this

SumarFloat  Proc var1:real4, var2:real4



endp


What code must I put inside to load var1 and var2 in two different FPU registers.

After it I can manipulate the bits.


and suppose I already sum the two float numbers. How can I return to my c program?

DO I have to put RET??
Posted on 2005-04-19 08:52:38 by luise.valencia
Have you ever bothered to read any of the instruction references for the x86?

FLD var1 -- Push var1 onto the FPU register stack.

After that you can't manipulate the bits, because the floating point registers do not support binary arithmetic. The floating point registers, and the associated FPU instructions are designed for floating point maths only. This is all very clear if you ever read ANY documentation.

Do you have to put RET? Only if you want your function to return. If you don't mind it crashing or running on to the function following it in memory feel free to not put it in. This is a fundamental basic point of assembly language programming.

In case you haven't noticed, my patience is wearing thin. Please for the love of God try to do this yourself, after a week of constant questioning you've got as far as an empty function with two arguments. To me that isn't progress, that's embarrasing.

Mirno
Posted on 2005-04-19 09:44:14 by Mirno
so if I cant manipulate bits on the fpu register stack I cant make anything

Posted on 2005-04-19 13:07:40 by luise.valencia
Perhaps you should have paid some attention in your class?
Posted on 2005-04-19 16:44:33 by f0dder

so if I cant manipulate bits on the fpu register stack I cant make anything


I'm just about fed up with reading these posts. Luise, if you are not prepared to take the responsibility of learning yourself, they don't come here looking for help.
Posted on 2005-04-19 17:00:56 by SpooK
have you actually played with any of the code lots of people here helped you with and not just printed it out, put your name on it and submitted it for homework? i'd guess the answer is no because anyone who actually bothered to even google for information on the fpu .. try it..

http://www.google.co.uk/search?q=fpu+tutorial&sourceid=mozilla-search&start=0&start=0&ie=utf-8&oe=utf-8&client=firefox-a&rls=org.mozilla:en-US:official

see the very FIRST hit, read it and stop being a lazy git
Posted on 2005-04-19 20:05:11 by evlncrn8
he got kicked from the masm board, for continuing to annoy the members with requests to do his work for him. He never made the effert to try and code something himeself.
Posted on 2005-04-20 00:42:34 by rags
Well, my decision stands. He can stay here if he tries to do his own work and learn for himself. Any more posts that ultimately break down to "please spoon feed me source code", and he will be banned.
Posted on 2005-04-20 00:51:22 by SpooK