ARCHITECTURE AND INSTRUCTIONS
The next four bytes will be initialized to 2,4,8, and 16, respectively. A table of bytes, all initialized to zero, can be defined by
ALL2ERO DB 0,0,0,0,0,0
or by the shorthand notation
ALLZERO DB 6 DUP (0)
And, finally, an
DONT_CARE DB ?,?,?,?,?,?,?,?
DONT_CARE DB 8 DUP (?)
TYPES OF MEMORY LOCATIONS
SUM DB ?
informs the assembler that the memory loca- tion SUM is of type BYTE. Later, when the assembler encounters an instruction state- ment such as
INC SUM
the assembler will know to generate a byte- increment instruction, rather than a word- increment instruction.
Amemory location can be one of the follow- ing types:
1) BYTE of data, as in:
SUM DB ? ;defining a byte
2)WORD of data (two consecutive bytes), as
m:
BIGGER.J)UM DW ? ;defining a word
3)DWORD of data (four consecutive bytes), as in:
BIGGEST_SUM DD ? ;defining a doubleword
4) NEAR instruction location, as in:
CYCLE: CMP SUM,100
5) FAR instruction location:
(means of defining such locations will be discussed shortly)
An instruction location can appear in a jump or call instruction statement. The assembler will generate an intrasegment jump or call if the location type is NEAR, and an interseg- ment jump or call if it is FAR. For example, the labeled instruction statement
CYCLE: CMP SUM,100
informs the assembler that the memory loca- tion CYCLE is of type NEAR. (We will see shortly how the synthetic operators PTR and THIS are used to define a memory location of type FAR). Later, when the assembler encounters an instruction such as
JMP CYCLE
the assembler will know to generate an intra- segment jump. instruction, rather than an intersegment jump instruction.
A memory address built by adding or sub- tracting a numeric value to or from some other memory address has the same type as the original memory address. For example, SUM+2 is a BYTE,
ANALYTIC AND SYNTHETIC OPERATORS
We now know enough about memory addres- ses to complete the discussion of operators.
The analytic operators decompose memory- address operands into their components. These operators are:
1)SEG
2)OFFSET
3)TYPE
4)SIZE
5)LENGTH
The SEG operator returns the segment com- ponent of the
The TYPE operator returns a numeric value, which is the type component of the memory- address operand. The value of the type