ARCHITECTURE AND INSTRUCTIONS

Further, the PTR operator can create loca- tions of instructions:

INCHES:

CMP

SUM,100

;type of INCHES is NEAR

 

JMP

INCHES

;intrasegment jump

MILES

EQU

FAR PTR INCHES

;type of MILES is FAR

 

JMP

MILES

;intersegment jump

Notice that the above shows ways to build new memory-address operands from old ones by

1)using the PTR operator as in BYTE PTR TWO_BYTE

2)using expressions as in ONE_BYTE+ 1

3)using a combination of PTR and expres- sions as in BYTE PTR (TWO_BYTE+l)

Expressions are useful when we wish to change the offset component but leave the type component unchanged.

Neither expressions, nor PTR, changes the segment component. And the new memory- address operand, created by either expres- sions or PTR, will have a length component of I (providing it's not· an instruction location).

The synthetic operator THIS, like PTR, builds a memory-address operand of a speci- fied type, without allocating memory for it. The segment and offset component of the new memory-address operand is the segment and offset of the next memory location avail- able for allocation. For example:

EQU THIS BYTE

DW ?

would create MY_BYTE with type compo- nent of BYTE, and with the same segment and offset components as MY_WORD. In

this example, MY.-BYTE could have been built with the PTR operator instead:

MY_BYTE EQU BYTE PTR MY_WORD

The THIS operator is convenient for defining FAR instruction locations:

MILES

EQU

THIS FAR

 

CMP

SUM,100

 

JMP

MILES

Note that the use of the THIS operator in the example made it unnecessary to have a NEAR instruction location with the same segment and offset as MILES. If we used the PTR operator instead of the THIS operator, such a NEAR instruction would have been necessary.

Segmentation-Definition Statements

The segmentation-definition statements orga- nize our program to use the 8088 memory segments. These directives are:

1)SEGMENT

2)ENDS

3)ASSUME

4)ORG

The SEGMENT and ENDS statement sub- divide the assembly-lllnguage source pro- gram into segments. Such segments correspond to the memory segments where the resulting object code will eventually be loaded. The assembler is concerned with pro- gram segmentation for the following reasons.

2-32

Page 67
Image 67
Intel 210200-002 manual Segment Ends Assume