mirror of
https://github.com/gbdev/rgbds.git
synced 2025-11-26 21:12:07 +00:00
more HTML formatting gunk
This commit is contained in:
@@ -1,104 +1,92 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
|
||||
"http://www.w3.org/TR/html4/loose.dtd">
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<TITLE>xAsm Integer/Boolean expressions</TITLE>
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
|
||||
<title>xAsm Integer/Boolean expressions</title>
|
||||
<link rel="stylesheet" type="text/css" href="../style.css">
|
||||
</HEAD>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Integer and Boolean expressions</h1>
|
||||
<p>An expression can be composed of many things. Expressions are always evaluated using signed 32-bit math.</p>
|
||||
<p>The most basic expression is just a single number.</p>
|
||||
<h2>Numeric Formats</h2>
|
||||
<p>xAsm has a number of numeric formats.</p>
|
||||
<ul>
|
||||
<li>Hexadecimal: $0123456789ABCDEF. Case-insensitive
|
||||
<li>Decimal: 0123456789
|
||||
<li>Octal: &01234567
|
||||
<li>Binary: %01
|
||||
<li>Fixedpoint (16.16): 01234.56789
|
||||
<li>Character constant: "ABYZ"
|
||||
<li>Gameboy graphics: `0123
|
||||
</ul>
|
||||
<p>The last one, Gameboy graphics, is quite interesting and useful. The values are actually pixel values and it converts the “chunky” data to “planar” data as used in the Gameboy.</p>
|
||||
<pre>DW `01012323</pre>
|
||||
<p>Admittedly an expression with just a single number is quite boring. To spice things up a bit there’s a few operators you can use to perform calculations between numbers.</p>
|
||||
<h2>Operators</h2>
|
||||
<p>A great number of operators you can use in expressions are available (listed in order of precedence):</p>
|
||||
<table>
|
||||
<caption>Operators</caption>
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col">Operator</th>
|
||||
<th scope="col">Meaning</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tr>
|
||||
<td>( )</td>
|
||||
<td>Precedence override</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>FUNC()</td>
|
||||
<td>Functioncall</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>~ + -</td>
|
||||
<td>Unary not/plus/minus</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>* / %</td>
|
||||
<td>Multiply/divide/modulo</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><< >></td>
|
||||
<td>Shift left/right</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>& | ^</td>
|
||||
<td>Binary and/or/xor</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>+ -</td>
|
||||
<td>Add/subtract</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>!= == <= >= < ></td>
|
||||
<td>Boolean comparison</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>&& ||</td>
|
||||
<td>Boolean and/or</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>!</td>
|
||||
<td>Unary Boolean not</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<BODY>
|
||||
<I><H2>Integer and Boolean expressions
|
||||
</H2></I>
|
||||
<HR>
|
||||
<p>The result of the boolean operators is zero if when FALSE and non-zero when TRUE. Thus it is legal to use an integer as the condition for <a href="if.htm">IF</a> blocks. You can use symbols instead of numbers in your expression if you wish.</p>
|
||||
|
||||
<P>An expression can be composed of many things. Expressions are always evaluated using signed 32-bit math.
|
||||
<P>The most basic expression is just a single number.
|
||||
<H4><BR>Numeric Formats</H4>
|
||||
<P>xAsm has a number of numeric formats.
|
||||
<UL>
|
||||
<LI>Hexadecimal: $0123456789ABCDEF. Case-insensitive
|
||||
<LI>Decimal: 0123456789
|
||||
<LI>Octal: &01234567
|
||||
<LI>Binary: %01
|
||||
<LI>Fixedpoint (16.16): 01234.56789
|
||||
<LI>Character constant: "ABYZ"
|
||||
<LI>Gameboy graphics: `0123
|
||||
</UL>
|
||||
<P>The last one, Gameboy graphics, is quite interesting and useful. The values are actually pixel values and it converts
|
||||
the "chunky" data to "planar" data as used in the Gameboy.<BR>
|
||||
<BR>
|
||||
<TABLE BORDER=0 BGCOLOR="Black" CELLPADDING=8 WIDTH="50%">
|
||||
<TR>
|
||||
<TD><FONT COLOR="#00FF00">
|
||||
<PRE>DW `01012323</PRE>
|
||||
</FONT></TD>
|
||||
</TR>
|
||||
</TABLE>
|
||||
<p>An expression is said to be constant when it doesn't change its value during linking. This basically means that you can't use labels in those expressions. The instructions in the macro-language all require expressions that are constant.</p>
|
||||
<h1>See also:</h1>
|
||||
<ul>
|
||||
<li><a href="symbols.htm">Symbols</a>
|
||||
<li><a href="expr_fix.htm">Fixed-point expressions and functions</a>
|
||||
<li><a href="expr_str.htm">String expressions, functions and formatting</a>
|
||||
<li><a href="miscfunc.htm">Other functions</a>
|
||||
</ul>
|
||||
|
||||
Admittedly an expression with just a single number is quite boring. To spice things up a bit there's a few operators you can use to perform calculations between numbers.
|
||||
<H4><BR>
|
||||
Operators</H4>
|
||||
<P>A great number of operators you can use in expressions are available (listed in order of precedence):
|
||||
<TABLE BORDER=1>
|
||||
<CAPTION><I>Operators</I></CAPTION>
|
||||
|
||||
<TR>
|
||||
<TD><B><I>Operator</I></B></TD>
|
||||
<TD><B><I>Meaning</I></B></TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD>( )</TD>
|
||||
<TD>Precedence override</TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD>FUNC()</TD>
|
||||
<TD>Functioncall</TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD>~ + -</TD>
|
||||
<TD>Unary not/plus/minus</TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD>* / %</TD>
|
||||
<TD>Multiply/divide/modulo</TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD><< >></TD>
|
||||
<TD>Shift left/right</TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD>& | ^</TD>
|
||||
<TD>Binary and/or/xor</TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD>+ -</TD>
|
||||
<TD>Add/subtract</TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD>!= == <= >= < ></TD>
|
||||
<TD>Boolean comparison</TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD>&& ||</TD>
|
||||
<TD>Boolean and/or</TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD>!</TD>
|
||||
<TD>Unary Boolean not</TD>
|
||||
</TR>
|
||||
</TABLE>
|
||||
|
||||
<P>The result of the boolean operators is zero if when FALSE and non-zero when TRUE. Thus it is legal to use an integer as the condition for <A HREF="if.htm">IF</A> blocks. You can use symbols instead of numbers in your expression if you wish.
|
||||
|
||||
<P>An expression is said to be constant when it doesn't change its value during linking. This basically means that you can't use labels in those expressions. The instructions in the macro-language all require expressions that are constant<BR>
|
||||
|
||||
<H3>See also:</H3>
|
||||
<UL>
|
||||
<LI><A HREF="symbols.htm">Symbols</A>
|
||||
<LI><A HREF="expr_fix.htm">Fixed-point expressions and functions</A>
|
||||
<LI><A HREF="expr_str.htm">String expressions, functions and formatting</A>
|
||||
<LI><A HREF="miscfunc.htm">Other functions</A>
|
||||
</UL>
|
||||
|
||||
<BR><HR>
|
||||
<FONT SIZE="-1"><I><P ALIGN=RIGHT>Last updated 21 June 1997 by <A HREF="mailto:surfsmurf@matilde.demon.co.uk">Carsten Sorensen</A></P></I></FONT>
|
||||
<hr>
|
||||
<p>Last updated 21 June 1997 by <a href="mailto:surfsmurf@matilde.demon.co.uk">Carsten Sorensen</a></p>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
Reference in New Issue
Block a user