183 lines
7.7 KiB
HTML
183 lines
7.7 KiB
HTML
|
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
||
|
<html>
|
||
|
<!-- This file documents the GNU Assembler "as".
|
||
|
|
||
|
Copyright (C) 1991-2016 Free Software Foundation, Inc.
|
||
|
|
||
|
Permission is granted to copy, distribute and/or modify this document
|
||
|
under the terms of the GNU Free Documentation License, Version 1.3
|
||
|
or any later version published by the Free Software Foundation;
|
||
|
with no Invariant Sections, with no Front-Cover Texts, and with no
|
||
|
Back-Cover Texts. A copy of the license is included in the
|
||
|
section entitled "GNU Free Documentation License".
|
||
|
-->
|
||
|
<!-- Created by GNU Texinfo 5.2, http://www.gnu.org/software/texinfo/ -->
|
||
|
<head>
|
||
|
<title>Using as: If</title>
|
||
|
|
||
|
<meta name="description" content="Using as: If">
|
||
|
<meta name="keywords" content="Using as: If">
|
||
|
<meta name="resource-type" content="document">
|
||
|
<meta name="distribution" content="global">
|
||
|
<meta name="Generator" content="makeinfo">
|
||
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||
|
<link href="index.html#Top" rel="start" title="Top">
|
||
|
<link href="AS-Index.html#AS-Index" rel="index" title="AS Index">
|
||
|
<link href="index.html#SEC_Contents" rel="contents" title="Table of Contents">
|
||
|
<link href="Pseudo-Ops.html#Pseudo-Ops" rel="up" title="Pseudo Ops">
|
||
|
<link href="Incbin.html#Incbin" rel="next" title="Incbin">
|
||
|
<link href="Ident.html#Ident" rel="prev" title="Ident">
|
||
|
<style type="text/css">
|
||
|
<!--
|
||
|
a.summary-letter {text-decoration: none}
|
||
|
blockquote.smallquotation {font-size: smaller}
|
||
|
div.display {margin-left: 3.2em}
|
||
|
div.example {margin-left: 3.2em}
|
||
|
div.indentedblock {margin-left: 3.2em}
|
||
|
div.lisp {margin-left: 3.2em}
|
||
|
div.smalldisplay {margin-left: 3.2em}
|
||
|
div.smallexample {margin-left: 3.2em}
|
||
|
div.smallindentedblock {margin-left: 3.2em; font-size: smaller}
|
||
|
div.smalllisp {margin-left: 3.2em}
|
||
|
kbd {font-style:oblique}
|
||
|
pre.display {font-family: inherit}
|
||
|
pre.format {font-family: inherit}
|
||
|
pre.menu-comment {font-family: serif}
|
||
|
pre.menu-preformatted {font-family: serif}
|
||
|
pre.smalldisplay {font-family: inherit; font-size: smaller}
|
||
|
pre.smallexample {font-size: smaller}
|
||
|
pre.smallformat {font-family: inherit; font-size: smaller}
|
||
|
pre.smalllisp {font-size: smaller}
|
||
|
span.nocodebreak {white-space:nowrap}
|
||
|
span.nolinebreak {white-space:nowrap}
|
||
|
span.roman {font-family:serif; font-weight:normal}
|
||
|
span.sansserif {font-family:sans-serif; font-weight:normal}
|
||
|
ul.no-bullet {list-style: none}
|
||
|
-->
|
||
|
</style>
|
||
|
|
||
|
|
||
|
</head>
|
||
|
|
||
|
<body lang="en" bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#800080" alink="#FF0000">
|
||
|
<a name="If"></a>
|
||
|
<div class="header">
|
||
|
<p>
|
||
|
Next: <a href="Incbin.html#Incbin" accesskey="n" rel="next">Incbin</a>, Previous: <a href="Ident.html#Ident" accesskey="p" rel="prev">Ident</a>, Up: <a href="Pseudo-Ops.html#Pseudo-Ops" accesskey="u" rel="up">Pseudo Ops</a> [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="AS-Index.html#AS-Index" title="Index" rel="index">Index</a>]</p>
|
||
|
</div>
|
||
|
<hr>
|
||
|
<a name="g_t_002eif-absolute-expression"></a>
|
||
|
<h3 class="section">7.41 <code>.if <var>absolute expression</var></code></h3>
|
||
|
|
||
|
<a name="index-conditional-assembly"></a>
|
||
|
<a name="index-if-directive"></a>
|
||
|
<p><code>.if</code> marks the beginning of a section of code which is only
|
||
|
considered part of the source program being assembled if the argument
|
||
|
(which must be an <var>absolute expression</var>) is non-zero. The end of
|
||
|
the conditional section of code must be marked by <code>.endif</code>
|
||
|
(see <a href="Endif.html#Endif"><code>.endif</code></a>); optionally, you may include code for the
|
||
|
alternative condition, flagged by <code>.else</code> (see <a href="Else.html#Else"><code>.else</code></a>).
|
||
|
If you have several conditions to check, <code>.elseif</code> may be used to avoid
|
||
|
nesting blocks if/else within each subsequent <code>.else</code> block.
|
||
|
</p>
|
||
|
<p>The following variants of <code>.if</code> are also supported:
|
||
|
</p><dl compact="compact">
|
||
|
<dd><a name="index-ifdef-directive"></a>
|
||
|
</dd>
|
||
|
<dt><code>.ifdef <var>symbol</var></code></dt>
|
||
|
<dd><p>Assembles the following section of code if the specified <var>symbol</var>
|
||
|
has been defined. Note a symbol which has been referenced but not yet defined
|
||
|
is considered to be undefined.
|
||
|
</p>
|
||
|
<a name="index-ifb-directive"></a>
|
||
|
</dd>
|
||
|
<dt><code>.ifb <var>text</var></code></dt>
|
||
|
<dd><p>Assembles the following section of code if the operand is blank (empty).
|
||
|
</p>
|
||
|
<a name="index-ifc-directive"></a>
|
||
|
</dd>
|
||
|
<dt><code>.ifc <var>string1</var>,<var>string2</var></code></dt>
|
||
|
<dd><p>Assembles the following section of code if the two strings are the same. The
|
||
|
strings may be optionally quoted with single quotes. If they are not quoted,
|
||
|
the first string stops at the first comma, and the second string stops at the
|
||
|
end of the line. Strings which contain whitespace should be quoted. The
|
||
|
string comparison is case sensitive.
|
||
|
</p>
|
||
|
<a name="index-ifeq-directive"></a>
|
||
|
</dd>
|
||
|
<dt><code>.ifeq <var>absolute expression</var></code></dt>
|
||
|
<dd><p>Assembles the following section of code if the argument is zero.
|
||
|
</p>
|
||
|
<a name="index-ifeqs-directive"></a>
|
||
|
</dd>
|
||
|
<dt><code>.ifeqs <var>string1</var>,<var>string2</var></code></dt>
|
||
|
<dd><p>Another form of <code>.ifc</code>. The strings must be quoted using double quotes.
|
||
|
</p>
|
||
|
<a name="index-ifge-directive"></a>
|
||
|
</dd>
|
||
|
<dt><code>.ifge <var>absolute expression</var></code></dt>
|
||
|
<dd><p>Assembles the following section of code if the argument is greater than or
|
||
|
equal to zero.
|
||
|
</p>
|
||
|
<a name="index-ifgt-directive"></a>
|
||
|
</dd>
|
||
|
<dt><code>.ifgt <var>absolute expression</var></code></dt>
|
||
|
<dd><p>Assembles the following section of code if the argument is greater than zero.
|
||
|
</p>
|
||
|
<a name="index-ifle-directive"></a>
|
||
|
</dd>
|
||
|
<dt><code>.ifle <var>absolute expression</var></code></dt>
|
||
|
<dd><p>Assembles the following section of code if the argument is less than or equal
|
||
|
to zero.
|
||
|
</p>
|
||
|
<a name="index-iflt-directive"></a>
|
||
|
</dd>
|
||
|
<dt><code>.iflt <var>absolute expression</var></code></dt>
|
||
|
<dd><p>Assembles the following section of code if the argument is less than zero.
|
||
|
</p>
|
||
|
<a name="index-ifnb-directive"></a>
|
||
|
</dd>
|
||
|
<dt><code>.ifnb <var>text</var></code></dt>
|
||
|
<dd><p>Like <code>.ifb</code>, but the sense of the test is reversed: this assembles the
|
||
|
following section of code if the operand is non-blank (non-empty).
|
||
|
</p>
|
||
|
<a name="index-ifnc-directive"></a>
|
||
|
</dd>
|
||
|
<dt><code>.ifnc <var>string1</var>,<var>string2</var>.</code></dt>
|
||
|
<dd><p>Like <code>.ifc</code>, but the sense of the test is reversed: this assembles the
|
||
|
following section of code if the two strings are not the same.
|
||
|
</p>
|
||
|
<a name="index-ifndef-directive"></a>
|
||
|
<a name="index-ifnotdef-directive"></a>
|
||
|
</dd>
|
||
|
<dt><code>.ifndef <var>symbol</var></code></dt>
|
||
|
<dt><code>.ifnotdef <var>symbol</var></code></dt>
|
||
|
<dd><p>Assembles the following section of code if the specified <var>symbol</var>
|
||
|
has not been defined. Both spelling variants are equivalent. Note a symbol
|
||
|
which has been referenced but not yet defined is considered to be undefined.
|
||
|
</p>
|
||
|
<a name="index-ifne-directive"></a>
|
||
|
</dd>
|
||
|
<dt><code>.ifne <var>absolute expression</var></code></dt>
|
||
|
<dd><p>Assembles the following section of code if the argument is not equal to zero
|
||
|
(in other words, this is equivalent to <code>.if</code>).
|
||
|
</p>
|
||
|
<a name="index-ifnes-directive"></a>
|
||
|
</dd>
|
||
|
<dt><code>.ifnes <var>string1</var>,<var>string2</var></code></dt>
|
||
|
<dd><p>Like <code>.ifeqs</code>, but the sense of the test is reversed: this assembles the
|
||
|
following section of code if the two strings are not the same.
|
||
|
</p></dd>
|
||
|
</dl>
|
||
|
|
||
|
<hr>
|
||
|
<div class="header">
|
||
|
<p>
|
||
|
Next: <a href="Incbin.html#Incbin" accesskey="n" rel="next">Incbin</a>, Previous: <a href="Ident.html#Ident" accesskey="p" rel="prev">Ident</a>, Up: <a href="Pseudo-Ops.html#Pseudo-Ops" accesskey="u" rel="up">Pseudo Ops</a> [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="AS-Index.html#AS-Index" title="Index" rel="index">Index</a>]</p>
|
||
|
</div>
|
||
|
|
||
|
|
||
|
|
||
|
</body>
|
||
|
</html>
|