@@ -2180,7 +2184,8 @@ Here's a list of all control commands and a description, what they do:
.BYT, .BYTE
Define byte sized data. Must be followed by a sequence of (byte ranged)
- expressions or strings.
+ expressions or strings. Strings will be translated using the current
+ character mapping definition.
Example:
@@ -2189,6 +2194,9 @@ Here's a list of all control commands and a description, what they do:
.byt "world", $0D, $00
+See: ,
+
+
.CASE
@@ -2207,8 +2215,10 @@ Here's a list of all control commands and a description, what they do:
.CHARMAP
- Apply a custom mapping for characters. The command is followed by two
- numbers. The first one is the index of the source character (range 0..255);
+ Apply a custom mapping for characters for the commands and . The command
+ is followed by two numbers. The first one is the index of the source character
+ (range 0..255);
the second one is the mapping (range 0..255). The mapping applies to all
character and string constants [
@@ -3356,6 +3366,22 @@ Here's a list of all control commands and a description, what they do:
+].LITERAL
+
+ Define byte sized data. Must be followed by a sequence of (byte ranged)
+ expressions or strings. Strings will disregard the current character
+ mapping definition and will be interpreted literally.
+
+ Example:
+
+
+ .literal "Hello "
+ .literal "world", $0D, $00
+
+
+See: ,
+
+
.LOBYTES
Define byte sized data by extracting only the low byte (that is, bits 0-7) from
diff --git a/src/ca65/pseudo.c b/src/ca65/pseudo.c
index df0482a5a..7e24d814d 100644
--- a/src/ca65/pseudo.c
+++ b/src/ca65/pseudo.c
@@ -566,8 +566,8 @@ static void DoBss (void)
-static void DoByte (void)
-/* Define bytes */
+static void DoByteBase (int EnableTranslation)
+/* Define bytes or literals */
{
/* Element type for the generated array */
static const char EType[1] = { GT_BYTE };
@@ -579,8 +579,12 @@ static void DoByte (void)
/* Parse arguments */
while (1) {
if (CurTok.Tok == TOK_STRCON) {
- /* A string, translate into target charset and emit */
- TgtTranslateStrBuf (&CurTok.SVal);
+ /* A string, translate into target charset
+ if appropriate */
+ if (EnableTranslation) {
+ TgtTranslateStrBuf (&CurTok.SVal);
+ }
+ /* Emit */
EmitStrBuf (&CurTok.SVal);
NextTok ();
} else {
@@ -613,6 +617,14 @@ static void DoByte (void)
+static void DoByte (void)
+/* Define bytes with translation */
+{
+ DoByteBase (1);
+}
+
+
+
static void DoCase (void)
/* Switch the IgnoreCase option */
{
@@ -1415,6 +1427,14 @@ static void DoList (void)
+static void DoLiteral (void)
+/* Define bytes without translation */
+{
+ DoByteBase (0);
+}
+
+
+
static void DoLoBytes (void)
/* Define bytes, extracting the lo byte from each expression in the list */
{
@@ -2103,6 +2123,7 @@ static CtrlDesc CtrlCmdTab [] = {
{ ccNone, DoLineCont },
{ ccNone, DoList },
{ ccNone, DoListBytes },
+ { ccNone, DoLiteral },
{ ccNone, DoUnexpected }, /* .LOBYTE */
{ ccNone, DoLoBytes },
{ ccNone, DoUnexpected }, /* .LOCAL */
diff --git a/src/ca65/scanner.c b/src/ca65/scanner.c
index 0452bb368..0a7d433b2 100644
--- a/src/ca65/scanner.c
+++ b/src/ca65/scanner.c
@@ -234,6 +234,7 @@ struct DotKeyword {
{ ".LINECONT", TOK_LINECONT },
{ ".LIST", TOK_LIST },
{ ".LISTBYTES", TOK_LISTBYTES },
+ { ".LITERAL", TOK_LITERAL },
{ ".LOBYTE", TOK_LOBYTE },
{ ".LOBYTES", TOK_LOBYTES },
{ ".LOCAL", TOK_LOCAL },
diff --git a/src/ca65/token.h b/src/ca65/token.h
index a94254bfd..02fc8d491 100644
--- a/src/ca65/token.h
+++ b/src/ca65/token.h
@@ -210,6 +210,7 @@ typedef enum token_t {
TOK_LINECONT,
TOK_LIST,
TOK_LISTBYTES,
+ TOK_LITERAL,
TOK_LOBYTE,
TOK_LOBYTES,
TOK_LOCAL,