1
0
mirror of https://github.com/cc65/cc65.git synced 2024-10-01 15:54:59 +00:00

Constant expressions, ^ operator

git-svn-id: svn://svn.cc65.org/cc65/trunk@2643 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
cuz 2003-11-11 23:04:54 +00:00
parent 94e041264e
commit 8eebbd1b74

View File

@ -373,7 +373,7 @@ Expressions referencing imported symbols must always be evaluated by the
linker.
<sect1>Size of an expressions result<p>
<sect1>Size of an expression result<p>
Sometimes, the assembler must know about the size of the value that is the
result of an expression. This is usually the case, if a decision has to be
@ -413,6 +413,26 @@ already known, after evaluating the left hand side, the right hand side is
not evaluated.
<sect1>Constant expressions<p>
Sometimes an expression must evaluate to a constant without looking at any
further input. One such example is the <tt/<ref id=".IF" name=".IF">/ command
that decides if parts of the code are assembled or not. An expression used in
the <tt/.IF/ command cannot reference a symbol defined later, because the
decision about the <tt/.IF/ must be made at the point when it is read. If the
expression used in such a context contains only constant numerical values,
there is no problem. When unresolvable symbols are involved it may get harder
for the assembler to determine if the expression is actually constant, and it
is even possible to create expressions that aren't recognized as constant.
Simplifying the expressions will often help.
In cases where the result of the expression is not needed immediately, the
assembler will delay evaluation until all input is read, at which point all
symbols are known. So using arbitrary complex constant expressions is no
problem in most cases.
<sect1>Available operators<label id="operators"><p>
Available operators sorted by precedence:
@ -445,8 +465,9 @@ Available operators sorted by precedence:
.BITNOT Unary bitwise not 1
&lt; Low byte operator 1
&gt; High byte operator 1
^ Bank byte operator 1
* Multiplication 2
* Multiplication 2
/ Division 2
.MOD Modulo operation 2
&amp; Bitwise and 2