You are on page 1of 34

MICROPROCESSORS AND

MICROCONTROLLERS

1
UNIT - I

MICROPROCESSOR ARCHITECTURE
AND
INSTRUCTION SET

2
8085 Block Diagram

Friday, June 17, 2022 Department of Electronics and Communication Engineering, LBRCE 3
8086 Microprocessor

• It operates 4.77-10 MHz frequency range


• It is a 16-bit Microprocessor
• 20-bit Address bus can access 1MB of memory
• It supports 64K I/O ports (Devices)
• It has 14 Registers of 16-bit each
• It has multiplexed address and data bus
• It has 6 byte queue
• It requires +5V power supply
• It is a 40 pin dual in line package IC
• It operates in two modes: Minimum and Maximum modes

4
Register Organization of 8086

• Four General purpose registers


• Four Index/Pointer registers
• Four Segment registers
• Two Other registers

5
General purpose registers

6
Index/Pointer registers

7
Segment registers

Friday, June 17, 2022 Department of Electronics and Communication Engineering, LBRCE 8
Other registers

Friday, June 17, 2022 Department of Electronics and Communication Engineering, LBRCE 9
Flags Register

Friday, June 17, 2022 Department of Electronics and Communication Engineering, LBRCE 10
8086 Block Diagram

11
Memory Segmentation

Friday, June 17, 2022 Department of Electronics and Communication Engineering, LBRCE 12
Bus Operation

Friday, June 17, 2022 Department of Electronics and Communication Engineering, LBRCE 13
Addressing Modes of 8086
• Immediate Addressing Mode
• Example: MOV AX, 0005H
• Direct Addressing Mode
• Example: MOV AX, [5000H]
• Register Addressing Mode
• Example: MOV BX, AX
• Register Indirect Addressing Mode
• Example: MOV AX, [BX]

Friday, June 17, 2022 Department of Electronics and Communication Engineering, LBRCE 14
Addressing Modes of 8086
• Indexed Addressing Mode
• Example: MOV AX, [SI]
• Register Relative Addressing Mode
• Example: MOV AX, 50H [BX]
• Base Indexed Addressing Mode
• Example: MOV AX, [BX][SI]
• Relative Base Indexed Addressing Mode
• Example: MOV AX, 50H [BX] [SI]

Friday, June 17, 2022 Department of Electronics and Communication Engineering, LBRCE 15
Addressing Modes for control transfer instructions

• Intersegment direct
• Example: JMP 5000H:2000H
• Intersegment indirect
• Example: JMP [2000H]
• Intrasegment direct
• Example: JMP SHORT LABEL
• Intrasegment indirect
• Example: JMP [BX]; Jump to effective address stored in BX

Friday, June 17, 2022 Department of Electronics and Communication Engineering, LBRCE 16
Instruction Set of 8086
• Data transfer Instructions
• Arithmetic& Logical Instructions
• Program control transfer Instructions
• Machine Control Instructions
• Shift / Rotate Instructions
• Flag Manipulation Instructions
• String Instructions

Friday, June 17, 2022 Department of Electronics and Communication Engineering, LBRCE 17
Data transfer Instructions
• MOV BX, 00F2H
• PUSH CX
• POP CX
• XCHG BX, CX
• IN AL, 0F8H
• OUT DX, AL
• XLAT
• LEA
• LDS/LES
• LAHF
• SAHF
• PUSHF
• POPF
Friday, June 17, 2022 Department of Electronics and Communication Engineering, LBRCE 18
Arithmetic& Logical Instructions
• ADD AX, BX
• ADC BX, CX
• INC DX
• SUB BX, AX
• SBB AX, CX
• DEC CX
• CMP BX, CX
• AAA
• AAS
• AAM
• DAA
• DAS
Friday, June 17, 2022 Department of Electronics and Communication Engineering, LBRCE 19
Arithmetic& Logical Instructions
• NEG AX
• MUL BX
• IMUL BL -Signed Multiplication
• CBW
• CWD
• DIV BX
• IDIV CX
• AND AX, BX
• OR BX, DX
• XOR BX, AX
• NOT AX
• TEST AX, BX
Friday, June 17, 2022 Department of Electronics and Communication Engineering, LBRCE 20
Program control transfer Instructions

• JZ / JE LABEL/ADDRESS
• JNZ / JNE
• JS
• JNS
• JO
• JNO
• JP / JPE
• JNP
• JB / JNAE / JC
• JNB / JAE / JNC
Friday, June 17, 2022 Department of Electronics and Communication Engineering, LBRCE 21
Program control transfer Instructions
• JBE / JNA
• JNBE / JA
• JL / JNGE
• JNL / JGE
• JLE
• JNLE / JG
• CALL ADDRESS
• RET
• IRET
• INTO
• INT N - N can be between 0 and 255

Friday, June 17, 2022 22


Machine Control Instructions
• WAIT
• HLT
• NOP
• ESC
• LOCK

Friday, June 17, 2022 Department of Electronics and Communication Engineering, LBRCE 23
Shift / Rotate Instructions
• SHL/SAL AX
• SHR BX, CL
• SAR AX, 01
• ROR AX
• ROL AX
• RCR AX
• RCL AX

Friday, June 17, 2022 Department of Electronics and Communication Engineering, LBRCE 24
Flag Manipulation Instructions
• CLC
• CMC
• STC
• CLD
• STD
• CLI
• STI

Friday, June 17, 2022 Department of Electronics and Communication Engineering, LBRCE 25
String Instructions
• REP EX: REP ADD AX, BX
• REPE / REPZ EX: REPE CMPSW
• REPNE / REPNZ
• MOVS / MOVSB / MOVSW
• CMPS / CMPSB / CMPSW
• SCAS / SCASB / SCASW EX: REPNZ SCASW
• LODS / LODSB / LODSW
• STOS / STOSB / STOSW
• LOOP
• LOOPE / LOOPZ
• LOOPNE / LOOPNZ

26
Assembler Directives

• There are some instructions in the assembly language program


which are not part of processor instruction set.
• These are the instructions to assembler, linker and loader.
• These are referred to as pseudo-operations or as assembler
directives.
• There are many specialized assembler directives. Let us see
some commonly used assembler directive in 8086 assembly
language programming .

27
Assembler Directives
ORG 5000
ASSUME CS: CODE, DS: DATA
DATA SEGMENT
---
DATA ENDS
CODE SEGMENT
START: ---
---
CODE ENDS
END START
28
Assembler Directives
• 1. ASSUME: It is used to tell the name of the logical segment.
• EX: ASSUME CS: CODE
• 2. DB -Define Byte: The DB directive is used to reserve byte or bytes of
memory locations in the available memory.
• EX: RANKS DB 01H,02H,03H,04H
• 3. DW -Define Word: 1 word (16-bit numbers)
• 4. DD -Define Double word: 2 words
• 5. DQ -Define Quad word: 4 words
• 6. DT -Define Ten Bytes: 10 bytes
• 7. END-End of Program: The END directive marks the end of an
assembly language program.
29
Assembler Directives
• 8. ENDP-End of Procedure:
• 9. ENDS-End of Segment:
• 10. EQU-Equate:
• 11. EVEN:
• 12. EXTRN:
• 13. GLOBAL
• 14. GROUP
• 15. INCLUDE
• 16. LABEL
• 17. NAME
• 18. OFFSET
30
Assembler Directives
• 19. ORG
• 20. PROC SMART_DIVIDE PROC FAR
• 21. PTR INC BYTE PTR[BX]
• 22. PUBLIC
• 23. SEGMENT
• 24. SHORT
• 25. TYPE

31
TUTORIAL

• Draw the Flags Register of 8086 and explain each flag with example.

• Develop an ALP to find the largest number.

• Develop an ALP to find the factorial of 6.

32
TUTORIAL

• Write an ALP to calculate the sum of squares of 5 natural numbers.

• Develop an ALP to find the number of Even and Odd numbers from
a given series.

• Develop an ALP to find the number of Positive and Negative


numbers from a given series.

33
End

34

You might also like