Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
58 views

MPMC Unit 2 Programming Part1

This document provides an overview of a course on instruction set and assembly language programming of the 8086 microprocessor. It discusses the instruction format, addressing modes, instruction set, assembler directives, and simple programs involving logical, branch, call, and other instructions. The syllabus covers instruction formats, addressing modes, and programming concepts like sorting, arithmetic expressions, and string manipulation. Textbooks and references for further reading are also provided.

Uploaded by

neha yarrapothu
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
58 views

MPMC Unit 2 Programming Part1

This document provides an overview of a course on instruction set and assembly language programming of the 8086 microprocessor. It discusses the instruction format, addressing modes, instruction set, assembler directives, and simple programs involving logical, branch, call, and other instructions. The syllabus covers instruction formats, addressing modes, and programming concepts like sorting, arithmetic expressions, and string manipulation. Textbooks and references for further reading are also provided.

Uploaded by

neha yarrapothu
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 14

Microprocessors and Microcontrollers

Unit II
Instruction Set and
Assembly Language Programming of 8086:
Part 1

B.Tech, ETM,
II Year, II Semester

N.Ramakrishna
Dept. of Electronics and Telematics
GNITS, Hyderabad
28 March 2022 MPMC - N.Ramakrishna Unit II Part 1 1
Syllabus
Unit II
Instruction Set and
Assembly Language Programming of 8086:
• Instruction formats
• Addressing modes
• Instruction set
• Assembler directives
• Macros
• Simple programs involving logical, branch and
call instructions, sorting,
evaluating arithmetic expressions,
string manipulations.

28 March 2022 MPMC - N.Ramakrishna Unit II Part 1 2


Instruction Format
Instructions
• Need opcode and operands
• Opcode – operation code
Specifies the operation to be performed
• Operand
- Data on which the opcode operates
• Example
opcode operand
Addition - needs two operands
Shift - needs one operand

28 March 2022 MPMC - N.Ramakrishna Unit II Part 1 3


Instruction Format
Memory organization – Quick review
• Data stored in byte
• Each byte location has an address
• Word (2 bytes) stored in two consecutive addresses
Example ADDRESS DATA
To store 34E6H 60088H E6H
60089H 34H
(Intel) Little Endian format – Lower byte in lower address
Upper byte in higher address
(Motorola) Big Endian - Upper byte in lower address
Lower byte in higher address
28 March 2022 MPMC - N.Ramakrishna Unit II Part 1 4
Addressing Modes
Addressing modes
• The way in which the operands are specified
in an assembly language instruction
• Example :
MOV destination, source
Assumptions
• Operands in registers, memory or in instruction
Both operands can not be in memory (for 8086)
• Two operands – one in memory, other in register
• Data types should match – byte or word

28 March 2022 MPMC - N.Ramakrishna Unit II Part 1 5


Addressing Modes
1. Register addressing
Both source and destination – registers
No memory access involved

Examples:
MOV AL, AH MOV SI, BX
MOV CH, BL MOV ES, AX

Are these correct?


MOV AX, BL
MOV BL, AX
28 March 2022 MPMC - N.Ramakrishna Unit II Part 1 6
Addressing Modes
2. Immediate addressing
Source – constant data, provided in instruction

Example:
MOV AL, 45H MOV BX, 34E3H
MOV CL, ‘Q’ MOV PRICE, 40H

Is this correct?
MOV DS, 2300H
(Segment registers are not allowed to be used)

28 March 2022 MPMC - N.Ramakrishna Unit II Part 1 7


Addressing Modes
3. Direct addressing
Source or destination – a memory address

Example:
MOV AX, [2345H] Offset in DS
MOV [1089H], AL How many bytes of data?

Also
MOV AX, PRICE
MOV COST, AL

28 March 2022 MPMC - N.Ramakrishna Unit II Part 1 8


Addressing Modes
4. Register Indirect addressing
Address of data held in register
Address registers allowed : BX, SI, DI
Effective address EA = {[BX]/[DI]/[SI]}
Example:
MOV AL, [BX]
MOV [SI], CL
MOV [DI], AX
 How many Bytes?
AL moved to address pointed by DI
AH moved to address pointed by DI+1
28 March 2022 MPMC - N.Ramakrishna Unit II Part 1 9
Addressing Modes
5. Register relative addressing
Number or displacement
is a part of effective address
Effective address EA = {[BX]/[DI]/[SI]/[BP]}
+ 8-bit or 16-bit displacement

Example:
MOV CL, 10[BX] or MOV CL, [BX+10]
MOV CL, [BX][10]
MOV CL, PRICE[BX]
PRICE defined earlier as 10

28 March 2022 MPMC - N.Ramakrishna Unit II Part 1 10


Addressing Modes
6. Based indexed mode
Base register and index register together
carry effective address
Example:
MOV AL, [BX][SI]
Effective Address EA = [BX]+[SI]
MOV [BX][DI], CX
 How many Bytes?

28 March 2022 MPMC - N.Ramakrishna Unit II Part 1 11


Addressing Modes
7. Relative Based Indexed mode
Effective address
= base register + index register + displacement

Example:
MOV DL, 5[BX][DI] ; EA = 5 + BX + DI
MOV 5[BP][SI], AX ; EA = 5 + BP + SI
MOV CL, COST[BX][SI] ;EA = COST + BX + SI

28 March 2022 MPMC - N.Ramakrishna Unit II Part 1 12


Text Books
TEXT BOOKS:
1. Advanced Microprocessors and Peripherals – A. K.
Ray and K.M. Bhurchandi, Tata-McGraw Hill, 2nd
edition 2006.
2. D. V. Hall, Microprocessors and Interfacing, Tata-
McGraw Hill, 2nd edition 2006.
3. Kenneth. J. Ayala, The 8051 microcontroller , 3rd
edition, Cengage learning, 2010
4. Microprocessors and Microcontrollers, Lyla B.Das,
Pearson, 2012

28 March 2022 MPMC - N.Ramakrishna Unit II Part 1 13


References
REFERENCES:
1. The 8051 Microcontrollers, Architecture and programming and
Applications -K.Uma Rao, Andhe Pallavi, , Pearson, 2009.
2. The 8051 Microcontoller and Embedded Systems Using
Assembly and C, Second Edition, Muhammad Ali Mazidi, Janice
Gillispie Mazidi, Rolin D. McKinlay, Prentice Hall
3. Micro Computer System 8086/8088 Family Architecture,
Programming and Design - Liu and GA Gibson,
Prentice Hall India, 2nd Ed.
4. Microcontrollers and application, Ajay. V. Deshmukh,
Tata-McGraw Hill, 2005
5. The 8085 Microprocessor: Architecture, programming and
Interfacing – K. Uday Kumar, B.S. Umashankar, 2008, Pearson

28 March 2022 MPMC - N.Ramakrishna Unit II Part 1 14

You might also like