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
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
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 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.
The
1)SEGMENT
2)ENDS
3)ASSUME
4)ORG
The SEGMENT and ENDS statement sub- divide the