An ASCII character string can be preassigned by using a string constant as an operand. The statement
MESSAGE DB 'H','E','L','L','O'
puts the ASCII codes for H(48), E(45), L(4C), and O(4F) in consecutive bytes beginning with the byte whose address is associated with the variable MESSAGE. This statement is equivalent to
MESSAGE DB 'HELLO'
Note that the first character in the string goes in the first byte, the second in the second byte, and so on.
the use of the duplication operator DUP. Several operands or operand patterns can be replaced with a form such as
Exp DUP(Operand, . . . , Operand)
where Exp is an expression that evaluates to a positive integer, which causes the operand pattern to be repeated the number of times indicated by Exp. The statements
ARRAY1 DB 2 DUP(0,1,2,?)
ARRAY2 DB 100 DUP(?) |
would cause the preassignment and allocation shown in Fig. 3-57(a).
Figure 3-57 Application of the DUP operator.
| |
(a) Unnested duplications | (b) Nested duplications |
Table of Contents | Next page | Previous page
This is page 42.