mirror of
https://github.com/gbdev/rgbds.git
synced 2025-11-20 18:22:07 +00:00
Document dw and dl with strings
This commit is contained in:
@@ -1075,27 +1075,33 @@ command-line option, except when using overlays with
|
|||||||
.Ic DB
|
.Ic DB
|
||||||
defines a list of bytes that will be stored in the final image.
|
defines a list of bytes that will be stored in the final image.
|
||||||
Ideal for tables and text.
|
Ideal for tables and text.
|
||||||
Note that strings are not zero-terminated!
|
|
||||||
.Bd -literal -offset indent
|
.Bd -literal -offset indent
|
||||||
DB 1,2,3,4,"This is a string"
|
DB 1,2,3,4,"This is a string"
|
||||||
.Ed
|
.Ed
|
||||||
.Pp
|
.Pp
|
||||||
.Ic DS
|
|
||||||
can also be used to fill a region of memory with some value.
|
|
||||||
The following produces 42 times the byte $FF:
|
|
||||||
.Bd -literal -offset indent
|
|
||||||
DS 42, $FF
|
|
||||||
.Ed
|
|
||||||
.Pp
|
|
||||||
Alternatively, you can use
|
Alternatively, you can use
|
||||||
.Ic DW
|
.Ic DW
|
||||||
to store a list of words (16-bit) or
|
to store a list of words (16-bit) or
|
||||||
.Ic DL
|
.Ic DL
|
||||||
to store a list of double-words/longs (32-bit).
|
to store a list of double-words/longs (32-bit).
|
||||||
Strings are not allowed as arguments to
|
.Pp
|
||||||
.Ic DW
|
Strings are handled a little specially: they first undergo charmap conversion (see
|
||||||
and
|
.Sx Character maps ) ,
|
||||||
.Ic DL .
|
then each resulting character is output individually.
|
||||||
|
For example, under the default charmap, the following two lines are identical:
|
||||||
|
.Bd -literal -offset indent
|
||||||
|
DW "Hello!"
|
||||||
|
DW "H", "e", "l", "l", "o", "!"
|
||||||
|
.Ed
|
||||||
|
.Pp
|
||||||
|
If you do not want this special handling, enclose the string in parentheses.
|
||||||
|
.Pp
|
||||||
|
.Ic DS
|
||||||
|
can also be used to fill a region of memory with some value.
|
||||||
|
The following produces 42 times the byte $FF:
|
||||||
|
.Bd -literal -offset indent
|
||||||
|
DS 42, $FF
|
||||||
|
.Ed
|
||||||
.Pp
|
.Pp
|
||||||
You can also use
|
You can also use
|
||||||
.Ic DB , DW
|
.Ic DB , DW
|
||||||
|
|||||||
Reference in New Issue
Block a user