mc: Implemented .LITERAL
This commit is contained in:
committed by
Oliver Schmidt
parent
f901adba22
commit
fd3d5d35fb
@@ -2084,7 +2084,11 @@ Here's a list of all control commands and a description, what they do:
|
|||||||
|
|
||||||
This will put the string "Hello world" followed by a binary zero into
|
This will put the string "Hello world" followed by a binary zero into
|
||||||
the current segment. There may be more strings separated by commas, but
|
the current segment. There may be more strings separated by commas, but
|
||||||
the binary zero is only appended once (after the last one).
|
the binary zero is only appended once (after the last one). Strings will
|
||||||
|
be translated using the current character mapping definition.
|
||||||
|
|
||||||
|
See: <tt><ref id=".BYTE" name=".BYTE"></tt>,<tt><ref id=".CHARMAP" name=".CHARMAP"></tt>,
|
||||||
|
<tt><ref id=".LITERAL" name=".LITERAL"></tt>
|
||||||
|
|
||||||
|
|
||||||
<sect1><tt>.ASSERT</tt><label id=".ASSERT"><p>
|
<sect1><tt>.ASSERT</tt><label id=".ASSERT"><p>
|
||||||
@@ -2180,7 +2184,8 @@ Here's a list of all control commands and a description, what they do:
|
|||||||
<sect1><tt>.BYT, .BYTE</tt><label id=".BYTE"><p>
|
<sect1><tt>.BYT, .BYTE</tt><label id=".BYTE"><p>
|
||||||
|
|
||||||
Define byte sized data. Must be followed by a sequence of (byte ranged)
|
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:
|
Example:
|
||||||
|
|
||||||
@@ -2189,6 +2194,9 @@ Here's a list of all control commands and a description, what they do:
|
|||||||
.byt "world", $0D, $00
|
.byt "world", $0D, $00
|
||||||
</verb></tscreen>
|
</verb></tscreen>
|
||||||
|
|
||||||
|
See: <tt><ref id=".ASCIIZ" name=".ASCIIZ"></tt>,<tt><ref id=".CHARMAP" name=".CHARMAP"></tt>
|
||||||
|
<tt><ref id=".LITERAL" name=".LITERAL"></tt>
|
||||||
|
|
||||||
|
|
||||||
<sect1><tt>.CASE</tt><label id=".CASE"><p>
|
<sect1><tt>.CASE</tt><label id=".CASE"><p>
|
||||||
|
|
||||||
@@ -2207,8 +2215,10 @@ Here's a list of all control commands and a description, what they do:
|
|||||||
|
|
||||||
<sect1><tt>.CHARMAP</tt><label id=".CHARMAP"><p>
|
<sect1><tt>.CHARMAP</tt><label id=".CHARMAP"><p>
|
||||||
|
|
||||||
Apply a custom mapping for characters. The command is followed by two
|
Apply a custom mapping for characters for the commands <tt><ref id=".ASCIIZ"
|
||||||
numbers. The first one is the index of the source character (range 0..255);
|
name=".ASCIIZ"></tt> and <tt><ref id=".BYTE" name=".BYTE"></tt>. 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
|
the second one is the mapping (range 0..255). The mapping applies to all
|
||||||
character and string constants <em/when/ they generate output; and, overrides
|
character and string constants <em/when/ they generate output; and, overrides
|
||||||
a mapping table specified with the <tt><ref id="option-t" name="-t"></tt>
|
a mapping table specified with the <tt><ref id="option-t" name="-t"></tt>
|
||||||
@@ -3356,6 +3366,22 @@ Here's a list of all control commands and a description, what they do:
|
|||||||
</verb></tscreen>
|
</verb></tscreen>
|
||||||
|
|
||||||
|
|
||||||
|
<sect1><tt>.LITERAL</tt><label id=".LITERAL"><p>
|
||||||
|
|
||||||
|
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:
|
||||||
|
|
||||||
|
<tscreen><verb>
|
||||||
|
.literal "Hello "
|
||||||
|
.literal "world", $0D, $00
|
||||||
|
</verb></tscreen>
|
||||||
|
|
||||||
|
See: <tt><ref id=".ASCIIZ" name=".ASCIIZ"></tt>,<tt><ref id=".BYTE" name=".BYTE"></tt>
|
||||||
|
|
||||||
|
|
||||||
<sect1><tt>.LOBYTES</tt><label id=".LOBYTES"><p>
|
<sect1><tt>.LOBYTES</tt><label id=".LOBYTES"><p>
|
||||||
|
|
||||||
Define byte sized data by extracting only the low byte (that is, bits 0-7) from
|
Define byte sized data by extracting only the low byte (that is, bits 0-7) from
|
||||||
|
|||||||
@@ -566,8 +566,8 @@ static void DoBss (void)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
static void DoByte (void)
|
static void DoByteBase (int EnableTranslation)
|
||||||
/* Define bytes */
|
/* Define bytes or literals */
|
||||||
{
|
{
|
||||||
/* Element type for the generated array */
|
/* Element type for the generated array */
|
||||||
static const char EType[1] = { GT_BYTE };
|
static const char EType[1] = { GT_BYTE };
|
||||||
@@ -579,8 +579,12 @@ static void DoByte (void)
|
|||||||
/* Parse arguments */
|
/* Parse arguments */
|
||||||
while (1) {
|
while (1) {
|
||||||
if (CurTok.Tok == TOK_STRCON) {
|
if (CurTok.Tok == TOK_STRCON) {
|
||||||
/* A string, translate into target charset and emit */
|
/* A string, translate into target charset
|
||||||
TgtTranslateStrBuf (&CurTok.SVal);
|
if appropriate */
|
||||||
|
if (EnableTranslation) {
|
||||||
|
TgtTranslateStrBuf (&CurTok.SVal);
|
||||||
|
}
|
||||||
|
/* Emit */
|
||||||
EmitStrBuf (&CurTok.SVal);
|
EmitStrBuf (&CurTok.SVal);
|
||||||
NextTok ();
|
NextTok ();
|
||||||
} else {
|
} else {
|
||||||
@@ -613,6 +617,14 @@ static void DoByte (void)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
static void DoByte (void)
|
||||||
|
/* Define bytes with translation */
|
||||||
|
{
|
||||||
|
DoByteBase (1);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
static void DoCase (void)
|
static void DoCase (void)
|
||||||
/* Switch the IgnoreCase option */
|
/* 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)
|
static void DoLoBytes (void)
|
||||||
/* Define bytes, extracting the lo byte from each expression in the list */
|
/* Define bytes, extracting the lo byte from each expression in the list */
|
||||||
{
|
{
|
||||||
@@ -2103,6 +2123,7 @@ static CtrlDesc CtrlCmdTab [] = {
|
|||||||
{ ccNone, DoLineCont },
|
{ ccNone, DoLineCont },
|
||||||
{ ccNone, DoList },
|
{ ccNone, DoList },
|
||||||
{ ccNone, DoListBytes },
|
{ ccNone, DoListBytes },
|
||||||
|
{ ccNone, DoLiteral },
|
||||||
{ ccNone, DoUnexpected }, /* .LOBYTE */
|
{ ccNone, DoUnexpected }, /* .LOBYTE */
|
||||||
{ ccNone, DoLoBytes },
|
{ ccNone, DoLoBytes },
|
||||||
{ ccNone, DoUnexpected }, /* .LOCAL */
|
{ ccNone, DoUnexpected }, /* .LOCAL */
|
||||||
|
|||||||
@@ -234,6 +234,7 @@ struct DotKeyword {
|
|||||||
{ ".LINECONT", TOK_LINECONT },
|
{ ".LINECONT", TOK_LINECONT },
|
||||||
{ ".LIST", TOK_LIST },
|
{ ".LIST", TOK_LIST },
|
||||||
{ ".LISTBYTES", TOK_LISTBYTES },
|
{ ".LISTBYTES", TOK_LISTBYTES },
|
||||||
|
{ ".LITERAL", TOK_LITERAL },
|
||||||
{ ".LOBYTE", TOK_LOBYTE },
|
{ ".LOBYTE", TOK_LOBYTE },
|
||||||
{ ".LOBYTES", TOK_LOBYTES },
|
{ ".LOBYTES", TOK_LOBYTES },
|
||||||
{ ".LOCAL", TOK_LOCAL },
|
{ ".LOCAL", TOK_LOCAL },
|
||||||
|
|||||||
@@ -210,6 +210,7 @@ typedef enum token_t {
|
|||||||
TOK_LINECONT,
|
TOK_LINECONT,
|
||||||
TOK_LIST,
|
TOK_LIST,
|
||||||
TOK_LISTBYTES,
|
TOK_LISTBYTES,
|
||||||
|
TOK_LITERAL,
|
||||||
TOK_LOBYTE,
|
TOK_LOBYTE,
|
||||||
TOK_LOBYTES,
|
TOK_LOBYTES,
|
||||||
TOK_LOCAL,
|
TOK_LOCAL,
|
||||||
|
|||||||
Reference in New Issue
Block a user