@@ -383,13 +383,14 @@ <h3 class="Ss" id="Operators"><a class="permalink" href="#Operators">Operators</
383
383
< td > Unary not</ td >
384
384
</ tr >
385
385
</ table >
386
- < p class ="Pp "> < code class ="Ic "> ~</ code > complements a value by inverting all its
387
- bits.</ p >
388
- < p class ="Pp "> < code class ="Ic "> %</ code > is used to get the remainder of the
389
- corresponding division, so that ‘a / b * b + a % b == a’ is
390
- always true. The result has the same sign as the divisor. This makes
391
- ‘a % b’. equal to ‘(a + b) % b’ or ‘(a -
392
- b) % b’.</ p >
386
+ < p class ="Pp "> ‘~’ complements a value by inverting all its
387
+ bits.</ p >
388
+ < p class ="Pp "> ‘%’ is used to get the remainder of the
389
+ corresponding division, so that ‘< code class ="Li "> x / y * y + x % y
390
+ == x</ code > ’ is always true. The result has the same sign as the
391
+ divisor. This makes ‘< code class ="Li "> x % y</ code > ’ equal to
392
+ ‘< code class ="Li "> (x + y) % y</ code > ’ or
393
+ ‘< code class ="Li "> (x - y) % y</ code > ’.</ p >
393
394
< p class ="Pp "> Shifting works by shifting all bits in the left operand either
394
395
left (‘<<’) or right (‘>>’) by the
395
396
right operand's amount. When shifting left, all newly-inserted bits are
@@ -635,6 +636,13 @@ <h3 class="Ss" id="Fixed-point_expressions"><a class="permalink" href="#Fixed-po
635
636
‘< code class ="Li "> MUL(6.0q8, 7.0q8, 8)</ code > ’ will evaluate
636
637
to ‘< code class ="Li "> 42.0q8</ code > ’ no matter what value is
637
638
set as the current < code class ="Cm "> Q</ code > option.</ p >
639
+ < p class ="Pp " id ="dividend "> The < code class ="Ic "> FMOD</ code > function is used to
640
+ get the remainder of the corresponding fixed-point division, so that
641
+ ‘< code class ="Li "> MUL(DIV(x, y), y) + FMOD(x, y) == x</ code > ’
642
+ is always true. The result has the same sign as the
643
+ < a class ="permalink " href ="#dividend "> < i class ="Em "> dividend</ i > </ a > ; this
644
+ is the opposite of how the integer modulo operator ‘%’
645
+ works!</ p >
638
646
< p class ="Pp "> The trigonometry functions ( < code class ="Ic "> SIN</ code > ,
639
647
< code class ="Ic "> COS</ code > , < code class ="Ic "> TAN</ code > , etc) are defined
640
648
in terms of a circle divided into 1.0 "turns" (equal to 2pi
@@ -1371,8 +1379,8 @@ <h3 class="Ss" id="Anonymous_labels"><a class="permalink" href="#Anonymous_label
1371
1379
</ section >
1372
1380
< section class ="Ss ">
1373
1381
< h3 class ="Ss " id ="Variables "> < a class ="permalink " href ="#Variables "> Variables</ a > </ h3 >
1374
- < p class ="Pp "> An equal sign < code class =" Ic " > = </ code > is used to define mutable
1375
- numeric symbols. Unlike the other symbols described below, variables can be
1382
+ < p class ="Pp "> An equal sign ‘=’ is used to define mutable numeric
1383
+ symbols. Unlike the other symbols described below, variables can be
1376
1384
redefined. This is useful for internal symbols in macros, for counters,
1377
1385
etc.</ p >
1378
1386
< div class ="Bd Pp Bd-indent Li ">
@@ -1431,9 +1439,9 @@ <h3 class="Ss" id="Variables"><a class="permalink" href="#Variables">Variables</
1431
1439
< h3 class ="Ss " id ="Numeric_constants "> < a class ="permalink " href ="#Numeric_constants "> Numeric
1432
1440
constants</ a > </ h3 >
1433
1441
< p class ="Pp "> < code class ="Ic "> EQU</ code > is used to define immutable numeric
1434
- symbols. Unlike < code class =" Ic " > = </ code > above, constants defined this way
1435
- cannot be redefined. These constants can be used for unchanging values such
1436
- as properties of the hardware.</ p >
1442
+ symbols. Unlike ‘=’ above, constants defined this way cannot
1443
+ be redefined. These constants can be used for unchanging values such as
1444
+ properties of the hardware.</ p >
1437
1445
< div class ="Bd Pp Bd-indent Li ">
1438
1446
< pre > def SCREEN_WIDTH equ 160 ; In pixels
1439
1447
def SCREEN_HEIGHT equ 144</ pre >
@@ -1927,14 +1935,15 @@ <h3 class="Ss" id="Unions"><a class="permalink" href="#Unions">Unions</a></h3>
1927
1935
</ div >
1928
1936
< p class ="Pp "> In the example above, ‘Name, Health, VideoBuffer’
1929
1937
all have the same value, as do ‘Nickname’ and
1930
- ‘Lives’. Thus, keep in mind that < code class ="Ic "> ld [Health],
1931
- a</ code > is identical to < code class ="Ic "> ld [Name], a</ code > .</ p >
1938
+ ‘Lives’. Thus, keep in mind that ‘< code class ="Li "> ld
1939
+ [Health], a</ code > ’ is identical to ‘< code class ="Li "> ld
1940
+ [Name], a</ code > ’.</ p >
1932
1941
< p class ="Pp "> The size of this union is 19 bytes, as this is the size of the
1933
1942
largest block (the last one, containing ‘VideoBuffer’).
1934
1943
Nesting unions is possible, with each inner union's size being considered as
1935
1944
described above.</ p >
1936
- < p class ="Pp "> Unions may be used in any section, but inside them may only be
1937
- < code class ="Ic "> DS - </ code > like commands (see
1945
+ < p class ="Pp "> Unions may be used in any section, but they may only contain
1946
+ space-allocating directives like < code class ="Ic "> DS</ code > (see
1938
1947
< a class ="Sx " href ="#Statically_allocating_space_in_RAM "> Statically
1939
1948
allocating space in RAM</ a > ).</ p >
1940
1949
</ section >
@@ -2093,8 +2102,8 @@ <h3 class="Ss" id="Printing_things_during_assembly"><a class="permalink" href="#
2093
2102
< dl class ="Bl-inset ">
2094
2103
< dt id ="PRINT "> < a class ="permalink " href ="#PRINT "> < code class ="Ic "> PRINT</ code > </ a > </ dt >
2095
2104
< dd > prints out each of its comma-separated arguments. Numbers are printed as
2096
- unsigned uppercase hexadecimal with a leading < code class =" Ic " > $ </ code > .
2097
- For different formats, use < code class ="Ic "> STRFMT</ code > .</ dd >
2105
+ unsigned uppercase hexadecimal with a leading ‘$’. For
2106
+ different formats, use < code class ="Ic "> STRFMT</ code > .</ dd >
2098
2107
< dt id ="PRINTLN "> < a class ="permalink " href ="#PRINTLN "> < code class ="Ic "> PRINTLN</ code > </ a > </ dt >
2099
2108
< dd > prints out each of its comma-separated arguments, if any, followed by a
2100
2109
line feed (‘< code class ="Li "> \n</ code > ’).</ dd >
@@ -2349,8 +2358,8 @@ <h3 class="Ss" id="Changing_options_while_assembling"><a class="permalink" href=
2349
2358
DW `00112233 ; uses the default graphics constant characters
2350
2359
PRINTLN $80000000/-1 ; no warning by default</ pre >
2351
2360
</ div >
2352
- < p class ="Pp "> The options that < code class ="Ic "> OPT</ code > can modify are
2353
- currently: < code class ="Cm "> b</ code > , < code class ="Cm "> g</ code > ,
2361
+ < p class ="Pp "> < code class ="Ic "> OPT</ code > can modify the options
2362
+ < code class ="Cm "> b</ code > , < code class ="Cm "> g</ code > ,
2354
2363
< code class ="Cm "> p</ code > , < code class ="Cm "> Q</ code > , and
2355
2364
< code class ="Cm "> r</ code > .</ p >
2356
2365
< p class ="Pp "> < code class ="Ic "> POPO</ code > and < code class ="Ic "> PUSHO</ code >
0 commit comments