Built-in Assembler String Constants

Language:
Русский
English

 Built-in Assembler String Constants


In built-in assembler statements, string constants must be enclosed in single or double quotes.

Two consecutive quotes of the same type as the enclosing quotes count as only one character.

String constants of any length are allowed in DB directives, and cause allocation of a sequence of bytes containing the ASCII values of the characters in the string.

When not in a DB directive, a string constant can be no longer than four characters, and denotes a numeric value that can participate in an expression.

The numeric value of a string constant is calculated as

 Ord(Ch1)
 + Ord(Ch2) shl  8
   + Ord(Ch3) shl 16
     + Ord(Ch4) shl 24

where

  - Ch1 is the rightmost (last) character
  - Ch4 is the leftmost (first) character

If the string is shorter than four characters, the leftmost (first)

 character(s) are assumed to be 0 (zero).

Here are some examples of string constants and their corresponding numeric values:

   String         Numeric

   Constant       Value
   'a'            00000061H
   'ba'           00006261H
   'cba'          00636261H
   'dcba'         64636261H
   'a '           00006120H
   '   a'         20202061H
   'a'*2          000000E2H
   'a'-'A'        00000020H
   NOT 'a'        FFFFFF9EH

Код для вставки: :: :: :: ::
Поделиться: // //