Opcode syntax: Difference between revisions

m
Bot: Replace deprecated source tag with syntaxhighlight
[unchecked revision][unchecked revision]
m (dead link removal)
m (Bot: Replace deprecated source tag with syntaxhighlight)
 
(2 intermediate revisions by 2 users not shown)
Line 35:
The AT&T syntax format for macros:
 
<syntaxhighlight lang="asm">
<code>
.macro <name> <args>
<operations>
.endm
</syntaxhighlight>
</code>
 
Example:
 
<syntaxhighlight lang="asm">
<pre>
.macro write string
movw string, %si
call printstr
.endm
</syntaxhighlight>
</pre>
 
This would be equivalent to the NASM macro:
 
<syntaxhighlight lang="asm">
<pre>
%macro write 1
mov si, %1
call printstr
%endmacro
</syntaxhighlight>
</pre>
 
Additionally, the cpp and m4[[M4]] macro preprocessors are often used for macro handling.
 
== Converting small snippets of code from Intel syntax to AT&T ==
 
You can use the following script to convert short snippets of code (one liners) from Intel syntax to AT&T syntax:
<sourcesyntaxhighlight lang="bash">#!/bin/bash
set -e
 
Line 100:
 
tail -n +$lineno "$objdump"
</syntaxhighlight>
</source>
 
== See Also ==