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:
|
There are a few other functions that do things beyond numeric or string operations:
|
||||||
.Bl -column "SECTION(symbol)"
|
.Bl -column "SECTION(symbol)"
|
||||||
.It Sy Name Ta Sy Operation
|
.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.
|
.It Fn BANK arg Ta Returns a bank number.
|
||||||
If
|
If
|
||||||
.Ar arg
|
.Ar arg
|
||||||
@@ -639,13 +646,6 @@ If
|
|||||||
.Ar arg
|
.Ar arg
|
||||||
is a section type keyword, it returns the starting address of that section type.
|
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.
|
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
|
.El
|
||||||
.Sh SECTIONS
|
.Sh SECTIONS
|
||||||
Before you can start writing code, you must define a section.
|
Before you can start writing code, you must define a section.
|
||||||
@@ -1275,16 +1275,18 @@ DEF str_SIZEOF EQU 259
|
|||||||
.Ed
|
.Ed
|
||||||
.Pp
|
.Pp
|
||||||
There are five commands in the RS group of commands:
|
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 Sy Command Ta Sy Meaning
|
||||||
.It Ic RSRESET Ta Equivalent to Ql RSSET 0 .
|
.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 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 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 RW Ar constexpr Ta Sets the preceding symbol to Ic _RS No and adds Ar constexpr No * 2 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 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 RL Ar constexpr Ta Sets Ar name No to Ic _RS No and then adds Ar constexpr No * 4 to Ic _RS .
|
||||||
.El
|
.El
|
||||||
.Pp
|
.Pp
|
||||||
If the argument to
|
If the
|
||||||
|
.Ar constexpr
|
||||||
|
argument to
|
||||||
.Ic RB , RW ,
|
.Ic RB , RW ,
|
||||||
or
|
or
|
||||||
.Ic RL
|
.Ic RL
|
||||||
@@ -1391,8 +1393,8 @@ So this won't work:
|
|||||||
MACRO outer
|
MACRO outer
|
||||||
MACRO inner
|
MACRO inner
|
||||||
PRINTLN "Hello!"
|
PRINTLN "Hello!"
|
||||||
ENDM
|
ENDM ; this actually ends the 'outer' macro...
|
||||||
ENDM
|
ENDM ; ...and then this is a syntax error!
|
||||||
.Ed
|
.Ed
|
||||||
.Pp
|
.Pp
|
||||||
But this will:
|
But this will:
|
||||||
@@ -1717,7 +1719,8 @@ Suppose your macro contains a loop.
|
|||||||
.Bd -literal -offset indent
|
.Bd -literal -offset indent
|
||||||
MACRO LoopyMacro
|
MACRO LoopyMacro
|
||||||
xor a, a
|
xor a, a
|
||||||
\&.loop ld [hl+],a
|
\&.loop
|
||||||
|
ld [hl+], a
|
||||||
dec c
|
dec c
|
||||||
jr nz, .loop
|
jr nz, .loop
|
||||||
ENDM
|
ENDM
|
||||||
@@ -1735,7 +1738,8 @@ blocks.
|
|||||||
.Bd -literal -offset indent
|
.Bd -literal -offset indent
|
||||||
MACRO LoopyMacro
|
MACRO LoopyMacro
|
||||||
xor a, a
|
xor a, a
|
||||||
\&.loop\e@ ld [hl+],a
|
\&.loop\e@
|
||||||
|
ld [hl+], a
|
||||||
dec c
|
dec c
|
||||||
jr nz, .loop\e@
|
jr nz, .loop\e@
|
||||||
ENDM
|
ENDM
|
||||||
@@ -1766,7 +1770,8 @@ MACRO LoopyMacro
|
|||||||
ld hl, \e1
|
ld hl, \e1
|
||||||
ld c, \e2
|
ld c, \e2
|
||||||
xor a, a
|
xor a, a
|
||||||
\&.loop\e@ ld [hl+],a
|
\&.loop\e@
|
||||||
|
ld [hl+], a
|
||||||
dec c
|
dec c
|
||||||
jr nz, .loop\e@
|
jr nz, .loop\e@
|
||||||
ENDM
|
ENDM
|
||||||
@@ -1952,16 +1957,16 @@ ENDR
|
|||||||
.Pp
|
.Pp
|
||||||
It acts just as if you had done:
|
It acts just as if you had done:
|
||||||
.Bd -literal -offset indent
|
.Bd -literal -offset indent
|
||||||
N = 0
|
DEF N = 0
|
||||||
dw N * N
|
dw N * N
|
||||||
N = 1
|
DEF N = 1
|
||||||
dw N * N
|
dw N * N
|
||||||
N = 2
|
DEF N = 2
|
||||||
dw N * N
|
dw N * N
|
||||||
; ...
|
; ...
|
||||||
N = 255
|
DEF N = 255
|
||||||
dw N * N
|
dw N * N
|
||||||
N = 256
|
DEF N = 256
|
||||||
.Ed
|
.Ed
|
||||||
.Pp
|
.Pp
|
||||||
You can customize the range of
|
You can customize the range of
|
||||||
|
|||||||
Reference in New Issue
Block a user