View Single Post
Old 09-16-10, 02:14 AM   #143
h.sie
Admiral
 
Join Date: Jul 2008
Posts: 2,192
Downloads: 131
Uploads: 0


Maybe here is someone with good x86 assembler skills, who could help me. While it is relative simple to do a conditional jump with integers in the CPU registers:

cmp EAX, EBX ; compare registers EAX and EBX
jge dest ; jump to dest if EAX > EBX

I found out that it is relative complex to do the same with floating-point values in the FPU, since one has to assure that FPU and CPU are syncronized:

fcom st(1) ; compare FPU registers st(0) and st(1)
fwait ; wait until FPU is ready (synchronize)
fstsw ax ; copy FPU status word to CPU register AX
fwait ; wait until FPU is ready (synchronize)
sahf ; set CPU flag registers according to AX for conditional jump
ja dest ; jump to dest if st(0) > st(1)

This works, but I don't like it. Is this really the most simple solution for a simple conditional jump??? I cannot believe that. Is the synchronization really necessary?? I cannot imagine that the CPU does not wait for the FPU.

Thanks.
h.sie

P.S: Maybe this is a good example to show my problems in order to damp down any expectations regarding complex addons in the future.
__________________
My Mediafire page: http://www.mediafire.com/hsie

Last edited by h.sie; 09-16-10 at 04:16 AM.
h.sie is offline   Reply With Quote