ARCHITECTURE AND INSTRUCTIONS

component for the various memory-address

. operands is:

 

Type

Memory Address Operand

Component

BYTE of data

1

WORD of data

2

DWORD of data

4

NEAR instruction location

-1

FAR instruction location

-2

PTR and THIS

The synthetic operators build memory- address operands from their components. These operators are PTR and THIS.

The PTR operator builds a memory-address operand that has the same segment and offset of some other memory-address operand, but has a different type. Unlike a data-definition statement, the PTR operator does not allo- cate memory; it merely gives another mean- ing to previously-allocated memory. For example, if TWO_BYTE were defined by,

Notice that the type component for bytes, words, and double words corresponds to the number of bytes that each occupies. The value of the type component for instruction locations does not have a physical interpreta- tion.

The LENGTH and SIZE operators apply only to data-memory-address operands (BYTE, WORD, or DWORD).

The LENGTH operator returns a numeric value for the number of units (bytes, words, or double words) associated with the memory- address operand.

The SIZE operator returns a numeric value for the number of bytes allocated for the memory-address operand. For example, if MULTI_WORDS is defined by

MULTLWORDS DW 50 DUP (0)

then LENGTH MULTI.JVORDS is 50 and SIZE MULTI_WORDS is 100. Notice that

.SIZE X is equal to (LENGTH X)* (TYPE

X).

TWO_BYTE DW ?

then we could name first the byte in the word as follows:

ONE_BYTE EQU BYTE PTR TWO_BYTE

In this example, the PTR operator creates a new memory-address operand having the same segment and offset components as TWO_BYTE, but having a type component of BYTE. We can name the second byte of TWO_BYTE either as

OTHER-BYTE EQU BYTE PTR (TWO_BYTE +1)

or more simply as

OTHER_BYTE EQU

The PTR operator can also create words and double-words as illustrated below:

MANY BYTES

D.B

100 DUP (?)

;an array of 100 bytes

FIRST WORD

EQU

WORD PTR MANY_BYTES

 

SECOND DOUBLE

EQU

DWORD PTR (MANY_~YTES +4)

2-31

Page 66
Image 66
Intel 210200-002 manual Then we could name first the byte in the word as follows