Hello,
I have a lot of real numbers to put on a structure and
fld 0.5 ;error A2050: real or BCD number not allowed
Is there an ascii to real function somewhere ?
ToutEnMasm
There's one in the MASM32 - see FpuLIB by Raymond.
FLD needs the source to be a memory address, so to use "fld 0.5" try
.const
half REAL4 0.5 ;can be REAL8 or REAL10
.code
...
fld half
That error should say "immediate value not allowed"... ::)
Thanks at all,
It's the method i have first used
TREAL4 MACRO pvalue:REQ,text:REQ
invoke StrToFloat,SADR(text),addr ChargeReal
fld real8 ptr ChargeReal
fstp real4 ptr pvalue
ENDM
But zooba have posted a macro in the masm forum that solve the problem using the definition of a real4.
movr4 MACRO dest, src
mov dest, 0BADF00Dh ; make sure it's using a full DWORD move
ORG $-4
REAL4 src ; now overwrite with our real number
ENDM
The two give the same result ,but the movr4 used less time of the processor.
and the method with defined constants give another useful
ToutEnMasm
ToutEnMasm
Ok,it seems that i have learn something this time.I have write a very simple method
I have verified it with the debugger,the result is correct.
ToutEnMasm
R4MOV MACRO dest,src
local reel
.const
reel REAL4 src
.code
PUSH reel
POP dest
ENDM