Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

Intel assembly question

Options
  • 20-06-2006 4:01pm
    #1
    Closed Accounts Posts: 2,349 ✭✭✭


    I can't find this anywhere without sifting through rotting techie manuals, but is it true with intel assembly that

    "mov eax, edx" moves the value of edx into eax and
    "mov [eax], edx" moves the value of edx into the memory address pointed to by eax?

    If so, can anyone explain to me first off all what all that "DWORD PTR" stuff is about, and secondly what the hell is the point of the LEA instruction?

    .text:7C921A3E mov eax, [ebp+8]
    .text:7C921A43 lea ecx, [eax+4]

    Take for example those two lines. If I'm not mistaken the mov instruction moves the value ebp+8 into the eax register.
    Equivalent to eax=ebp+8

    The second line loads eax+4 into ecx.
    Equivalent to ecx=eax+4.

    Is this not the same as the mov instruction? What can be done with LEA that can't be done with mov??


Comments

  • Registered Users Posts: 9,579 ✭✭✭Webmonkey


    Well LEA is Load Effective Address, so no it doesn't load eax+4 into ecx.
    It loads ecx with the offset of the location specified by the memory operand ([eax+4]) so no, its a completly different instruction than the mov.

    As for the First instruction mov eax, [ebp+8], - no this does not move epb+8 in. The [ ] are indicating the processor to go to the memory location of ebp+8 and fetch the data from there and store it in eax.

    About the DWORD PTR, don't have a clue sorry. All i know is DWORD means Double Word = 2 x Word = 2 * 2 bytes = 4 bytes? My memory is bad with this
    God its being ages since i've being reading on this, makes me want to get back into it.
    An Excellent , free ebook to read is the Art Of Assembly. I havnt read it all, not even a 1/4 yet,stopped months ago but i must get back into it.


  • Closed Accounts Posts: 2,349 ✭✭✭nobodythere


    Thanks for the book recommendation, I'm learning from a book called secrets of reverse engineering.
    I get what you're saying, thanks a mill, all of this data/metadata, things pointing to other things and which is which is what I have to get my head around to understand the language.


  • Registered Users Posts: 9,579 ✭✭✭Webmonkey


    No probs, but seriously read the first few chapters of Art of Assembly, it is amazenly detailed with diagrams.

    Quick link to it direct for you:
    www.planetpdf.com/codecuts/pdfs/aoa.pdf

    Good luck with it anyways


  • Closed Accounts Posts: 884 ✭✭✭NutJob


    DWORD PTR
    BYTE PTR

    just controls the size of the read from the offset


    satying 16bit here as its been a while


    read a byte:

    mov ah,byte ptr[bp + offset crap]

    mov ax,word ptr[bp+ offset crap]


    suggest u read up on these as thell cause confusion later if u dont get them down right


Advertisement