You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

If.html 7.7KB

3 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
  2. <html>
  3. <!-- This file documents the GNU Assembler "as".
  4. Copyright (C) 1991-2020 Free Software Foundation, Inc.
  5. Permission is granted to copy, distribute and/or modify this document
  6. under the terms of the GNU Free Documentation License, Version 1.3
  7. or any later version published by the Free Software Foundation;
  8. with no Invariant Sections, with no Front-Cover Texts, and with no
  9. Back-Cover Texts. A copy of the license is included in the
  10. section entitled "GNU Free Documentation License".
  11. -->
  12. <!-- Created by GNU Texinfo 6.5, http://www.gnu.org/software/texinfo/ -->
  13. <head>
  14. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  15. <title>If (Using as)</title>
  16. <meta name="description" content="If (Using as)">
  17. <meta name="keywords" content="If (Using as)">
  18. <meta name="resource-type" content="document">
  19. <meta name="distribution" content="global">
  20. <meta name="Generator" content="makeinfo">
  21. <link href="index.html#Top" rel="start" title="Top">
  22. <link href="AS-Index.html#AS-Index" rel="index" title="AS Index">
  23. <link href="index.html#SEC_Contents" rel="contents" title="Table of Contents">
  24. <link href="Pseudo-Ops.html#Pseudo-Ops" rel="up" title="Pseudo Ops">
  25. <link href="Incbin.html#Incbin" rel="next" title="Incbin">
  26. <link href="Ident.html#Ident" rel="prev" title="Ident">
  27. <style type="text/css">
  28. <!--
  29. a.summary-letter {text-decoration: none}
  30. blockquote.indentedblock {margin-right: 0em}
  31. blockquote.smallindentedblock {margin-right: 0em; font-size: smaller}
  32. blockquote.smallquotation {font-size: smaller}
  33. div.display {margin-left: 3.2em}
  34. div.example {margin-left: 3.2em}
  35. div.lisp {margin-left: 3.2em}
  36. div.smalldisplay {margin-left: 3.2em}
  37. div.smallexample {margin-left: 3.2em}
  38. div.smalllisp {margin-left: 3.2em}
  39. kbd {font-style: oblique}
  40. pre.display {font-family: inherit}
  41. pre.format {font-family: inherit}
  42. pre.menu-comment {font-family: serif}
  43. pre.menu-preformatted {font-family: serif}
  44. pre.smalldisplay {font-family: inherit; font-size: smaller}
  45. pre.smallexample {font-size: smaller}
  46. pre.smallformat {font-family: inherit; font-size: smaller}
  47. pre.smalllisp {font-size: smaller}
  48. span.nolinebreak {white-space: nowrap}
  49. span.roman {font-family: initial; font-weight: normal}
  50. span.sansserif {font-family: sans-serif; font-weight: normal}
  51. ul.no-bullet {list-style: none}
  52. -->
  53. </style>
  54. </head>
  55. <body lang="en">
  56. <a name="If"></a>
  57. <div class="header">
  58. <p>
  59. 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> &nbsp; [<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>
  60. </div>
  61. <hr>
  62. <a name="g_t_002eif-absolute-expression"></a>
  63. <h3 class="section">7.44 <code>.if <var>absolute expression</var></code></h3>
  64. <a name="index-conditional-assembly"></a>
  65. <a name="index-if-directive"></a>
  66. <p><code>.if</code> marks the beginning of a section of code which is only
  67. considered part of the source program being assembled if the argument
  68. (which must be an <var>absolute expression</var>) is non-zero. The end of
  69. the conditional section of code must be marked by <code>.endif</code>
  70. (see <a href="Endif.html#Endif"><code>.endif</code></a>); optionally, you may include code for the
  71. alternative condition, flagged by <code>.else</code> (see <a href="Else.html#Else"><code>.else</code></a>).
  72. If you have several conditions to check, <code>.elseif</code> may be used to avoid
  73. nesting blocks if/else within each subsequent <code>.else</code> block.
  74. </p>
  75. <p>The following variants of <code>.if</code> are also supported:
  76. </p><dl compact="compact">
  77. <dd><a name="index-ifdef-directive"></a>
  78. </dd>
  79. <dt><code>.ifdef <var>symbol</var></code></dt>
  80. <dd><p>Assembles the following section of code if the specified <var>symbol</var>
  81. has been defined. Note a symbol which has been referenced but not yet defined
  82. is considered to be undefined.
  83. </p>
  84. <a name="index-ifb-directive"></a>
  85. </dd>
  86. <dt><code>.ifb <var>text</var></code></dt>
  87. <dd><p>Assembles the following section of code if the operand is blank (empty).
  88. </p>
  89. <a name="index-ifc-directive"></a>
  90. </dd>
  91. <dt><code>.ifc <var>string1</var>,<var>string2</var></code></dt>
  92. <dd><p>Assembles the following section of code if the two strings are the same. The
  93. strings may be optionally quoted with single quotes. If they are not quoted,
  94. the first string stops at the first comma, and the second string stops at the
  95. end of the line. Strings which contain whitespace should be quoted. The
  96. string comparison is case sensitive.
  97. </p>
  98. <a name="index-ifeq-directive"></a>
  99. </dd>
  100. <dt><code>.ifeq <var>absolute expression</var></code></dt>
  101. <dd><p>Assembles the following section of code if the argument is zero.
  102. </p>
  103. <a name="index-ifeqs-directive"></a>
  104. </dd>
  105. <dt><code>.ifeqs <var>string1</var>,<var>string2</var></code></dt>
  106. <dd><p>Another form of <code>.ifc</code>. The strings must be quoted using double quotes.
  107. </p>
  108. <a name="index-ifge-directive"></a>
  109. </dd>
  110. <dt><code>.ifge <var>absolute expression</var></code></dt>
  111. <dd><p>Assembles the following section of code if the argument is greater than or
  112. equal to zero.
  113. </p>
  114. <a name="index-ifgt-directive"></a>
  115. </dd>
  116. <dt><code>.ifgt <var>absolute expression</var></code></dt>
  117. <dd><p>Assembles the following section of code if the argument is greater than zero.
  118. </p>
  119. <a name="index-ifle-directive"></a>
  120. </dd>
  121. <dt><code>.ifle <var>absolute expression</var></code></dt>
  122. <dd><p>Assembles the following section of code if the argument is less than or equal
  123. to zero.
  124. </p>
  125. <a name="index-iflt-directive"></a>
  126. </dd>
  127. <dt><code>.iflt <var>absolute expression</var></code></dt>
  128. <dd><p>Assembles the following section of code if the argument is less than zero.
  129. </p>
  130. <a name="index-ifnb-directive"></a>
  131. </dd>
  132. <dt><code>.ifnb <var>text</var></code></dt>
  133. <dd><p>Like <code>.ifb</code>, but the sense of the test is reversed: this assembles the
  134. following section of code if the operand is non-blank (non-empty).
  135. </p>
  136. <a name="index-ifnc-directive"></a>
  137. </dd>
  138. <dt><code>.ifnc <var>string1</var>,<var>string2</var>.</code></dt>
  139. <dd><p>Like <code>.ifc</code>, but the sense of the test is reversed: this assembles the
  140. following section of code if the two strings are not the same.
  141. </p>
  142. <a name="index-ifndef-directive"></a>
  143. <a name="index-ifnotdef-directive"></a>
  144. </dd>
  145. <dt><code>.ifndef <var>symbol</var></code></dt>
  146. <dt><code>.ifnotdef <var>symbol</var></code></dt>
  147. <dd><p>Assembles the following section of code if the specified <var>symbol</var>
  148. has not been defined. Both spelling variants are equivalent. Note a symbol
  149. which has been referenced but not yet defined is considered to be undefined.
  150. </p>
  151. <a name="index-ifne-directive"></a>
  152. </dd>
  153. <dt><code>.ifne <var>absolute expression</var></code></dt>
  154. <dd><p>Assembles the following section of code if the argument is not equal to zero
  155. (in other words, this is equivalent to <code>.if</code>).
  156. </p>
  157. <a name="index-ifnes-directive"></a>
  158. </dd>
  159. <dt><code>.ifnes <var>string1</var>,<var>string2</var></code></dt>
  160. <dd><p>Like <code>.ifeqs</code>, but the sense of the test is reversed: this assembles the
  161. following section of code if the two strings are not the same.
  162. </p></dd>
  163. </dl>
  164. <hr>
  165. <div class="header">
  166. <p>
  167. 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> &nbsp; [<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>
  168. </div>
  169. </body>
  170. </html>