Add other sites
This commit is contained in:
32
src/asmscript/conditionals.html
Normal file
32
src/asmscript/conditionals.html
Normal file
@@ -0,0 +1,32 @@
|
||||
<!doctype html>
|
||||
<html lang="en-US">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>asmscript (asms) documentation</title>
|
||||
<link rel="stylesheet" href="style.css">
|
||||
</head>
|
||||
<body>
|
||||
<main>
|
||||
<h1><a href="index.html">asmscript</a></h1>
|
||||
<nav>
|
||||
<ul>
|
||||
<li><a href="index.html">Overview</a></li>
|
||||
<li><a href="operands.html">Operands</a></li>
|
||||
<li><a href="procedures.html">Procedures</a></li>
|
||||
<li><a href="statements.html">Statements</a></li>
|
||||
<li><a href="conditions.html">Conditions</a></li>
|
||||
<li><a href="conditionals.html">Conditionals</a></li>
|
||||
</ul>
|
||||
</nav>
|
||||
<h2>Conditionals</h2>
|
||||
<p>Conditionals are extensions to statements that by their nature do not contain a condition. You can make a conditional by inserting the following syntax right before a semicolon:</p>
|
||||
<pre><span class="kw">if</span> CONDITION</pre>
|
||||
<p>Conditionals serve as a shorthand for branches with only one statement and no else block.</p>
|
||||
<p>Examples:</p>
|
||||
<pre><span class="reg">rax</span> = <span class="num">0</num> <span class="kw">if</span> <span class="reg">rcx</span> > <span class="num">5</span>;</span>
|
||||
<span class="reg">rax</span> += <span class="reg">rcx</span> <span class="kw">if</span> <span class="reg">rsi</span> <= <span class="num">-1</span>;
|
||||
<span class="kw">continue</span> <span class="kw">if</span> <span class="num">0</span> != <span class="reg">r15</span>;</pre>
|
||||
<p>Fun fact: the original intention behind conditionals is to have a syntax for conditional move intructions (cmov). Eventually I came to the conclusion that this syntax might as well be applicable to almost every statement, not just assignment. Conditional moves aren't implemented though, so when you use a conditional on an assignment, the compiler will just emit a conditional jump instruction.</p>
|
||||
</main>
|
||||
</body>
|
||||
</html>
|
Reference in New Issue
Block a user