mc: Implemented .LITERAL
This commit is contained in:
parent
f901adba22
commit
fd3d5d35fb
4 changed files with 57 additions and 8 deletions
|
@ -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
|
||||
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>
|
||||
|
@ -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>
|
||||
|
||||
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
|
||||
</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>
|
||||
|
||||
|
@ -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>
|
||||
|
||||
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 <tt><ref id=".ASCIIZ"
|
||||
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
|
||||
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>
|
||||
|
@ -3356,6 +3366,22 @@ Here's a list of all control commands and a description, what they do:
|
|||
</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>
|
||||
|
||||
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)
|
||||
/* 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 */
|
||||
|
|
|
@ -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 },
|
||||
|
|
|
@ -210,6 +210,7 @@ typedef enum token_t {
|
|||
TOK_LINECONT,
|
||||
TOK_LIST,
|
||||
TOK_LISTBYTES,
|
||||
TOK_LITERAL,
|
||||
TOK_LOBYTE,
|
||||
TOK_LOBYTES,
|
||||
TOK_LOCAL,
|
||||
|
|
Loading…
Add table
Reference in a new issue