Reference Guide

6-16 The Development Library
Entries from the EXTABLE may be used. As the EXTABLE does not have the label names limitations
with operators, in ambiguous case (
DUP+#5
may either be an addition
DUP + 5
, or an entry
DUP+#5
’), add
""
around the word:
"DUP"+#5
.
Calculations are done with 64 bits.
X divide by 0 = $FFFFFFFFFFFFFFFF.
In order to avoid wasting memory, MASD tries to compile expressions as soon as it sees them. If MASD
is not able to compile an expression directly, it’s compiled at the end of the compilation. In order to use
less memory, it’s a good idea to define your constants at the beginning of the sources so MASD can
compile expression using the constants directly.
The only operator symbols not allowed in labels are +, -, * and /; therefore, if you want to use a symbol
operator after a label, you must put the symbol between " in order to ‘limit’ the symbol. Meaningless
Example:
"DUP"<<5
.
A label/constant with strange char may be ‘protected’ between " chars.
The evaluation stack of MASD allows you to have around 10 pending computations (parenthesis,
operator priority).
MASD only works with integers. You can represent signed values using standard 2’s complement, but be
careful as all operators are unsigned.
MASD recognizes the following operators:
Operator
Priority
Notes
<<
7
Left Shift
1<<5 = $20
>>
7
Right shift
$20>>5 = 1
%
6
Modulo (remainder of division) X%0=0
*
5
Multiplication
/
5
Division X/0=$FFFFFFFFFFFFFFFF
+
4
Addition
-
4
Subtraction
<
3
Is smaller (true=1, false = 0)
>
3
Is greater (true=1, false = 0)
<=, ‰
3
Is smaller or equal (true=1, false = 0)
>=, Š
3
Is greater or equal (true=1, false = 0)
=
3
Is equal (true = 1, false = 0)
#, ‹
3
Is different (true = 1, false = 0)
&
2
Logical and
!
1
Logical or
^
1
Logical xor
Note: Throughout this documentation, you will see discussions about expressions that can be “immediately”
evaluated. This refers to any expression that contains only number and labels/constants that have already been
declared.
Macros and includes
If data are to be included in a project, it can be entered in hex in a source file, using
$
. However, a simpler way is to
include data from an external file, called a macro. The macro file must be a character string, a graphic, a code object
or a list.
- In case of a string or a code, MASD includes only the data part (after the length) of the object
- In case of a graphic, only the graphic data will be included (no length, no dimensions)