> Built-in Assembler DB, DW, and DD Directives


 Built-in Assembler DB, DW, and DD Directives

The built-in assembler supports three assembler directives: DB (define byte), DW (define word), and DD (define double word).

   Dir   Operand Type          Value Range      Built-in Assembler Generates
   DB    Constant expression  128 to 255        1 byte
         Character string     Any length        Sequence of bytes corresponding
                                                to ASCII code of each character
   DW    Constant expression  -32,768 to 65,535 1 word
         Address expression                     Near pointer (offset word)
   DD    Constant expression  -2,147,483,648 1  double word
                              to 4,294,967,295
         Address expression                     Far pointer (offset  word
                                                followed by segment word)

The data generated by the DB, DW, and DD directives is always stored in the code segment.

To generate uninitialized or initialized data in the data segment, use normal Pascal var or const declarations.

Here are some examples of DB, DW, and DD directives:

   Dir   Operand             Result
   DB    0FFH                One byte
   DB    0,99                Two bytes
   DB    'A'                 Ord('A')
   DB    'Hello...', 0DH,0AH String + CR/LF
   DB    12,"Turbo Pascal"   Pascal-style string

   DW    0FFFFH              One word
   DW    0,9999              Two words
   DW    'A'                 Same as DB 'A',0
   DW    'BA'                Same as DB 'A','B'
   DW    MyVar               Offset of MyVar
   DW    MyProc              Offset of MyProc

   DD    0FFFFFFFFH          One double-word
   DD    0,999999999         Two double-words
   DD    'A'                 Same as DB 'A',0,0,0
   DD    'DCBA'              Same as DB 'A','B','C','D'
   DD    MyVar               Pointer to MyVar
   DD    MyProc              Pointer to MyProc

The only kind of symbol that can be defined in a built-in assembler statement is a label. All variables must be declared using Pascal syntax.

 К началу страницы 
Тэги: DB DD DW

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

Хостинг предоставлен компанией "Веб Сервис Центр" при поддержке компании "ДокЛаб"