mirror of
https://github.com/gbdev/rgbds.git
synced 2025-11-20 18:22:07 +00:00
Document the behavior of FMOD, and other man page cleanup (#1458)
This commit is contained in:
43
man/rgbasm.5
43
man/rgbasm.5
@@ -297,20 +297,20 @@ A great number of operators you can use in expressions are available (listed fro
|
|||||||
.It Li \&! Ta Unary not
|
.It Li \&! Ta Unary not
|
||||||
.El
|
.El
|
||||||
.Pp
|
.Pp
|
||||||
.Ic ~
|
.Sq ~
|
||||||
complements a value by inverting all its bits.
|
complements a value by inverting all its bits.
|
||||||
.Pp
|
.Pp
|
||||||
.Ic %
|
.Sq %
|
||||||
is used to get the remainder of the corresponding division, so that
|
is used to get the remainder of the corresponding division, so that
|
||||||
.Sq a / b * b + a % b == a
|
.Ql x / y * y + x % y == x
|
||||||
is always true.
|
is always true.
|
||||||
The result has the same sign as the divisor.
|
The result has the same sign as the divisor.
|
||||||
This makes
|
This makes
|
||||||
.Sq a % b .
|
.Ql x % y
|
||||||
equal to
|
equal to
|
||||||
.Sq (a + b) % b
|
.Ql (x + y) % y
|
||||||
or
|
or
|
||||||
.Sq (a - b) % b .
|
.Ql (x - y) % y .
|
||||||
.Pp
|
.Pp
|
||||||
Shifting works by shifting all bits in the left operand either left
|
Shifting works by shifting all bits in the left operand either left
|
||||||
.Pq Sq <<
|
.Pq Sq <<
|
||||||
@@ -427,6 +427,18 @@ no matter what value is set as the current
|
|||||||
.Cm Q
|
.Cm Q
|
||||||
option.
|
option.
|
||||||
.Pp
|
.Pp
|
||||||
|
The
|
||||||
|
.Ic FMOD
|
||||||
|
function
|
||||||
|
is used to get the remainder of the corresponding fixed-point division, so that
|
||||||
|
.Ql MUL(DIV(x, y), y) + FMOD(x, y) == x
|
||||||
|
is always true.
|
||||||
|
The result has the same sign as the
|
||||||
|
.Em dividend ;
|
||||||
|
this is the opposite of how the integer modulo operator
|
||||||
|
.Sq %
|
||||||
|
works!
|
||||||
|
.Pp
|
||||||
The trigonometry functions (
|
The trigonometry functions (
|
||||||
.Ic SIN ,
|
.Ic SIN ,
|
||||||
.Ic COS ,
|
.Ic COS ,
|
||||||
@@ -1120,7 +1132,7 @@ and so on.
|
|||||||
.Ed
|
.Ed
|
||||||
.Ss Variables
|
.Ss Variables
|
||||||
An equal sign
|
An equal sign
|
||||||
.Ic =
|
.Sq =
|
||||||
is used to define mutable numeric symbols.
|
is used to define mutable numeric symbols.
|
||||||
Unlike the other symbols described below, variables can be redefined.
|
Unlike the other symbols described below, variables can be redefined.
|
||||||
This is useful for internal symbols in macros, for counters, etc.
|
This is useful for internal symbols in macros, for counters, etc.
|
||||||
@@ -1170,7 +1182,7 @@ below).
|
|||||||
.Ic EQU
|
.Ic EQU
|
||||||
is used to define immutable numeric symbols.
|
is used to define immutable numeric symbols.
|
||||||
Unlike
|
Unlike
|
||||||
.Ic =
|
.Sq =
|
||||||
above, constants defined this way cannot be redefined.
|
above, constants defined this way cannot be redefined.
|
||||||
These constants can be used for unchanging values such as properties of the hardware.
|
These constants can be used for unchanging values such as properties of the hardware.
|
||||||
.Bd -literal -offset indent
|
.Bd -literal -offset indent
|
||||||
@@ -1637,17 +1649,17 @@ all have the same value, as do
|
|||||||
and
|
and
|
||||||
.Sq Lives .
|
.Sq Lives .
|
||||||
Thus, keep in mind that
|
Thus, keep in mind that
|
||||||
.Ic ld [Health], a
|
.Ql ld [Health], a
|
||||||
is identical to
|
is identical to
|
||||||
.Ic ld [Name], a .
|
.Ql ld [Name], a .
|
||||||
.Pp
|
.Pp
|
||||||
The size of this union is 19 bytes, as this is the size of the largest block (the last one, containing
|
The size of this union is 19 bytes, as this is the size of the largest block (the last one, containing
|
||||||
.Sq VideoBuffer ) .
|
.Sq VideoBuffer ) .
|
||||||
Nesting unions is possible, with each inner union's size being considered as described above.
|
Nesting unions is possible, with each inner union's size being considered as described above.
|
||||||
.Pp
|
.Pp
|
||||||
Unions may be used in any section, but inside them may only be
|
Unions may be used in any section, but they may only contain space-allocating directives like
|
||||||
.Ic DS -
|
.Ic DS
|
||||||
like commands (see
|
(see
|
||||||
.Sx Statically allocating space in RAM ) .
|
.Sx Statically allocating space in RAM ) .
|
||||||
.Sh THE MACRO LANGUAGE
|
.Sh THE MACRO LANGUAGE
|
||||||
.Ss Invoking macros
|
.Ss Invoking macros
|
||||||
@@ -1847,7 +1859,7 @@ PRINTLN STRFMT("E = %f", 2.718)
|
|||||||
.It Ic PRINT
|
.It Ic PRINT
|
||||||
prints out each of its comma-separated arguments.
|
prints out each of its comma-separated arguments.
|
||||||
Numbers are printed as unsigned uppercase hexadecimal with a leading
|
Numbers are printed as unsigned uppercase hexadecimal with a leading
|
||||||
.Ic $ .
|
.Sq $ .
|
||||||
For different formats, use
|
For different formats, use
|
||||||
.Ic STRFMT .
|
.Ic STRFMT .
|
||||||
.It Ic PRINTLN
|
.It Ic PRINTLN
|
||||||
@@ -2167,9 +2179,8 @@ POPO
|
|||||||
PRINTLN $80000000/-1 ; no warning by default
|
PRINTLN $80000000/-1 ; no warning by default
|
||||||
.Ed
|
.Ed
|
||||||
.Pp
|
.Pp
|
||||||
The options that
|
|
||||||
.Ic OPT
|
.Ic OPT
|
||||||
can modify are currently:
|
can modify the options
|
||||||
.Cm b , g , p , Q ,
|
.Cm b , g , p , Q ,
|
||||||
and
|
and
|
||||||
.Cm r .
|
.Cm r .
|
||||||
|
|||||||
Reference in New Issue
Block a user