4. INST. OPERANDS FUNCTION
AND REG, memory
memory, REG
REG, REG
memory, immediate
REG, immediate
Example:
MOV AL, 'a' ; AL = 01100001b
AND AL, 11011111b ; AL = 01000001b
; ('A')
Example:
MOV AL, 'A’ ; AL = 01000001b
OR AL, 00100000b ; AL = 01100001b
;('a')
OR
XOR
Example:
MOV AL, 'A’ ; AL = 01000001b
XOR AL, AL ; AL = ?
S, Z & P FLAGS are Affected
5. INST. OPERANDS FUNCTION
TEST
REG, memory
memory, REG
REG, REG
memory, immediate
REG, immediate
source operand AND destination operand
Example:
MOV AL, 'a' ; AL = 01100001b
MOV BH, ‘A' ; BH = 01000001b
TEST AL,BH ; AL & BH
; dose not changed
; ONLY AFFECT FLAGS
S, Z & P FLAGS are Affected
6. INST. OPERANDS FUNCTION
NEG
REG
memory
Example:
MOV AL, 5 ; AL = 05h
NEG AL ; AL = 0FBh (-5)
NEG AL ; AL = 05h (5)
Example:
MOV AL, FF ; AL = FFh
INC AL ; AL = ?
INC
DEC
Example:
MOV AL, 0 ; AL =0
DEC AL ; AL = ?
S, Z, O, A & P FLAGS are Affected
8. INST. OPERANDS FUNCTION
CMP
REG, memory
memory, REG
REG, REG
memory, immediate
REG, immediate
Algorithm:
Compare.
operand1 - operand2
Result is not stored anywhere,
flags are set (OF, SF, ZF, AF, PF,
CF) according to result.
Example:
MOV AL, 5
MOV BL, 5
CMP AL, BL
; AL = 5, ZF = 1 (so equal!)
9.
10. INST. OPERANDS FUNCTION
SHL/
SAL
REG or MEM
CY 0
SHR REG or MEM CY
0
ROL REG or MEM
CY
ROR REG or MEM CY
REG or MEM CY
RCR
REG or MEM
CY
RCL
REG, 1
memory, 1
REG, CL
memory, CL
O & C FLAGS are Affected
11. INST. OPERANDS FUNCTION
SAR REG or MEM CY
REG, 1
memory, 1
REG, CL
memory, CL
S, Z, O, C & P FLAGS are Affected
12. Draw The Hardware Block Diagram That represents
The Instruction SAR AL,1 With Timing Diagram.
Draw The Hardware Block Diagram That Represents
The Instruction SCR BH,1 With Timing Diagram.
Write A Program To Calculate 2^5 And Store The
Result In BL.
Write A Program To Divide The Number Stored
In CX By 16 And Store TheResult In DX.