MyLecture10.pptx
MyLecture10.pptx
◼ The instruction set of a microprocessor defines the basic operations that a programmer can make the
device perform.
◼ The instruction set of 8088/8086 microprocessor has 117 basic instructions.
◼ The wide range of operands and addressing modes permitted for use with these instructions
executable at the machine code level.
GROUPS OF INSTRUCTIONS
◼ The instruction set can be divided into a number of groups of functionally related
instructions.
◼ Data Transfer Group of Instructions
◼ Arithmetic and Logic Group of Instructions
◼ Transfer of Control Group of Instructions
DATA TRANSFER GROUP
◼ Arithmetic Instructions
◼ Logic Instructions
◼ Compare and Test Instructions
◼ Multiplication Instructions
◼ Division Instructions
◼ BCD and ASCII Arithmetic Instructions
◼ Rotate Instructions
◼ Shift Instructions
◼ Flag Control Instructions
TRANSFER OF CONTROL GROUP
◼ Jump Instructions
◼ Subroutine Handling Instructions
◼ Loop Handling Instructions
DATA TRANSFER INSTRUCTIONS
D S Examples:
• MOV AX , DI; (AX) 🡨 (DI)
REG REG
• MOV DL , CH; (DL) 🡨 (CH)
REG MEM
• MOV AX , [BX]; (AX) 🡨 (DS:[BX])
MEM REG
◼ MOV D , S • MOV [DI] , DX; (DS:[DI]) 🡨 (DX)
MEM IMM
(D) 🡨 (S) • MOV WORDPTR[BP] , 3Ch; (SS:[BP]) 🡨 003Ch
REG IMM
No Flags affected • MOV DI , 9F60h; (DI) 🡨 9F60h
ACC MEM
• MOV AX , WD2; (AX) 🡨 (DS: WD2)
MEM ACC • MOV BT2 , AL; (DS:BT2) 🡨 (AL)
SEG REG • MOV DS , DX; (DS) 🡨 (DX)
SEG MEM • MOV ES , [DI+40h]; (ES) 🡨 (DS:[DI+40h])
REG SEG • MOV DI , SS; (DI) 🡨 (SS)
MEM SEG • MOV [SI+50h] , CS; (DS:[SI+50h]) 🡨 (CS)
DATA TRANSFER INSTRUCTIONS
DS*10h + BX + 8 D6
DS*10h + BX + 7 38
DS*10h + BX + 6 15
DS*10h + BX + 5 2E
◼ XLAT
DS*10h + BX + 4 9B
(AL) 🡨 (DS:[BX+AL]) or
DS*10h + BX + 3 56
(AL) 🡨 (DS*10h+BX+AL)
DS*10h + BX + 2 D4
DS*10h + BX + 1 3C
DS*10h + BX + 0 45
:
:
DS*10h
DATA TRANSFER INSTRUCTIONS
ACC PT
◼ IN ACC , PT
AL P8 Fixed
(ACC) 🡨 Data present at input port ‘PT’
AX P8 Address
◼ OUT PT , ACC
AL DX Variable
Data appear at output port ‘PT’ 🡨 (ACC) Address
AX DX
Examples: (Fixed Addressed Isolated I/O)
IN AL , 80h ; From input port ’80h’ a byte is read/inputted into ‘AL’
IN AX , 80h ; From input port ’80h’ a word is read/inputted into ‘AX’
OUT 60h , AL ; From ‘AL’ a byte is written/outputted at port ‘60h’
OUT 60h , AX ; From ‘AX’ a word is written/outputted at port ‘60h’
ISOLATED I/O INSTRUCTIONS
S16 / D16
REG16
◼ PUSH S16 ; (SS:[SP – 1]) 🡨 (S15-8) , (SS:[SP – 2]) 🡨 (S7-0) , (SP) 🡨 (SP) – 2.
MEM16
◼ POP D16 ; (D7-0) 🡨 (SS:[SP]) , (D15-8) 🡨 (SS:[SP+1]) , (SP) 🡨 (SP) + 2.
SEG
◼ DETAILED DISCUSSION IN LECTURE # 9.
IMM(not for POP & not
available for 8088/8086)
FLAG
ALL
STACK OPERATION INSTRUCTIONS
Examples:
◼ PUSH AX; ((SP)-1)🡨(AH), ((SP)-2)🡨(AL), (SP)🡨(SP)-2.
◼ PUSH [BX]; ((SP)-1)🡨(DS:[BX+1]), ((SP)-2)🡨(DS:[BX]), (SP)🡨(SP)-2.
◼ PUSH DS; ((SP)-1)🡨(DSH), ((SP)-2)🡨(DSL), (SP)🡨(SP)-2.
◼ PUSHF; ((SP)-1)🡨(FLH), ((SP)-2)🡨(FLL), (SP)🡨(SP)-2.
◼ POP DX; (DL)🡨((SP)), (DH)🡨((SP)+1), (SP)🡨(SP)+2.
◼ POP [BP]; (SS:[BP])🡨((SP)), (SS:[BP]+1)🡨((SP)+1), (SP)🡨(SP)+2.
◼ POPF; (FLL)🡨((SP)), (FLH)🡨((SP)+1), (SP)🡨(SP)+2.
◼ POP ES; (ESL)🡨((SP)), (ESH)🡨((SP)+1), (SP)🡨(SP)+2.
STRING DATA TRANSFER INSTRUCTIONS
REG IMM
Where NUM1 EQU 45D0h
ACC IMM
ARITHMETIC INSTRUCTIONS
REG IMM
Where NUM1 EQU D5h
ACC IMM
ARITHMETIC INSTRUCTIONS
◼ INC/DEC/NEG OP
(OP) 🡨 (OP) + 1 Examples:
(OP) 🡨 (OP) - 1 • INC SI; (SI) 🡨 (SI) + 1
(OP) 🡨 0 - (OP) • DEC DH; (DH) 🡨 (DH) - 1
• NEG BT1; BT1 🡨 0 - (DS:BT1)
Status Flags are affected
• INC WD1; WD1 🡨 WD1 + 1
OPERAND (OP) • DEC BYTEPTR [DI]; BYTE(DS:[DI]) 🡨 BYTE(DS:[DI] -1
• NEG WORDPTR [BP+40h] ; WORD(SS:[BP+40h]) 🡨 0 - WORD(SS:[BP+40h])
REG8
REG16
Where BT1 DB 5Dh
MEM WD1 DW 13F0h
LOGIC INSTRUCTIONS
REG IMM
Where NUM1 EQU 45D0h
ACC IMM
LOGIC INSTRUCTIONS
Q. Given (AX) = E68Ah, choose the correct logic operation for the following:
MASK AX YAND YOR YXOR
1. Bit 5,6 and 8 are to be set
0 0 0 0 0
2. Bit 3, 10 and 11 are to be reset
0 1 0 1 1
3. Bit 2, 14 and 15 are to be complemented
1 0 0 1 1
Solution:
1 1 1 1 0
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 0 0 1 1 0 1 0 0 0 1 0 1 0 AX
0 0 0 0 0 0 0 1 0 1 1 0 0 0 0 0 OR MASK
1 1 1 0 0 1 1 1 1 1 1 0 1 0 1 0 AX
1 1 1 1 0 0 1 1 1 1 1 1 0 1 1 1 AND MASK
1 1 1 0 0 0 1 1 1 1 1 0 0 0 1 0 AX
1 1 0 0 0 0 0 0 0 0 0 0 0 1 0 0 XOR MASK
0 0 1 0 0 0 1 1 1 1 1 0 0 1 1 0 AX
LOGIC INSTRUCTIONS
◼ NOT OP
(OP) 🡨 1s of complement of (OP)
Examples:
All Status Flags affected
• NOT SI; (SI) 🡨 1s complement of (SI)
• NOT DH; (DH) 🡨 1s complement of (DH)
OP • NOT BT1; (DS:BT1) 🡨 1s complement of (DS:BT1)
REG8 • NOT WD1; (DS:WD1) 🡨 1s complement of WD1
• NOT BYTEPTR [DI]; BYTE(DS:[DI]) 🡨 1s complement of BYTE(DS:[DI])
REG16
• NOT WORDPTR [BP+40h] ; WORD(SS:[BP+40h]) 🡨 1s complement of WORD(SS:[BP+40h])
MEM
Where BT1 DB 5Dh
WD1 DW 13F0h
COMPARE AND TEST INSTRUCTIONS