
ARCHITECTURE AND INSTRUCTIONS
division. Thus 19/7 is2, whereas 19 MOD7 is 5.
Arithmetic operators may always be applied to a pair of numeric operands, and the result will be numeric. The rules for applying arithmetic operators on
For example, the product of two memory addresses has no meaningful interpretation. What segment would it be in? What offset would it have? Hence, it is a prohibited operation.
The difference of two memory addresses in the same segment is the numeric distance between them - the difference in their offsets.
The only other meaningful arithmetic opera- tion on a memory address is adding or subtracting a numeric value. Thus SUM+2,
NOTE: The value of SUM+2 is a memory address two bytes beyond SUM in the MY _ DATA segment; it is not the numeric value that is 2
logical Operators
The logical operators are
The operands of logical operators must be numeric only -
1010101 010101010B AND 11001100110011 OOB is 1000100010001000B;
1100110011001100B OR 1111000011110000B is 1111110011111100B
NOT 1111111111111111 B is OOOOOOOOOOOOOOOOB and
1111000011110000B XOR SUM is invalid.
As an example of logical operators, consider:
IN AL,PORT_VAL
OUT PORT_VAL AND OFEH,AL
The IN instruction gets input from PORT _VAL, wherever that is.
Execution of the OUT instruction sends out- put to port PORT3AL AND OFEH, which is either the same port, if PORT_VAL is even, or the next
Observe that AND, OR, XOR, and NOT are instruction mnemonics as well as
AND | OX,PORT_VAL AND OFEH |
will cause the assembler to compute the value of PORT_VAL AND OFEH and then gener- ate an
Relational Operators
1)Equal (EQ)
2)
3)
4)
5)
6)
PORT_VAL LT 5 is a relational operator. The two operands must both be numeric or must both be memory addresses in the same segment. The result is always a numeric value. It will be 0 if the relationship is false,