hello everyone !
just a question for curiosity  :idea:

Is there a shorter way to copy the float value to buffer ?
edi holds the pointer to buffer
Float is a real8

lea esi,Float
mov eax,
mov ,eax
add esi,4
add edi,4
mov eax,
mov ,eax
add esi,4
add edi,4
Posted on 2010-05-09 05:33:56 by jpam
That really depends on the databus width.

For a 32bit machine, you can either move the data in two dwords as you have, or you can use a FPU or MMX instruction to move it - which is shorter, but not as fast... it really still involves moving the data as separate dwords, and even worse, we endure bus contention waits that are not normally present.

For a 64 bit machine, you can move the whole real8 at once using any general purpose register.


Posted on 2010-05-09 05:52:21 by Homer
Thanks Homer

i was reading the opcode helpfile from masm
searching for some special opcode that auto increase the pointers in edi and esi, like STOS does
but could not find anything usefull.
Posted on 2010-05-09 06:16:59 by jpam

lea esi,Float
mov eax,
mov ,eax
add esi,4
add edi,4
mov eax,
mov ,eax
add esi,4
add edi,4


sure there are.


mov esi,0
mov eax,
mov ebx,
mov ,eax
mov ,ebx
inc esi

or

xor esi,esi
fld qword
fstp qword
inc esi

or

xor esi,esi
movq mm0,
movq ,mm0
inc esi

or... whatever solution you want.
Posted on 2010-05-09 06:25:52 by edfed
It really depends on the amount of data you want to move, the target CPU class, and whether you want to favor speed over size or size over speed.
Posted on 2010-05-09 10:05:31 by ti_mo_n
At this point, I have to assume that "Float" is a memory variable containing a single REAL8 value. The easiest way to copy it to another memory area pointed to by EDI is:

lea  esi,Float
movsd
movsd


If you have "n" consecutive REAL8 values to copy to another memory area pointed to by EDI:

mov  ecx,n
add  ecx,ecx
lea  esi,Float
rep  movsd


Posted on 2010-05-11 21:38:39 by Raymond
your code works... assuming es = ds, or at least, es defined to point to some chosen memory area.
Posted on 2010-05-12 17:34:53 by edfed

your code works... assuming es = ds, or at least, es defined to point to some chosen memory area.


... and also assuming that the direction flag is indeed clear.
Posted on 2010-05-12 18:05:12 by SpooK