Mul.n
The mul.n command multiplies a variable with a number.
Syntax
mul.n(var vA, byt B);
vA = vA * B;
vA *= B;
Remarks
Because variables are 8 bit unsigned numbers, if the result of the multiplication exceeds 255, the result 'wraps around'. For example, if v50 currently equals 200, the statement:
mul.n(v50, 2);
will result in a value for v50 of 144 (200 * 2 = 400; 400 - 256 = 144). This can be represented mathematically as vA = (vA * B) mod 256
.
Note that this command uses the 'dot' notation (i.e. mul.n vs. muln) unlike the original set of mathematical commands.
Possible Errors
None.
Example
<syntaxhighlight lang="agi"> v50 = 5; mul.n(v50, 3); [ v50 now equals 150 v50 = v50 * 3; [ v50 now equals 194 (450 - 256) v50 *= 3; [ v50 now equals 70 (582 - 256 * 2) </syntaxhighlight>
Technical Information
Required Interpreter Version: | Available in version 2.411 and above. |
Byte-Code Value: | 165 (0xA5 hex) |