Professional Documents
Culture Documents
Micro - 5 Instruction (2) Logical + Shift 16-10-2023
Micro - 5 Instruction (2) Logical + Shift 16-10-2023
QUIZ #4
A) PUSH AX B) POP DX
1
10/12/2023
Instructions
for
INTEL 8086
Microprocessor
(2)
logical Group
Shift & Rotate Group
Dr. Mazin H. Aziz 2nd-Class Microprocessor I 10/12/2023 3
10/12/2023
2
10/12/2023
3
10/12/2023
Instructions Groups
(3)
(1) SHIFT
DATA &
Transfer ROTATION
Group (7)
Group
CONTROL
Group
(2) (4)
LOGICAL BRANCH
Group Group
(5) (6)
ARITHMATIC CHARRECTER
Group STRING
7
Group Dr. Mazin H. Aziz 2nd-Class
10/12/2023
Microprocessor I
LOGICAL GROUP
AND NEG
NOT
OR INC
TEST
XOR DEC
CMP
10/12/2023 8
Dr. Mazin H. Aziz 2nd-Class Microprocessor I
4
10/12/2023
Example:
AND REG, memory MOV AL, 'a' ; AL = 01100001b
AND AL, 11011111b ; AL = 01000001b
; ('A')
memory, REG
Example:
OR REG, REG MOV AL, 'A’
OR
; AL = 01000001b
AL, 00100000b ; AL = 01100001b
memory, immediate ;('a')
Example:
REG, immediate
XOR MOV AL, 'A’ ; AL = 01000001b
XOR AL, AL ; AL = ?
S, Z & P FLAGS are Affected
Dr. Mazin H. Aziz 2nd-Class Microprocessor I 10/12/2023 9
memory, REG
Example:
TEST REG, REG MOV AL, 'a' ; AL = 01100001b
MOV BH, ‘A' ; BH = 01000001b
memory, immediate TEST AL,BH ; AL & BH
; dose not change
REG, immediate ; ONLY AFFECTS FLAGS
10
5
10/12/2023
Example:
MOV AL, 77h ; AL = 77h
REG NOT AL ; AL =88h
NOT MOV AL, 7h ; AL = 7h
memory NOT AL ; AL = ?
11
REG Example:
INC MOV AL, FF ; AL = FFh
INC AL ; AL = ?
memory Example:
DEC MOV AL, 0 ; AL =0
DEC AL ; AL = ?
S, Z, O, A & P FLAGS are Affected
10/12/2023 12
Dr. Mazin H. Aziz 2nd-Class Microprocessor I
12
6
10/12/2023
13
HOMEWORK #3
Using Instructions from the Logical Group do the following:
5) Write the shortest Program that finds the 2’s complement of the
16-bit number stored at 45321h.
10/12/2023 14
Dr. Mazin H. Aziz 2nd-Class Microprocessor I
14
7
10/12/2023
SHL RCR
ROL
SHR RCL
ROR
SAR
15
16
8
10/12/2023
REG, 1
memory, 1
SAR REG, CL
REG or MEM CY
memory, CL
17
HOMEWORK #3
Using Instructions from the Shift and Rotate Group do the following:
6) Write a program to exchange CL with CH.
7) Write a program to exchange the contents of the byte located at
the address (32001h) by that located at the address (32002h).
8) Write a program to divide the stored number in CX by 8 and store
the result in BX.
9) Write a program to multiply the stored byte at the address (70h)
by 16 and store the result (word) at the address (80h).
10) Write a program that exchanges (swaps) the least significant
nibble of DL with the most significant nibble of it.
Dr. Mazin H. Aziz 2nd-Class Microprocessor I 10/12/2023 18
18
9
10/12/2023
THE END
Dr. Mazin H. Aziz 2nd-Class Microprocessor I 10/12/2023 19
19
10