What do the dollar ($) and percentage (%) signs represent in x86 assembly?

后端 未结 5 1220
耶瑟儿~
耶瑟儿~ 2020-12-15 03:01

I am trying to understand how the assembly language works for a micro-computer architecture class, and I keep facing different syntaxes in examples:

sub $48,         


        
5条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-12-15 03:58

    Thats not Intel syntax, its AT&T syntax, also called GAS syntax.

    the $ prefix is for immediates (constants), and the % prefix is for registers (they are required1).

    For more about AT&T syntax, see also the [att] tag wiki.


    1 Unless the noprefix option is specified, see here & here. But usually noprefix is only used with .intel_syntax noprefix, to get MASM-like syntax.

提交回复
热议问题