{"id":13656,"date":"2022-12-08T16:20:44","date_gmt":"2022-12-08T16:20:44","guid":{"rendered":"http:\/\/blog.bachi.net\/?p=13656"},"modified":"2022-12-08T20:19:59","modified_gmt":"2022-12-08T20:19:59","slug":"assembly-intel-vs-att-syntax","status":"publish","type":"post","link":"https:\/\/blog.bachi.net\/?p=13656","title":{"rendered":"Assembly Intel vs. AT&#038;T Syntax \/ GAS vs. NASM"},"content":{"rendered":"<p><a href=\"https:\/\/sdasgup3.github.io\/Intel_Vs_Att_format\/\">Differences in Intel (NASM) vs AT&#038;T (GAS) Syntax.<\/a><\/p>\n<p><a href=\"https:\/\/developer.ibm.com\/articles\/l-gas-nasm\/\">Linux assemblers: A comparison of GAS and NASM<\/a>, A side-by-side look at GNU Assembler (GAS) and Netwide Assembler (NASM)<\/p>\n<p><a href=\"https:\/\/stackoverflow.com\/questions\/13793609\/nasm-vs-gas-practical-differences\">NASM Vs GAS (Practical differences)<\/a><br \/>\n<a href=\"https:\/\/stackoverflow.com\/questions\/9347909\/can-i-use-intel-syntax-of-x86-assembly-with-gcc\">Can I use Intel syntax of x86 assembly with GCC?<\/a><br \/>\n<a href=\"https:\/\/stackoverflow.com\/questions\/36898966\/using-intel-syntax-noprefix-how-can-i-get-memory-address-of-a-label\">Using &#8220;.intel_syntax noprefix&#8221; how can I get memory address of a label?<\/a><br \/>\n<a href=\"https:\/\/stackoverflow.com\/questions\/10168743\/which-variable-size-to-use-db-dw-dd-with-x86-assembly\">Which variable size to use (db, dw, dd) with x86 assembly?<\/a><br \/>\n<a href=\"https:\/\/stackoverflow.com\/questions\/8006711\/whats-the-difference-between-equ-and-db-in-nasm\">What&#8217;s the difference between equ and db in NASM?<\/a><br \/>\n<a href=\"https:\/\/stackoverflow.com\/questions\/34349675\/no-such-instruction-error-when-assembling-an-array-declaration\">&#8220;no such instruction error&#8221; when assembling an array declaration<\/a><br \/>\n<a href=\"https:\/\/stackoverflow.com\/questions\/21624155\/difference-between-equ-and-word-in-arm-assembly\">Difference between .equ and .word in ARM Assembly?<\/a><br \/>\n<a href=\"https:\/\/stackoverflow.com\/questions\/51421942\/why-are-there-empty-address-spaces-between-data-sections-in-memory-x86-nasm\">Why are there empty address spaces between data sections in memory (x86 \/ nasm)?<\/a><br \/>\n<a href=\"https:\/\/stackoverflow.com\/questions\/10361231\/what-does-the-dollar-sign-mean-in-x86-assembly-when-calculating-string-lengt\">What does the dollar sign ($) mean in x86 assembly when calculating string lengths like &#8220;$ &#8211; label&#8221;? [duplicate]<\/a><\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\nmov si, name              \r\nmov si, &#x5B;name]\r\nmov si, word ptr &#x5B;name]\r\nmov si, offset name\r\n<\/pre>\n<p>EQU defines a symbol to a given constant value: when EQU is used, the source line must contain a label. The action of EQU is to define the given label name to the value of its (only) operand. This definition is absolute, and cannot change later. So, for example,<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\nmessage         db      'hello, world' \r\nmsglen          equ     $-message\r\n<\/pre>\n<p>defines msglen to be the constant 12. msglen may not then be redefined later. This is not a preprocessor definition either: the value of msglen is evaluated once, using the value of $ (see section 3.5 for an explanation of $) at the point of definition, rather than being evaluated wherever it is referenced and using the value of $ at the point of reference.<\/p>\n<table border=\"0\" cellspacing=\"0\" width=\"534\">\n<tbody>\n<tr>\n<td valign=\"TOP\" width=\"26%\"><u><font size=\"2\">Operand <\/font><\/u><\/td>\n<td colspan=\"2\" valign=\"TOP\">&nbsp;<u><font size=\"2\">Format<\/font><\/u><\/td>\n<td colspan=\"2\" valign=\"MIDDLE\">&nbsp;<u><font size=\"2\">6811\/6812example<\/font><\/u><\/td>\n<\/tr>\n<tr>\n<td valign=\"TOP\" width=\"26%\"><font size=\"2\">no operand<\/font><\/td>\n<td colspan=\"2\" valign=\"TOP\"><font size=\"2\">accumulator and inherent<\/font><\/td>\n<td colspan=\"2\" valign=\"TOP\"><font color=\"#0000FF\" size=\"2\" face=\"Courier,Courier New\">clra<\/font><\/td>\n<\/tr>\n<tr>\n<td valign=\"TOP\" width=\"26%\"><font size=\"2\">&lt;expression&gt;<\/font><\/td>\n<td colspan=\"2\" valign=\"TOP\"><font size=\"2\">direct, extended, or relative<\/font><\/td>\n<td colspan=\"2\" valign=\"TOP\"><font color=\"#0000FF\" size=\"2\" face=\"Courier,Courier New\">ldaa<\/font><font size=\"2\" face=\"Courier,Courier New\"> 4<\/font><\/td>\n<\/tr>\n<tr>\n<td valign=\"TOP\" width=\"26%\"><font size=\"2\">#&lt;expression&gt;<\/font><\/td>\n<td colspan=\"2\" valign=\"TOP\"><font size=\"2\">immediate<\/font><\/td>\n<td colspan=\"2\" valign=\"TOP\"><font color=\"#0000FF\" size=\"2\" face=\"Courier,Courier New\">ldaa<\/font><font size=\"2\" face=\"Courier,Courier New\"> #4<\/font><\/td>\n<\/tr>\n<tr>\n<td valign=\"TOP\" width=\"26%\"><font size=\"2\">&lt;expression&gt;,R<\/font><\/td>\n<td colspan=\"2\" valign=\"TOP\"><font size=\"2\">indexed with address register<\/font><\/td>\n<td colspan=\"2\" valign=\"TOP\"><font color=\"#0000FF\" size=\"2\" face=\"Courier,Courier New\">ldaa<\/font><font size=\"2\" face=\"Courier,Courier New\"> 4,x<\/font><\/td>\n<\/tr>\n<tr>\n<td valign=\"TOP\" width=\"26%\"><font size=\"2\">&lt;expr&gt;,&lt;expr&gt;<\/font><\/td>\n<td colspan=\"2\" valign=\"TOP\"><font size=\"2\">bit set or clear<\/font><\/td>\n<td colspan=\"2\" valign=\"TOP\"><font color=\"#0000FF\" size=\"2\" face=\"Courier,Courier New\">bset<\/font><font size=\"2\" face=\"Courier,Courier New\"> 4,#$01<\/font><\/td>\n<\/tr>\n<tr>\n<td valign=\"TOP\" width=\"26%\"><font size=\"2\">&lt;expr&gt;,&lt;expr&gt;,&lt;expr&gt;<\/font><\/td>\n<td colspan=\"2\" valign=\"TOP\"><font size=\"2\">bit test and branch<\/font><\/td>\n<td colspan=\"2\" valign=\"TOP\"><font color=\"#0000FF\" size=\"2\" face=\"Courier,Courier New\">brset<\/font><font size=\"2\" face=\"Courier,Courier New\"> 4,#$01,there<\/font><\/td>\n<\/tr>\n<tr>\n<td valign=\"TOP\" width=\"26%\"><font size=\"2\">&lt;expr&gt;,R,&lt;expr&gt;,&lt;expr&gt;<\/font><\/td>\n<td colspan=\"2\" valign=\"TOP\"><font size=\"2\">bit test and branch<\/font><\/td>\n<td colspan=\"2\" valign=\"TOP\"><font color=\"#0000FF\" size=\"2\" face=\"Courier,Courier New\">brset<\/font><font size=\"2\" face=\"Courier,Courier New\"> 4,x,#$01,there<\/font><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n","protected":false},"excerpt":{"rendered":"<p>Differences in Intel (NASM) vs AT&#038;T (GAS) Syntax. Linux assemblers: A comparison of GAS and NASM, A side-by-side look at GNU Assembler (GAS) and Netwide Assembler (NASM) NASM Vs GAS (Practical differences) Can I use Intel syntax of x86 assembly with GCC? Using &#8220;.intel_syntax noprefix&#8221; how can I get memory address of a label? Which [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-13656","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/blog.bachi.net\/index.php?rest_route=\/wp\/v2\/posts\/13656","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.bachi.net\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.bachi.net\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.bachi.net\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.bachi.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=13656"}],"version-history":[{"count":10,"href":"https:\/\/blog.bachi.net\/index.php?rest_route=\/wp\/v2\/posts\/13656\/revisions"}],"predecessor-version":[{"id":13666,"href":"https:\/\/blog.bachi.net\/index.php?rest_route=\/wp\/v2\/posts\/13656\/revisions\/13666"}],"wp:attachment":[{"href":"https:\/\/blog.bachi.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=13656"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.bachi.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=13656"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.bachi.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=13656"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}