0

atm Im learning assembler. The problem is that I started learning assembler with the Intel syntax, so Im not that familiar with the AT&T syntax. I know the basics of the AT&T already but I still have two questions:

  1. When using inline asm in my C++ project, how do i access the variables, parameters or functions outside the asm-code? With Intel syntax it's pretty self explaining but I have no idea how to do that with AT&T sytax.

  2. How can I return a value in asm? When I have a C++ function with an asm part, how can i say asm that I want to return a special value?

Im using a windows 8 VM with x86 32bit processor btw

  • Have you seen [Can I use Intel syntax of x86 assembly with gcc?](http://stackoverflow.com/questions/9347909/can-i-use-intel-syntax-of-x86-assembly-with-gcc?rq=1) – Bo Persson May 22 '16 at 01:33
  • Don't access named variables from within the inline asm. Use input/output operands. Inline asm is the hardest way to learn asm. If you're not confident you know when to use a `"memory"` clobber, and when to use a `"=&r"` early-clobber output operand, etc. etc., then write whole functions in asm and call them from C. Then you can use NASM. If you do still want to use GNU C inline asm, then see [the bottom of this answer](http://stackoverflow.com/questions/34520013/using-base-pointer-register-in-c-inline-asm/34522750#34522750) for links to docs, and my answers showing how to use it well. – Peter Cordes May 22 '16 at 01:38
  • Thanks Bo!!! it worked. But I think I should stop learning inline assembler for now and concentrate on another kind of assembler, until I have a really solide knowledge. – Troll Sama bin Laden May 22 '16 at 17:27

0 Answers0