8086 instruction set with types
description
Transcript of 8086 instruction set with types
![Page 1: 8086 instruction set with types](https://reader031.fdocuments.us/reader031/viewer/2022012405/5561a6e0d8b42afd708b4e42/html5/thumbnails/1.jpg)
University of PuneS.E. I.T.
Subject code: 214447
Part 02: Assembly Language Programming With 8086
Processor Architecture and Interfacing
Tushar B Kute,Sandip Institute of Technology and Research Centre, [email protected]
![Page 2: 8086 instruction set with types](https://reader031.fdocuments.us/reader031/viewer/2022012405/5561a6e0d8b42afd708b4e42/html5/thumbnails/2.jpg)
Program Development
• Assembly Language Program Development
![Page 3: 8086 instruction set with types](https://reader031.fdocuments.us/reader031/viewer/2022012405/5561a6e0d8b42afd708b4e42/html5/thumbnails/3.jpg)
Example Code
DATA SEGMENT ;Data segment declarationMULTIPLICAND DW 341AHMULTIPLIER DW 20F4HPRODUCT DW 2 DUP(0)
DATA ENDSCODE SEGMENT
ASSUME CS:CODE, DS:DATASTART: MOV AX, DATA
MOV DS, AXMOV AX, MULTIPLICANDMUL MULTIPLIERMOV PRODUCT, AXMOV PRODUCT+2, DXINT 3
CODE ENDSEND START
![Page 4: 8086 instruction set with types](https://reader031.fdocuments.us/reader031/viewer/2022012405/5561a6e0d8b42afd708b4e42/html5/thumbnails/4.jpg)
8086 Instructions
• Data transfer • Arithmetic• Bit manipulation• String• Program execution transfer• Processor control
![Page 5: 8086 instruction set with types](https://reader031.fdocuments.us/reader031/viewer/2022012405/5561a6e0d8b42afd708b4e42/html5/thumbnails/5.jpg)
Data Transfer Instructions
• MOV• PUSH• POP• PUSHA• POPA• XCHG• XLAT
General
![Page 6: 8086 instruction set with types](https://reader031.fdocuments.us/reader031/viewer/2022012405/5561a6e0d8b42afd708b4e42/html5/thumbnails/6.jpg)
MOV Destination, Source
• MOV CX, 045FH• MOV BL, [43E4H]• MOV AX, DX• MOV DH, [BX]• MOV DS, BX• MOV RESULTS[BP], AX
![Page 7: 8086 instruction set with types](https://reader031.fdocuments.us/reader031/viewer/2022012405/5561a6e0d8b42afd708b4e42/html5/thumbnails/7.jpg)
PUSH Source
• PUSH BX• PUSH DS• PUSH TABLE[BX]
POP Destination
• POP BX• POP DS• POP TABLE[BX]
![Page 8: 8086 instruction set with types](https://reader031.fdocuments.us/reader031/viewer/2022012405/5561a6e0d8b42afd708b4e42/html5/thumbnails/8.jpg)
XCHG Destination, Source
• PUSHA• POPA• XLAT / XLATB
• XCHG AX, BX• XCHG AL, CH• XCHG AL, PRICES[BX]
![Page 9: 8086 instruction set with types](https://reader031.fdocuments.us/reader031/viewer/2022012405/5561a6e0d8b42afd708b4e42/html5/thumbnails/9.jpg)
Data Transfer Instructions• IN• OUT
• LEA• LDS• LES
• LAHF• SAHF• PUSHF• POPF
Simple IO port transfer
Special address transfer
Flag transfer
![Page 10: 8086 instruction set with types](https://reader031.fdocuments.us/reader031/viewer/2022012405/5561a6e0d8b42afd708b4e42/html5/thumbnails/10.jpg)
IN Accumulator, Port
• IN AL, 0C4H• IN AX, 34H
OUT Port, Accumulator
• OUT 3BH, AL• OUT 2CH, AX
![Page 11: 8086 instruction set with types](https://reader031.fdocuments.us/reader031/viewer/2022012405/5561a6e0d8b42afd708b4e42/html5/thumbnails/11.jpg)
LES Register, Memory addr of first word
• LES BX, [789AH]• LES DI, [BX]
LEA Register, Source
• LEA BX, PRICES• LEA BP, SS:STACK_TOP• LEA CX, [BX][DI]
![Page 12: 8086 instruction set with types](https://reader031.fdocuments.us/reader031/viewer/2022012405/5561a6e0d8b42afd708b4e42/html5/thumbnails/12.jpg)
LDS Register, Memory addr of first word
• LDS BX, [789AH]• LDS DI, [BX]
![Page 13: 8086 instruction set with types](https://reader031.fdocuments.us/reader031/viewer/2022012405/5561a6e0d8b42afd708b4e42/html5/thumbnails/13.jpg)
Flag Transfer Instructions
• LAHF [Load AH With Flags]
• SAHF [Store AH in Flags]
• PUSHF [Push flags on stack]
• POPF [Pop stack top to flags]
![Page 14: 8086 instruction set with types](https://reader031.fdocuments.us/reader031/viewer/2022012405/5561a6e0d8b42afd708b4e42/html5/thumbnails/14.jpg)
Arithmetic Instructions• ADD• ADC• INC• AAA• DAA• SBB• SUB• DEC• NEG• CMP
• AAS• DAS• MUL• IMUL• AAM• DIV• IDIV• AAD• CBW• CDW
![Page 15: 8086 instruction set with types](https://reader031.fdocuments.us/reader031/viewer/2022012405/5561a6e0d8b42afd708b4e42/html5/thumbnails/15.jpg)
ADD Destination, Source• ADD AL, 74H• ADD CL, BL• ADD DX, BX• ADD DX, [SI]
ADC Destination, Source• ADC AL, 74H• ADC CL, BL• ADC DX, BX• ADC DX, [SI]
![Page 16: 8086 instruction set with types](https://reader031.fdocuments.us/reader031/viewer/2022012405/5561a6e0d8b42afd708b4e42/html5/thumbnails/16.jpg)
INC Destination
• INC BL• INC CX• INC VARIABLE
AAA [ASCII Adjust Accumulator After Addition]
DAA [Decimal Adjust Accumulator After Addition]
![Page 17: 8086 instruction set with types](https://reader031.fdocuments.us/reader031/viewer/2022012405/5561a6e0d8b42afd708b4e42/html5/thumbnails/17.jpg)
SUB Destination, Source
• SUB CX, BX• SUB CH, AL• SUB AX, 4563H• SUB PRICES[BX], 04H
SBB Destination, Source
• SBB CX, BX• SBB CH, AL• SBB AX, 4563H
![Page 18: 8086 instruction set with types](https://reader031.fdocuments.us/reader031/viewer/2022012405/5561a6e0d8b42afd708b4e42/html5/thumbnails/18.jpg)
DEC Destination
• DEC AL• DEC BP• DEC VARIABLE
NEG Destination
• NEG AL• NEG BX• NEG BYTE PTR[BX]
![Page 19: 8086 instruction set with types](https://reader031.fdocuments.us/reader031/viewer/2022012405/5561a6e0d8b42afd708b4e42/html5/thumbnails/19.jpg)
CMP Destination, Source
• CMP AL, 01H• CMP BH, CL• CMP CX, TEMP_MIN• CMP TEMP_MIN, CX
AAS [ASCII Adjust Accumulator For Subtraction]
DAS [Decimal Adjust Accumulator For Subtraction]
![Page 20: 8086 instruction set with types](https://reader031.fdocuments.us/reader031/viewer/2022012405/5561a6e0d8b42afd708b4e42/html5/thumbnails/20.jpg)
MUL Source
• MUL BH• MUL CX• MUL BYTE PTR[BX]
AAM[BCD Adjust Accumulator After Multiply]
![Page 21: 8086 instruction set with types](https://reader031.fdocuments.us/reader031/viewer/2022012405/5561a6e0d8b42afd708b4e42/html5/thumbnails/21.jpg)
DIV Source
• DIV BH• DIV CX• DIV BYTE PTR[BX]
AAD[Binary Adjust Accumulator Before Division]
![Page 22: 8086 instruction set with types](https://reader031.fdocuments.us/reader031/viewer/2022012405/5561a6e0d8b42afd708b4e42/html5/thumbnails/22.jpg)
CBWConvert Signed Byte to Signed Word
CWDConvert Signed Word to Signed Double Word
![Page 23: 8086 instruction set with types](https://reader031.fdocuments.us/reader031/viewer/2022012405/5561a6e0d8b42afd708b4e42/html5/thumbnails/23.jpg)
Bit Manipulation Instructions
• NOT• AND• OR• XOR• TEST
• SAL• SHL• SAR• SHR
• ROL• RCL• ROR• RCR
Logical Shift Rotate
![Page 24: 8086 instruction set with types](https://reader031.fdocuments.us/reader031/viewer/2022012405/5561a6e0d8b42afd708b4e42/html5/thumbnails/24.jpg)
NOT Destination
• NOT BX• NOT BYTE PTR[BX]
AND Destination, Source
• AND BH, CL• AND CX, [SI]• AND BX, 00FFH• AND DX, BX
![Page 25: 8086 instruction set with types](https://reader031.fdocuments.us/reader031/viewer/2022012405/5561a6e0d8b42afd708b4e42/html5/thumbnails/25.jpg)
OR Destination, Source
• OR BH, CL• OR CX, [SI]• OR BX, 00FFH• OR DX, BX
XOR Destination, Source
• XOR BH, CL• XOR BP, DI• XOR DX, BX
![Page 26: 8086 instruction set with types](https://reader031.fdocuments.us/reader031/viewer/2022012405/5561a6e0d8b42afd708b4e42/html5/thumbnails/26.jpg)
TEST Destination, Source
• TEST BH, CL• TEST CX, [SI]• TEST BX, 00FFH• TEST DX, BX
![Page 27: 8086 instruction set with types](https://reader031.fdocuments.us/reader031/viewer/2022012405/5561a6e0d8b42afd708b4e42/html5/thumbnails/27.jpg)
SAL / SHL Destination, Count
• SAL BX, 01• SAL BP, CL• MOV CL, 04H• SAL AL, CL
1 0 1 1 0 1 1 10
B7 B6 B5 B4 B3 B2 B1 B0C
0 1 1 0 1 1 1 01
![Page 28: 8086 instruction set with types](https://reader031.fdocuments.us/reader031/viewer/2022012405/5561a6e0d8b42afd708b4e42/html5/thumbnails/28.jpg)
SHR Destination, Count
• SHR BP, 01• SHR AL, CL
1 0 1 1 0 1 1 1
B7 B6 B5 B4 B3 B2 B1 B0
0 1 0 1 1 0 1 1
0
C
1
0
![Page 29: 8086 instruction set with types](https://reader031.fdocuments.us/reader031/viewer/2022012405/5561a6e0d8b42afd708b4e42/html5/thumbnails/29.jpg)
SAR Destination, Count
• SAR DI, 1• SAR AL, 01
1 0 1 1 0 1 1 1
B7 B6 B5 B4 B3 B2 B1 B0
1 1 0 1 1 0 1 1
0
C
1
![Page 30: 8086 instruction set with types](https://reader031.fdocuments.us/reader031/viewer/2022012405/5561a6e0d8b42afd708b4e42/html5/thumbnails/30.jpg)
ROL Destination, Count
• ROL AX, 1• ROL BL, CL
1 0 1 1 0 1 1 10
B7 B6 B5 B4 B3 B2 B1 B0C
0 1 1 0 1 1 1 11
![Page 31: 8086 instruction set with types](https://reader031.fdocuments.us/reader031/viewer/2022012405/5561a6e0d8b42afd708b4e42/html5/thumbnails/31.jpg)
RCL Destination, Count
• RCL AX, 1• RCL BL, CL
1 0 1 1 0 1 1 10
B7 B6 B5 B4 B3 B2 B1 B0C
0 1 1 0 1 1 1 01
![Page 32: 8086 instruction set with types](https://reader031.fdocuments.us/reader031/viewer/2022012405/5561a6e0d8b42afd708b4e42/html5/thumbnails/32.jpg)
ROR Destination, Count
• ROR BL, 01• ROR AL, CL
1 0 1 1 0 1 1 1
B7 B6 B5 B4 B3 B2 B1 B0
1 1 0 1 1 0 1 1
0
C
1
![Page 33: 8086 instruction set with types](https://reader031.fdocuments.us/reader031/viewer/2022012405/5561a6e0d8b42afd708b4e42/html5/thumbnails/33.jpg)
RCR Destination, Count
• RCR BL, 01• RCR AL, CL
1 0 1 1 0 1 1 1
B7 B6 B5 B4 B3 B2 B1 B0
1 1 0 1 1 0 1 1
0
C
1
![Page 34: 8086 instruction set with types](https://reader031.fdocuments.us/reader031/viewer/2022012405/5561a6e0d8b42afd708b4e42/html5/thumbnails/34.jpg)
Program Execution Transfer
• CALL SQRT• CALL BX• CALL WORD PTR(BX)
CALL name of procedure
RET
![Page 35: 8086 instruction set with types](https://reader031.fdocuments.us/reader031/viewer/2022012405/5561a6e0d8b42afd708b4e42/html5/thumbnails/35.jpg)
Jump Instructions
• JMP label
Instruction Description (Jump if) ConditionsJA/JNBE Above/Below Not Equal C=0, Z=0JAE/JNB Above or Equal/ Not Below C=0, Z=1JB/JNAE Below/Not Above nor Equal C=1, Z=0JBE/JNA Below or Equal/Not Above C=1, Z=1JC Carry flag=1 C=1JE/JZ Equal / Zero Z=1
![Page 36: 8086 instruction set with types](https://reader031.fdocuments.us/reader031/viewer/2022012405/5561a6e0d8b42afd708b4e42/html5/thumbnails/36.jpg)
Jump InstructionsInstruction Description (Jump if) ConditionsJG/JNLE Greater/Not Less Than or
EqualC=O, Z=0
JGE/JNL Greater Than or Equal/Not Less Than
S=O
JL/JNGE Less Than/Not Greater Than or Equal
S≠O
JLE/JNG Less Than or Equal/Not Greater Than
S=O, Z=1
JNC No Carry C=0JNE/JNZ Not Equal / Not Zero Z=0
![Page 37: 8086 instruction set with types](https://reader031.fdocuments.us/reader031/viewer/2022012405/5561a6e0d8b42afd708b4e42/html5/thumbnails/37.jpg)
Jump InstructionsInstruction Description (Jump if) ConditionsJNO Not Overflow O=0JNP/JPO Not Parity/Parity Odd P=0JNS Not Sign S=0JO Overflow O=1JP/JPE Parity/Parity Even P=1JS Sign Flag S=1JCXZ CX is Zero CX=0
![Page 38: 8086 instruction set with types](https://reader031.fdocuments.us/reader031/viewer/2022012405/5561a6e0d8b42afd708b4e42/html5/thumbnails/38.jpg)
Iteration Control Instructions
Instruction Description Conditions for Exit
LOOP Loop through sequence of instructions
CX=0
LOOPE/LOOPZ
Loop through sequence of instructions
CX=0 or ZF=0
LOOPNE/LOOPNZ
Loop through sequence of instructions
CX=0 or ZF=1
![Page 39: 8086 instruction set with types](https://reader031.fdocuments.us/reader031/viewer/2022012405/5561a6e0d8b42afd708b4e42/html5/thumbnails/39.jpg)
Processor Control Instructions
• STC• CLC• CMC• STD• CLD• STI• CLI
![Page 40: 8086 instruction set with types](https://reader031.fdocuments.us/reader031/viewer/2022012405/5561a6e0d8b42afd708b4e42/html5/thumbnails/40.jpg)
External Hardware Synchronization
• HLT• WAIT• ESC• LOCK• NOP
![Page 41: 8086 instruction set with types](https://reader031.fdocuments.us/reader031/viewer/2022012405/5561a6e0d8b42afd708b4e42/html5/thumbnails/41.jpg)
Interrupt Instructions
• INT• INTO• IRET
![Page 42: 8086 instruction set with types](https://reader031.fdocuments.us/reader031/viewer/2022012405/5561a6e0d8b42afd708b4e42/html5/thumbnails/42.jpg)
References
• “Microprocessors and Interfacing” by Douglas Hall, Tata McGraw Hill Publishing.