SlideShare ist ein Scribd-Unternehmen logo
1 von 52
1 
x86’s instruction sets
2 
Instruction Set Classification 
 Transfer 
 Move 
 Arithmetic 
 Add / Subtract 
 Mul / Div, etc. 
 Control 
 Jump 
 Call / Return, etc.
3 
Data transfer : Move 
 MOV Dest, Src 
 MOV reg, reg reg <- reg 
 MOV reg, mem reg <- mem 
 MOV mem, reg mem <- reg 
 MOV reg, imm reg <- imm 
 MOV mem, imm mem <- imm 
 There is no move mem<-mem instruction.
Move limitation 
 Both operand must be in the same size. 
 There is no instruction to put immediate value 
directly to segment register. Have to use 
accumulator (AX) to accomplish this. 
 To put immediate value directly to memory, 
we have to specify its size. (Byte/Word PTR) 
4
5 
Move (MOV) Example 
 MOV AX,100h 
 MOV BX,AX 
 MOV DX,BX 
 MOV AX,1234h 
 MOV DX,5678h 
 MOV AL,DL 
 MOV BH,DH
6 
MOV Example 
 MOV AX,1000h 
 MOV [100h],AX 
 MOV BX,[100h] 
 MOV BYTE PTR [200h],10h 
 MOV WORD PTR [300h],10h 
 MOV AX,2300h 
 MOV DS,AX
7 
MOV : 16 / 8 Bit register 
 To move value 
between registers, 
their size must be 
the same.
8 
MOV : Memory 
 Given only offset where to put value, it will be 
automatically select DS as the segment register.
9 
Byte ordering : Little endian 
 Since, x86’s byte 
ordering is little 
endian. 
 Therefore, the LSB 
will be placed at 
lowest address and 
MSB will be placed at 
highest address.
10 
Displacement 
 We can use BX (Base) 
register to point a place 
of memory. 
 Both register direct or 
displacement. 
 AX = ?
11 
What is the result of … 
 MOV [100h] , 10h 
 Address 100 = 10h 
 What about address 101? 
 Word or Byte? 
 MOV WORD PTR [100h], 10h 
 MOV BYTE PTR [100h], 10h 
 What about MOV [100h], AX ?
12 
Status Register (Flag)
13 
Flag 
 8086 has 16 bit flag to indicate the status of final 
arithmetic result.
14 
Zero Flag 
 The zero flag will be set (1) whenever the result is 
zero.
15 
Parity flag 
 The parity flag will be set whenever the number of 
bit “1” are even.
16 
Carry flag 
 Carry flag will be set whenever there is a carry or 
borrow (only with unsigned operation).
17 
Overflow flag 
 Overflow flag will be set whenever the result is 
overflow (with signed operation).
18 
Sign flag 
 Sign flag will be set whenever the result is negative 
with signed operation.
19 
More flag 
 Auxiliary flag will be set when the result of BCD 
operation need to be adjusted. 
 Direction flag is used to specify direction 
(increment/decrement index register) in string 
operation. 
 Trap flag is used to interrupt CPU after each 
operation. 
 Interrupt flag is used to enable/disable hardware 
interrupt.
20 
Flag set/reset instructions 
 Carry flag STC / CLC 
 Direction flag STD / CLD 
 Interrupt flag STI / CLI
21 
Arithmetic instructions
22 
Increment - Decrement 
 INC / DEC 
 INC register DEC register 
 INC memory DEC memory 
 EX. 
 INC AX 
 DEC BL 
 How can we increment a byte of memory? 
 INC ??? [100]
23 
Add 
 ADD reg, imm ADC reg, imm 
 ADD reg, mem ADC reg, mem 
 ADD reg, reg ADC reg, reg 
 ADD mem, imm ADC mem, imm 
 ADD mem, reg ADC mem, reg
24 
EX. ADD 
 MOV AL, 10h 
 ADD AL, 20h ;AL = 30h 
 MOV BX, 200h ;BX = 0200h 
 MOV WORD PTR [BX], 10h 
 ADD WORD PTR [BX], 70h 
 MOV AH, 89h ;AX = 8930h 
 ADD AX, 9876h ;AX = 21A6h 
 ADC BX, 01h ;BX = 0202h ?
25 
Subtract 
 SUB reg, imm SBB reg, imm 
 SUB reg, mem SBB reg, mem 
 SUB reg, reg SBB reg, reg 
 SUB mem, imm SBB mem, imm 
 SUB mem, reg SBB mem, reg
26 
Ex. SUB 
 MOV AL, 10h 
 ADD AL, 20h ;AL = 30h 
 MOV BX, 200h ;BX = 0200h 
 MOV WORD PTR [BX], 10h 
 SUB WORD PTR [BX], 70h 
 MOV AH, 89h ;AX = 8930h 
 SBB AX, 0001h ;AX = 892Eh ? 
 SBB AX, 0001h ;AX = 892Dh
27 
Compare 
 CMP reg, imm 
 CMP reg, mem 
 CMP reg, reg 
 CMP mem, reg 
 There is no “CMP mem, imm”
28 
Ex. CMP 
 MOV CX, 10h 
 CMP CX, 20h ;Z=0,S=1,C=1,O=0 
 MOV BX, 40h 
 CMP BX, 40h ;Z=1,S=0,C=0,O=0 
 MOV AX, 30h 
 CMP AX, 20h ;Z=0,S=0,C=0,O=0
29 
Negation 
 Compute 2’complement. 
 Carry flag always set. 
 Usage 
 NEG reg 
 NEG mem
30 
Ex. NEG 
 MOV CX, 10h 
 NEG CX ; CX = 0FFF0h 
 MOV AX,0FFFFH 
 NEG AX ; AX = 1 
 MOV BX,1H 
 NEG BX ; BX = 0FFFFh
31 
Multiplication 
 IMUL (Integer multiplication) unsigned 
multiplication 
 MUL (Multiplication) signed multiplication. 
 MUL reg IMUL reg 
 MUL mem IMUL mem 
 Always perform with accumulator. 
 Effected flag are only over and carry flag.
32 
8 bit multiplication 
 AL is multiplicand 
 AX keep the result 
 MOV AL,10h ; AL = 10h 
 MOV CL,13h ; CL = 13h 
 IMUL CL ; AX = 0130h
33 
16 bit multiplication 
 AX is multiplicand 
 DX:AX keep the result 
 MOV AX,0100h ; AX = 0100h 
 MOV BX,1234h ; BX = 1234h 
 IMUL BX ; DX = 0012h 
; AX = 3400h
34 
Division 
 IDIV (Integer division) unsigned division. 
 DIV (Division) signed division. 
 DIV reg IDIV reg 
 DIV mem IDIV mem 
 Always perform with accumulator. 
 Effected flag are only over and carry flag.
35 
8 bit division 
 AL is dividend 
 AL keep the result 
 AH keep the remainder 
 MOV AX, 0017h 
 MOV BX, 0010h 
 DIV BL ; AX = 0701
36 
16 bit multiplication 
 DX:AX dividend. 
 AX keep the result, DX keep the remainder. 
 MOV AX,4022h ; 
 MOV DX,0000h ; 
 MOV CX,1000h ; 
 DIV CX ;AX = 0004 
;DX = 0022
37 
Conversion 
 Byte to Word : CBW 
 Signed convert AL -> AX 
 Word to Double word : CWD 
 Signed convert AX -> DX:AX
38 
Ex. Conversion 
 MOV AL,22h 
 CBW ; AX=0022h 
 MOV AL,F0h 
 CBW ; AX=FFF0h 
 MOV AX, 3422h 
 CWD ; DX=0000h 
; AX=3422h
39
Example about flag with arithmetic 
40 
 เอกสารอ้างอิง 
 เอกสารประกอบการสอนวิชา 204221 องค์ประกอบคอมพิวเตอร์และ 
ภาษาแอสเซมบลี้ มหาวิทยาลัยเกษตรศาสตร์, 1994
Example about flag with arithmetic 
41 
NEG -> Carry flag always 1, INC/DEC does not effect any flag
42 
Jump and Loops 
 Control structures 
 Selection 
 Repetition / Loop 
 Jxx Label
43
44
45
46 
If ah=10, if ah>=10
47 
Get ‘Q’ and Print ASCII code.
48 
Loop 
 Base on CX (Counter register) to count the 
loop. 
 Instructions : 
 LOOP ; Dec CX … 0 
 LOOPZ ;CX<>0 and Z=1 
 LOOPNZ ;CX<>0 and Z=0 
 JCXZ ; Jump if CX=0, used with 
LOOP to determine the CX before loop.
49 
LOOP
50 
JCXZ
51 
Example finding first character
52 
That’s all.

Weitere ähnliche Inhalte

Was ist angesagt?

Assembly Language Programming By Ytha Yu, Charles Marut Chap 7 (Logic, Shift,...
Assembly Language Programming By Ytha Yu, Charles Marut Chap 7 (Logic, Shift,...Assembly Language Programming By Ytha Yu, Charles Marut Chap 7 (Logic, Shift,...
Assembly Language Programming By Ytha Yu, Charles Marut Chap 7 (Logic, Shift,...Bilal Amjad
 
Addressing modes of 8086
Addressing modes of 8086Addressing modes of 8086
Addressing modes of 8086saurav kumar
 
Interrupts on 8086 microprocessor by vijay kumar.k
Interrupts on 8086 microprocessor by vijay kumar.kInterrupts on 8086 microprocessor by vijay kumar.k
Interrupts on 8086 microprocessor by vijay kumar.kVijay Kumar
 
Instruction set of 8086
Instruction set of 8086Instruction set of 8086
Instruction set of 80869840596838
 
Assembly Language Lecture 5
Assembly Language Lecture 5Assembly Language Lecture 5
Assembly Language Lecture 5Motaz Saad
 
23. serial and parallel data communication
23. serial and parallel data communication23. serial and parallel data communication
23. serial and parallel data communicationsandip das
 
Instruction Set of 8086 Microprocessor
Instruction Set of 8086 MicroprocessorInstruction Set of 8086 Microprocessor
Instruction Set of 8086 MicroprocessorAshita Agrawal
 
Clock-8086 bus cycle
Clock-8086 bus cycleClock-8086 bus cycle
Clock-8086 bus cycleRani Rahul
 
Unit 3 – assembly language programming
Unit 3 – assembly language programmingUnit 3 – assembly language programming
Unit 3 – assembly language programmingKartik Sharma
 
8086 Microprocessor powerpoint
8086  Microprocessor  powerpoint8086  Microprocessor  powerpoint
8086 Microprocessor powerpointRandhir Kumar
 
1326 Introduction To 8086 Microprocessor
1326 Introduction To 8086 Microprocessor1326 Introduction To 8086 Microprocessor
1326 Introduction To 8086 Microprocessortechbed
 
Microprocessor 8086 instructions
Microprocessor 8086 instructionsMicroprocessor 8086 instructions
Microprocessor 8086 instructionsRavi Anand
 
Memory & I/O interfacing
Memory & I/O  interfacingMemory & I/O  interfacing
Memory & I/O interfacingdeval patel
 
INTEL 8086 MICROPROCESSOR
INTEL 8086 MICROPROCESSORINTEL 8086 MICROPROCESSOR
INTEL 8086 MICROPROCESSORSagar Kuntumal
 
Memory banking-of-8086-final
Memory banking-of-8086-finalMemory banking-of-8086-final
Memory banking-of-8086-finalEstiak Khan
 

Was ist angesagt? (20)

Assembly Language Programming By Ytha Yu, Charles Marut Chap 7 (Logic, Shift,...
Assembly Language Programming By Ytha Yu, Charles Marut Chap 7 (Logic, Shift,...Assembly Language Programming By Ytha Yu, Charles Marut Chap 7 (Logic, Shift,...
Assembly Language Programming By Ytha Yu, Charles Marut Chap 7 (Logic, Shift,...
 
Addressing modes of 8086
Addressing modes of 8086Addressing modes of 8086
Addressing modes of 8086
 
Interrupts on 8086 microprocessor by vijay kumar.k
Interrupts on 8086 microprocessor by vijay kumar.kInterrupts on 8086 microprocessor by vijay kumar.k
Interrupts on 8086 microprocessor by vijay kumar.k
 
Instruction set of 8086 Microprocessor
Instruction set of 8086 Microprocessor Instruction set of 8086 Microprocessor
Instruction set of 8086 Microprocessor
 
Instruction set of 8086
Instruction set of 8086Instruction set of 8086
Instruction set of 8086
 
8086 instruction set
8086 instruction set8086 instruction set
8086 instruction set
 
Assembly Language Lecture 5
Assembly Language Lecture 5Assembly Language Lecture 5
Assembly Language Lecture 5
 
23. serial and parallel data communication
23. serial and parallel data communication23. serial and parallel data communication
23. serial and parallel data communication
 
Stack
StackStack
Stack
 
Instruction Set of 8086 Microprocessor
Instruction Set of 8086 MicroprocessorInstruction Set of 8086 Microprocessor
Instruction Set of 8086 Microprocessor
 
Clock-8086 bus cycle
Clock-8086 bus cycleClock-8086 bus cycle
Clock-8086 bus cycle
 
Unit 3 – assembly language programming
Unit 3 – assembly language programmingUnit 3 – assembly language programming
Unit 3 – assembly language programming
 
8086 alp
8086 alp8086 alp
8086 alp
 
8086 Microprocessor powerpoint
8086  Microprocessor  powerpoint8086  Microprocessor  powerpoint
8086 Microprocessor powerpoint
 
8086 Microprocessor
8086 Microprocessor8086 Microprocessor
8086 Microprocessor
 
1326 Introduction To 8086 Microprocessor
1326 Introduction To 8086 Microprocessor1326 Introduction To 8086 Microprocessor
1326 Introduction To 8086 Microprocessor
 
Microprocessor 8086 instructions
Microprocessor 8086 instructionsMicroprocessor 8086 instructions
Microprocessor 8086 instructions
 
Memory & I/O interfacing
Memory & I/O  interfacingMemory & I/O  interfacing
Memory & I/O interfacing
 
INTEL 8086 MICROPROCESSOR
INTEL 8086 MICROPROCESSORINTEL 8086 MICROPROCESSOR
INTEL 8086 MICROPROCESSOR
 
Memory banking-of-8086-final
Memory banking-of-8086-finalMemory banking-of-8086-final
Memory banking-of-8086-final
 

Andere mochten auch

Instruction Set Of 8086 DIU CSE
Instruction Set Of 8086 DIU CSEInstruction Set Of 8086 DIU CSE
Instruction Set Of 8086 DIU CSEsalmancreation
 
Instruction set of 8086
Instruction set of 8086Instruction set of 8086
Instruction set of 8086aviban
 
instruction set of 8086
instruction set of 8086instruction set of 8086
instruction set of 8086muneer.k
 
Flags registor of 8086 processor
Flags registor of 8086 processorFlags registor of 8086 processor
Flags registor of 8086 processorFazle Akash
 
8086 instruction set with types
8086 instruction set with types8086 instruction set with types
8086 instruction set with typesRavinder Rautela
 
8086 instructions
8086 instructions8086 instructions
8086 instructionsRavi Anand
 

Andere mochten auch (7)

Instruction Set Of 8086 DIU CSE
Instruction Set Of 8086 DIU CSEInstruction Set Of 8086 DIU CSE
Instruction Set Of 8086 DIU CSE
 
Instruction set of 8086
Instruction set of 8086Instruction set of 8086
Instruction set of 8086
 
instruction set of 8086
instruction set of 8086instruction set of 8086
instruction set of 8086
 
Instruction formats-in-8086
Instruction formats-in-8086Instruction formats-in-8086
Instruction formats-in-8086
 
Flags registor of 8086 processor
Flags registor of 8086 processorFlags registor of 8086 processor
Flags registor of 8086 processor
 
8086 instruction set with types
8086 instruction set with types8086 instruction set with types
8086 instruction set with types
 
8086 instructions
8086 instructions8086 instructions
8086 instructions
 

Ähnlich wie 8086 instruction set

Ähnlich wie 8086 instruction set (20)

Instruction 4.pptx
Instruction 4.pptxInstruction 4.pptx
Instruction 4.pptx
 
[ASM]Lab7
[ASM]Lab7[ASM]Lab7
[ASM]Lab7
 
Assembly Complete 8086 Instruction Set
Assembly Complete 8086 Instruction SetAssembly Complete 8086 Instruction Set
Assembly Complete 8086 Instruction Set
 
[ASM]Lab4
[ASM]Lab4[ASM]Lab4
[ASM]Lab4
 
Mod-2.pptx
Mod-2.pptxMod-2.pptx
Mod-2.pptx
 
Arithmetic instrctions
Arithmetic instrctionsArithmetic instrctions
Arithmetic instrctions
 
Module 2 (1).pptx
Module 2 (1).pptxModule 2 (1).pptx
Module 2 (1).pptx
 
1344 Alp Of 8086
1344 Alp Of 80861344 Alp Of 8086
1344 Alp Of 8086
 
Lec06
Lec06Lec06
Lec06
 
Instruction set of 8086
Instruction set of 8086Instruction set of 8086
Instruction set of 8086
 
Instructionsetof8086 180224060745(3)
Instructionsetof8086 180224060745(3)Instructionsetof8086 180224060745(3)
Instructionsetof8086 180224060745(3)
 
Assembly class
Assembly classAssembly class
Assembly class
 
Al2ed chapter7
Al2ed chapter7Al2ed chapter7
Al2ed chapter7
 
Intel codetable
Intel codetableIntel codetable
Intel codetable
 
Instruction set of 8086
Instruction set of 8086Instruction set of 8086
Instruction set of 8086
 
Chap 3_2.ppt
Chap 3_2.pptChap 3_2.ppt
Chap 3_2.ppt
 
Lecture5
Lecture5Lecture5
Lecture5
 
Lecture5(1)
Lecture5(1)Lecture5(1)
Lecture5(1)
 
Micro unit 3
Micro unit 3Micro unit 3
Micro unit 3
 
Microprocssor
MicroprocssorMicroprocssor
Microprocssor
 

Kürzlich hochgeladen

Escorts Service Arekere ☎ 7737669865☎ Book Your One night Stand (Bangalore)
Escorts Service Arekere ☎ 7737669865☎ Book Your One night Stand (Bangalore)Escorts Service Arekere ☎ 7737669865☎ Book Your One night Stand (Bangalore)
Escorts Service Arekere ☎ 7737669865☎ Book Your One night Stand (Bangalore)amitlee9823
 
Vip Mumbai Call Girls Andheri East Call On 9920725232 With Body to body massa...
Vip Mumbai Call Girls Andheri East Call On 9920725232 With Body to body massa...Vip Mumbai Call Girls Andheri East Call On 9920725232 With Body to body massa...
Vip Mumbai Call Girls Andheri East Call On 9920725232 With Body to body massa...amitlee9823
 
Call Girls in Thane 9892124323, Vashi cAll girls Serivces Juhu Escorts, powai...
Call Girls in Thane 9892124323, Vashi cAll girls Serivces Juhu Escorts, powai...Call Girls in Thane 9892124323, Vashi cAll girls Serivces Juhu Escorts, powai...
Call Girls in Thane 9892124323, Vashi cAll girls Serivces Juhu Escorts, powai...Pooja Nehwal
 
Call Girls Banashankari Just Call 👗 7737669865 👗 Top Class Call Girl Service ...
Call Girls Banashankari Just Call 👗 7737669865 👗 Top Class Call Girl Service ...Call Girls Banashankari Just Call 👗 7737669865 👗 Top Class Call Girl Service ...
Call Girls Banashankari Just Call 👗 7737669865 👗 Top Class Call Girl Service ...amitlee9823
 
Call Girls Pimple Saudagar Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Pimple Saudagar Call Me 7737669865 Budget Friendly No Advance BookingCall Girls Pimple Saudagar Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Pimple Saudagar Call Me 7737669865 Budget Friendly No Advance Bookingroncy bisnoi
 
Deira Dubai Escorts +0561951007 Escort Service in Dubai by Dubai Escort Girls
Deira Dubai Escorts +0561951007 Escort Service in Dubai by Dubai Escort GirlsDeira Dubai Escorts +0561951007 Escort Service in Dubai by Dubai Escort Girls
Deira Dubai Escorts +0561951007 Escort Service in Dubai by Dubai Escort GirlsEscorts Call Girls
 
Book Paid Lohegaon Call Girls Pune 8250192130Low Budget Full Independent High...
Book Paid Lohegaon Call Girls Pune 8250192130Low Budget Full Independent High...Book Paid Lohegaon Call Girls Pune 8250192130Low Budget Full Independent High...
Book Paid Lohegaon Call Girls Pune 8250192130Low Budget Full Independent High...ranjana rawat
 
(=Towel) Dubai Call Girls O525547819 Call Girls In Dubai (Fav0r)
(=Towel) Dubai Call Girls O525547819 Call Girls In Dubai (Fav0r)(=Towel) Dubai Call Girls O525547819 Call Girls In Dubai (Fav0r)
(=Towel) Dubai Call Girls O525547819 Call Girls In Dubai (Fav0r)kojalkojal131
 
9892124323 Pooja Nehwal Call Girls Services Call Girls service in Santacruz A...
9892124323 Pooja Nehwal Call Girls Services Call Girls service in Santacruz A...9892124323 Pooja Nehwal Call Girls Services Call Girls service in Santacruz A...
9892124323 Pooja Nehwal Call Girls Services Call Girls service in Santacruz A...Pooja Nehwal
 
VVIP Pune Call Girls Warje (7001035870) Pune Escorts Nearby with Complete Sat...
VVIP Pune Call Girls Warje (7001035870) Pune Escorts Nearby with Complete Sat...VVIP Pune Call Girls Warje (7001035870) Pune Escorts Nearby with Complete Sat...
VVIP Pune Call Girls Warje (7001035870) Pune Escorts Nearby with Complete Sat...Call Girls in Nagpur High Profile
 
VVIP Pune Call Girls Kalyani Nagar (7001035870) Pune Escorts Nearby with Comp...
VVIP Pune Call Girls Kalyani Nagar (7001035870) Pune Escorts Nearby with Comp...VVIP Pune Call Girls Kalyani Nagar (7001035870) Pune Escorts Nearby with Comp...
VVIP Pune Call Girls Kalyani Nagar (7001035870) Pune Escorts Nearby with Comp...Call Girls in Nagpur High Profile
 
Call Girls Chikhali Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Chikhali Call Me 7737669865 Budget Friendly No Advance BookingCall Girls Chikhali Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Chikhali Call Me 7737669865 Budget Friendly No Advance Bookingroncy bisnoi
 
Call Girls Dubai Slut Wife O525547819 Call Girls Dubai Gaped
Call Girls Dubai Slut Wife O525547819 Call Girls Dubai GapedCall Girls Dubai Slut Wife O525547819 Call Girls Dubai Gaped
Call Girls Dubai Slut Wife O525547819 Call Girls Dubai Gapedkojalkojal131
 
Kothanur Call Girls Service: 🍓 7737669865 🍓 High Profile Model Escorts | Bang...
Kothanur Call Girls Service: 🍓 7737669865 🍓 High Profile Model Escorts | Bang...Kothanur Call Girls Service: 🍓 7737669865 🍓 High Profile Model Escorts | Bang...
Kothanur Call Girls Service: 🍓 7737669865 🍓 High Profile Model Escorts | Bang...amitlee9823
 
Get Premium Pimple Saudagar Call Girls (8005736733) 24x7 Rate 15999 with A/c ...
Get Premium Pimple Saudagar Call Girls (8005736733) 24x7 Rate 15999 with A/c ...Get Premium Pimple Saudagar Call Girls (8005736733) 24x7 Rate 15999 with A/c ...
Get Premium Pimple Saudagar Call Girls (8005736733) 24x7 Rate 15999 with A/c ...MOHANI PANDEY
 
9004554577, Get Adorable Call Girls service. Book call girls & escort service...
9004554577, Get Adorable Call Girls service. Book call girls & escort service...9004554577, Get Adorable Call Girls service. Book call girls & escort service...
9004554577, Get Adorable Call Girls service. Book call girls & escort service...Pooja Nehwal
 

Kürzlich hochgeladen (20)

Escorts Service Arekere ☎ 7737669865☎ Book Your One night Stand (Bangalore)
Escorts Service Arekere ☎ 7737669865☎ Book Your One night Stand (Bangalore)Escorts Service Arekere ☎ 7737669865☎ Book Your One night Stand (Bangalore)
Escorts Service Arekere ☎ 7737669865☎ Book Your One night Stand (Bangalore)
 
Vip Mumbai Call Girls Andheri East Call On 9920725232 With Body to body massa...
Vip Mumbai Call Girls Andheri East Call On 9920725232 With Body to body massa...Vip Mumbai Call Girls Andheri East Call On 9920725232 With Body to body massa...
Vip Mumbai Call Girls Andheri East Call On 9920725232 With Body to body massa...
 
🔝 9953056974🔝 Delhi Call Girls in Ajmeri Gate
🔝 9953056974🔝 Delhi Call Girls in Ajmeri Gate🔝 9953056974🔝 Delhi Call Girls in Ajmeri Gate
🔝 9953056974🔝 Delhi Call Girls in Ajmeri Gate
 
Call Girls in Thane 9892124323, Vashi cAll girls Serivces Juhu Escorts, powai...
Call Girls in Thane 9892124323, Vashi cAll girls Serivces Juhu Escorts, powai...Call Girls in Thane 9892124323, Vashi cAll girls Serivces Juhu Escorts, powai...
Call Girls in Thane 9892124323, Vashi cAll girls Serivces Juhu Escorts, powai...
 
Call Girls Banashankari Just Call 👗 7737669865 👗 Top Class Call Girl Service ...
Call Girls Banashankari Just Call 👗 7737669865 👗 Top Class Call Girl Service ...Call Girls Banashankari Just Call 👗 7737669865 👗 Top Class Call Girl Service ...
Call Girls Banashankari Just Call 👗 7737669865 👗 Top Class Call Girl Service ...
 
Call Girls Pimple Saudagar Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Pimple Saudagar Call Me 7737669865 Budget Friendly No Advance BookingCall Girls Pimple Saudagar Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Pimple Saudagar Call Me 7737669865 Budget Friendly No Advance Booking
 
Deira Dubai Escorts +0561951007 Escort Service in Dubai by Dubai Escort Girls
Deira Dubai Escorts +0561951007 Escort Service in Dubai by Dubai Escort GirlsDeira Dubai Escorts +0561951007 Escort Service in Dubai by Dubai Escort Girls
Deira Dubai Escorts +0561951007 Escort Service in Dubai by Dubai Escort Girls
 
CHEAP Call Girls in Mayapuri (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Mayapuri  (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Mayapuri  (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Mayapuri (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
 
(ISHITA) Call Girls Service Aurangabad Call Now 8617697112 Aurangabad Escorts...
(ISHITA) Call Girls Service Aurangabad Call Now 8617697112 Aurangabad Escorts...(ISHITA) Call Girls Service Aurangabad Call Now 8617697112 Aurangabad Escorts...
(ISHITA) Call Girls Service Aurangabad Call Now 8617697112 Aurangabad Escorts...
 
Book Paid Lohegaon Call Girls Pune 8250192130Low Budget Full Independent High...
Book Paid Lohegaon Call Girls Pune 8250192130Low Budget Full Independent High...Book Paid Lohegaon Call Girls Pune 8250192130Low Budget Full Independent High...
Book Paid Lohegaon Call Girls Pune 8250192130Low Budget Full Independent High...
 
young call girls in Sainik Farm 🔝 9953056974 🔝 Delhi escort Service
young call girls in Sainik Farm 🔝 9953056974 🔝 Delhi escort Serviceyoung call girls in Sainik Farm 🔝 9953056974 🔝 Delhi escort Service
young call girls in Sainik Farm 🔝 9953056974 🔝 Delhi escort Service
 
(=Towel) Dubai Call Girls O525547819 Call Girls In Dubai (Fav0r)
(=Towel) Dubai Call Girls O525547819 Call Girls In Dubai (Fav0r)(=Towel) Dubai Call Girls O525547819 Call Girls In Dubai (Fav0r)
(=Towel) Dubai Call Girls O525547819 Call Girls In Dubai (Fav0r)
 
9892124323 Pooja Nehwal Call Girls Services Call Girls service in Santacruz A...
9892124323 Pooja Nehwal Call Girls Services Call Girls service in Santacruz A...9892124323 Pooja Nehwal Call Girls Services Call Girls service in Santacruz A...
9892124323 Pooja Nehwal Call Girls Services Call Girls service in Santacruz A...
 
VVIP Pune Call Girls Warje (7001035870) Pune Escorts Nearby with Complete Sat...
VVIP Pune Call Girls Warje (7001035870) Pune Escorts Nearby with Complete Sat...VVIP Pune Call Girls Warje (7001035870) Pune Escorts Nearby with Complete Sat...
VVIP Pune Call Girls Warje (7001035870) Pune Escorts Nearby with Complete Sat...
 
VVIP Pune Call Girls Kalyani Nagar (7001035870) Pune Escorts Nearby with Comp...
VVIP Pune Call Girls Kalyani Nagar (7001035870) Pune Escorts Nearby with Comp...VVIP Pune Call Girls Kalyani Nagar (7001035870) Pune Escorts Nearby with Comp...
VVIP Pune Call Girls Kalyani Nagar (7001035870) Pune Escorts Nearby with Comp...
 
Call Girls Chikhali Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Chikhali Call Me 7737669865 Budget Friendly No Advance BookingCall Girls Chikhali Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Chikhali Call Me 7737669865 Budget Friendly No Advance Booking
 
Call Girls Dubai Slut Wife O525547819 Call Girls Dubai Gaped
Call Girls Dubai Slut Wife O525547819 Call Girls Dubai GapedCall Girls Dubai Slut Wife O525547819 Call Girls Dubai Gaped
Call Girls Dubai Slut Wife O525547819 Call Girls Dubai Gaped
 
Kothanur Call Girls Service: 🍓 7737669865 🍓 High Profile Model Escorts | Bang...
Kothanur Call Girls Service: 🍓 7737669865 🍓 High Profile Model Escorts | Bang...Kothanur Call Girls Service: 🍓 7737669865 🍓 High Profile Model Escorts | Bang...
Kothanur Call Girls Service: 🍓 7737669865 🍓 High Profile Model Escorts | Bang...
 
Get Premium Pimple Saudagar Call Girls (8005736733) 24x7 Rate 15999 with A/c ...
Get Premium Pimple Saudagar Call Girls (8005736733) 24x7 Rate 15999 with A/c ...Get Premium Pimple Saudagar Call Girls (8005736733) 24x7 Rate 15999 with A/c ...
Get Premium Pimple Saudagar Call Girls (8005736733) 24x7 Rate 15999 with A/c ...
 
9004554577, Get Adorable Call Girls service. Book call girls & escort service...
9004554577, Get Adorable Call Girls service. Book call girls & escort service...9004554577, Get Adorable Call Girls service. Book call girls & escort service...
9004554577, Get Adorable Call Girls service. Book call girls & escort service...
 

8086 instruction set

  • 2. 2 Instruction Set Classification  Transfer  Move  Arithmetic  Add / Subtract  Mul / Div, etc.  Control  Jump  Call / Return, etc.
  • 3. 3 Data transfer : Move  MOV Dest, Src  MOV reg, reg reg <- reg  MOV reg, mem reg <- mem  MOV mem, reg mem <- reg  MOV reg, imm reg <- imm  MOV mem, imm mem <- imm  There is no move mem<-mem instruction.
  • 4. Move limitation  Both operand must be in the same size.  There is no instruction to put immediate value directly to segment register. Have to use accumulator (AX) to accomplish this.  To put immediate value directly to memory, we have to specify its size. (Byte/Word PTR) 4
  • 5. 5 Move (MOV) Example  MOV AX,100h  MOV BX,AX  MOV DX,BX  MOV AX,1234h  MOV DX,5678h  MOV AL,DL  MOV BH,DH
  • 6. 6 MOV Example  MOV AX,1000h  MOV [100h],AX  MOV BX,[100h]  MOV BYTE PTR [200h],10h  MOV WORD PTR [300h],10h  MOV AX,2300h  MOV DS,AX
  • 7. 7 MOV : 16 / 8 Bit register  To move value between registers, their size must be the same.
  • 8. 8 MOV : Memory  Given only offset where to put value, it will be automatically select DS as the segment register.
  • 9. 9 Byte ordering : Little endian  Since, x86’s byte ordering is little endian.  Therefore, the LSB will be placed at lowest address and MSB will be placed at highest address.
  • 10. 10 Displacement  We can use BX (Base) register to point a place of memory.  Both register direct or displacement.  AX = ?
  • 11. 11 What is the result of …  MOV [100h] , 10h  Address 100 = 10h  What about address 101?  Word or Byte?  MOV WORD PTR [100h], 10h  MOV BYTE PTR [100h], 10h  What about MOV [100h], AX ?
  • 13. 13 Flag  8086 has 16 bit flag to indicate the status of final arithmetic result.
  • 14. 14 Zero Flag  The zero flag will be set (1) whenever the result is zero.
  • 15. 15 Parity flag  The parity flag will be set whenever the number of bit “1” are even.
  • 16. 16 Carry flag  Carry flag will be set whenever there is a carry or borrow (only with unsigned operation).
  • 17. 17 Overflow flag  Overflow flag will be set whenever the result is overflow (with signed operation).
  • 18. 18 Sign flag  Sign flag will be set whenever the result is negative with signed operation.
  • 19. 19 More flag  Auxiliary flag will be set when the result of BCD operation need to be adjusted.  Direction flag is used to specify direction (increment/decrement index register) in string operation.  Trap flag is used to interrupt CPU after each operation.  Interrupt flag is used to enable/disable hardware interrupt.
  • 20. 20 Flag set/reset instructions  Carry flag STC / CLC  Direction flag STD / CLD  Interrupt flag STI / CLI
  • 22. 22 Increment - Decrement  INC / DEC  INC register DEC register  INC memory DEC memory  EX.  INC AX  DEC BL  How can we increment a byte of memory?  INC ??? [100]
  • 23. 23 Add  ADD reg, imm ADC reg, imm  ADD reg, mem ADC reg, mem  ADD reg, reg ADC reg, reg  ADD mem, imm ADC mem, imm  ADD mem, reg ADC mem, reg
  • 24. 24 EX. ADD  MOV AL, 10h  ADD AL, 20h ;AL = 30h  MOV BX, 200h ;BX = 0200h  MOV WORD PTR [BX], 10h  ADD WORD PTR [BX], 70h  MOV AH, 89h ;AX = 8930h  ADD AX, 9876h ;AX = 21A6h  ADC BX, 01h ;BX = 0202h ?
  • 25. 25 Subtract  SUB reg, imm SBB reg, imm  SUB reg, mem SBB reg, mem  SUB reg, reg SBB reg, reg  SUB mem, imm SBB mem, imm  SUB mem, reg SBB mem, reg
  • 26. 26 Ex. SUB  MOV AL, 10h  ADD AL, 20h ;AL = 30h  MOV BX, 200h ;BX = 0200h  MOV WORD PTR [BX], 10h  SUB WORD PTR [BX], 70h  MOV AH, 89h ;AX = 8930h  SBB AX, 0001h ;AX = 892Eh ?  SBB AX, 0001h ;AX = 892Dh
  • 27. 27 Compare  CMP reg, imm  CMP reg, mem  CMP reg, reg  CMP mem, reg  There is no “CMP mem, imm”
  • 28. 28 Ex. CMP  MOV CX, 10h  CMP CX, 20h ;Z=0,S=1,C=1,O=0  MOV BX, 40h  CMP BX, 40h ;Z=1,S=0,C=0,O=0  MOV AX, 30h  CMP AX, 20h ;Z=0,S=0,C=0,O=0
  • 29. 29 Negation  Compute 2’complement.  Carry flag always set.  Usage  NEG reg  NEG mem
  • 30. 30 Ex. NEG  MOV CX, 10h  NEG CX ; CX = 0FFF0h  MOV AX,0FFFFH  NEG AX ; AX = 1  MOV BX,1H  NEG BX ; BX = 0FFFFh
  • 31. 31 Multiplication  IMUL (Integer multiplication) unsigned multiplication  MUL (Multiplication) signed multiplication.  MUL reg IMUL reg  MUL mem IMUL mem  Always perform with accumulator.  Effected flag are only over and carry flag.
  • 32. 32 8 bit multiplication  AL is multiplicand  AX keep the result  MOV AL,10h ; AL = 10h  MOV CL,13h ; CL = 13h  IMUL CL ; AX = 0130h
  • 33. 33 16 bit multiplication  AX is multiplicand  DX:AX keep the result  MOV AX,0100h ; AX = 0100h  MOV BX,1234h ; BX = 1234h  IMUL BX ; DX = 0012h ; AX = 3400h
  • 34. 34 Division  IDIV (Integer division) unsigned division.  DIV (Division) signed division.  DIV reg IDIV reg  DIV mem IDIV mem  Always perform with accumulator.  Effected flag are only over and carry flag.
  • 35. 35 8 bit division  AL is dividend  AL keep the result  AH keep the remainder  MOV AX, 0017h  MOV BX, 0010h  DIV BL ; AX = 0701
  • 36. 36 16 bit multiplication  DX:AX dividend.  AX keep the result, DX keep the remainder.  MOV AX,4022h ;  MOV DX,0000h ;  MOV CX,1000h ;  DIV CX ;AX = 0004 ;DX = 0022
  • 37. 37 Conversion  Byte to Word : CBW  Signed convert AL -> AX  Word to Double word : CWD  Signed convert AX -> DX:AX
  • 38. 38 Ex. Conversion  MOV AL,22h  CBW ; AX=0022h  MOV AL,F0h  CBW ; AX=FFF0h  MOV AX, 3422h  CWD ; DX=0000h ; AX=3422h
  • 39. 39
  • 40. Example about flag with arithmetic 40  เอกสารอ้างอิง  เอกสารประกอบการสอนวิชา 204221 องค์ประกอบคอมพิวเตอร์และ ภาษาแอสเซมบลี้ มหาวิทยาลัยเกษตรศาสตร์, 1994
  • 41. Example about flag with arithmetic 41 NEG -> Carry flag always 1, INC/DEC does not effect any flag
  • 42. 42 Jump and Loops  Control structures  Selection  Repetition / Loop  Jxx Label
  • 43. 43
  • 44. 44
  • 45. 45
  • 46. 46 If ah=10, if ah>=10
  • 47. 47 Get ‘Q’ and Print ASCII code.
  • 48. 48 Loop  Base on CX (Counter register) to count the loop.  Instructions :  LOOP ; Dec CX … 0  LOOPZ ;CX<>0 and Z=1  LOOPNZ ;CX<>0 and Z=0  JCXZ ; Jump if CX=0, used with LOOP to determine the CX before loop.
  • 51. 51 Example finding first character