hi
its me again... :P
does any one knows how to do this :
using fpu instructions ?
thx again
its me again... :P
does any one knows how to do this :
mov ecx,10
.while ecx
invoke ....
dec ecx
.endw
using fpu instructions ?
thx again
_10 WORD 10
fild _10
floopy:
.
.
.
.
fld1
fsub st(7), st
fcomip st, st(7) ; P6+ required
jna floopy ; C=1 or Z=1
The ST(7) on the end assumes you have other stuff on the FPU stack - ST(7) is the loop counter. I can usually get by with using the general purpose registers.le me see if i got it....
we load _10 to ST(0), then we decrement the TOP register and load 1....
so where is the _10 ? on ST(7) ?
im confused :?
_10 WORD 10 ; Declare _10 = 10
fild _10 ; ST(0) = _10
floopy: ; The Loop...
.
. ; Stuff to do...
.
.
fld 1 ; ST(0) = 1
fsub st(7), st ; ST(7) -= ST(0)
fcomip st, st(7) ; is ST(0) = ST(7) ?
jna floopy ; if not, loop again....
we load _10 to ST(0), then we decrement the TOP register and load 1....
so where is the _10 ? on ST(7) ?
im confused :?
GR33d, try using 6 more FPU slots, or change ST(7) to ST(1) if you don't use the FPU for anything else.
Using an FPU register as a counter would be about the worse thing you should ever try doing for numerous reasons. Here are a few:
- There are only 8 FPU registers which are a very valuable resource when compared to the millions of memory bytes which can be used for the same purpose.
- You would have to keep track of which FPU register is holding your counter, as compared to a fixed address for a memory variable or a fixed CPU register.
- Decrementing a memory variable will affect CPU flags immediately; a comparison is necessary to verify the status of an FPU register.
And..... if your counter is in st(7) and you try loading a value of 1 with the "fld1" instruction (or any other instruction), not only would you trash your counter but the "1" would not even be loaded. READ THE TUTORIAL.
Raymond
- There are only 8 FPU registers which are a very valuable resource when compared to the millions of memory bytes which can be used for the same purpose.
- You would have to keep track of which FPU register is holding your counter, as compared to a fixed address for a memory variable or a fixed CPU register.
- Decrementing a memory variable will affect CPU flags immediately; a comparison is necessary to verify the status of an FPU register.
And..... if your counter is in st(7) and you try loading a value of 1 with the "fld1" instruction (or any other instruction), not only would you trash your counter but the "1" would not even be loaded. READ THE TUTORIAL.
Raymond
so...
after all...
we should reject the idea of making a .while instruction with floting numbers right ?
and .... using eax,ebx,ecx for a .while wold be slower than making a .while with fpu instructions ?
thx
after all...
we should reject the idea of making a .while instruction with floting numbers right ?
and .... using eax,ebx,ecx for a .while wold be slower than making a .while with fpu instructions ?
thx
And..... if your counter is in st(7) and you try loading a value of 1 with the "fld1" instruction (or any other instruction), not only would you trash your counter but the "1" would not even be loaded. READ THE TUTORIAL.
Raymond
Sorry to confuse you - I did not mean the counter is in st(7) until after "1" is loaded. I tried to clarify by stating to load 6 other FPU values. Somehow the code seemed very clear to me.Raymond
we should reject the idea of making a .while instruction with floting numbers right ?
RIGHT
using eax,ebx,ecx for a .while wold be slower than making a .while with fpu instructions ?
WRONG Using a CPU register would definitely be faster.
Raymond