SlideShare uma empresa Scribd logo
1 de 49
1. Data Transfer Instructions
2. Arithmetic Instructions
3. Logical Instructions
4. String manipulation Instructions
5. Process Control Instructions
6. Control Transfer Instructions
Instruction Set
1
8086 Microprocessor
8086 supports 6 types of instructions:
1. Data Transfer Instructions
Instruction Set
2
8086 Microprocessor
Instructions that are used to transfer data/ address in to
registers, memory locations and I/O ports.
Generally involve two operands: Source operand and
Destination operand of the same size.
Source: Register or a memory location or an immediate data
Destination : Register or a memory location.
The size should be a either a byte or a word.
A 8-bit data can only be moved to 8-bit register/ memory
and a 16-bit data can be moved to 16-bit register/ memory.
1. Data Transfer Instructions
Instruction Set
3
8086 Microprocessor
Mnemonics: MOV, XCHG, PUSH, POP, IN, OUT …
MOV reg2/ mem, reg1/ mem
MOV reg2, reg1
MOV mem, reg1
MOV reg2, mem
(reg2)  (reg1)
(mem)  (reg1)
(reg2)  (mem)
MOV reg/ mem, data
MOV reg, data
MOV mem, data
(reg)  data
(mem)  data
XCHG reg2/ mem, reg1
XCHG reg2, reg1
XCHG mem, reg1
(reg2)  (reg1)
(mem)  (reg1)
1. Data Transfer Instructions
Instruction Set
4
8086 Microprocessor
Mnemonics: MOV, XCHG, PUSH, POP, IN, OUT …
PUSH reg16/ mem
PUSH reg16
PUSH mem
(SP)  (SP) – 2
MA S = (SS) x 1610 + SP
(MA S ; MA S + 1)  (reg16)
(SP)  (SP) – 2
MA S = (SS) x 1610 + SP
(MA S ; MA S + 1)  (mem)
POP reg16/ mem
POP reg16
POP mem
MA S = (SS) x 1610 + SP
(reg16)  (MA S ; MA S + 1)
(SP)  (SP) + 2
MA S = (SS) x 1610 + SP
(mem)  (MA S ; MA S + 1)
(SP)  (SP) + 2
1. Data Transfer Instructions
Instruction Set
5
8086 Microprocessor
Mnemonics: MOV, XCHG, PUSH, POP, IN, OUT …
IN A, [DX]
IN AL, [DX]
IN AX, [DX]
PORTaddr = (DX)
(AL)  (PORT)
PORTaddr = (DX)
(AX)  (PORT)
IN A, addr8
IN AL, addr8
IN AX, addr8
(AL)  (addr8)
(AX)  (addr8)
OUT [DX], A
OUT [DX], AL
OUT [DX], AX
PORTaddr = (DX)
(PORT)  (AL)
PORTaddr = (DX)
(PORT)  (AX)
OUT addr8, A
OUT addr8, AL
OUT addr8, AX
(addr8)  (AL)
(addr8)  (AX)
2. Arithmetic Instructions
Instruction Set
6
8086 Microprocessor
Mnemonics: ADD, ADC, SUB, SBB, INC, DEC, MUL, DIV, CMP…
ADD reg2/ mem, reg1/mem
ADC reg2, reg1
ADC reg2, mem
ADC mem, reg1
(reg2)  (reg1) + (reg2)
(reg2)  (reg2) + (mem)
(mem)  (mem)+(reg1)
ADD reg/mem, data
ADD reg, data
ADD mem, data
(reg)  (reg)+ data
(mem)  (mem)+data
ADD A, data
ADD AL, data8
ADD AX, data16
(AL)  (AL) + data8
(AX)  (AX) +data16
2. Arithmetic Instructions
Instruction Set
7
8086 Microprocessor
Mnemonics: ADD, ADC, SUB, SBB, INC, DEC, MUL, DIV, CMP…
ADC reg2/ mem, reg1/mem
ADC reg2, reg1
ADC reg2, mem
ADC mem, reg1
(reg2)  (reg1) + (reg2)+CF
(reg2)  (reg2) + (mem)+CF
(mem)  (mem)+(reg1)+CF
ADC reg/mem, data
ADC reg, data
ADC mem, data
(reg)  (reg)+ data+CF
(mem)  (mem)+data+CF
ADDC A, data
ADD AL, data8
ADD AX, data16
(AL)  (AL) + data8+CF
(AX)  (AX) +data16+CF
2. Arithmetic Instructions
Instruction Set
8
8086 Microprocessor
Mnemonics: ADD, ADC, SUB, SBB, INC, DEC, MUL, DIV, CMP…
SUB reg2/ mem, reg1/mem
SUB reg2, reg1
SUB reg2, mem
SUB mem, reg1
(reg2)  (reg1) - (reg2)
(reg2)  (reg2) - (mem)
(mem)  (mem) - (reg1)
SUB reg/mem, data
SUB reg, data
SUB mem, data
(reg)  (reg) - data
(mem)  (mem) - data
SUB A, data
SUB AL, data8
SUB AX, data16
(AL)  (AL) - data8
(AX)  (AX) - data16
2. Arithmetic Instructions
Instruction Set
9
8086 Microprocessor
Mnemonics: ADD, ADC, SUB, SBB, INC, DEC, MUL, DIV, CMP…
SBB reg2/ mem, reg1/mem
SBB reg2, reg1
SBB reg2, mem
SBB mem, reg1
(reg2)  (reg1) - (reg2) - CF
(reg2)  (reg2) - (mem)- CF
(mem)  (mem) - (reg1) –CF
SBB reg/mem, data
SBB reg, data
SBB mem, data
(reg)  (reg) – data - CF
(mem)  (mem) - data - CF
SBB A, data
SBB AL, data8
SBB AX, data16
(AL)  (AL) - data8 - CF
(AX)  (AX) - data16 - CF
2. Arithmetic Instructions
Instruction Set
10
8086 Microprocessor
Mnemonics: ADD, ADC, SUB, SBB, INC, DEC, MUL, DIV, CMP…
INC reg/ mem
INC reg8
INC reg16
INC mem
(reg8)  (reg8) + 1
(reg16)  (reg16) + 1
(mem)  (mem) + 1
DEC reg/ mem
DEC reg8
DEC reg16
DEC mem
(reg8)  (reg8) - 1
(reg16)  (reg16) - 1
(mem)  (mem) - 1
2. Arithmetic Instructions
Instruction Set
11
8086 Microprocessor
Mnemonics: ADD, ADC, SUB, SBB, INC, DEC, MUL, DIV, CMP…
MUL reg/ mem
MUL reg
MUL mem
For byte : (AX)  (AL) x (reg8)
For word : (DX)(AX)  (AX) x (reg16)
For byte : (AX)  (AL) x (mem8)
For word : (DX)(AX)  (AX) x (mem16)
IMUL reg/ mem
IMUL reg
IMUL mem
For byte : (AX)  (AL) x (reg8)
For word : (DX)(AX)  (AX) x (reg16)
For byte : (AX)  (AX) x (mem8)
For word : (DX)(AX)  (AX) x (mem16)
2. Arithmetic Instructions
Instruction Set
12
8086 Microprocessor
Mnemonics: ADD, ADC, SUB, SBB, INC, DEC, MUL, DIV, CMP…
DIV reg/ mem
DIV reg
DIV mem
For 16-bit :- 8-bit :
(AL)  (AX) :- (reg8) Quotient
(AH)  (AX) MOD(reg8) Remainder
For 32-bit :- 16-bit :
(AX)  (DX)(AX) :- (reg16) Quotient
(DX)  (DX)(AX) MOD(reg16) Remainder
For 16-bit :- 8-bit :
(AL)  (AX) :- (mem8) Quotient
(AH)  (AX) MOD(mem8) Remainder
For 32-bit :- 16-bit :
(AX)  (DX)(AX) :- (mem16) Quotient
(DX)  (DX)(AX) MOD(mem16) Remainder
2. Arithmetic Instructions
Instruction Set
13
8086 Microprocessor
Mnemonics: ADD, ADC, SUB, SBB, INC, DEC, MUL, DIV, CMP…
IDIV reg/ mem
IDIV reg
IDIV mem
For 16-bit :- 8-bit :
(AL)  (AX) :- (reg8) Quotient
(AH)  (AX) MOD(reg8) Remainder
For 32-bit :- 16-bit :
(AX)  (DX)(AX) :- (reg16) Quotient
(DX)  (DX)(AX) MOD(reg16) Remainder
For 16-bit :- 8-bit :
(AL)  (AX) :- (mem8) Quotient
(AH)  (AX) MOD(mem8) Remainder
For 32-bit :- 16-bit :
(AX)  (DX)(AX) :- (mem16) Quotient
(DX)  (DX)(AX) MOD(mem16) Remainder
2. Arithmetic Instructions
Instruction Set
14
8086 Microprocessor
Mnemonics: ADD, ADC, SUB, SBB, INC, DEC, MUL, DIV, CMP…
CMP reg2/mem, reg1/ mem
CMP reg2, reg1
CMP reg2, mem
CMP mem, reg1
Modify flags  (reg2) – (reg1)
If (reg2) > (reg1) then CF=0, ZF=0, SF=0
If (reg2) < (reg1) then CF=1, ZF=0, SF=1
If (reg2) = (reg1) then CF=0, ZF=1, SF=0
Modify flags  (reg2) – (mem)
If (reg2) > (mem) then CF=0, ZF=0, SF=0
If (reg2) < (mem) then CF=1, ZF=0, SF=1
If (reg2) = (mem) then CF=0, ZF=1, SF=0
Modify flags  (mem) – (reg1)
If (mem) > (reg1) then CF=0, ZF=0, SF=0
If (mem) < (reg1) then CF=1, ZF=0, SF=1
If (mem) = (reg1) then CF=0, ZF=1, SF=0
2. Arithmetic Instructions
Instruction Set
15
8086 Microprocessor
Mnemonics: ADD, ADC, SUB, SBB, INC, DEC, MUL, DIV, CMP…
CMP reg/mem, data
CMP reg, data
CMP mem, data
Modify flags  (reg) – (data)
If (reg) > data then CF=0, ZF=0, SF=0
If (reg) < data then CF=1, ZF=0, SF=1
If (reg) = data then CF=0, ZF=1, SF=0
Modify flags  (mem) – (mem)
If (mem) > data then CF=0, ZF=0, SF=0
If (mem) < data then CF=1, ZF=0, SF=1
If (mem) = data then CF=0, ZF=1, SF=0
2. Arithmetic Instructions
Instruction Set
16
8086 Microprocessor
Mnemonics: ADD, ADC, SUB, SBB, INC, DEC, MUL, DIV, CMP…
CMP A, data
CMP AL, data8
CMP AX, data16
Modify flags  (AL) – data8
If (AL) > data8 then CF=0, ZF=0, SF=0
If (AL) < data8 then CF=1, ZF=0, SF=1
If (AL) = data8 then CF=0, ZF=1, SF=0
Modify flags  (AX) – data16
If (AX) > data16 then CF=0, ZF=0, SF=0
If (mem) < data16 then CF=1, ZF=0, SF=1
If (mem) = data16 then CF=0, ZF=1, SF=0
3. Logical Instructions
Instruction Set
17
8086 Microprocessor
Mnemonics: AND, OR, XOR, TEST, SHR, SHL, RCR, RCL …
3. Logical Instructions
Instruction Set
18
8086 Microprocessor
Mnemonics: AND, OR, XOR, TEST, SHR, SHL, RCR, RCL …
3. Logical Instructions
Instruction Set
19
8086 Microprocessor
Mnemonics: AND, OR, XOR, TEST, SHR, SHL, RCR, RCL …
3. Logical Instructions
Instruction Set
20
8086 Microprocessor
Mnemonics: AND, OR, XOR, TEST, SHR, SHL, RCR, RCL …
3. Logical Instructions
Instruction Set
21
8086 Microprocessor
Mnemonics: AND, OR, XOR, TEST, SHR, SHL, RCR, RCL …
3. Logical Instructions
Instruction Set
22
8086 Microprocessor
Mnemonics: AND, OR, XOR, TEST, SHR, SHL, RCR, RCL …
3. Logical Instructions
Instruction Set
23
8086 Microprocessor
Mnemonics: AND, OR, XOR, TEST, SHR, SHL, RCR, RCL …
3. Logical Instructions
Instruction Set
24
8086 Microprocessor
Mnemonics: AND, OR, XOR, TEST, SHR, SHL, RCR, RCL …
4. String Manipulation Instructions
Instruction Set
25
8086 Microprocessor
 String : Sequence of bytes or words
 8086 instruction set includes instruction for string movement, comparison,
scan, load and store.
 REP instruction prefix : used to repeat execution of string instructions
 String instructions end with S or SB or SW.
S represents string, SB string byte and SW string word.
 Offset or effective address of the source operand is stored in SI register and
that of the destination operand is stored in DI register.
 Depending on the status of DF, SI and DI registers are automatically
updated.
 DF = 0  SI and DI are incremented by 1 for byte and 2 for word.
 DF = 1  SI and DI are decremented by 1 for byte and 2 for word.
4. String Manipulation Instructions
Instruction Set
26
8086 Microprocessor
Mnemonics: REP, MOVS, CMPS, SCAS, LODS, STOS
REP
REPZ/ REPE
(Repeat CMPS or SCAS until
ZF = 0)
REPNZ/ REPNE
(Repeat CMPS or SCAS until
ZF = 1)
While CX  0 and ZF = 1, repeat execution of
string instruction and
(CX)  (CX) – 1
While CX  0 and ZF = 0, repeat execution of
string instruction and
(CX)  (CX) - 1
4. String Manipulation Instructions
Instruction Set
27
8086 Microprocessor
Mnemonics: REP, MOVS, CMPS, SCAS, LODS, STOS
MOVS
MOVSB
MOVSW
MA = (DS) x 1610 + (SI)
MAE = (ES) x 1610 + (DI)
(MAE)  (MA)
If DF = 0, then (DI)  (DI) + 1; (SI)  (SI) + 1
If DF = 1, then (DI)  (DI) - 1; (SI)  (SI) - 1
MA = (DS) x 1610 + (SI)
MAE = (ES) x 1610 + (DI)
(MAE ; MAE + 1)  (MA; MA + 1)
If DF = 0, then (DI)  (DI) + 2; (SI)  (SI) + 2
If DF = 1, then (DI)  (DI) - 2; (SI)  (SI) - 2
4. String Manipulation Instructions
Instruction Set
28
8086 Microprocessor
Mnemonics: REP, MOVS, CMPS, SCAS, LODS, STOS
CMPS
CMPSB
CMPSW
MA = (DS) x 1610 + (SI)
MAE = (ES) x 1610 + (DI)
Modify flags  (MA) - (MAE)
If (MA) > (MAE), then CF = 0; ZF = 0; SF = 0
If (MA) < (MAE), then CF = 1; ZF = 0; SF = 1
If (MA) = (MAE), then CF = 0; ZF = 1; SF = 0
For byte operation
If DF = 0, then (DI)  (DI) + 1; (SI)  (SI) + 1
If DF = 1, then (DI)  (DI) - 1; (SI)  (SI) - 1
For word operation
If DF = 0, then (DI)  (DI) + 2; (SI)  (SI) + 2
If DF = 1, then (DI)  (DI) - 2; (SI)  (SI) - 2
Compare two string byte or string word
4. String Manipulation Instructions
Instruction Set
29
8086 Microprocessor
Mnemonics: REP, MOVS, CMPS, SCAS, LODS, STOS
SCAS
SCASB
SCASW
MAE = (ES) x 1610 + (DI)
Modify flags  (AL) - (MAE)
If (AL) > (MAE), then CF = 0; ZF = 0; SF = 0
If (AL) < (MAE), then CF = 1; ZF = 0; SF = 1
If (AL) = (MAE), then CF = 0; ZF = 1; SF = 0
If DF = 0, then (DI)  (DI) + 1
If DF = 1, then (DI)  (DI) – 1
MAE = (ES) x 1610 + (DI)
Modify flags  (AL) - (MAE)
If (AX) > (MAE ; MAE + 1), then CF = 0; ZF = 0; SF = 0
If (AX) < (MAE ; MAE + 1), then CF = 1; ZF = 0; SF = 1
If (AX) = (MAE ; MAE + 1), then CF = 0; ZF = 1; SF = 0
If DF = 0, then (DI)  (DI) + 2
If DF = 1, then (DI)  (DI) – 2
Scan (compare) a string byte or word with accumulator
4. String Manipulation Instructions
Instruction Set
30
8086 Microprocessor
Mnemonics: REP, MOVS, CMPS, SCAS, LODS, STOS
LODS
LODSB
LODSW
MA = (DS) x 1610 + (SI)
(AL)  (MA)
If DF = 0, then (SI)  (SI) + 1
If DF = 1, then (SI)  (SI) – 1
MA = (DS) x 1610 + (SI)
(AX)  (MA ; MA + 1)
If DF = 0, then (SI)  (SI) + 2
If DF = 1, then (SI)  (SI) – 2
Load string byte in to AL or string word in to AX
4. String Manipulation Instructions
Instruction Set
31
8086 Microprocessor
Mnemonics: REP, MOVS, CMPS, SCAS, LODS, STOS
STOS
STOSB
STOSW
MAE = (ES) x 1610 + (DI)
(MAE)  (AL)
If DF = 0, then (DI)  (DI) + 1
If DF = 1, then (DI)  (DI) – 1
MAE = (ES) x 1610 + (DI)
(MAE ; MAE + 1 )  (AX)
If DF = 0, then (DI)  (DI) + 2
If DF = 1, then (DI)  (DI) – 2
Store byte from AL or word from AX in to string
Mnemonics Explanation
STC Set CF  1
CLC Clear CF  0
CMC Complement carry CF  CF/
STD Set direction flag DF  1
CLD Clear direction flag DF  0
STI Set interrupt enable flag IF  1
CLI Clear interrupt enable flag IF  0
NOP No operation
HLT Halt after interrupt is set
WAIT Wait for TEST pin active
ESC opcode mem/ reg Used to pass instruction to a coprocessor
which shares the address and data bus
with the 8086
LOCK Lock bus during next instruction
5. Processor Control Instructions
Instruction Set
32
8086 Microprocessor
6. Control Transfer Instructions
Instruction Set
33
8086 Microprocessor
Transfer the control to a specific destination or target instruction
Do not affect flags
Mnemonics Explanation
CALL reg/ mem/ disp16 Call subroutine
RET Return from subroutine
JMP reg/ mem/ disp8/ disp16 Unconditional jump
 8086 Unconditional transfers
6. Control Transfer Instructions
Instruction Set
34
8086 Microprocessor
 8086 signed conditional
branch instructions
 8086 unsigned conditional
branch instructions
Checks flags
If conditions are true, the program control is
transferred to the new memory location in the same
segment by modifying the content of IP
6. Control Transfer Instructions
Instruction Set
35
8086 Microprocessor
Name Alternate name
JE disp8
Jump if equal
JZ disp8
Jump if result is 0
JNE disp8
Jump if not equal
JNZ disp8
Jump if not zero
JG disp8
Jump if greater
JNLE disp8
Jump if not less or
equal
JGE disp8
Jump if greater
than or equal
JNL disp8
Jump if not less
JL disp8
Jump if less than
JNGE disp8
Jump if not
greater than or
equal
JLE disp8
Jump if less than
or equal
JNG disp8
Jump if not
greater
 8086 signed conditional
branch instructions
 8086 unsigned conditional
branch instructions
Name Alternate name
JE disp8
Jump if equal
JZ disp8
Jump if result is 0
JNE disp8
Jump if not equal
JNZ disp8
Jump if not zero
JA disp8
Jump if above
JNBE disp8
Jump if not below
or equal
JAE disp8
Jump if above or
equal
JNB disp8
Jump if not below
JB disp8
Jump if below
JNAE disp8
Jump if not above
or equal
JBE disp8
Jump if below or
equal
JNA disp8
Jump if not above
6. Control Transfer Instructions
Instruction Set
36
8086 Microprocessor
Mnemonics Explanation
JC disp8 Jump if CF = 1
JNC disp8 Jump if CF = 0
JP disp8 Jump if PF = 1
JNP disp8 Jump if PF = 0
JO disp8 Jump if OF = 1
JNO disp8 Jump if OF = 0
JS disp8 Jump if SF = 1
JNS disp8 Jump if SF = 0
JZ disp8 Jump if result is zero, i.e, Z = 1
JNZ disp8 Jump if result is not zero, i.e, Z = 1
 8086 conditional branch instructions affecting individual flags
8086 Instruction Set: Summary
AND Logical AND of byte or word
NOT Logical NOT of byte or word
OR Logical OR of byte or word
RCL Rotate left trough carry byte or word
RCR Rotate right trough carry byte or word
ROL Rotate left byte or word
ROR Rotate right byte or word
SAL Arithmetic shift left byte or word
SAR Arithmetic shift right byte or word
SHL Logical shift left byte or word
SHR Logical shift right byte or word
TEST Test byte or word
XOR Logical exclusive-OR of byte or word
CMPS Compare byte or word string
LODS Load byte or word string
IN Input byte or word from port
OUT Output byte or word to
MOV Move to/from register/memory
MOVS Move byte or word string
MOVSB Move string byte
MOVSW Move string word
8086 Instruction Set: Summary
38
DAA Decimal adjust for addition
DAS Decimal adjust for subtraction
DEC Decrement byte or word by one
DIV Divide byte or word
IDIV Integer divide byte or word
IMUL Integer multiply byte or word
INC Increment byte or word by one
MUL Multiply byte or word (unsigned)
NEG Negate byte or word
SBB Subtract byte or word and carry (borrow)
SUB Subtract byte or word
REP Repeat
REPE Repeat while equal
REPZ Repeat while zero
REPNE Repeat while not equal
REPNZ Repeat while not zero
SCAS Scan byte or word string
STOS Store byte or word string
8086 Instruction Set: Summary
LAHF Load AH from flags
LDS Load pointer using data segment
LEA Load effective address
LES Load pointer using extra segment port
POP Pop word off stack
POPF Pop flags off stack
PUSH Push word onto stack
PUSHF Push flags onto stack
SAHF Store AH into flags
XCHG Exchange byte or word
XLAT Translate byte
AAA ASCII adjust for addition
AAD ASCII adjust for division
AAM ASCII adjust for multiply
AAS ASCII adjust for subtraction
ADC Add byte or word plus carry
ADD Add byte or word
CBW Convert byte or word
CMP Compare byte or word
CWD Convert word to double-word
Assemble Directives
40
8086 Microprocessor
Instructions to the Assembler regarding the program being
executed.
Control the generation of machine codes and organization of
the program; but no machine codes are generated for
assembler directives.
Also called ‘pseudo instructions’
Used to :
› specify the start and end of a program
› attach value to variables
› allocate storage locations to input/ output data
› define start and end of segments, procedures, macros etc..
Assemble Directives
41
8086 Microprocessor
Define Byte
Define a byte type (8-bit) variable
Reserves specific amount of memory
locations to each variable
Range : 00H – FFH for unsigned value;
00H – 7FH for positive value and
80H – FFH for negative value
General form : variable DB value/ values
Example:
LIST DB 7FH, 42H, 35H
Three consecutive memory locations are reserved for
the variable LIST and each data specified in the
instruction are stored as initial value in the reserved
memory location
DB
DW
SEGMENT
ENDS
ASSUME
ORG
END
EVEN
EQU
PROC
FAR
NEAR
ENDP
SHORT
MACRO
ENDM
Assemble Directives
42
8086 Microprocessor
Define Word
Define a word type (16-bit) variable
Reserves two consecutive memory locations
to each variable
Range : 0000H – FFFFH for unsigned value;
0000H – 7FFFH for positive value and
8000H – FFFFH for negative value
General form : variable DW value/ values
Example:
ALIST DW 6512H, 0F251H, 0CDE2H
Six consecutive memory locations are reserved for
the variable ALIST and each 16-bit data specified in
the instruction is stored in two consecutive memory
location.
DB
DW
SEGMENT
ENDS
ASSUME
ORG
END
EVEN
EQU
PROC
FAR
NEAR
ENDP
SHORT
MACRO
ENDM
Assemble Directives
43
8086 Microprocessor
SEGMENT : Used to indicate the beginning of
a code/ data/ stack segment
ENDS : Used to indicate the end of a code/
data/ stack segment
General form:
Segnam SEGMENT
…
…
…
…
…
…
Segnam ENDS
Program code
or
Data Defining Statements
User defined name of
the segment
DB
DW
SEGMENT
ENDS
ASSUME
ORG
END
EVEN
EQU
PROC
FAR
NEAR
ENDP
SHORT
MACRO
ENDM
Assemble Directives
44
8086 Microprocessor
DB
DW
SEGMENT
ENDS
ASSUME
ORG
END
EVEN
EQU
PROC
FAR
NEAR
ENDP
SHORT
MACRO
ENDM
Informs the assembler the name of the
program/ data segment that should be used
for a specific segment.
General form:
Segment Register
ASSUME segreg : segnam, .. , segreg : segnam
User defined name of
the segment
ASSUME CS: ACODE, DS:ADATA Tells the compiler that the
instructions of the program are
stored in the segment ACODE and
data are stored in the segment
ADATA
Example:
Assemble Directives
45
8086 Microprocessor
DB
DW
SEGMENT
ENDS
ASSUME
ORG
END
EVEN
EQU
PROC
FAR
NEAR
ENDP
SHORT
MACRO
ENDM
ORG (Origin) is used to assign the starting address
(Effective address) for a program/ data segment
END is used to terminate a program; statements
after END will be ignored
EVEN : Informs the assembler to store program/
data segment starting from an even address
EQU (Equate) is used to attach a value to a variable
ORG 1000H Informs the assembler that the statements
following ORG 1000H should be stored in
memory starting with effective address
1000H
LOOP EQU 10FEH Value of variable LOOP is 10FEH
_SDATA SEGMENT
ORG 1200H
A DB 4CH
EVEN
B DW 1052H
_SDATA ENDS
In this data segment, effective address of
memory location assigned to A will be 1200H
and that of B will be 1202H and 1203H.
Examples:
Assemble Directives
46
8086 Microprocessor
DB
DW
SEGMENT
ENDS
ASSUME
ORG
END
EVEN
EQU
PROC
ENDP
FAR
NEAR
SHORT
MACRO
ENDM
PROC Indicates the beginning of a procedure
ENDP End of procedure
FAR Intersegment call
NEAR Intrasegment call
General form
procname PROC[NEAR/ FAR]
…
…
…
RET
procname ENDP
Program statements of the
procedure
Last statement of the
procedure
User defined name of
the procedure
Assemble Directives
47
8086 Microprocessor
DB
DW
SEGMENT
ENDS
ASSUME
ORG
END
EVEN
EQU
PROC
ENDP
FAR
NEAR
SHORT
MACRO
ENDM
ADD64 PROC NEAR
…
…
…
RET
ADD64 ENDP
The subroutine/ procedure named ADD64 is
declared as NEAR and so the assembler will
code the CALL and RET instructions involved
in this procedure as near call and return
CONVERT PROC FAR
…
…
…
RET
CONVERT ENDP
The subroutine/ procedure named CONVERT
is declared as FAR and so the assembler will
code the CALL and RET instructions involved
in this procedure as far call and return
Examples:
Assemble Directives
48
8086 Microprocessor
DB
DW
SEGMENT
ENDS
ASSUME
ORG
END
EVEN
EQU
PROC
ENDP
FAR
NEAR
SHORT
MACRO
ENDM
Reserves one memory location for 8-bit
signed displacement in jump instructions
JMP SHORT
AHEAD
The directive will reserve one
memory location for 8-bit
displacement named AHEAD
Example:
Assemble Directives
49
8086 Microprocessor
DB
DW
SEGMENT
ENDS
ASSUME
ORG
END
EVEN
EQU
PROC
ENDP
FAR
NEAR
SHORT
MACRO
ENDM
MACRO Indicate the beginning of a macro
ENDM End of a macro
General form:
macroname MACRO[Arg1, Arg2 ...]
…
…
…
macroname ENDM
Program
statements in
the macro
User defined name of
the macro

Mais conteúdo relacionado

Mais procurados

Architecture of 8086 microprocessor
Architecture of  8086 microprocessorArchitecture of  8086 microprocessor
Architecture of 8086 microprocessorAnirban Saha Anik
 
Byte and string manipulation 8086
Byte and string manipulation 8086Byte and string manipulation 8086
Byte and string manipulation 8086mpsrekha83
 
8086 modes
8086 modes8086 modes
8086 modesPDFSHARE
 
PPT on 8085 Microprocessor
PPT on 8085 Microprocessor  PPT on 8085 Microprocessor
PPT on 8085 Microprocessor DebrajJana4
 
Instruction set of 8086
Instruction set of 8086Instruction set of 8086
Instruction set of 80869840596838
 
Assembly Language and microprocessor
Assembly Language and microprocessorAssembly Language and microprocessor
Assembly Language and microprocessorKhaled Sany
 
Instruction sets of 8086
Instruction sets of 8086Instruction sets of 8086
Instruction sets of 8086Mahalakshmiv11
 
flag register of 8086
flag register of 8086flag register of 8086
flag register of 8086asrithak
 
8237 dma controller
8237 dma controller8237 dma controller
8237 dma controllerTech_MX
 
Instruction set of 8086
Instruction set of 8086Instruction set of 8086
Instruction set of 8086aviban
 
Stacks & subroutines 1
Stacks & subroutines 1Stacks & subroutines 1
Stacks & subroutines 1deval patel
 
8086 architecture and pin description
8086 architecture and pin description 8086 architecture and pin description
8086 architecture and pin description Aswini Dharmaraj
 
8086 assembly language
8086 assembly language8086 assembly language
8086 assembly languageMir Majid
 
Addressing modes of 8086
Addressing modes of 8086Addressing modes of 8086
Addressing modes of 8086saurav kumar
 
8086 microprocessor-architecture
8086 microprocessor-architecture8086 microprocessor-architecture
8086 microprocessor-architectureprasadpawaskar
 
8085 microprocessor ramesh gaonkar
8085 microprocessor   ramesh gaonkar8085 microprocessor   ramesh gaonkar
8085 microprocessor ramesh gaonkarSAQUIB AHMAD
 
8259 Programmable Interrupt Controller
8259 Programmable Interrupt Controller8259 Programmable Interrupt Controller
8259 Programmable Interrupt Controllerabhikalmegh
 

Mais procurados (20)

Architecture of 8086 microprocessor
Architecture of  8086 microprocessorArchitecture of  8086 microprocessor
Architecture of 8086 microprocessor
 
Byte and string manipulation 8086
Byte and string manipulation 8086Byte and string manipulation 8086
Byte and string manipulation 8086
 
8086 modes
8086 modes8086 modes
8086 modes
 
PPT on 8085 Microprocessor
PPT on 8085 Microprocessor  PPT on 8085 Microprocessor
PPT on 8085 Microprocessor
 
Microprocessor 8086
Microprocessor 8086Microprocessor 8086
Microprocessor 8086
 
Instruction set of 8086
Instruction set of 8086Instruction set of 8086
Instruction set of 8086
 
Assembly Language and microprocessor
Assembly Language and microprocessorAssembly Language and microprocessor
Assembly Language and microprocessor
 
Instruction sets of 8086
Instruction sets of 8086Instruction sets of 8086
Instruction sets of 8086
 
flag register of 8086
flag register of 8086flag register of 8086
flag register of 8086
 
8237 dma controller
8237 dma controller8237 dma controller
8237 dma controller
 
Instruction set of 8086
Instruction set of 8086Instruction set of 8086
Instruction set of 8086
 
Stacks & subroutines 1
Stacks & subroutines 1Stacks & subroutines 1
Stacks & subroutines 1
 
8086 architecture and pin description
8086 architecture and pin description 8086 architecture and pin description
8086 architecture and pin description
 
8086 assembly language
8086 assembly language8086 assembly language
8086 assembly language
 
Addressing modes of 8086
Addressing modes of 8086Addressing modes of 8086
Addressing modes of 8086
 
8086 microprocessor-architecture
8086 microprocessor-architecture8086 microprocessor-architecture
8086 microprocessor-architecture
 
ARM Processors
ARM ProcessorsARM Processors
ARM Processors
 
8085 microprocessor ramesh gaonkar
8085 microprocessor   ramesh gaonkar8085 microprocessor   ramesh gaonkar
8085 microprocessor ramesh gaonkar
 
Amba bus
Amba busAmba bus
Amba bus
 
8259 Programmable Interrupt Controller
8259 Programmable Interrupt Controller8259 Programmable Interrupt Controller
8259 Programmable Interrupt Controller
 

Destaque

8086 microprocessor instruction set by Er. Swapnil Kaware
8086 microprocessor instruction set by Er. Swapnil Kaware8086 microprocessor instruction set by Er. Swapnil Kaware
8086 microprocessor instruction set by Er. Swapnil KawareProf. Swapnil V. Kaware
 
3 organization of intel 8086
3 organization of intel 80863 organization of intel 8086
3 organization of intel 8086ELIMENG
 
8086 Microprocessor powerpoint
8086  Microprocessor  powerpoint8086  Microprocessor  powerpoint
8086 Microprocessor powerpointRandhir Kumar
 
Ch2 microcontroller architecture
Ch2 microcontroller architectureCh2 microcontroller architecture
Ch2 microcontroller architectureAhmad Sidik
 
8086 module 1 & 2 work
8086 module 1 & 2   work8086 module 1 & 2   work
8086 module 1 & 2 workSuhail Km
 
fco-lecture-8086
fco-lecture-8086fco-lecture-8086
fco-lecture-808624happy24
 
Architecture of 8086 Microprocessor
Architecture of 8086 Microprocessor  Architecture of 8086 Microprocessor
Architecture of 8086 Microprocessor Mustapha Fatty
 
8254 timer - Microprocessor and interfacing
8254 timer - Microprocessor and interfacing8254 timer - Microprocessor and interfacing
8254 timer - Microprocessor and interfacingAmitabh Shukla
 
The Intel 8086 microprocessor
The Intel 8086 microprocessorThe Intel 8086 microprocessor
The Intel 8086 microprocessorGeorge Thomas
 
8254 Programmable Interval Timer by vijay
8254 Programmable Interval Timer by vijay8254 Programmable Interval Timer by vijay
8254 Programmable Interval Timer by vijayVijay Kumar
 

Destaque (16)

Instruction set of 8086
Instruction set of 8086Instruction set of 8086
Instruction set of 8086
 
8086 microprocessor instruction set by Er. Swapnil Kaware
8086 microprocessor instruction set by Er. Swapnil Kaware8086 microprocessor instruction set by Er. Swapnil Kaware
8086 microprocessor instruction set by Er. Swapnil Kaware
 
Lecture2
Lecture2Lecture2
Lecture2
 
3 organization of intel 8086
3 organization of intel 80863 organization of intel 8086
3 organization of intel 8086
 
8086 Architecture
8086 Architecture8086 Architecture
8086 Architecture
 
8086 Microprocessor powerpoint
8086  Microprocessor  powerpoint8086  Microprocessor  powerpoint
8086 Microprocessor powerpoint
 
Ch2 microcontroller architecture
Ch2 microcontroller architectureCh2 microcontroller architecture
Ch2 microcontroller architecture
 
8086 module 1 & 2 work
8086 module 1 & 2   work8086 module 1 & 2   work
8086 module 1 & 2 work
 
fco-lecture-8086
fco-lecture-8086fco-lecture-8086
fco-lecture-8086
 
Architecture of 8086 Microprocessor
Architecture of 8086 Microprocessor  Architecture of 8086 Microprocessor
Architecture of 8086 Microprocessor
 
Timing diagram 8085 microprocessor
Timing diagram 8085 microprocessorTiming diagram 8085 microprocessor
Timing diagram 8085 microprocessor
 
Programmable Timer 8253/8254
Programmable Timer 8253/8254Programmable Timer 8253/8254
Programmable Timer 8253/8254
 
Instruction set of 8086 Microprocessor
Instruction set of 8086 Microprocessor Instruction set of 8086 Microprocessor
Instruction set of 8086 Microprocessor
 
8254 timer - Microprocessor and interfacing
8254 timer - Microprocessor and interfacing8254 timer - Microprocessor and interfacing
8254 timer - Microprocessor and interfacing
 
The Intel 8086 microprocessor
The Intel 8086 microprocessorThe Intel 8086 microprocessor
The Intel 8086 microprocessor
 
8254 Programmable Interval Timer by vijay
8254 Programmable Interval Timer by vijay8254 Programmable Interval Timer by vijay
8254 Programmable Interval Timer by vijay
 

Semelhante a Microprocessor 8086 instructions

Flag registers, addressing modes, instruction set
Flag registers, addressing modes, instruction setFlag registers, addressing modes, instruction set
Flag registers, addressing modes, instruction setaviban
 
Lec12 Computer Architecture by Hsien-Hsin Sean Lee Georgia Tech -- P6, Netbur...
Lec12 Computer Architecture by Hsien-Hsin Sean Lee Georgia Tech -- P6, Netbur...Lec12 Computer Architecture by Hsien-Hsin Sean Lee Georgia Tech -- P6, Netbur...
Lec12 Computer Architecture by Hsien-Hsin Sean Lee Georgia Tech -- P6, Netbur...Hsien-Hsin Sean Lee, Ph.D.
 
other-architectures.ppt
other-architectures.pptother-architectures.ppt
other-architectures.pptJaya Chavan
 
8051 Programming Instruction Set
 8051 Programming Instruction Set 8051 Programming Instruction Set
8051 Programming Instruction SetShreyans Pathak
 
PPT 8085 microprocessor
PPT 8085 microprocessor PPT 8085 microprocessor
PPT 8085 microprocessor Ardhendupanja
 
Introduction of 8086 micro processor .
Introduction of 8086 micro processor .Introduction of 8086 micro processor .
Introduction of 8086 micro processor .Siraj Ahmed
 
Chapter3 presentation2
Chapter3 presentation2Chapter3 presentation2
Chapter3 presentation2surendar88
 
Arm teaching material
Arm teaching materialArm teaching material
Arm teaching materialJohn Williams
 
ARM AAE - Intrustion Sets
ARM AAE - Intrustion SetsARM AAE - Intrustion Sets
ARM AAE - Intrustion SetsAnh Dung NGUYEN
 
Discussion on 8080 Microprocessor_r1 - Everyting you need to know.pptx
Discussion on 8080 Microprocessor_r1 - Everyting you need to know.pptxDiscussion on 8080 Microprocessor_r1 - Everyting you need to know.pptx
Discussion on 8080 Microprocessor_r1 - Everyting you need to know.pptxpjmulat
 
LPC 2148 Instructions Set.ppt
LPC 2148 Instructions Set.pptLPC 2148 Instructions Set.ppt
LPC 2148 Instructions Set.pptProfBadariNathK
 
Instruction set of 8051.ppt
Instruction set of 8051.pptInstruction set of 8051.ppt
Instruction set of 8051.pptChandiniChinni2
 
Lec18 Intro to Computer Engineering by Hsien-Hsin Sean Lee Georgia Tech -- In...
Lec18 Intro to Computer Engineering by Hsien-Hsin Sean Lee Georgia Tech -- In...Lec18 Intro to Computer Engineering by Hsien-Hsin Sean Lee Georgia Tech -- In...
Lec18 Intro to Computer Engineering by Hsien-Hsin Sean Lee Georgia Tech -- In...Hsien-Hsin Sean Lee, Ph.D.
 
1 introduction to dsp processor 20140919
1 introduction to dsp processor 201409191 introduction to dsp processor 20140919
1 introduction to dsp processor 20140919Hans Kuo
 
Instruction set summary
Instruction set summary Instruction set summary
Instruction set summary janicetiong
 

Semelhante a Microprocessor 8086 instructions (20)

Flag registers, addressing modes, instruction set
Flag registers, addressing modes, instruction setFlag registers, addressing modes, instruction set
Flag registers, addressing modes, instruction set
 
Lec12 Computer Architecture by Hsien-Hsin Sean Lee Georgia Tech -- P6, Netbur...
Lec12 Computer Architecture by Hsien-Hsin Sean Lee Georgia Tech -- P6, Netbur...Lec12 Computer Architecture by Hsien-Hsin Sean Lee Georgia Tech -- P6, Netbur...
Lec12 Computer Architecture by Hsien-Hsin Sean Lee Georgia Tech -- P6, Netbur...
 
other-architectures.ppt
other-architectures.pptother-architectures.ppt
other-architectures.ppt
 
8051 Programming Instruction Set
 8051 Programming Instruction Set 8051 Programming Instruction Set
8051 Programming Instruction Set
 
PPT 8085 microprocessor
PPT 8085 microprocessor PPT 8085 microprocessor
PPT 8085 microprocessor
 
Introduction of 8086 micro processor .
Introduction of 8086 micro processor .Introduction of 8086 micro processor .
Introduction of 8086 micro processor .
 
Chapter3 presentation2
Chapter3 presentation2Chapter3 presentation2
Chapter3 presentation2
 
Arm teaching material
Arm teaching materialArm teaching material
Arm teaching material
 
Arm teaching material
Arm teaching materialArm teaching material
Arm teaching material
 
ARM AAE - Intrustion Sets
ARM AAE - Intrustion SetsARM AAE - Intrustion Sets
ARM AAE - Intrustion Sets
 
Arm architecture
Arm architectureArm architecture
Arm architecture
 
Discussion on 8080 Microprocessor_r1 - Everyting you need to know.pptx
Discussion on 8080 Microprocessor_r1 - Everyting you need to know.pptxDiscussion on 8080 Microprocessor_r1 - Everyting you need to know.pptx
Discussion on 8080 Microprocessor_r1 - Everyting you need to know.pptx
 
LPC 2148 Instructions Set.ppt
LPC 2148 Instructions Set.pptLPC 2148 Instructions Set.ppt
LPC 2148 Instructions Set.ppt
 
Instruction set of 8051.ppt
Instruction set of 8051.pptInstruction set of 8051.ppt
Instruction set of 8051.ppt
 
Lec03
Lec03Lec03
Lec03
 
Lec18 Intro to Computer Engineering by Hsien-Hsin Sean Lee Georgia Tech -- In...
Lec18 Intro to Computer Engineering by Hsien-Hsin Sean Lee Georgia Tech -- In...Lec18 Intro to Computer Engineering by Hsien-Hsin Sean Lee Georgia Tech -- In...
Lec18 Intro to Computer Engineering by Hsien-Hsin Sean Lee Georgia Tech -- In...
 
8085 Architecture
8085 Architecture8085 Architecture
8085 Architecture
 
8085 micro processor
8085 micro processor8085 micro processor
8085 micro processor
 
1 introduction to dsp processor 20140919
1 introduction to dsp processor 201409191 introduction to dsp processor 20140919
1 introduction to dsp processor 20140919
 
Instruction set summary
Instruction set summary Instruction set summary
Instruction set summary
 

Mais de Ravi Anand

data-acquisition-system-ppt
data-acquisition-system-pptdata-acquisition-system-ppt
data-acquisition-system-pptRavi Anand
 
Methods for Voltage Stability Enhancement
Methods for Voltage Stability EnhancementMethods for Voltage Stability Enhancement
Methods for Voltage Stability EnhancementRavi Anand
 
Automation And Robotics
Automation And Robotics Automation And Robotics
Automation And Robotics Ravi Anand
 
Automation And Robotics
Automation And Robotics Automation And Robotics
Automation And Robotics Ravi Anand
 
ANALOG TO DIGITAL COMMUNICATION {MODULATION}
ANALOG TO DIGITAL COMMUNICATION {MODULATION}ANALOG TO DIGITAL COMMUNICATION {MODULATION}
ANALOG TO DIGITAL COMMUNICATION {MODULATION}Ravi Anand
 
Types of Circuit Breaker
Types of Circuit BreakerTypes of Circuit Breaker
Types of Circuit BreakerRavi Anand
 
Seminar Report on MHD (Magneto Hydro Dynamics)
Seminar Report on MHD (Magneto Hydro Dynamics)Seminar Report on MHD (Magneto Hydro Dynamics)
Seminar Report on MHD (Magneto Hydro Dynamics)Ravi Anand
 
Electrical Design of Transmission Line
Electrical Design of Transmission LineElectrical Design of Transmission Line
Electrical Design of Transmission LineRavi Anand
 
Electrical Design of Transmission Line
Electrical Design of Transmission LineElectrical Design of Transmission Line
Electrical Design of Transmission LineRavi Anand
 
Electrical Design of Transmission Line
Electrical Design of Transmission LineElectrical Design of Transmission Line
Electrical Design of Transmission LineRavi Anand
 
Introduction to 8085 Microprocessor
Introduction to 8085 MicroprocessorIntroduction to 8085 Microprocessor
Introduction to 8085 MicroprocessorRavi Anand
 
8085 instruction set (detailed)
8085 instruction set (detailed)8085 instruction set (detailed)
8085 instruction set (detailed)Ravi Anand
 
8086 instructions
8086 instructions8086 instructions
8086 instructionsRavi Anand
 
Microprocessor 8086 notes
Microprocessor 8086 notesMicroprocessor 8086 notes
Microprocessor 8086 notesRavi Anand
 
Emmi (imp. question)
Emmi (imp. question)Emmi (imp. question)
Emmi (imp. question)Ravi Anand
 
Cro (emmi) (3)
Cro (emmi) (3)Cro (emmi) (3)
Cro (emmi) (3)Ravi Anand
 
Cro (emmi) (2)
Cro (emmi) (2)Cro (emmi) (2)
Cro (emmi) (2)Ravi Anand
 
Cro (emmi) (1)
Cro (emmi) (1)Cro (emmi) (1)
Cro (emmi) (1)Ravi Anand
 

Mais de Ravi Anand (20)

data-acquisition-system-ppt
data-acquisition-system-pptdata-acquisition-system-ppt
data-acquisition-system-ppt
 
Methods for Voltage Stability Enhancement
Methods for Voltage Stability EnhancementMethods for Voltage Stability Enhancement
Methods for Voltage Stability Enhancement
 
Automation And Robotics
Automation And Robotics Automation And Robotics
Automation And Robotics
 
Automation And Robotics
Automation And Robotics Automation And Robotics
Automation And Robotics
 
ANALOG TO DIGITAL COMMUNICATION {MODULATION}
ANALOG TO DIGITAL COMMUNICATION {MODULATION}ANALOG TO DIGITAL COMMUNICATION {MODULATION}
ANALOG TO DIGITAL COMMUNICATION {MODULATION}
 
Types of Circuit Breaker
Types of Circuit BreakerTypes of Circuit Breaker
Types of Circuit Breaker
 
Seminar Report on MHD (Magneto Hydro Dynamics)
Seminar Report on MHD (Magneto Hydro Dynamics)Seminar Report on MHD (Magneto Hydro Dynamics)
Seminar Report on MHD (Magneto Hydro Dynamics)
 
8086
80868086
8086
 
Electrical Design of Transmission Line
Electrical Design of Transmission LineElectrical Design of Transmission Line
Electrical Design of Transmission Line
 
Electrical Design of Transmission Line
Electrical Design of Transmission LineElectrical Design of Transmission Line
Electrical Design of Transmission Line
 
Electrical Design of Transmission Line
Electrical Design of Transmission LineElectrical Design of Transmission Line
Electrical Design of Transmission Line
 
Introduction to 8085 Microprocessor
Introduction to 8085 MicroprocessorIntroduction to 8085 Microprocessor
Introduction to 8085 Microprocessor
 
8085 instruction set (detailed)
8085 instruction set (detailed)8085 instruction set (detailed)
8085 instruction set (detailed)
 
8086
80868086
8086
 
8086 instructions
8086 instructions8086 instructions
8086 instructions
 
Microprocessor 8086 notes
Microprocessor 8086 notesMicroprocessor 8086 notes
Microprocessor 8086 notes
 
Emmi (imp. question)
Emmi (imp. question)Emmi (imp. question)
Emmi (imp. question)
 
Cro (emmi) (3)
Cro (emmi) (3)Cro (emmi) (3)
Cro (emmi) (3)
 
Cro (emmi) (2)
Cro (emmi) (2)Cro (emmi) (2)
Cro (emmi) (2)
 
Cro (emmi) (1)
Cro (emmi) (1)Cro (emmi) (1)
Cro (emmi) (1)
 

Último

Cost estimation approach: FP to COCOMO scenario based question
Cost estimation approach: FP to COCOMO scenario based questionCost estimation approach: FP to COCOMO scenario based question
Cost estimation approach: FP to COCOMO scenario based questionSneha Padhiar
 
US Department of Education FAFSA Week of Action
US Department of Education FAFSA Week of ActionUS Department of Education FAFSA Week of Action
US Department of Education FAFSA Week of ActionMebane Rash
 
FUNCTIONAL AND NON FUNCTIONAL REQUIREMENT
FUNCTIONAL AND NON FUNCTIONAL REQUIREMENTFUNCTIONAL AND NON FUNCTIONAL REQUIREMENT
FUNCTIONAL AND NON FUNCTIONAL REQUIREMENTSneha Padhiar
 
11. Properties of Liquid Fuels in Energy Engineering.pdf
11. Properties of Liquid Fuels in Energy Engineering.pdf11. Properties of Liquid Fuels in Energy Engineering.pdf
11. Properties of Liquid Fuels in Energy Engineering.pdfHafizMudaserAhmad
 
Virtual memory management in Operating System
Virtual memory management in Operating SystemVirtual memory management in Operating System
Virtual memory management in Operating SystemRashmi Bhat
 
Research Methodology for Engineering pdf
Research Methodology for Engineering pdfResearch Methodology for Engineering pdf
Research Methodology for Engineering pdfCaalaaAbdulkerim
 
Python Programming for basic beginners.pptx
Python Programming for basic beginners.pptxPython Programming for basic beginners.pptx
Python Programming for basic beginners.pptxmohitesoham12
 
Main Memory Management in Operating System
Main Memory Management in Operating SystemMain Memory Management in Operating System
Main Memory Management in Operating SystemRashmi Bhat
 
TEST CASE GENERATION GENERATION BLOCK BOX APPROACH
TEST CASE GENERATION GENERATION BLOCK BOX APPROACHTEST CASE GENERATION GENERATION BLOCK BOX APPROACH
TEST CASE GENERATION GENERATION BLOCK BOX APPROACHSneha Padhiar
 
Levelling - Rise and fall - Height of instrument method
Levelling - Rise and fall - Height of instrument methodLevelling - Rise and fall - Height of instrument method
Levelling - Rise and fall - Height of instrument methodManicka Mamallan Andavar
 
List of Accredited Concrete Batching Plant.pdf
List of Accredited Concrete Batching Plant.pdfList of Accredited Concrete Batching Plant.pdf
List of Accredited Concrete Batching Plant.pdfisabel213075
 
Artificial Intelligence in Power System overview
Artificial Intelligence in Power System overviewArtificial Intelligence in Power System overview
Artificial Intelligence in Power System overviewsandhya757531
 
High Voltage Engineering- OVER VOLTAGES IN ELECTRICAL POWER SYSTEMS
High Voltage Engineering- OVER VOLTAGES IN ELECTRICAL POWER SYSTEMSHigh Voltage Engineering- OVER VOLTAGES IN ELECTRICAL POWER SYSTEMS
High Voltage Engineering- OVER VOLTAGES IN ELECTRICAL POWER SYSTEMSsandhya757531
 
Immutable Image-Based Operating Systems - EW2024.pdf
Immutable Image-Based Operating Systems - EW2024.pdfImmutable Image-Based Operating Systems - EW2024.pdf
Immutable Image-Based Operating Systems - EW2024.pdfDrew Moseley
 
ROBOETHICS-CCS345 ETHICS AND ARTIFICIAL INTELLIGENCE.ppt
ROBOETHICS-CCS345 ETHICS AND ARTIFICIAL INTELLIGENCE.pptROBOETHICS-CCS345 ETHICS AND ARTIFICIAL INTELLIGENCE.ppt
ROBOETHICS-CCS345 ETHICS AND ARTIFICIAL INTELLIGENCE.pptJohnWilliam111370
 
Computer Graphics Introduction, Open GL, Line and Circle drawing algorithm
Computer Graphics Introduction, Open GL, Line and Circle drawing algorithmComputer Graphics Introduction, Open GL, Line and Circle drawing algorithm
Computer Graphics Introduction, Open GL, Line and Circle drawing algorithmDeepika Walanjkar
 
Module-1-(Building Acoustics) Noise Control (Unit-3). pdf
Module-1-(Building Acoustics) Noise Control (Unit-3). pdfModule-1-(Building Acoustics) Noise Control (Unit-3). pdf
Module-1-(Building Acoustics) Noise Control (Unit-3). pdfManish Kumar
 
Ch10-Global Supply Chain - Cadena de Suministro.pdf
Ch10-Global Supply Chain - Cadena de Suministro.pdfCh10-Global Supply Chain - Cadena de Suministro.pdf
Ch10-Global Supply Chain - Cadena de Suministro.pdfChristianCDAM
 
Energy Awareness training ppt for manufacturing process.pptx
Energy Awareness training ppt for manufacturing process.pptxEnergy Awareness training ppt for manufacturing process.pptx
Energy Awareness training ppt for manufacturing process.pptxsiddharthjain2303
 

Último (20)

Cost estimation approach: FP to COCOMO scenario based question
Cost estimation approach: FP to COCOMO scenario based questionCost estimation approach: FP to COCOMO scenario based question
Cost estimation approach: FP to COCOMO scenario based question
 
US Department of Education FAFSA Week of Action
US Department of Education FAFSA Week of ActionUS Department of Education FAFSA Week of Action
US Department of Education FAFSA Week of Action
 
FUNCTIONAL AND NON FUNCTIONAL REQUIREMENT
FUNCTIONAL AND NON FUNCTIONAL REQUIREMENTFUNCTIONAL AND NON FUNCTIONAL REQUIREMENT
FUNCTIONAL AND NON FUNCTIONAL REQUIREMENT
 
11. Properties of Liquid Fuels in Energy Engineering.pdf
11. Properties of Liquid Fuels in Energy Engineering.pdf11. Properties of Liquid Fuels in Energy Engineering.pdf
11. Properties of Liquid Fuels in Energy Engineering.pdf
 
Virtual memory management in Operating System
Virtual memory management in Operating SystemVirtual memory management in Operating System
Virtual memory management in Operating System
 
Research Methodology for Engineering pdf
Research Methodology for Engineering pdfResearch Methodology for Engineering pdf
Research Methodology for Engineering pdf
 
Python Programming for basic beginners.pptx
Python Programming for basic beginners.pptxPython Programming for basic beginners.pptx
Python Programming for basic beginners.pptx
 
Main Memory Management in Operating System
Main Memory Management in Operating SystemMain Memory Management in Operating System
Main Memory Management in Operating System
 
TEST CASE GENERATION GENERATION BLOCK BOX APPROACH
TEST CASE GENERATION GENERATION BLOCK BOX APPROACHTEST CASE GENERATION GENERATION BLOCK BOX APPROACH
TEST CASE GENERATION GENERATION BLOCK BOX APPROACH
 
Levelling - Rise and fall - Height of instrument method
Levelling - Rise and fall - Height of instrument methodLevelling - Rise and fall - Height of instrument method
Levelling - Rise and fall - Height of instrument method
 
List of Accredited Concrete Batching Plant.pdf
List of Accredited Concrete Batching Plant.pdfList of Accredited Concrete Batching Plant.pdf
List of Accredited Concrete Batching Plant.pdf
 
Artificial Intelligence in Power System overview
Artificial Intelligence in Power System overviewArtificial Intelligence in Power System overview
Artificial Intelligence in Power System overview
 
High Voltage Engineering- OVER VOLTAGES IN ELECTRICAL POWER SYSTEMS
High Voltage Engineering- OVER VOLTAGES IN ELECTRICAL POWER SYSTEMSHigh Voltage Engineering- OVER VOLTAGES IN ELECTRICAL POWER SYSTEMS
High Voltage Engineering- OVER VOLTAGES IN ELECTRICAL POWER SYSTEMS
 
Designing pile caps according to ACI 318-19.pptx
Designing pile caps according to ACI 318-19.pptxDesigning pile caps according to ACI 318-19.pptx
Designing pile caps according to ACI 318-19.pptx
 
Immutable Image-Based Operating Systems - EW2024.pdf
Immutable Image-Based Operating Systems - EW2024.pdfImmutable Image-Based Operating Systems - EW2024.pdf
Immutable Image-Based Operating Systems - EW2024.pdf
 
ROBOETHICS-CCS345 ETHICS AND ARTIFICIAL INTELLIGENCE.ppt
ROBOETHICS-CCS345 ETHICS AND ARTIFICIAL INTELLIGENCE.pptROBOETHICS-CCS345 ETHICS AND ARTIFICIAL INTELLIGENCE.ppt
ROBOETHICS-CCS345 ETHICS AND ARTIFICIAL INTELLIGENCE.ppt
 
Computer Graphics Introduction, Open GL, Line and Circle drawing algorithm
Computer Graphics Introduction, Open GL, Line and Circle drawing algorithmComputer Graphics Introduction, Open GL, Line and Circle drawing algorithm
Computer Graphics Introduction, Open GL, Line and Circle drawing algorithm
 
Module-1-(Building Acoustics) Noise Control (Unit-3). pdf
Module-1-(Building Acoustics) Noise Control (Unit-3). pdfModule-1-(Building Acoustics) Noise Control (Unit-3). pdf
Module-1-(Building Acoustics) Noise Control (Unit-3). pdf
 
Ch10-Global Supply Chain - Cadena de Suministro.pdf
Ch10-Global Supply Chain - Cadena de Suministro.pdfCh10-Global Supply Chain - Cadena de Suministro.pdf
Ch10-Global Supply Chain - Cadena de Suministro.pdf
 
Energy Awareness training ppt for manufacturing process.pptx
Energy Awareness training ppt for manufacturing process.pptxEnergy Awareness training ppt for manufacturing process.pptx
Energy Awareness training ppt for manufacturing process.pptx
 

Microprocessor 8086 instructions

  • 1. 1. Data Transfer Instructions 2. Arithmetic Instructions 3. Logical Instructions 4. String manipulation Instructions 5. Process Control Instructions 6. Control Transfer Instructions Instruction Set 1 8086 Microprocessor 8086 supports 6 types of instructions:
  • 2. 1. Data Transfer Instructions Instruction Set 2 8086 Microprocessor Instructions that are used to transfer data/ address in to registers, memory locations and I/O ports. Generally involve two operands: Source operand and Destination operand of the same size. Source: Register or a memory location or an immediate data Destination : Register or a memory location. The size should be a either a byte or a word. A 8-bit data can only be moved to 8-bit register/ memory and a 16-bit data can be moved to 16-bit register/ memory.
  • 3. 1. Data Transfer Instructions Instruction Set 3 8086 Microprocessor Mnemonics: MOV, XCHG, PUSH, POP, IN, OUT … MOV reg2/ mem, reg1/ mem MOV reg2, reg1 MOV mem, reg1 MOV reg2, mem (reg2)  (reg1) (mem)  (reg1) (reg2)  (mem) MOV reg/ mem, data MOV reg, data MOV mem, data (reg)  data (mem)  data XCHG reg2/ mem, reg1 XCHG reg2, reg1 XCHG mem, reg1 (reg2)  (reg1) (mem)  (reg1)
  • 4. 1. Data Transfer Instructions Instruction Set 4 8086 Microprocessor Mnemonics: MOV, XCHG, PUSH, POP, IN, OUT … PUSH reg16/ mem PUSH reg16 PUSH mem (SP)  (SP) – 2 MA S = (SS) x 1610 + SP (MA S ; MA S + 1)  (reg16) (SP)  (SP) – 2 MA S = (SS) x 1610 + SP (MA S ; MA S + 1)  (mem) POP reg16/ mem POP reg16 POP mem MA S = (SS) x 1610 + SP (reg16)  (MA S ; MA S + 1) (SP)  (SP) + 2 MA S = (SS) x 1610 + SP (mem)  (MA S ; MA S + 1) (SP)  (SP) + 2
  • 5. 1. Data Transfer Instructions Instruction Set 5 8086 Microprocessor Mnemonics: MOV, XCHG, PUSH, POP, IN, OUT … IN A, [DX] IN AL, [DX] IN AX, [DX] PORTaddr = (DX) (AL)  (PORT) PORTaddr = (DX) (AX)  (PORT) IN A, addr8 IN AL, addr8 IN AX, addr8 (AL)  (addr8) (AX)  (addr8) OUT [DX], A OUT [DX], AL OUT [DX], AX PORTaddr = (DX) (PORT)  (AL) PORTaddr = (DX) (PORT)  (AX) OUT addr8, A OUT addr8, AL OUT addr8, AX (addr8)  (AL) (addr8)  (AX)
  • 6. 2. Arithmetic Instructions Instruction Set 6 8086 Microprocessor Mnemonics: ADD, ADC, SUB, SBB, INC, DEC, MUL, DIV, CMP… ADD reg2/ mem, reg1/mem ADC reg2, reg1 ADC reg2, mem ADC mem, reg1 (reg2)  (reg1) + (reg2) (reg2)  (reg2) + (mem) (mem)  (mem)+(reg1) ADD reg/mem, data ADD reg, data ADD mem, data (reg)  (reg)+ data (mem)  (mem)+data ADD A, data ADD AL, data8 ADD AX, data16 (AL)  (AL) + data8 (AX)  (AX) +data16
  • 7. 2. Arithmetic Instructions Instruction Set 7 8086 Microprocessor Mnemonics: ADD, ADC, SUB, SBB, INC, DEC, MUL, DIV, CMP… ADC reg2/ mem, reg1/mem ADC reg2, reg1 ADC reg2, mem ADC mem, reg1 (reg2)  (reg1) + (reg2)+CF (reg2)  (reg2) + (mem)+CF (mem)  (mem)+(reg1)+CF ADC reg/mem, data ADC reg, data ADC mem, data (reg)  (reg)+ data+CF (mem)  (mem)+data+CF ADDC A, data ADD AL, data8 ADD AX, data16 (AL)  (AL) + data8+CF (AX)  (AX) +data16+CF
  • 8. 2. Arithmetic Instructions Instruction Set 8 8086 Microprocessor Mnemonics: ADD, ADC, SUB, SBB, INC, DEC, MUL, DIV, CMP… SUB reg2/ mem, reg1/mem SUB reg2, reg1 SUB reg2, mem SUB mem, reg1 (reg2)  (reg1) - (reg2) (reg2)  (reg2) - (mem) (mem)  (mem) - (reg1) SUB reg/mem, data SUB reg, data SUB mem, data (reg)  (reg) - data (mem)  (mem) - data SUB A, data SUB AL, data8 SUB AX, data16 (AL)  (AL) - data8 (AX)  (AX) - data16
  • 9. 2. Arithmetic Instructions Instruction Set 9 8086 Microprocessor Mnemonics: ADD, ADC, SUB, SBB, INC, DEC, MUL, DIV, CMP… SBB reg2/ mem, reg1/mem SBB reg2, reg1 SBB reg2, mem SBB mem, reg1 (reg2)  (reg1) - (reg2) - CF (reg2)  (reg2) - (mem)- CF (mem)  (mem) - (reg1) –CF SBB reg/mem, data SBB reg, data SBB mem, data (reg)  (reg) – data - CF (mem)  (mem) - data - CF SBB A, data SBB AL, data8 SBB AX, data16 (AL)  (AL) - data8 - CF (AX)  (AX) - data16 - CF
  • 10. 2. Arithmetic Instructions Instruction Set 10 8086 Microprocessor Mnemonics: ADD, ADC, SUB, SBB, INC, DEC, MUL, DIV, CMP… INC reg/ mem INC reg8 INC reg16 INC mem (reg8)  (reg8) + 1 (reg16)  (reg16) + 1 (mem)  (mem) + 1 DEC reg/ mem DEC reg8 DEC reg16 DEC mem (reg8)  (reg8) - 1 (reg16)  (reg16) - 1 (mem)  (mem) - 1
  • 11. 2. Arithmetic Instructions Instruction Set 11 8086 Microprocessor Mnemonics: ADD, ADC, SUB, SBB, INC, DEC, MUL, DIV, CMP… MUL reg/ mem MUL reg MUL mem For byte : (AX)  (AL) x (reg8) For word : (DX)(AX)  (AX) x (reg16) For byte : (AX)  (AL) x (mem8) For word : (DX)(AX)  (AX) x (mem16) IMUL reg/ mem IMUL reg IMUL mem For byte : (AX)  (AL) x (reg8) For word : (DX)(AX)  (AX) x (reg16) For byte : (AX)  (AX) x (mem8) For word : (DX)(AX)  (AX) x (mem16)
  • 12. 2. Arithmetic Instructions Instruction Set 12 8086 Microprocessor Mnemonics: ADD, ADC, SUB, SBB, INC, DEC, MUL, DIV, CMP… DIV reg/ mem DIV reg DIV mem For 16-bit :- 8-bit : (AL)  (AX) :- (reg8) Quotient (AH)  (AX) MOD(reg8) Remainder For 32-bit :- 16-bit : (AX)  (DX)(AX) :- (reg16) Quotient (DX)  (DX)(AX) MOD(reg16) Remainder For 16-bit :- 8-bit : (AL)  (AX) :- (mem8) Quotient (AH)  (AX) MOD(mem8) Remainder For 32-bit :- 16-bit : (AX)  (DX)(AX) :- (mem16) Quotient (DX)  (DX)(AX) MOD(mem16) Remainder
  • 13. 2. Arithmetic Instructions Instruction Set 13 8086 Microprocessor Mnemonics: ADD, ADC, SUB, SBB, INC, DEC, MUL, DIV, CMP… IDIV reg/ mem IDIV reg IDIV mem For 16-bit :- 8-bit : (AL)  (AX) :- (reg8) Quotient (AH)  (AX) MOD(reg8) Remainder For 32-bit :- 16-bit : (AX)  (DX)(AX) :- (reg16) Quotient (DX)  (DX)(AX) MOD(reg16) Remainder For 16-bit :- 8-bit : (AL)  (AX) :- (mem8) Quotient (AH)  (AX) MOD(mem8) Remainder For 32-bit :- 16-bit : (AX)  (DX)(AX) :- (mem16) Quotient (DX)  (DX)(AX) MOD(mem16) Remainder
  • 14. 2. Arithmetic Instructions Instruction Set 14 8086 Microprocessor Mnemonics: ADD, ADC, SUB, SBB, INC, DEC, MUL, DIV, CMP… CMP reg2/mem, reg1/ mem CMP reg2, reg1 CMP reg2, mem CMP mem, reg1 Modify flags  (reg2) – (reg1) If (reg2) > (reg1) then CF=0, ZF=0, SF=0 If (reg2) < (reg1) then CF=1, ZF=0, SF=1 If (reg2) = (reg1) then CF=0, ZF=1, SF=0 Modify flags  (reg2) – (mem) If (reg2) > (mem) then CF=0, ZF=0, SF=0 If (reg2) < (mem) then CF=1, ZF=0, SF=1 If (reg2) = (mem) then CF=0, ZF=1, SF=0 Modify flags  (mem) – (reg1) If (mem) > (reg1) then CF=0, ZF=0, SF=0 If (mem) < (reg1) then CF=1, ZF=0, SF=1 If (mem) = (reg1) then CF=0, ZF=1, SF=0
  • 15. 2. Arithmetic Instructions Instruction Set 15 8086 Microprocessor Mnemonics: ADD, ADC, SUB, SBB, INC, DEC, MUL, DIV, CMP… CMP reg/mem, data CMP reg, data CMP mem, data Modify flags  (reg) – (data) If (reg) > data then CF=0, ZF=0, SF=0 If (reg) < data then CF=1, ZF=0, SF=1 If (reg) = data then CF=0, ZF=1, SF=0 Modify flags  (mem) – (mem) If (mem) > data then CF=0, ZF=0, SF=0 If (mem) < data then CF=1, ZF=0, SF=1 If (mem) = data then CF=0, ZF=1, SF=0
  • 16. 2. Arithmetic Instructions Instruction Set 16 8086 Microprocessor Mnemonics: ADD, ADC, SUB, SBB, INC, DEC, MUL, DIV, CMP… CMP A, data CMP AL, data8 CMP AX, data16 Modify flags  (AL) – data8 If (AL) > data8 then CF=0, ZF=0, SF=0 If (AL) < data8 then CF=1, ZF=0, SF=1 If (AL) = data8 then CF=0, ZF=1, SF=0 Modify flags  (AX) – data16 If (AX) > data16 then CF=0, ZF=0, SF=0 If (mem) < data16 then CF=1, ZF=0, SF=1 If (mem) = data16 then CF=0, ZF=1, SF=0
  • 17. 3. Logical Instructions Instruction Set 17 8086 Microprocessor Mnemonics: AND, OR, XOR, TEST, SHR, SHL, RCR, RCL …
  • 18. 3. Logical Instructions Instruction Set 18 8086 Microprocessor Mnemonics: AND, OR, XOR, TEST, SHR, SHL, RCR, RCL …
  • 19. 3. Logical Instructions Instruction Set 19 8086 Microprocessor Mnemonics: AND, OR, XOR, TEST, SHR, SHL, RCR, RCL …
  • 20. 3. Logical Instructions Instruction Set 20 8086 Microprocessor Mnemonics: AND, OR, XOR, TEST, SHR, SHL, RCR, RCL …
  • 21. 3. Logical Instructions Instruction Set 21 8086 Microprocessor Mnemonics: AND, OR, XOR, TEST, SHR, SHL, RCR, RCL …
  • 22. 3. Logical Instructions Instruction Set 22 8086 Microprocessor Mnemonics: AND, OR, XOR, TEST, SHR, SHL, RCR, RCL …
  • 23. 3. Logical Instructions Instruction Set 23 8086 Microprocessor Mnemonics: AND, OR, XOR, TEST, SHR, SHL, RCR, RCL …
  • 24. 3. Logical Instructions Instruction Set 24 8086 Microprocessor Mnemonics: AND, OR, XOR, TEST, SHR, SHL, RCR, RCL …
  • 25. 4. String Manipulation Instructions Instruction Set 25 8086 Microprocessor  String : Sequence of bytes or words  8086 instruction set includes instruction for string movement, comparison, scan, load and store.  REP instruction prefix : used to repeat execution of string instructions  String instructions end with S or SB or SW. S represents string, SB string byte and SW string word.  Offset or effective address of the source operand is stored in SI register and that of the destination operand is stored in DI register.  Depending on the status of DF, SI and DI registers are automatically updated.  DF = 0  SI and DI are incremented by 1 for byte and 2 for word.  DF = 1  SI and DI are decremented by 1 for byte and 2 for word.
  • 26. 4. String Manipulation Instructions Instruction Set 26 8086 Microprocessor Mnemonics: REP, MOVS, CMPS, SCAS, LODS, STOS REP REPZ/ REPE (Repeat CMPS or SCAS until ZF = 0) REPNZ/ REPNE (Repeat CMPS or SCAS until ZF = 1) While CX  0 and ZF = 1, repeat execution of string instruction and (CX)  (CX) – 1 While CX  0 and ZF = 0, repeat execution of string instruction and (CX)  (CX) - 1
  • 27. 4. String Manipulation Instructions Instruction Set 27 8086 Microprocessor Mnemonics: REP, MOVS, CMPS, SCAS, LODS, STOS MOVS MOVSB MOVSW MA = (DS) x 1610 + (SI) MAE = (ES) x 1610 + (DI) (MAE)  (MA) If DF = 0, then (DI)  (DI) + 1; (SI)  (SI) + 1 If DF = 1, then (DI)  (DI) - 1; (SI)  (SI) - 1 MA = (DS) x 1610 + (SI) MAE = (ES) x 1610 + (DI) (MAE ; MAE + 1)  (MA; MA + 1) If DF = 0, then (DI)  (DI) + 2; (SI)  (SI) + 2 If DF = 1, then (DI)  (DI) - 2; (SI)  (SI) - 2
  • 28. 4. String Manipulation Instructions Instruction Set 28 8086 Microprocessor Mnemonics: REP, MOVS, CMPS, SCAS, LODS, STOS CMPS CMPSB CMPSW MA = (DS) x 1610 + (SI) MAE = (ES) x 1610 + (DI) Modify flags  (MA) - (MAE) If (MA) > (MAE), then CF = 0; ZF = 0; SF = 0 If (MA) < (MAE), then CF = 1; ZF = 0; SF = 1 If (MA) = (MAE), then CF = 0; ZF = 1; SF = 0 For byte operation If DF = 0, then (DI)  (DI) + 1; (SI)  (SI) + 1 If DF = 1, then (DI)  (DI) - 1; (SI)  (SI) - 1 For word operation If DF = 0, then (DI)  (DI) + 2; (SI)  (SI) + 2 If DF = 1, then (DI)  (DI) - 2; (SI)  (SI) - 2 Compare two string byte or string word
  • 29. 4. String Manipulation Instructions Instruction Set 29 8086 Microprocessor Mnemonics: REP, MOVS, CMPS, SCAS, LODS, STOS SCAS SCASB SCASW MAE = (ES) x 1610 + (DI) Modify flags  (AL) - (MAE) If (AL) > (MAE), then CF = 0; ZF = 0; SF = 0 If (AL) < (MAE), then CF = 1; ZF = 0; SF = 1 If (AL) = (MAE), then CF = 0; ZF = 1; SF = 0 If DF = 0, then (DI)  (DI) + 1 If DF = 1, then (DI)  (DI) – 1 MAE = (ES) x 1610 + (DI) Modify flags  (AL) - (MAE) If (AX) > (MAE ; MAE + 1), then CF = 0; ZF = 0; SF = 0 If (AX) < (MAE ; MAE + 1), then CF = 1; ZF = 0; SF = 1 If (AX) = (MAE ; MAE + 1), then CF = 0; ZF = 1; SF = 0 If DF = 0, then (DI)  (DI) + 2 If DF = 1, then (DI)  (DI) – 2 Scan (compare) a string byte or word with accumulator
  • 30. 4. String Manipulation Instructions Instruction Set 30 8086 Microprocessor Mnemonics: REP, MOVS, CMPS, SCAS, LODS, STOS LODS LODSB LODSW MA = (DS) x 1610 + (SI) (AL)  (MA) If DF = 0, then (SI)  (SI) + 1 If DF = 1, then (SI)  (SI) – 1 MA = (DS) x 1610 + (SI) (AX)  (MA ; MA + 1) If DF = 0, then (SI)  (SI) + 2 If DF = 1, then (SI)  (SI) – 2 Load string byte in to AL or string word in to AX
  • 31. 4. String Manipulation Instructions Instruction Set 31 8086 Microprocessor Mnemonics: REP, MOVS, CMPS, SCAS, LODS, STOS STOS STOSB STOSW MAE = (ES) x 1610 + (DI) (MAE)  (AL) If DF = 0, then (DI)  (DI) + 1 If DF = 1, then (DI)  (DI) – 1 MAE = (ES) x 1610 + (DI) (MAE ; MAE + 1 )  (AX) If DF = 0, then (DI)  (DI) + 2 If DF = 1, then (DI)  (DI) – 2 Store byte from AL or word from AX in to string
  • 32. Mnemonics Explanation STC Set CF  1 CLC Clear CF  0 CMC Complement carry CF  CF/ STD Set direction flag DF  1 CLD Clear direction flag DF  0 STI Set interrupt enable flag IF  1 CLI Clear interrupt enable flag IF  0 NOP No operation HLT Halt after interrupt is set WAIT Wait for TEST pin active ESC opcode mem/ reg Used to pass instruction to a coprocessor which shares the address and data bus with the 8086 LOCK Lock bus during next instruction 5. Processor Control Instructions Instruction Set 32 8086 Microprocessor
  • 33. 6. Control Transfer Instructions Instruction Set 33 8086 Microprocessor Transfer the control to a specific destination or target instruction Do not affect flags Mnemonics Explanation CALL reg/ mem/ disp16 Call subroutine RET Return from subroutine JMP reg/ mem/ disp8/ disp16 Unconditional jump  8086 Unconditional transfers
  • 34. 6. Control Transfer Instructions Instruction Set 34 8086 Microprocessor  8086 signed conditional branch instructions  8086 unsigned conditional branch instructions Checks flags If conditions are true, the program control is transferred to the new memory location in the same segment by modifying the content of IP
  • 35. 6. Control Transfer Instructions Instruction Set 35 8086 Microprocessor Name Alternate name JE disp8 Jump if equal JZ disp8 Jump if result is 0 JNE disp8 Jump if not equal JNZ disp8 Jump if not zero JG disp8 Jump if greater JNLE disp8 Jump if not less or equal JGE disp8 Jump if greater than or equal JNL disp8 Jump if not less JL disp8 Jump if less than JNGE disp8 Jump if not greater than or equal JLE disp8 Jump if less than or equal JNG disp8 Jump if not greater  8086 signed conditional branch instructions  8086 unsigned conditional branch instructions Name Alternate name JE disp8 Jump if equal JZ disp8 Jump if result is 0 JNE disp8 Jump if not equal JNZ disp8 Jump if not zero JA disp8 Jump if above JNBE disp8 Jump if not below or equal JAE disp8 Jump if above or equal JNB disp8 Jump if not below JB disp8 Jump if below JNAE disp8 Jump if not above or equal JBE disp8 Jump if below or equal JNA disp8 Jump if not above
  • 36. 6. Control Transfer Instructions Instruction Set 36 8086 Microprocessor Mnemonics Explanation JC disp8 Jump if CF = 1 JNC disp8 Jump if CF = 0 JP disp8 Jump if PF = 1 JNP disp8 Jump if PF = 0 JO disp8 Jump if OF = 1 JNO disp8 Jump if OF = 0 JS disp8 Jump if SF = 1 JNS disp8 Jump if SF = 0 JZ disp8 Jump if result is zero, i.e, Z = 1 JNZ disp8 Jump if result is not zero, i.e, Z = 1  8086 conditional branch instructions affecting individual flags
  • 37. 8086 Instruction Set: Summary AND Logical AND of byte or word NOT Logical NOT of byte or word OR Logical OR of byte or word RCL Rotate left trough carry byte or word RCR Rotate right trough carry byte or word ROL Rotate left byte or word ROR Rotate right byte or word SAL Arithmetic shift left byte or word SAR Arithmetic shift right byte or word SHL Logical shift left byte or word SHR Logical shift right byte or word TEST Test byte or word XOR Logical exclusive-OR of byte or word CMPS Compare byte or word string LODS Load byte or word string IN Input byte or word from port OUT Output byte or word to MOV Move to/from register/memory MOVS Move byte or word string MOVSB Move string byte MOVSW Move string word
  • 38. 8086 Instruction Set: Summary 38 DAA Decimal adjust for addition DAS Decimal adjust for subtraction DEC Decrement byte or word by one DIV Divide byte or word IDIV Integer divide byte or word IMUL Integer multiply byte or word INC Increment byte or word by one MUL Multiply byte or word (unsigned) NEG Negate byte or word SBB Subtract byte or word and carry (borrow) SUB Subtract byte or word REP Repeat REPE Repeat while equal REPZ Repeat while zero REPNE Repeat while not equal REPNZ Repeat while not zero SCAS Scan byte or word string STOS Store byte or word string
  • 39. 8086 Instruction Set: Summary LAHF Load AH from flags LDS Load pointer using data segment LEA Load effective address LES Load pointer using extra segment port POP Pop word off stack POPF Pop flags off stack PUSH Push word onto stack PUSHF Push flags onto stack SAHF Store AH into flags XCHG Exchange byte or word XLAT Translate byte AAA ASCII adjust for addition AAD ASCII adjust for division AAM ASCII adjust for multiply AAS ASCII adjust for subtraction ADC Add byte or word plus carry ADD Add byte or word CBW Convert byte or word CMP Compare byte or word CWD Convert word to double-word
  • 40. Assemble Directives 40 8086 Microprocessor Instructions to the Assembler regarding the program being executed. Control the generation of machine codes and organization of the program; but no machine codes are generated for assembler directives. Also called ‘pseudo instructions’ Used to : › specify the start and end of a program › attach value to variables › allocate storage locations to input/ output data › define start and end of segments, procedures, macros etc..
  • 41. Assemble Directives 41 8086 Microprocessor Define Byte Define a byte type (8-bit) variable Reserves specific amount of memory locations to each variable Range : 00H – FFH for unsigned value; 00H – 7FH for positive value and 80H – FFH for negative value General form : variable DB value/ values Example: LIST DB 7FH, 42H, 35H Three consecutive memory locations are reserved for the variable LIST and each data specified in the instruction are stored as initial value in the reserved memory location DB DW SEGMENT ENDS ASSUME ORG END EVEN EQU PROC FAR NEAR ENDP SHORT MACRO ENDM
  • 42. Assemble Directives 42 8086 Microprocessor Define Word Define a word type (16-bit) variable Reserves two consecutive memory locations to each variable Range : 0000H – FFFFH for unsigned value; 0000H – 7FFFH for positive value and 8000H – FFFFH for negative value General form : variable DW value/ values Example: ALIST DW 6512H, 0F251H, 0CDE2H Six consecutive memory locations are reserved for the variable ALIST and each 16-bit data specified in the instruction is stored in two consecutive memory location. DB DW SEGMENT ENDS ASSUME ORG END EVEN EQU PROC FAR NEAR ENDP SHORT MACRO ENDM
  • 43. Assemble Directives 43 8086 Microprocessor SEGMENT : Used to indicate the beginning of a code/ data/ stack segment ENDS : Used to indicate the end of a code/ data/ stack segment General form: Segnam SEGMENT … … … … … … Segnam ENDS Program code or Data Defining Statements User defined name of the segment DB DW SEGMENT ENDS ASSUME ORG END EVEN EQU PROC FAR NEAR ENDP SHORT MACRO ENDM
  • 44. Assemble Directives 44 8086 Microprocessor DB DW SEGMENT ENDS ASSUME ORG END EVEN EQU PROC FAR NEAR ENDP SHORT MACRO ENDM Informs the assembler the name of the program/ data segment that should be used for a specific segment. General form: Segment Register ASSUME segreg : segnam, .. , segreg : segnam User defined name of the segment ASSUME CS: ACODE, DS:ADATA Tells the compiler that the instructions of the program are stored in the segment ACODE and data are stored in the segment ADATA Example:
  • 45. Assemble Directives 45 8086 Microprocessor DB DW SEGMENT ENDS ASSUME ORG END EVEN EQU PROC FAR NEAR ENDP SHORT MACRO ENDM ORG (Origin) is used to assign the starting address (Effective address) for a program/ data segment END is used to terminate a program; statements after END will be ignored EVEN : Informs the assembler to store program/ data segment starting from an even address EQU (Equate) is used to attach a value to a variable ORG 1000H Informs the assembler that the statements following ORG 1000H should be stored in memory starting with effective address 1000H LOOP EQU 10FEH Value of variable LOOP is 10FEH _SDATA SEGMENT ORG 1200H A DB 4CH EVEN B DW 1052H _SDATA ENDS In this data segment, effective address of memory location assigned to A will be 1200H and that of B will be 1202H and 1203H. Examples:
  • 46. Assemble Directives 46 8086 Microprocessor DB DW SEGMENT ENDS ASSUME ORG END EVEN EQU PROC ENDP FAR NEAR SHORT MACRO ENDM PROC Indicates the beginning of a procedure ENDP End of procedure FAR Intersegment call NEAR Intrasegment call General form procname PROC[NEAR/ FAR] … … … RET procname ENDP Program statements of the procedure Last statement of the procedure User defined name of the procedure
  • 47. Assemble Directives 47 8086 Microprocessor DB DW SEGMENT ENDS ASSUME ORG END EVEN EQU PROC ENDP FAR NEAR SHORT MACRO ENDM ADD64 PROC NEAR … … … RET ADD64 ENDP The subroutine/ procedure named ADD64 is declared as NEAR and so the assembler will code the CALL and RET instructions involved in this procedure as near call and return CONVERT PROC FAR … … … RET CONVERT ENDP The subroutine/ procedure named CONVERT is declared as FAR and so the assembler will code the CALL and RET instructions involved in this procedure as far call and return Examples:
  • 48. Assemble Directives 48 8086 Microprocessor DB DW SEGMENT ENDS ASSUME ORG END EVEN EQU PROC ENDP FAR NEAR SHORT MACRO ENDM Reserves one memory location for 8-bit signed displacement in jump instructions JMP SHORT AHEAD The directive will reserve one memory location for 8-bit displacement named AHEAD Example:
  • 49. Assemble Directives 49 8086 Microprocessor DB DW SEGMENT ENDS ASSUME ORG END EVEN EQU PROC ENDP FAR NEAR SHORT MACRO ENDM MACRO Indicate the beginning of a macro ENDM End of a macro General form: macroname MACRO[Arg1, Arg2 ...] … … … macroname ENDM Program statements in the macro User defined name of the macro