Opcode syntax: Difference between revisions
Jump to navigation
Jump to search
[unchecked revision] | [unchecked revision] |
Content added Content deleted
m (dead link removal) |
No edit summary |
||
Line 35: | Line 35: | ||
The AT&T syntax format for macros: |
The AT&T syntax format for macros: |
||
<source lang="asm"> |
|||
<code> |
|||
.macro <name> <args> |
.macro <name> <args> |
||
<operations> |
<operations> |
||
.endm |
.endm |
||
</ |
</source> |
||
Example: |
Example: |
||
<source lang="asm"> |
|||
<pre> |
|||
.macro write string |
.macro write string |
||
movw string, %si |
movw string, %si |
||
call printstr |
call printstr |
||
.endm |
.endm |
||
</ |
</source> |
||
This would be equivalent to the NASM macro: |
This would be equivalent to the NASM macro: |
||
<source lang="asm"> |
|||
<pre> |
|||
%macro write 1 |
%macro write 1 |
||
mov si, %1 |
mov si, %1 |
||
call printstr |
call printstr |
||
%endmacro |
%endmacro |
||
</ |
</source> |
||
Additionally, the cpp and |
Additionally, the cpp and [[M4]] macro preprocessors are often used for macro handling. |
||
== Converting small snippets of code from Intel syntax to AT&T == |
== Converting small snippets of code from Intel syntax to AT&T == |