Questions tagged [x87]

x87 is the legacy 80bit floating point subset of the x86 instruction set. It's obsoleted by SSE/SSE2 for float/double, but is still useful for 80bit extended precision. The 32bit x86 ABI also returns FP results in an x87 register. See the tag wiki for a tutorial link.

See the wiki for links, including the most useful one: http://www.ray.masmcode.com/tutorial/index.html.

249 questions
0
votes
1 answer

Explain how the FFREE instruction works

http://en.wikipedia.org/wiki/X86_instruction_listings how does the ffree instruction excatly works ? FFREE Free register when i have in FPU STack: st2 5 , st1 2, st0 7 then after these instruction(ffree) i have.. st 1 5, st0 2 is that…
Kamil Witkowski
  • 1,978
  • 1
  • 19
  • 33
0
votes
0 answers

Nasm fiadd operation size not specifed error

I use nasm and FPU x86 Instructions. now let's say i have in FPU st0 0. i have variable : jedynka: dd 1.0 and now operation: fiadd [jedynka] doesn't work, error in nasm: error: opeartion size not specifed when: fiadd dword [jedynka] , the…
Kamil Witkowski
  • 1,978
  • 1
  • 19
  • 33
0
votes
0 answers

Assembler taylor series arctg x

I wrote program in assembly that takes only two variables from C program, then returns the answer to C program at the end. I got problem with finding what is wrong in assembly file. My goal is to write program using FPU (nasm), that will count…
Kamil Witkowski
  • 1,978
  • 1
  • 19
  • 33
0
votes
1 answer

About x87 FPU precision

In the Intel IA-32 software developer manual. It says that bit 8 & 9 of x87 FPU control word determines the precision of floating-point calculations. The default precision is double extended precision. After the instruction "FINIT" is executed, the…
Gary Yin
  • 525
  • 6
  • 17
0
votes
0 answers

Getting -nan when doing computations with the FPU Nasm x86 Assembly

First of all I would like to thank anyone who replies to this, your help is greatly appreciated! I am trying to compute the standard deviation of a set of floating point numbers passed to my program as command line parameters. First I store each of…
Tom
  • 67
  • 8
0
votes
1 answer

Simple addition of single precision floats in x87 FPU

I'm writing a small assembly program which takes two single-precision floating point numbers, adds them together and displays the result. However, I would like to have the result saved in a register for later use. To help me get started, I've…
spurra
  • 1,007
  • 2
  • 13
  • 38
0
votes
1 answer

Invalid operand size for instruction

So I'm trying to finish up my averaging program with float numbers, but I'm getting an invalid operand size. I don't understand what I'm doing wrong. .386 .model flat public _Average .code _Average proc finit mov ecx, [esp + 4] …
user2980447
  • 11
  • 1
  • 1
0
votes
1 answer

Dividing longfloat and int in Assembly x86-64

I have a program where i loop for as long as the user enters Y (for yes). The user then inputs data of type long float. I also have a counter, r14, which will count each time they input a long float. After the loop ends, i wish to calculate the…
vap
  • 95
  • 1
  • 1
  • 7
0
votes
2 answers

fpu state (x87)

I am searching for info about how many values can be considered as part of current fpu state (I mean the values on which floating point code calculations depend on) I know that it would be 3 modes of precission, 4 modes of rounding, about 5 bit…
grunge fightr
  • 1,360
  • 2
  • 19
  • 38
0
votes
1 answer

Why loop failed in asm(x87)

I have some calculation in asm in loop, it must be before Sum will be 3, but loop work all time and never ending. Here is mu code: int main() { float Sum=0; int i=0; int A=5; int B=180; int C=3; _asm{ finit m1:inc i …
Andrew
  • 266
  • 6
  • 18
0
votes
1 answer

How make look and put to array in asm(x87)

I have a task - calculate 6 results of function (Y = (20 * x) /(5 * x2 – 8,5)) the x - start from 1 and each calculation must increas by 4 (1, 5, 9 ..). I write some code but i dont understand how to made loop and put data to array. All operation…
Andrew
  • 266
  • 6
  • 18
0
votes
2 answers

Resetting 8087CW in C++ causing exception in .NET application

I am working with a .NET 3.5 application in C# that calls some legacy C++ code regularly. I've noticed that calling into the C++ sometimes leads to an "Overflow or underflow arithmetic operation" when I mouse over an Infragistics UltraGrid that has…
Everett
  • 1,077
  • 5
  • 23
  • 42
-1
votes
1 answer

NASM trying to multiply integer by float, printf writes garbage

I tried creating a very simple example: a conversion program, where one number is an int and the other is a double. global _main extern _printf section .data km_h dd 70 format db '%fmph=%dkm/h',10,13,0 km_mi dq 1.609 section…
-1
votes
1 answer

Error: Memory operand not allowed in context

.code orderTotal db 0.0 Burger: fadd dword ptr [orderTotal], 10 jmp Food Pizza: fadd dword ptr [orderTotal], 16 jmp Food ChickenRice: fadd dword ptr [orderTotal], 8 jmp Food It is supposed to add value into orderTotal,…
BrP
  • 1
-1
votes
1 answer

x86 Assembly Question - Can anyone determine what is happening below?

I downloaded a modification for a 20+ year old game I play, which is written in assembly code. It adds a fog effect, and then varies the grip levels based on that. However, the fog level is chosen seemingly at random. Is it easy to see that…
1 2 3
16
17