flat assembler
Message board for the users of flat assembler.
![]() |
Author |
|
UniverseIsASimulation
Hey, guys!
So, I've studied a bit how you can embed Assembly into C, and I've posted an example of how to do that on my website. Do you think what I wrote there is clear and accurate? How can I improve that example? |
|||
![]() |
|
UniverseIsASimulation
Quote: I believe GCC features something to access stack variables from asm Yes, but that, as far as I know, only works if you use AT&T syntax. |
|||
![]() |
|
Furs
IMO you should either write the entire function in asm, or use inline asm with operands. This is very powerful, because you tell the compiler what are the inputs, outputs, clobbers, jump targets, etc.
When it knows such information, it can produce much better code, and you don't have to deal with global variables. You can specify an operand to reside either in memory or register or whatever else, and GCC will choose based on surrounding code what it thinks it's best, etc. Raw inline asm by contrast produces sub-optimal code surrounding your asm. Only thing is that it takes a while to learn it properly. But I love it. ![]() |
|||
![]() |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2020, Tomasz Grysztar. Also on GitHub, YouTube, Twitter.
Website powered by rwasa.