mirror of
https://github.com/gbdev/rgbds.git
synced 2025-11-20 10:12:06 +00:00
Document ELIF
Signed-off-by: Antonio Niño Díaz <antonio_nd@outlook.com>
This commit is contained in:
@@ -704,27 +704,48 @@ calls infinitely (or until you run out of memory, whichever comes first).
|
|||||||
.Dl INCLUDE \[dq]irq.inc\[dq]
|
.Dl INCLUDE \[dq]irq.inc\[dq]
|
||||||
.Pp
|
.Pp
|
||||||
.Ss Conditional assembling
|
.Ss Conditional assembling
|
||||||
The three commands
|
The four commands
|
||||||
.Ic IF ,
|
.Ic IF ,
|
||||||
.Ic ELSE
|
.Ic ELIF ,
|
||||||
|
.Ic ELSE ,
|
||||||
and
|
and
|
||||||
.Ic ENDC
|
.Ic ENDC
|
||||||
are used to conditionally assemble parts of your file.
|
are used to conditionally assemble parts of your file.
|
||||||
This is a powerful feature commonly used in macros.
|
This is a powerful feature commonly used in macros.
|
||||||
.Pp
|
.Pp
|
||||||
.Bd -literal -offset indent
|
.Bd -literal -offset indent
|
||||||
IF 2+2==4
|
IF NUM < 0
|
||||||
PRINTT \[dq]2+2==4\[rs]n\[dq]
|
PRINTT \[dq]NUM < 0\[rs]n\[dq]
|
||||||
|
ELIF NUM == 0
|
||||||
|
PRINTT \[dq]NUM == 0\[rs]n\[dq]
|
||||||
ELSE
|
ELSE
|
||||||
PRINTT \[dq]2+2!=4\[rs]n\[dq]
|
PRINTT \[dq]NUM > 0\[rs]n\[dq]
|
||||||
ENDC
|
ENDC
|
||||||
.Ed
|
.Ed
|
||||||
.Pp
|
.Pp
|
||||||
The
|
The
|
||||||
|
.Ic ELIF
|
||||||
|
and
|
||||||
.Ic ELSE
|
.Ic ELSE
|
||||||
block is optional.
|
blocks are optional.
|
||||||
.Ic IF No / Ic ELSE No / Ic ENDC
|
.Ic IF No / Ic ELIF No / Ic ELSE No / Ic ENDC
|
||||||
blocks can be nested.
|
blocks can be nested.
|
||||||
|
.Pp
|
||||||
|
Note that if an
|
||||||
|
.Ic ELSE
|
||||||
|
block is found before an
|
||||||
|
.Ic ELIF
|
||||||
|
block, the
|
||||||
|
.Ic ELIF
|
||||||
|
block will be ignored.
|
||||||
|
All
|
||||||
|
.Ic ELIF
|
||||||
|
blocks must go before the
|
||||||
|
.Ic ELSE
|
||||||
|
block.
|
||||||
|
Also, if there is more than one
|
||||||
|
.Ic ELSE
|
||||||
|
block, all of them but the first one are ignored.
|
||||||
.Ss Integer and Boolean expressions
|
.Ss Integer and Boolean expressions
|
||||||
An expression can be composed of many things.
|
An expression can be composed of many things.
|
||||||
Expressions are always evaluated using signed 32-bit math.
|
Expressions are always evaluated using signed 32-bit math.
|
||||||
@@ -970,6 +991,7 @@ machine.
|
|||||||
.It Sx DIV
|
.It Sx DIV
|
||||||
.It Sx DS
|
.It Sx DS
|
||||||
.It Sx DW
|
.It Sx DW
|
||||||
|
.It Sx ELIF
|
||||||
.It Sx ELSE
|
.It Sx ELSE
|
||||||
.It Sx ENDC
|
.It Sx ENDC
|
||||||
.It Sx ENDM
|
.It Sx ENDM
|
||||||
|
|||||||
Reference in New Issue
Block a user