just making sure, the mov instruct cannot mov an instruction from memory(RAM) to another spot in memory(RAM) correct?
u must first move it from ram to register then from register back to ram? correct??
Posted on 2010-12-07 09:27:52 by dougfunny
Yes, with one exception being MOVS#. (#=B|W|D|Q)
MOVSD = MOVeS Dword from esi to edi.

example (64bit mode):
  lea rsi,source
  lea rdi,destination
  mov ecx,10
  rep movsq; REPeat eCX times

Posted on 2010-12-07 10:01:33 by drizz

mov [mem], imm can be considered as memory-to-memory copy (as push/pop [mem] does ;)).
Posted on 2010-12-09 16:31:18 by baldr
push/pop can be considered but would you recommend it?  ;)

i mean changing esp to control source / destination
Posted on 2010-12-09 19:13:50 by drizz

esp isn't a holy cow. Use it carefully and you'll get yourself very specific general-purpose register. ;)

; "Weird Hello.fasm"
                format  PE GUI
                include "WIN32A.INC"

                section ".code" code executable readable writeable
                entry  $
                mov    esp, wicked_stack
MessageBox:    jmp    [__imp__MessageBoxA@16]
ExitProcess:    jmp    [__imp__ExitProcess@4]

                cmp    eax,
                pop    eax
                pop    eax
                jnz    @f
                mov    esp, eax
@@:            ret

                rb      65536

                section ".data" data readable writeable
                dd      MessageBox
                dd      HWND_DESKTOP, hello_world, hello_caption, MB_OK+MB_ICONEXCLAMATION
                dd      eax_eq_literal?_branch
                dd      HWND_DESKTOP, goodbye_world, hello_caption, MB_YESNO+MB_ICONQUESTION
                dd      IDYES, goodbye_ok
                dd      MessageBox
                dd      ExitProcess
                dd      HWND_DESKTOP, goto_hell_world, hello_caption, MB_OK+MB_ICONINFORMATION
                dd      0
                dd      -1
goodbye_ok:    dd      ExitProcess
                dd      0
                dd      0

hello_caption  db      "Weird Hello", 0
hello_world    db      "Hello, World!", 0
goodbye_world  db      "Goodbye, World?", 0
goto_hell_world db      "Go to hell, cruel World!", 0

                data    import
                library USER32, "USER32.DLL",\
                        KERNEL32, "KERNEL32.DLL"
                import  USER32,\
                        __imp__MessageBoxA@16, "MessageBoxA"
                import  KERNEL32,\
                        __imp__ExitProcess@4, "ExitProcess"
                end    data
Posted on 2010-12-10 12:08:33 by baldr
If this example is for me, thanks, but nothing I already didn't know.

this are 2 more examples of mem to mem copy in a single instruction(push/pop) - I do not recommend even considering using them.
	mov edx,destination
mov esp,source
pop ; copy dword
mov edx,source
mov esp,destination
add esp,4
push ; copy dword
Posted on 2010-12-10 16:57:44 by drizz

I'm just trying to emphasize the thesis that esp is kinda special GPR (yes, general-purpose register). Use it as you wish, but not without consequences. ;)
Posted on 2010-12-14 14:29:32 by baldr