trying to divide a float value that is in my FPU stack by a integer value that is stored in a register

this is the code i tried first
i'm positive that fstp is putting the value on the stack, because it's outputting it correctly

any ideas? or should i do this differently?

fstp    qword	[ebx]   ;Copy contents of st0 to space currently on top of the system stack
	fld	qword	[edi]	;move edi onto FPU
	fdiv			; divide?
	fstp	qword	[ebx]	;copy the result to print it out

Hi,
1. First of all, I advice you calling finit.
2. May be you must set the fpu control word.
3. Suposse you have a real number on st(0)
4. To divide it by an integer you need the address of the integer not the value in a register. You need the integer in memory -or on the stack-.
5. If ebx points to the four bytes of the integer, simply:
fidiv dword ptr [ebx] ;This is writen with masm sintax.
6. The value on st(0) will disapear and will be replaced with the result.

Cheers.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.