mirror of
https://github.com/gbdev/rgbds.git
synced 2025-11-20 10:12:06 +00:00
Reword some RGBASM docs
This commit is contained in:
49
man/rgbasm.5
49
man/rgbasm.5
@@ -603,6 +603,13 @@ Modifications to a character map take effect immediately from that point onward.
|
||||
There are a few other functions that do things beyond numeric or string operations:
|
||||
.Bl -column "SECTION(symbol)"
|
||||
.It Sy Name Ta Sy Operation
|
||||
.It Fn DEF symbol Ta Returns 1 if
|
||||
.Ar symbol
|
||||
has been defined, 0 otherwise.
|
||||
String constants are not expanded within the parentheses.
|
||||
.It Fn ISCONST arg Ta Returns 1 if Ar arg Ap s value is known by RGBASM (e.g. if it can be an argument to
|
||||
.Ic IF ) ,
|
||||
or 0 if only RGBLINK can compute its value.
|
||||
.It Fn BANK arg Ta Returns a bank number.
|
||||
If
|
||||
.Ar arg
|
||||
@@ -639,13 +646,6 @@ If
|
||||
.Ar arg
|
||||
is a section type keyword, it returns the starting address of that section type.
|
||||
The result is not constant, since only RGBLINK can compute its value.
|
||||
.It Fn DEF symbol Ta Returns 1 if
|
||||
.Ar symbol
|
||||
has been defined, 0 otherwise.
|
||||
String constants are not expanded within the parentheses.
|
||||
.It Fn ISCONST arg Ta Returns 1 if Ar arg Ap s value is known by RGBASM (e.g. if it can be an argument to
|
||||
.Ic IF ) ,
|
||||
or 0 if only RGBLINK can compute its value.
|
||||
.El
|
||||
.Sh SECTIONS
|
||||
Before you can start writing code, you must define a section.
|
||||
@@ -1275,16 +1275,18 @@ DEF str_SIZEOF EQU 259
|
||||
.Ed
|
||||
.Pp
|
||||
There are five commands in the RS group of commands:
|
||||
.Bl -column "RSSET constexpr"
|
||||
.Bl -column "DEF name RB constexpr"
|
||||
.It Sy Command Ta Sy Meaning
|
||||
.It Ic RSRESET Ta Equivalent to Ql RSSET 0 .
|
||||
.It Ic RSSET Ar constexpr Ta Sets the Ic _RS No counter to Ar constexpr .
|
||||
.It Ic RB Ar constexpr Ta Sets the preceding symbol to Ic _RS No and adds Ar constexpr No to Ic _RS .
|
||||
.It Ic RW Ar constexpr Ta Sets the preceding symbol to Ic _RS No and adds Ar constexpr No * 2 to Ic _RS .
|
||||
.It Ic RL Ar constexpr Ta Sets the preceding symbol to Ic _RS No and adds Ar constexpr No * 4 to Ic _RS .
|
||||
.It Ic DEF Ar name Ic RB Ar constexpr Ta Sets Ar name No to Ic _RS No and then adds Ar constexpr No to Ic _RS .
|
||||
.It Ic DEF Ar name Ic RW Ar constexpr Ta Sets Ar name No to Ic _RS No and then adds Ar constexpr No * 2 to Ic _RS .
|
||||
.It Ic DEF Ar name Ic RL Ar constexpr Ta Sets Ar name No to Ic _RS No and then adds Ar constexpr No * 4 to Ic _RS .
|
||||
.El
|
||||
.Pp
|
||||
If the argument to
|
||||
If the
|
||||
.Ar constexpr
|
||||
argument to
|
||||
.Ic RB , RW ,
|
||||
or
|
||||
.Ic RL
|
||||
@@ -1391,8 +1393,8 @@ So this won't work:
|
||||
MACRO outer
|
||||
MACRO inner
|
||||
PRINTLN "Hello!"
|
||||
ENDM
|
||||
ENDM
|
||||
ENDM ; this actually ends the 'outer' macro...
|
||||
ENDM ; ...and then this is a syntax error!
|
||||
.Ed
|
||||
.Pp
|
||||
But this will:
|
||||
@@ -1717,7 +1719,8 @@ Suppose your macro contains a loop.
|
||||
.Bd -literal -offset indent
|
||||
MACRO LoopyMacro
|
||||
xor a, a
|
||||
\&.loop ld [hl+],a
|
||||
\&.loop
|
||||
ld [hl+], a
|
||||
dec c
|
||||
jr nz, .loop
|
||||
ENDM
|
||||
@@ -1735,7 +1738,8 @@ blocks.
|
||||
.Bd -literal -offset indent
|
||||
MACRO LoopyMacro
|
||||
xor a, a
|
||||
\&.loop\e@ ld [hl+],a
|
||||
\&.loop\e@
|
||||
ld [hl+], a
|
||||
dec c
|
||||
jr nz, .loop\e@
|
||||
ENDM
|
||||
@@ -1766,7 +1770,8 @@ MACRO LoopyMacro
|
||||
ld hl, \e1
|
||||
ld c, \e2
|
||||
xor a, a
|
||||
\&.loop\e@ ld [hl+],a
|
||||
\&.loop\e@
|
||||
ld [hl+], a
|
||||
dec c
|
||||
jr nz, .loop\e@
|
||||
ENDM
|
||||
@@ -1952,16 +1957,16 @@ ENDR
|
||||
.Pp
|
||||
It acts just as if you had done:
|
||||
.Bd -literal -offset indent
|
||||
N = 0
|
||||
DEF N = 0
|
||||
dw N * N
|
||||
N = 1
|
||||
DEF N = 1
|
||||
dw N * N
|
||||
N = 2
|
||||
DEF N = 2
|
||||
dw N * N
|
||||
; ...
|
||||
N = 255
|
||||
DEF N = 255
|
||||
dw N * N
|
||||
N = 256
|
||||
DEF N = 256
|
||||
.Ed
|
||||
.Pp
|
||||
You can customize the range of
|
||||
|
||||
Reference in New Issue
Block a user