Is there anywhere I can find any specific information about FPU memory addressing modes? The FPU helpfile included with MASM32 is confusing, and I haven't seen any other information anywhere.
What I'm trying to find out is whether the FPU can use indirect memory addressing... ex.
...
VECTOR STRUCT 4
x REAL4 ?
y REAL4 ?
VECTOR ENDS
PVECTOR typedef PTR VECTOR
.code
VectorLenSq PROC pV:PVECTOR
fld .x ; <- can I do this?
fmult .x ; <- or this?
...
The helpfile says that one of the addressing modes available is longs, which makes me think it may be possible, though it may require loading bx with the displacement instead of using an immediate displacement. Anyone else know where I can find more info?
What I'm trying to find out is whether the FPU can use indirect memory addressing... ex.
...
VECTOR STRUCT 4
x REAL4 ?
y REAL4 ?
VECTOR ENDS
PVECTOR typedef PTR VECTOR
.code
VectorLenSq PROC pV:PVECTOR
fld .x ; <- can I do this?
fmult .x ; <- or this?
...
The helpfile says that one of the addressing modes available is longs, which makes me think it may be possible, though it may require loading bx with the displacement instead of using an immediate displacement. Anyone else know where I can find more info?
The FPU help in masm32 seems to use 16-bit registers, don't know why... It's probably an old text. So read ebx for bx, esi for si etc. That's what you use in 32-bit.
But what you want to do is not possible even with normal integer instructions. It's not just indirection, its double indirection.
'pV' is actually at . So to get the actual pointer you need the value at (the firts indirect access).. Then you add 4 to that pointer (VECTOR.x) and get the real4 at that point (the second indirect access). So there's no way you can do it with one instruction.
Thomas
But what you want to do is not possible even with normal integer instructions. It's not just indirection, its double indirection.
'pV' is actually at . So to get the actual pointer you need the value at (the firts indirect access).. Then you add 4 to that pointer (VECTOR.x) and get the real4 at that point (the second indirect access). So there's no way you can do it with one instruction.
Thomas
Oh yeah, that's right. Well, thanks... I'm glad I asked before I actually tried to implement it.
The easiest way of finding out if the construction of an instruction is acceptable is to write a small program with such an instruction and
(i) first see if the assembler accepts such syntax,
(ii) use a debugger and see if the result is as expected.
You can usually accomplished the above within a few minutes, which should be a lot faster and definitely more conclusive than researching the subject.
Using the above, you would find out that MASM will not accept the "parameter.item" struc syntax of a parameter in a procedure. However, you can pass the "parameter.item" of a structure to a procedure. I tested the following code which works just fine.
;*************************
.data
VECTOR STRUCT 4
x REAL4 ?
y REAL4 ?
VECTOR ENDS
PVECTOR VECTOR <1.1,2.2>
.code
start:
invoke VectorLenSq,PVECTOR.x,PVECTOR.y
invoke ExitProcess,0
VectorLenSq PROC pVx:DWORD, pVy:DWORD
fld pVx ;loads 1.1
fmul pVy ;gives the expected 2.42 result
ret
VectorLenSq endp
end start
;************************
Raymond
(i) first see if the assembler accepts such syntax,
(ii) use a debugger and see if the result is as expected.
You can usually accomplished the above within a few minutes, which should be a lot faster and definitely more conclusive than researching the subject.
Using the above, you would find out that MASM will not accept the "parameter.item" struc syntax of a parameter in a procedure. However, you can pass the "parameter.item" of a structure to a procedure. I tested the following code which works just fine.
;*************************
.data
VECTOR STRUCT 4
x REAL4 ?
y REAL4 ?
VECTOR ENDS
PVECTOR VECTOR <1.1,2.2>
.code
start:
invoke VectorLenSq,PVECTOR.x,PVECTOR.y
invoke ExitProcess,0
VectorLenSq PROC pVx:DWORD, pVy:DWORD
fld pVx ;loads 1.1
fmul pVy ;gives the expected 2.42 result
ret
VectorLenSq endp
end start
;************************
Raymond
I give you an URL that is say it is where (in my site) I put
a good manual for FPU (Floating Point)...
Go to chapter 7 and you'll find all about Floating Point...
http://pageperso.aol.fr/GerardChap/asm-ref.zip
If some of you , want to see good programmation I advice to you
another good URL ...
http://pageperso.aol.fr/GerardChap/Start.html
G?rard
------------------------------------------------------------
"Pride permits to overcome the diffilculty of knowing"
( Unknown )
a good manual for FPU (Floating Point)...
Go to chapter 7 and you'll find all about Floating Point...
http://pageperso.aol.fr/GerardChap/asm-ref.zip
If some of you , want to see good programmation I advice to you
another good URL ...
http://pageperso.aol.fr/GerardChap/Start.html
G?rard
------------------------------------------------------------
"Pride permits to overcome the diffilculty of knowing"
( Unknown )