Results 1 to 4 of 4

Thread: Help getting started in x86 assembly (or x86_64)

  1. #1
    Join Date
    Apr 2011
    Beans
    17

    Help getting started in x86 assembly (or x86_64)

    Hi, I was thinking of learning assembly language for x86 processors. I have a few questions, though, that I can't seem to find on Google. What kind of knowledge/tools do I need for this? Also, through a few google searches, I learned that the x86_64 instruction set is just an extension of the x86 set. Does that mean the code designed for x86 machines will work on x86_64? Lastly, is there any difference at all between amd64 and x86_64?

    EDIT: Also, is there a particular assembler I should use? I was planning to use GNU binutils as, but I also stumbled upon NASM and I don't know if there are any differences.
    Last edited by spencer the great; January 24th, 2014 at 06:59 AM.

  2. #2
    Join Date
    Nov 2005
    Location
    Bordeaux, France
    Beans
    11,292
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: Help getting started in x86 assembly (or x86_64)

    Study this book.

    But to answer your questions...

    Quote Originally Posted by spencer the great View Post
    What kind of knowledge
    See above.

    Quote Originally Posted by spencer the great View Post
    tools
    A text editor, an assembler and probably a compiler/linker as well. Just install build-essential, binutils, and your favourite text editor and assembler.

    Quote Originally Posted by spencer the great View Post
    I learned that the x86_64 instruction set is just an extension of the x86 set. Does that mean the code designed for x86 machines will work on x86_64?
    Yes, although in some cases if you have a 64 bit OS, you need to install additional software to run 32 bit code. This is a limitation of the OS, not of the CPU.

    Quote Originally Posted by spencer the great View Post
    Lastly, is there any difference at all between amd64 and x86_64?
    No, in most cases they are just different names for the same thing.

    Quote Originally Posted by spencer the great View Post
    EDIT: Also, is there a particular assembler I should use? I was planning to use GNU binutils as, but I also stumbled upon NASM and I don't know if there are any differences.
    Picking an assembler, just like picking a desktop environment or a text editor, is a matter of personal preference. GNU as and NASM/YASM basically just use different syntaxes to do the same thing.
    Last edited by Bachstelze; January 24th, 2014 at 10:41 AM.
    「明後日の夕方には帰ってるからね。」


  3. #3
    Join Date
    Aug 2011
    Location
    47°9′S 126°43W
    Beans
    2,165
    Distro
    Kubuntu 14.04 Trusty Tahr

    Re: Help getting started in x86 assembly (or x86_64)

    In addition to Bachstelze's answer: the more familiar you are with binary & hex notation, and bitwise manipulations the better. And you'll need a debugger. I rarely use debuggers for high-level languages but for ASM it's quite unavoidable, adding print statements in the code being rather cumbersome and having side effects (register usage...).
    Warning: unless noted otherwise, code in my posts should be understood as "coding suggestions", and its use may require more neurones than the two necessary for Ctrl-C/Ctrl-V.

  4. #4
    Join Date
    Dec 2004
    Location
    Manchester
    Beans
    2,086
    Distro
    Ubuntu Mate 15.10 Wily Werewolf

    Re: Help getting started in x86 assembly (or x86_64)

    You might like
    http://gcc.godbolt.org/
    I lets you see the assembly output from C source. (you might want to add -masm=intel to the compiler options to see x86)

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •