ARCHITECTURE AND INSTRUCTIONS
Further, the
PTR
operator can create loca-
tions of instructions:
INCHES:
CMP
JMP
SUM,100
INCHES
;type
of
INCHES is NEAR
;intrasegment
jump
MILES EQU
JMP
FAR PTR INCHES
MILES
;type
of
MILES is FAR
;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
DW
THIS BYTE
?
would create MY_BYTE with type compo-
nent of BYTE, and with the same segment
and offset components as
MY_WORD. In
2-32
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
CMP
JMP
THIS
FAR
SUM,100
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.