SlideShare a Scribd company logo
MICROPROCESSOR
• Microprocessor is a semiconductor device consisting of electronic logic
circuits manufactured by using LSI or VLSI technique.
• Microprocessor is a programmable logic devices with registers, flip-
flops & timing elements.
– ALU
• Arithmetic operations
• Logical operations
– Register unit
– Control unit
Computer Languages
- Machine language
- Assembly language (Mnemonics, Assemblers)
- High-level language (Compilers, interpreters)
Architecture of Microprocessor
• The process of data manipulation and communication is determined
by the logic design of the microprocessor called the architecture.
• Function performed by the microprocessor
– Microprocessor- Initiated operations
• I/O Read, I/O Write, MR, MW
– Internal Data operations and registers
• Perform A & L operations
• Registers
• Flags
• PC, SP
– Peripherals/Externally Initiated operations
• Reset, Interrupt, Read, Hold
Instructions
– An instruction is a command to the microprocessor to perform a
given task on specified data.
– Types
• 1-byte instructions (MOV C,A CMA (complement)
• 2-byte instructions ( MVI A, data)
• 3-byte instructions (JMP 2010)
Operations
• Data transfer operations
• Arithmetic operations
• Logic operations
• Branch operations
Interfacing
Interfacing devices are semiconductor chips that are needed to
connect peripherals to the bus system.
Ex: Tri-state devices, Decoders, Encoders
8085 Microprocessor
Intel’s 8085 is an 8bit general purpose microprocessor capable of addressing
64k of memory
8085 pin out diagram
Signal classification
1. Address bus
2. Data/address bus
3. Control & Status signal
4. Power & Frequency signals
5. Interrupts & peripheral initiated signals
6. Serial I/O ports.
Functional Block Diagram of 8085
1. ALU
Flags :
S - Sign flag (if D7=1 –ive no. If D7=0 +ive no.)
Z – Zero flag (if result is 0 then Z is set)
AC – Auxiliary Carry flag (if D3 passed carry to D4 then AC is set)
P – Parity flag (after A & L if result has even no. of 1s then P is set)
CY – Carry flag ( A & L operations results in a carry the CY is set )
2. Timing & Control Unit
This unit synchronizes all the microprocessor operations with clock and
generates the control signals necessary for communication between
microprocessor and IO devices.
3. Instruction Register (IR) & Decoder
IR - When instruction is fetched from memory, it is loaded in the instruction
register.
Decoder – decodes the instruction and establishes the sequence of events
to follow.
4. Register Array
A - accumulator
B,C,D,E, H,L
W,Z – temporary registers (not accessible for user)
8086 Microprocessor
• Limitations of 8085
• Intel’s 8086 was the first 16-bit microprocessor launched in 1978.
Architecture of 8086:
8086 is divided into two units – Bus Interface Unit (BIU), Execution Unit (EU)
Execution Unit:
1. Control circuit – which directs internal operations.
2. Instruction Decoder – translates instructions fetched from memory into a
series of actions which the EU carries out.
3. ALU – Add, sub, increment, decrement, complement, shift binary numbers.
4. General Data Registers
AX = (AH+AL) Accumulator
BX - used as an offset storage for forming physical address
CX - default counter in case of string and loop instructions
DX – implicit operand or destination register in case of a few instruction
5. Flag Registers
A flag is a flip-flop that indicates some condition produced by the execution
of an instruction or controls certain operations of the EU.
A 16-bit flag register in the EU contains 9 active flags, 6 flags indicate some
condition produced by an instruction, 3 flags are control flags.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
O – Overflow Flag
D – Direction
I – Interrupt Flag
T – Trap Flag
S – Sign Flag
Z – Zero Flag
Ac – Auxiliary Carry Flag
P – Parity Flag
Cy – Carry Flag
X – Not used
X X X X O D I T S Z X Ac X P X Cy
6. Pointers and Index Registers
Pointers contain offset within the particular segments.
IP – Instruction Pointer register holds the 16-bit address or
offset of the next code byte within code segment .
20 bit address = offset of IP + Segment base address
in CS.
BP – Base Pointer contains Source Index (SI) register and
Destination Index (DI) register
SP – Stack Pointer register in the Execution Unit holds the
16-bit offset from the start of the segment to the
memory location where a word was most recently
stored on the stack (i.e top of stack).
SP,SI,DI – these 3 register are used for temporary storage
of data.
Bus Interface Unit:
Segment Registers
8086 has segmented memory. 1MB memory is
divided into 16 logical segments (16x64K)
CS – Code Segment register used for addressing a
memory location in the code segment of the memory
where the executable program is stored.
SS – Stack Segment register refers to stack segment of
stack data
DS – Data Segment register point to the data segment of
the memory, where the data is resided.
ES – Extra Segment register also refers to a segment
which essentially is another data segment of the
memory. (It also points to data segment).
Addressing Modes of 8086
The way in which an operand is specified is called its addressing
mode.
I. Data-related addressing modes
II. Branch addressing modes
I. Data-related addressing modes
1. Immediate addressing mode
The datum is either 8 bits or 16 bits long and is part of the instruction.
2. Direct addressing modes
The 16 bit effective address (EA) of the datum is part of the
instruction
3. Register addressing modes
The datum is in the register that is specified by the instruction.
4. Register Indirect
The effective address of the datum is in the base register BX or
an index register that is specified by the instruction.
5. Register Relative
The effective address is the sum of an 8 or 16 bit displacement
and the contents of a base register or an index register.
6. Based Indexed
the effective address is the sum of a base register and an index
register.
7. Relative Based Indexed
The effective address is the sum of an 8 or 16-bit displacement
and a based indexed address.
II. Branch Addressing Modes
1. Intrasegment Direct
The effective branch address is the sum of an 8- or 16-bit displacement and
the current contents of IP.
It may be used with either conditional or unconditional branching, but a
conditional branch instruction can have only an 8-bit displacement.
2. Intrasegment Indirect
The effective branch address is the contents of a register or memory location
that is accessed using any of the data-related addressing modes. This
mode is used only in Unconditional branch instructions.
3. Intersegment Direct
Replaces the contents of IP with part of the instruction and the contents of CS
with another part of the instruction.
The purpose of this mode is to provide a means of branching from one code
segment to another.
4. Intersegment Direct
Replaces the contents of IP and CS with the contents of two consecutive
words in memory that are referenced using any of the data-related addressing
modes except the immediate and register modes.
Assembler Directives
• An assembler is a program used to convert an assembly
language program into the equivalent machine code
modules which may further be converted to executable
codes.
• It decides the address of each label and substitutes the
values for each of the constant and variables.
It then forms the machine code for the mnemonics and
data in the assembly language program (ALP).
• The logical errors or other programming errors are not
found out by the assembler.
To know errors hints are required from the programmer.
• The hints are given to the assembler using some
predefined alphabetical strings called Assembler
Directives, which help the assembler to correctly
1. SEGMENT, ENDS Directives
The SEGMENT and ENDS directives are used to identify a
group of data items or a group of instructions that we want
to be put together in a particular segment.
A group of data statements or a group of instruction
statements contained between SEGMENT and ENDS
directives is called a logical segment.
ex: DATA_HERE SEGMENT
------ logical
------ segment
DATA_HERE ENDS
2. DB – Define Byte
DB Directive is used to reserve byte / bytes of memory
locations in the available memory.
3. DW – Define Word
DW is used to specify that the data is of type word (16-
bits).
4. DD – Define Double Word
DD is used to specify that the data is of type
double word (32-bits).
5. DQ – Define Quadword
This directive us used to direct the assembler to
reserve 4 words (8 bytes) of memory for specified
variable and may initialize it with the specified
values.
6. DT – Define Ten Bytes
The DT directive directs the assembler to reserve
10 bytes of memory for specified variable and
may initialize it with the specified values.
7. ASSUME – Assume Logical Segment Name
The ASSUME directive is used to inform the assembler, the names
of the logical segments to be assumed for different segments used
in the program.
The ASSUME statement is a must at the starting of each
assembly language program.
Ex: ASSUME CS:CODE
directs the assembler that the machine codes are available in a
segment named CODE, and hence the CS register is to be loaded
with address (segment) allotted by the operating system for the
label CODE, while loading.
8. END – END of Program
The END directive marks the end of an ALP.
In ALP, the subroutines are called procedures.
• ENDP – END of Procedure
The ENDP directive is used to indicate the end of a procedure.
Ex: PROCEDURE STAR
----
----
STAR ENDP
10. EVEN – Align on Even Memory Address
The EVEN directive updates the location counter to the next even
address.
Ex: EVEN
PROCEDURE ROOT
-----
----
ROOT ENDP
11. EQU – Equate
The directive EQU is used to assign a label with a value or a
symbol.
While assembling, whenever the assembler comes across the label ,
it substitutes the numerical value for that label and finds out the
equivalent code.
12. LABEL – Label
The Label directive is used to assign a name to current content of
the location counter.
13. EXTRN – External and PUBLIC : Public
The directive EXTRN informs the assembler that the names,
procedures and labels declared after this directive have already
been defined in some other assembly language modules.
While in the other module, where the names, procedures and
labels actually appear, they must be declared public, using the
PUBLIC directive.
Ex: MODULE1 SEGMENT
PUBLIC FACTORIAL FAR
MODULE1 ENDS
MODULE2 SEGMENT
EXTRN FACTORIAL FAR
MODULE2 ENDS
14. GROUP – Group the Related Segments
This directive is used to form logical groups of segments with
similar purpose or type.
The assembler passes an information to the linker/loader to form
the code such that the group declared segments or operands
must lie within a 64KB memory segment.
Ex: PROGRAM GROUP CODE, DATA, STACK
ASSUME CS:PROGRAM, DS:PROGRAM, SS:PROGRAM
15. LOCAL
The lables, variables, constants or procedures declared LOCAL in a
module are to be used only by that particular module.
Ex: LOCAL a,b,DATA, ARRAY
16. OFFSET – Offset of a Label
When the assembler comes across the OFFSET operator along with
a label, it first computes the 16-bit displacement of the particular
label, and replaces the string ‘OFFSET LABEL’ by the computed
displacement.
This operator is used with arrays, strings, labels and procedures to
decide their offsets in their default segments.
17. ORG – Origin
The ORG directive directs the assembler to start the memory
allotment for the particular segment, block or code from the
declared address in the ORG statement.
While starting the assembly process for a module, the assembler
initializes a location counter to keep track of the allotted addresses
for the module.
If an ORG statement is not written in the program, the location
counter is initialized to 0000.
18. PROC – Procedure
The PROC directive marks the start of a named
procedure in the statement.
Also, the types NEAR or FAR specify the type of
the procedure, i.e whether it is to be called by the
main program located within 64k of physical
memory or not.
19. FAR PTR
This directive indicates the assembler that the label
following FAR PTR is not available within the same
segment and the address of the label is of 32-bits i.e 2
bytes offset followed by 2 bytes segment address.
20. NEAR PTR
This directive indicates the assembler that the label
following NEAR PTR is in the same segment and
needs only 16-bit i.e 2 byte offset to address it.
Assembler Operators
Another type of hint which helps the assembler to assign a
particular constant with a label or initialize particular memory
locations or labels with constants is an operator.
1. PTR – Pointer
The PTR operator is used to declare the type of a label, variable
or memory operand. The operator PTR is prefixed by either
BYTE or WORD.
2. SEG – Segment of a Label
The SEG operator is used to decide the segment address of the
label, variable, or procedure and substitutes the segment base
address in place of “SEG” label.
3. SHORT
The SHORT operator indicates to the assembler that only one
byte is required to code the displacement for a jump i.e
displacement is within -128 to +127 bytes from the address of
the byte next to the jump opcode.
This method of specifying the jump address saves the memory.
4. TYPE
The TYPE operator directs the assembler to decide the data type
of the specified label and replaces the ‘TYPE’ label by the
decided data type.
Ex: MOV AX, TYPE STRING
moves the value 0002h in AX.
5. GLOBAL
The labels, variables, constants or procedures declared GLOBAL
may be used by other modules of the program.
Ex: ROUTINE PROC GLOBAL
6. ‘ + & - ‘ Operators
These operators represent arithmetic addition and subtraction
respectively and are typically used to add or subtract
displacement (8 or 16 bit) to base or index registers or stack or
base pointers.
Ex: MOV AL, [SI +2]
8086 Stack
• The Stack is a section of memory we set aside for storing
return address. And used to save the contents of registers for
the calling program while a procedure executes. It also used
to hold data or addresses that will be acted upon by a
procedure.
• 8086 contains stack segment (SS) register and stack pointer
(SP) register.
• SS reg. is used to hold the upper 16 bits of the starting
address we give to the stack segment. SP reg. is used to hold
the offset of the last word written on the stack.
• 8086 produces the physical address for a stack location by
adding the offset contained in the SP reg. to the stack
segment base address represented by the 16-bit number in
the SS reg.
• SP reg. is automatically decremented by 2 before a word is
written to the stack i.e. initialize the SP reg to point to the
top of the memory you set aside as a stack.
• If the CALL is to a procedure in the same code
segment then the CALL is NEAR, and the
Instruction Pointer (IP) contents will be saved on
the stack.
• A RET at the end of the procedure copies IP value
from the stack back to the IP to return execution to
the calling program.
• If the CALL is to a procedure in another code
segment, the CALL is FAR, and both the IP & CS
register contents will be saved on the stack.
• A RET instruction at the end of the procedure
copies these values from the stack back into the IP
& CS registers to return execution to the mainline
program.
Procedures
• Procedure is a group of instructions used at several
different points in a program.
Procedure name PROC arguments
----
----
RET
ENDP
• CALL instruction is used to call a particular
procedure
• RET instruction at the end of the procedure
returns execution to the next instruction
• CALL instruction executes, it automatically stores
the return address in the stack memory.
Passing parameters to procedure
1. Passing parameters in Registers
DATA SEGMENT
BCD_INPUT DB 20H
BIN_VALUE DB ?
DATA ENDS
CODE SEGMENT
---
MOV AL, BCD_INPUT ;Moving input into AL reg.
CALL BCD_BIN ; call procedure BCD_BIN
---
NOP
;Procedure to convert BCD to Binary no.
BCD_BIN PROC NEAR
----
---
RET
BCD_BIN ENDP
---
CODE ENDS
END
2. Passing parameters in General Memory
DATA SEGMENT
BCD_INPUT DB 20H
BIN_VALUE DB ?
DATA ENDS
CODE SEGMENT
---
CALL BCD_BIN ; call procedure BCD_BIN
---
NOP
;Procedure to convert BCD to Binary no.
BCD_BIN PROC NEAR
----
MOV AL, BCD_INPUT ;Load input from memory
------
MOV [DI], AL ; Store result in memory
RET
BCD_BIN ENDP
----
CODE ENDS
3. Passing Parameters using Pointers
DATA SEGMENT
BCD_INPUT DB 20H
BIN_VALUE DB ?
DATA ENDS
CODE SEGMENT
---
MOV SI, OFFSET BCD_INPUT ;create pointer to BCD
input
MOV DI, OFFSET BIN_VALUE ; Store result
CALL BCD_BIN ; call procedure BCD_BIN
---
NOP
;Procedure to convert BCD to Binary no.
BCD_BIN PROC NEAR
----
MOV AL, [SI] ;Load input from memory
------
MOV [DI], AL ; Store result in memory
----
RET
BCD_BIN ENDP
----
CODE ENDS
END
MACROS
• A macro is group if instructions we bracket and give a
name to at the start of our program. Each time we “call”
the macro in our program, the assembler will insert the
defined group of instructions in place of the “call”.
• Every time a macro name in the program, replace it
with the group of instructions defined as that macro at
the start of the program. This process is known as
expanding the macro or macro expansion.
• Using a macro avoids the overhead time involved in
calling, returning from a procedure.
• A disadvantage of generating in-line code each time a
macro is called is that this will make the program take
up more memory than using a procedure.
Defining a MACRO:
Macro_name MACRO dummy parameters
------
-----
ENDM
Ex:
Move_ASCII MACRO Number,Source,Destination
Mov CX,Number ; No. of characters to be moved in CX
LEA SI,Source ; Point SI at ASCII source
LEA DI,Destination ; Point DI at ASCII destination
CLD ; Autoincrement pointer after move
REP MOVSB ; Copy ASCII string to new location
ENDM
A macro may be defined in another macro or
a macro may be called from inside a macro. This type of
macro is called a nested macro.

More Related Content

What's hot

Assembler directives and basic steps ALP of 8086
Assembler directives and basic steps ALP of 8086Assembler directives and basic steps ALP of 8086
Assembler directives and basic steps ALP of 8086
Urvashi Singh
 
8085 instruction set
8085 instruction set8085 instruction set
Interfacing of io device to 8085
Interfacing of io device to 8085Interfacing of io device to 8085
Interfacing of io device to 8085
Nitin Ahire
 
8051 Microcontroller PPT's By Er. Swapnil Kaware
8051 Microcontroller PPT's By Er. Swapnil Kaware8051 Microcontroller PPT's By Er. Swapnil Kaware
8051 Microcontroller PPT's By Er. Swapnil KawareProf. Swapnil V. Kaware
 
Interrupts of 8086
Interrupts of 8086Interrupts of 8086
Interrupts of 8086
Albin Panakkal
 
Architecture of 8051
Architecture of 8051Architecture of 8051
Architecture of 8051
hello_priti
 
Minimum mode and Maximum mode Configuration in 8086
Minimum mode and Maximum mode Configuration in 8086Minimum mode and Maximum mode Configuration in 8086
Minimum mode and Maximum mode Configuration in 8086
Jismy .K.Jose
 
Addressing modes 8085
Addressing modes 8085Addressing modes 8085
Addressing modes 8085
ShivamSood22
 
Register Organisation of 8086 Microprocessor
Register Organisation of 8086 MicroprocessorRegister Organisation of 8086 Microprocessor
Register Organisation of 8086 MicroprocessorNikhil Kumar
 
Microprocessor 8086 instruction description
Microprocessor 8086 instruction descriptionMicroprocessor 8086 instruction description
Microprocessor 8086 instruction description
Dheeraj Suri
 
Adc interfacing
Adc interfacingAdc interfacing
Adc interfacing
Monica Gunjal
 
The 8051 microcontroler based embedded systems
The 8051 microcontroler based embedded systemsThe 8051 microcontroler based embedded systems
The 8051 microcontroler based embedded systems
manishpatel_79
 
Memory interfacing
Memory interfacingMemory interfacing
Memory interfacing
mahalakshmimalini
 
Instruction sets of 8086
Instruction sets of 8086Instruction sets of 8086
Instruction sets of 8086
Mahalakshmiv11
 
Intel 8051 - pin description
Intel 8051  - pin descriptionIntel 8051  - pin description
Intel 8051 - pin description
DEPARTMENT OF PHYSICS
 
Machine cycles
Machine cyclesMachine cycles
Machine cycles
WafaAbied
 
Logical, Shift, and Rotate Instruction
Logical, Shift, and Rotate InstructionLogical, Shift, and Rotate Instruction
Logical, Shift, and Rotate Instruction
Badrul Alam
 
Presentation on 8086 Microprocessor
Presentation  on   8086 MicroprocessorPresentation  on   8086 Microprocessor
Presentation on 8086 Microprocessor
Nahian Ahmed
 
8051 Microcontroller
8051 Microcontroller8051 Microcontroller
8051 Microcontroller
thokalpv
 

What's hot (20)

Assembler directives and basic steps ALP of 8086
Assembler directives and basic steps ALP of 8086Assembler directives and basic steps ALP of 8086
Assembler directives and basic steps ALP of 8086
 
8085 instruction set
8085 instruction set8085 instruction set
8085 instruction set
 
Interfacing of io device to 8085
Interfacing of io device to 8085Interfacing of io device to 8085
Interfacing of io device to 8085
 
8051 Microcontroller PPT's By Er. Swapnil Kaware
8051 Microcontroller PPT's By Er. Swapnil Kaware8051 Microcontroller PPT's By Er. Swapnil Kaware
8051 Microcontroller PPT's By Er. Swapnil Kaware
 
Interrupts of 8086
Interrupts of 8086Interrupts of 8086
Interrupts of 8086
 
Architecture of 8051
Architecture of 8051Architecture of 8051
Architecture of 8051
 
Minimum mode and Maximum mode Configuration in 8086
Minimum mode and Maximum mode Configuration in 8086Minimum mode and Maximum mode Configuration in 8086
Minimum mode and Maximum mode Configuration in 8086
 
Addressing modes 8085
Addressing modes 8085Addressing modes 8085
Addressing modes 8085
 
Register Organisation of 8086 Microprocessor
Register Organisation of 8086 MicroprocessorRegister Organisation of 8086 Microprocessor
Register Organisation of 8086 Microprocessor
 
Microprocessor 8086 instruction description
Microprocessor 8086 instruction descriptionMicroprocessor 8086 instruction description
Microprocessor 8086 instruction description
 
Adc interfacing
Adc interfacingAdc interfacing
Adc interfacing
 
The 8051 microcontroler based embedded systems
The 8051 microcontroler based embedded systemsThe 8051 microcontroler based embedded systems
The 8051 microcontroler based embedded systems
 
Memory interfacing
Memory interfacingMemory interfacing
Memory interfacing
 
Interfacing 8255
Interfacing 8255Interfacing 8255
Interfacing 8255
 
Instruction sets of 8086
Instruction sets of 8086Instruction sets of 8086
Instruction sets of 8086
 
Intel 8051 - pin description
Intel 8051  - pin descriptionIntel 8051  - pin description
Intel 8051 - pin description
 
Machine cycles
Machine cyclesMachine cycles
Machine cycles
 
Logical, Shift, and Rotate Instruction
Logical, Shift, and Rotate InstructionLogical, Shift, and Rotate Instruction
Logical, Shift, and Rotate Instruction
 
Presentation on 8086 Microprocessor
Presentation  on   8086 MicroprocessorPresentation  on   8086 Microprocessor
Presentation on 8086 Microprocessor
 
8051 Microcontroller
8051 Microcontroller8051 Microcontroller
8051 Microcontroller
 

Similar to microprocessor

viva q&a for mp lab
viva q&a for mp labviva q&a for mp lab
viva q&a for mp lab
g yugandhar srinivas
 
Internal architecture-of-8086
Internal architecture-of-8086Internal architecture-of-8086
Internal architecture-of-8086
Estiak Khan
 
8086 microprocessor
8086 microprocessor8086 microprocessor
8086 microprocessor
VEERA BOOPATHY E
 
Mpmc unit 1 notes
Mpmc unit 1 notesMpmc unit 1 notes
Mpmc unit 1 notes
pavihari
 
Module 1 8086
Module 1 8086Module 1 8086
Module 1 8086
Deepak John
 
EC 8691 Microprocessor and Microcontroller.pptx
EC 8691 Microprocessor and Microcontroller.pptxEC 8691 Microprocessor and Microcontroller.pptx
EC 8691 Microprocessor and Microcontroller.pptx
GobinathAECEJRF1101
 
Advanced micro -processor
Advanced micro -processorAdvanced micro -processor
Advanced micro -processor
Hinal Lunagariya
 
Micro overview
Micro overviewMicro overview
Micro overview
lamamokalled
 
EE8551 MPMC
EE8551  MPMCEE8551  MPMC
EE8551 MPMC
rmkceteee
 
Microprocessor 8086
Microprocessor 8086Microprocessor 8086
Microprocessor 8086
Aanjaney Singh Chauhan
 
Unit 1 MPMC
Unit 1 MPMCUnit 1 MPMC
Unit 1 MPMC
tamilnesaner
 
Assembly language programming(unit 4)
Assembly language programming(unit 4)Assembly language programming(unit 4)
Assembly language programming(unit 4)Ashim Saha
 
UNIT 1.pptx
UNIT 1.pptxUNIT 1.pptx
UNIT 1.pptx
srinath594128
 
Bt0068
Bt0068Bt0068
Bt0068
Simpaly Jha
 
UNIT 1.pptx
UNIT 1.pptxUNIT 1.pptx
UNIT 1.pptx
BASKARS53
 
Introduction to microprocessor
Introduction to microprocessorIntroduction to microprocessor
Introduction to microprocessor
RamaPrabha24
 
Intel 8086
Intel 8086 Intel 8086
Intel 8086
Manoj VNV
 
Pdemodule 4
Pdemodule 4Pdemodule 4
Pdemodule 4
neerajtcr1990
 
Amp
AmpAmp

Similar to microprocessor (20)

viva q&a for mp lab
viva q&a for mp labviva q&a for mp lab
viva q&a for mp lab
 
Internal architecture-of-8086
Internal architecture-of-8086Internal architecture-of-8086
Internal architecture-of-8086
 
8086 microprocessor
8086 microprocessor8086 microprocessor
8086 microprocessor
 
Mpmc unit 1 notes
Mpmc unit 1 notesMpmc unit 1 notes
Mpmc unit 1 notes
 
Module 1 8086
Module 1 8086Module 1 8086
Module 1 8086
 
EC 8691 Microprocessor and Microcontroller.pptx
EC 8691 Microprocessor and Microcontroller.pptxEC 8691 Microprocessor and Microcontroller.pptx
EC 8691 Microprocessor and Microcontroller.pptx
 
Advanced micro -processor
Advanced micro -processorAdvanced micro -processor
Advanced micro -processor
 
Micro overview
Micro overviewMicro overview
Micro overview
 
EE8551 MPMC
EE8551  MPMCEE8551  MPMC
EE8551 MPMC
 
Microprocessor 8086
Microprocessor 8086Microprocessor 8086
Microprocessor 8086
 
Unit 1 MPMC
Unit 1 MPMCUnit 1 MPMC
Unit 1 MPMC
 
Assembly language programming(unit 4)
Assembly language programming(unit 4)Assembly language programming(unit 4)
Assembly language programming(unit 4)
 
UNIT 1.pptx
UNIT 1.pptxUNIT 1.pptx
UNIT 1.pptx
 
Bt0068
Bt0068Bt0068
Bt0068
 
UNIT 1.pptx
UNIT 1.pptxUNIT 1.pptx
UNIT 1.pptx
 
Bc0040
Bc0040Bc0040
Bc0040
 
Introduction to microprocessor
Introduction to microprocessorIntroduction to microprocessor
Introduction to microprocessor
 
Intel 8086
Intel 8086 Intel 8086
Intel 8086
 
Pdemodule 4
Pdemodule 4Pdemodule 4
Pdemodule 4
 
Amp
AmpAmp
Amp
 

More from ATTO RATHORE

8085-microprocessor
8085-microprocessor8085-microprocessor
8085-microprocessor
ATTO RATHORE
 
8085-microprocessor
8085-microprocessor8085-microprocessor
8085-microprocessor
ATTO RATHORE
 
microprocessor
   microprocessor   microprocessor
microprocessor
ATTO RATHORE
 
bel-ppt-pptx
bel-ppt-pptxbel-ppt-pptx
bel-ppt-pptx
ATTO RATHORE
 
bharat-electronics-limited
bharat-electronics-limitedbharat-electronics-limited
bharat-electronics-limited
ATTO RATHORE
 
bel-radar
bel-radarbel-radar
bel-radar
ATTO RATHORE
 
bharat-electonics-limited
 bharat-electonics-limited bharat-electonics-limited
bharat-electonics-limited
ATTO RATHORE
 
industrial-training-in-bharat-electronics-limited
 industrial-training-in-bharat-electronics-limited industrial-training-in-bharat-electronics-limited
industrial-training-in-bharat-electronics-limited
ATTO RATHORE
 
bharat-electronics-limited-ppt
bharat-electronics-limited-pptbharat-electronics-limited-ppt
bharat-electronics-limited-ppt
ATTO RATHORE
 
bharat-eectronics-limited-a-study-on-working-of-different-department
bharat-eectronics-limited-a-study-on-working-of-different-departmentbharat-eectronics-limited-a-study-on-working-of-different-department
bharat-eectronics-limited-a-study-on-working-of-different-department
ATTO RATHORE
 
basic electronics
basic    electronicsbasic    electronics
basic electronics
ATTO RATHORE
 
basic electronics
 basic   electronics basic   electronics
basic electronics
ATTO RATHORE
 
basic electronics
basic   electronicsbasic   electronics
basic electronics
ATTO RATHORE
 
basic electronics
basic  electronicsbasic  electronics
basic electronics
ATTO RATHORE
 
basic-analog-electronics
basic-analog-electronicsbasic-analog-electronics
basic-analog-electronics
ATTO RATHORE
 
basic electronics
basic electronicsbasic electronics
basic electronics
ATTO RATHORE
 
basic-electronics
basic-electronicsbasic-electronics
basic-electronics
ATTO RATHORE
 
basic-electronics
basic-electronicsbasic-electronics
basic-electronics
ATTO RATHORE
 
transmission-line-and-waveguide-ppt
transmission-line-and-waveguide-ppttransmission-line-and-waveguide-ppt
transmission-line-and-waveguide-ppt
ATTO RATHORE
 
waveguide-1
waveguide-1waveguide-1
waveguide-1
ATTO RATHORE
 

More from ATTO RATHORE (20)

8085-microprocessor
8085-microprocessor8085-microprocessor
8085-microprocessor
 
8085-microprocessor
8085-microprocessor8085-microprocessor
8085-microprocessor
 
microprocessor
   microprocessor   microprocessor
microprocessor
 
bel-ppt-pptx
bel-ppt-pptxbel-ppt-pptx
bel-ppt-pptx
 
bharat-electronics-limited
bharat-electronics-limitedbharat-electronics-limited
bharat-electronics-limited
 
bel-radar
bel-radarbel-radar
bel-radar
 
bharat-electonics-limited
 bharat-electonics-limited bharat-electonics-limited
bharat-electonics-limited
 
industrial-training-in-bharat-electronics-limited
 industrial-training-in-bharat-electronics-limited industrial-training-in-bharat-electronics-limited
industrial-training-in-bharat-electronics-limited
 
bharat-electronics-limited-ppt
bharat-electronics-limited-pptbharat-electronics-limited-ppt
bharat-electronics-limited-ppt
 
bharat-eectronics-limited-a-study-on-working-of-different-department
bharat-eectronics-limited-a-study-on-working-of-different-departmentbharat-eectronics-limited-a-study-on-working-of-different-department
bharat-eectronics-limited-a-study-on-working-of-different-department
 
basic electronics
basic    electronicsbasic    electronics
basic electronics
 
basic electronics
 basic   electronics basic   electronics
basic electronics
 
basic electronics
basic   electronicsbasic   electronics
basic electronics
 
basic electronics
basic  electronicsbasic  electronics
basic electronics
 
basic-analog-electronics
basic-analog-electronicsbasic-analog-electronics
basic-analog-electronics
 
basic electronics
basic electronicsbasic electronics
basic electronics
 
basic-electronics
basic-electronicsbasic-electronics
basic-electronics
 
basic-electronics
basic-electronicsbasic-electronics
basic-electronics
 
transmission-line-and-waveguide-ppt
transmission-line-and-waveguide-ppttransmission-line-and-waveguide-ppt
transmission-line-and-waveguide-ppt
 
waveguide-1
waveguide-1waveguide-1
waveguide-1
 

Recently uploaded

J.Yang, ICLR 2024, MLILAB, KAIST AI.pdf
J.Yang,  ICLR 2024, MLILAB, KAIST AI.pdfJ.Yang,  ICLR 2024, MLILAB, KAIST AI.pdf
J.Yang, ICLR 2024, MLILAB, KAIST AI.pdf
MLILAB
 
CME397 Surface Engineering- Professional Elective
CME397 Surface Engineering- Professional ElectiveCME397 Surface Engineering- Professional Elective
CME397 Surface Engineering- Professional Elective
karthi keyan
 
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdfAKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
SamSarthak3
 
Final project report on grocery store management system..pdf
Final project report on grocery store management system..pdfFinal project report on grocery store management system..pdf
Final project report on grocery store management system..pdf
Kamal Acharya
 
MCQ Soil mechanics questions (Soil shear strength).pdf
MCQ Soil mechanics questions (Soil shear strength).pdfMCQ Soil mechanics questions (Soil shear strength).pdf
MCQ Soil mechanics questions (Soil shear strength).pdf
Osamah Alsalih
 
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&BDesign and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
Sreedhar Chowdam
 
TECHNICAL TRAINING MANUAL GENERAL FAMILIARIZATION COURSE
TECHNICAL TRAINING MANUAL   GENERAL FAMILIARIZATION COURSETECHNICAL TRAINING MANUAL   GENERAL FAMILIARIZATION COURSE
TECHNICAL TRAINING MANUAL GENERAL FAMILIARIZATION COURSE
DuvanRamosGarzon1
 
weather web application report.pdf
weather web application report.pdfweather web application report.pdf
weather web application report.pdf
Pratik Pawar
 
Cosmetic shop management system project report.pdf
Cosmetic shop management system project report.pdfCosmetic shop management system project report.pdf
Cosmetic shop management system project report.pdf
Kamal Acharya
 
Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...
Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...
Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...
AJAYKUMARPUND1
 
ethical hacking-mobile hacking methods.ppt
ethical hacking-mobile hacking methods.pptethical hacking-mobile hacking methods.ppt
ethical hacking-mobile hacking methods.ppt
Jayaprasanna4
 
addressing modes in computer architecture
addressing modes  in computer architectureaddressing modes  in computer architecture
addressing modes in computer architecture
ShahidSultan24
 
Courier management system project report.pdf
Courier management system project report.pdfCourier management system project report.pdf
Courier management system project report.pdf
Kamal Acharya
 
HYDROPOWER - Hydroelectric power generation
HYDROPOWER - Hydroelectric power generationHYDROPOWER - Hydroelectric power generation
HYDROPOWER - Hydroelectric power generation
Robbie Edward Sayers
 
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
Amil Baba Dawood bangali
 
Standard Reomte Control Interface - Neometrix
Standard Reomte Control Interface - NeometrixStandard Reomte Control Interface - Neometrix
Standard Reomte Control Interface - Neometrix
Neometrix_Engineering_Pvt_Ltd
 
Democratizing Fuzzing at Scale by Abhishek Arya
Democratizing Fuzzing at Scale by Abhishek AryaDemocratizing Fuzzing at Scale by Abhishek Arya
Democratizing Fuzzing at Scale by Abhishek Arya
abh.arya
 
Railway Signalling Principles Edition 3.pdf
Railway Signalling Principles Edition 3.pdfRailway Signalling Principles Edition 3.pdf
Railway Signalling Principles Edition 3.pdf
TeeVichai
 
在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样
在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样
在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样
obonagu
 
Forklift Classes Overview by Intella Parts
Forklift Classes Overview by Intella PartsForklift Classes Overview by Intella Parts
Forklift Classes Overview by Intella Parts
Intella Parts
 

Recently uploaded (20)

J.Yang, ICLR 2024, MLILAB, KAIST AI.pdf
J.Yang,  ICLR 2024, MLILAB, KAIST AI.pdfJ.Yang,  ICLR 2024, MLILAB, KAIST AI.pdf
J.Yang, ICLR 2024, MLILAB, KAIST AI.pdf
 
CME397 Surface Engineering- Professional Elective
CME397 Surface Engineering- Professional ElectiveCME397 Surface Engineering- Professional Elective
CME397 Surface Engineering- Professional Elective
 
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdfAKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
 
Final project report on grocery store management system..pdf
Final project report on grocery store management system..pdfFinal project report on grocery store management system..pdf
Final project report on grocery store management system..pdf
 
MCQ Soil mechanics questions (Soil shear strength).pdf
MCQ Soil mechanics questions (Soil shear strength).pdfMCQ Soil mechanics questions (Soil shear strength).pdf
MCQ Soil mechanics questions (Soil shear strength).pdf
 
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&BDesign and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
 
TECHNICAL TRAINING MANUAL GENERAL FAMILIARIZATION COURSE
TECHNICAL TRAINING MANUAL   GENERAL FAMILIARIZATION COURSETECHNICAL TRAINING MANUAL   GENERAL FAMILIARIZATION COURSE
TECHNICAL TRAINING MANUAL GENERAL FAMILIARIZATION COURSE
 
weather web application report.pdf
weather web application report.pdfweather web application report.pdf
weather web application report.pdf
 
Cosmetic shop management system project report.pdf
Cosmetic shop management system project report.pdfCosmetic shop management system project report.pdf
Cosmetic shop management system project report.pdf
 
Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...
Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...
Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...
 
ethical hacking-mobile hacking methods.ppt
ethical hacking-mobile hacking methods.pptethical hacking-mobile hacking methods.ppt
ethical hacking-mobile hacking methods.ppt
 
addressing modes in computer architecture
addressing modes  in computer architectureaddressing modes  in computer architecture
addressing modes in computer architecture
 
Courier management system project report.pdf
Courier management system project report.pdfCourier management system project report.pdf
Courier management system project report.pdf
 
HYDROPOWER - Hydroelectric power generation
HYDROPOWER - Hydroelectric power generationHYDROPOWER - Hydroelectric power generation
HYDROPOWER - Hydroelectric power generation
 
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
 
Standard Reomte Control Interface - Neometrix
Standard Reomte Control Interface - NeometrixStandard Reomte Control Interface - Neometrix
Standard Reomte Control Interface - Neometrix
 
Democratizing Fuzzing at Scale by Abhishek Arya
Democratizing Fuzzing at Scale by Abhishek AryaDemocratizing Fuzzing at Scale by Abhishek Arya
Democratizing Fuzzing at Scale by Abhishek Arya
 
Railway Signalling Principles Edition 3.pdf
Railway Signalling Principles Edition 3.pdfRailway Signalling Principles Edition 3.pdf
Railway Signalling Principles Edition 3.pdf
 
在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样
在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样
在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样
 
Forklift Classes Overview by Intella Parts
Forklift Classes Overview by Intella PartsForklift Classes Overview by Intella Parts
Forklift Classes Overview by Intella Parts
 

microprocessor

  • 1. MICROPROCESSOR • Microprocessor is a semiconductor device consisting of electronic logic circuits manufactured by using LSI or VLSI technique. • Microprocessor is a programmable logic devices with registers, flip- flops & timing elements. – ALU • Arithmetic operations • Logical operations – Register unit – Control unit Computer Languages - Machine language - Assembly language (Mnemonics, Assemblers) - High-level language (Compilers, interpreters)
  • 2. Architecture of Microprocessor • The process of data manipulation and communication is determined by the logic design of the microprocessor called the architecture. • Function performed by the microprocessor – Microprocessor- Initiated operations • I/O Read, I/O Write, MR, MW – Internal Data operations and registers • Perform A & L operations • Registers • Flags • PC, SP – Peripherals/Externally Initiated operations • Reset, Interrupt, Read, Hold
  • 3. Instructions – An instruction is a command to the microprocessor to perform a given task on specified data. – Types • 1-byte instructions (MOV C,A CMA (complement) • 2-byte instructions ( MVI A, data) • 3-byte instructions (JMP 2010) Operations • Data transfer operations • Arithmetic operations • Logic operations • Branch operations Interfacing Interfacing devices are semiconductor chips that are needed to connect peripherals to the bus system. Ex: Tri-state devices, Decoders, Encoders
  • 4. 8085 Microprocessor Intel’s 8085 is an 8bit general purpose microprocessor capable of addressing 64k of memory 8085 pin out diagram Signal classification 1. Address bus 2. Data/address bus 3. Control & Status signal 4. Power & Frequency signals 5. Interrupts & peripheral initiated signals 6. Serial I/O ports. Functional Block Diagram of 8085 1. ALU Flags : S - Sign flag (if D7=1 –ive no. If D7=0 +ive no.) Z – Zero flag (if result is 0 then Z is set) AC – Auxiliary Carry flag (if D3 passed carry to D4 then AC is set) P – Parity flag (after A & L if result has even no. of 1s then P is set) CY – Carry flag ( A & L operations results in a carry the CY is set )
  • 5. 2. Timing & Control Unit This unit synchronizes all the microprocessor operations with clock and generates the control signals necessary for communication between microprocessor and IO devices. 3. Instruction Register (IR) & Decoder IR - When instruction is fetched from memory, it is loaded in the instruction register. Decoder – decodes the instruction and establishes the sequence of events to follow. 4. Register Array A - accumulator B,C,D,E, H,L W,Z – temporary registers (not accessible for user)
  • 6. 8086 Microprocessor • Limitations of 8085 • Intel’s 8086 was the first 16-bit microprocessor launched in 1978. Architecture of 8086: 8086 is divided into two units – Bus Interface Unit (BIU), Execution Unit (EU) Execution Unit: 1. Control circuit – which directs internal operations. 2. Instruction Decoder – translates instructions fetched from memory into a series of actions which the EU carries out. 3. ALU – Add, sub, increment, decrement, complement, shift binary numbers. 4. General Data Registers AX = (AH+AL) Accumulator BX - used as an offset storage for forming physical address CX - default counter in case of string and loop instructions DX – implicit operand or destination register in case of a few instruction
  • 7. 5. Flag Registers A flag is a flip-flop that indicates some condition produced by the execution of an instruction or controls certain operations of the EU. A 16-bit flag register in the EU contains 9 active flags, 6 flags indicate some condition produced by an instruction, 3 flags are control flags. 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 O – Overflow Flag D – Direction I – Interrupt Flag T – Trap Flag S – Sign Flag Z – Zero Flag Ac – Auxiliary Carry Flag P – Parity Flag Cy – Carry Flag X – Not used X X X X O D I T S Z X Ac X P X Cy
  • 8. 6. Pointers and Index Registers Pointers contain offset within the particular segments. IP – Instruction Pointer register holds the 16-bit address or offset of the next code byte within code segment . 20 bit address = offset of IP + Segment base address in CS. BP – Base Pointer contains Source Index (SI) register and Destination Index (DI) register SP – Stack Pointer register in the Execution Unit holds the 16-bit offset from the start of the segment to the memory location where a word was most recently stored on the stack (i.e top of stack). SP,SI,DI – these 3 register are used for temporary storage of data.
  • 9. Bus Interface Unit: Segment Registers 8086 has segmented memory. 1MB memory is divided into 16 logical segments (16x64K) CS – Code Segment register used for addressing a memory location in the code segment of the memory where the executable program is stored. SS – Stack Segment register refers to stack segment of stack data DS – Data Segment register point to the data segment of the memory, where the data is resided. ES – Extra Segment register also refers to a segment which essentially is another data segment of the memory. (It also points to data segment).
  • 10. Addressing Modes of 8086 The way in which an operand is specified is called its addressing mode. I. Data-related addressing modes II. Branch addressing modes I. Data-related addressing modes 1. Immediate addressing mode The datum is either 8 bits or 16 bits long and is part of the instruction. 2. Direct addressing modes The 16 bit effective address (EA) of the datum is part of the instruction 3. Register addressing modes The datum is in the register that is specified by the instruction.
  • 11. 4. Register Indirect The effective address of the datum is in the base register BX or an index register that is specified by the instruction. 5. Register Relative The effective address is the sum of an 8 or 16 bit displacement and the contents of a base register or an index register. 6. Based Indexed the effective address is the sum of a base register and an index register. 7. Relative Based Indexed The effective address is the sum of an 8 or 16-bit displacement and a based indexed address.
  • 12. II. Branch Addressing Modes 1. Intrasegment Direct The effective branch address is the sum of an 8- or 16-bit displacement and the current contents of IP. It may be used with either conditional or unconditional branching, but a conditional branch instruction can have only an 8-bit displacement. 2. Intrasegment Indirect The effective branch address is the contents of a register or memory location that is accessed using any of the data-related addressing modes. This mode is used only in Unconditional branch instructions. 3. Intersegment Direct Replaces the contents of IP with part of the instruction and the contents of CS with another part of the instruction. The purpose of this mode is to provide a means of branching from one code segment to another. 4. Intersegment Direct Replaces the contents of IP and CS with the contents of two consecutive words in memory that are referenced using any of the data-related addressing modes except the immediate and register modes.
  • 13. Assembler Directives • An assembler is a program used to convert an assembly language program into the equivalent machine code modules which may further be converted to executable codes. • It decides the address of each label and substitutes the values for each of the constant and variables. It then forms the machine code for the mnemonics and data in the assembly language program (ALP). • The logical errors or other programming errors are not found out by the assembler. To know errors hints are required from the programmer. • The hints are given to the assembler using some predefined alphabetical strings called Assembler Directives, which help the assembler to correctly
  • 14. 1. SEGMENT, ENDS Directives The SEGMENT and ENDS directives are used to identify a group of data items or a group of instructions that we want to be put together in a particular segment. A group of data statements or a group of instruction statements contained between SEGMENT and ENDS directives is called a logical segment. ex: DATA_HERE SEGMENT ------ logical ------ segment DATA_HERE ENDS 2. DB – Define Byte DB Directive is used to reserve byte / bytes of memory locations in the available memory. 3. DW – Define Word DW is used to specify that the data is of type word (16- bits).
  • 15. 4. DD – Define Double Word DD is used to specify that the data is of type double word (32-bits). 5. DQ – Define Quadword This directive us used to direct the assembler to reserve 4 words (8 bytes) of memory for specified variable and may initialize it with the specified values. 6. DT – Define Ten Bytes The DT directive directs the assembler to reserve 10 bytes of memory for specified variable and may initialize it with the specified values.
  • 16. 7. ASSUME – Assume Logical Segment Name The ASSUME directive is used to inform the assembler, the names of the logical segments to be assumed for different segments used in the program. The ASSUME statement is a must at the starting of each assembly language program. Ex: ASSUME CS:CODE directs the assembler that the machine codes are available in a segment named CODE, and hence the CS register is to be loaded with address (segment) allotted by the operating system for the label CODE, while loading. 8. END – END of Program The END directive marks the end of an ALP. In ALP, the subroutines are called procedures. • ENDP – END of Procedure The ENDP directive is used to indicate the end of a procedure. Ex: PROCEDURE STAR ---- ---- STAR ENDP
  • 17. 10. EVEN – Align on Even Memory Address The EVEN directive updates the location counter to the next even address. Ex: EVEN PROCEDURE ROOT ----- ---- ROOT ENDP 11. EQU – Equate The directive EQU is used to assign a label with a value or a symbol. While assembling, whenever the assembler comes across the label , it substitutes the numerical value for that label and finds out the equivalent code. 12. LABEL – Label The Label directive is used to assign a name to current content of the location counter.
  • 18. 13. EXTRN – External and PUBLIC : Public The directive EXTRN informs the assembler that the names, procedures and labels declared after this directive have already been defined in some other assembly language modules. While in the other module, where the names, procedures and labels actually appear, they must be declared public, using the PUBLIC directive. Ex: MODULE1 SEGMENT PUBLIC FACTORIAL FAR MODULE1 ENDS MODULE2 SEGMENT EXTRN FACTORIAL FAR MODULE2 ENDS 14. GROUP – Group the Related Segments This directive is used to form logical groups of segments with similar purpose or type. The assembler passes an information to the linker/loader to form the code such that the group declared segments or operands must lie within a 64KB memory segment. Ex: PROGRAM GROUP CODE, DATA, STACK ASSUME CS:PROGRAM, DS:PROGRAM, SS:PROGRAM
  • 19. 15. LOCAL The lables, variables, constants or procedures declared LOCAL in a module are to be used only by that particular module. Ex: LOCAL a,b,DATA, ARRAY 16. OFFSET – Offset of a Label When the assembler comes across the OFFSET operator along with a label, it first computes the 16-bit displacement of the particular label, and replaces the string ‘OFFSET LABEL’ by the computed displacement. This operator is used with arrays, strings, labels and procedures to decide their offsets in their default segments. 17. ORG – Origin The ORG directive directs the assembler to start the memory allotment for the particular segment, block or code from the declared address in the ORG statement. While starting the assembly process for a module, the assembler initializes a location counter to keep track of the allotted addresses for the module. If an ORG statement is not written in the program, the location counter is initialized to 0000.
  • 20. 18. PROC – Procedure The PROC directive marks the start of a named procedure in the statement. Also, the types NEAR or FAR specify the type of the procedure, i.e whether it is to be called by the main program located within 64k of physical memory or not. 19. FAR PTR This directive indicates the assembler that the label following FAR PTR is not available within the same segment and the address of the label is of 32-bits i.e 2 bytes offset followed by 2 bytes segment address. 20. NEAR PTR This directive indicates the assembler that the label following NEAR PTR is in the same segment and needs only 16-bit i.e 2 byte offset to address it.
  • 21. Assembler Operators Another type of hint which helps the assembler to assign a particular constant with a label or initialize particular memory locations or labels with constants is an operator. 1. PTR – Pointer The PTR operator is used to declare the type of a label, variable or memory operand. The operator PTR is prefixed by either BYTE or WORD. 2. SEG – Segment of a Label The SEG operator is used to decide the segment address of the label, variable, or procedure and substitutes the segment base address in place of “SEG” label. 3. SHORT The SHORT operator indicates to the assembler that only one byte is required to code the displacement for a jump i.e displacement is within -128 to +127 bytes from the address of the byte next to the jump opcode. This method of specifying the jump address saves the memory.
  • 22. 4. TYPE The TYPE operator directs the assembler to decide the data type of the specified label and replaces the ‘TYPE’ label by the decided data type. Ex: MOV AX, TYPE STRING moves the value 0002h in AX. 5. GLOBAL The labels, variables, constants or procedures declared GLOBAL may be used by other modules of the program. Ex: ROUTINE PROC GLOBAL 6. ‘ + & - ‘ Operators These operators represent arithmetic addition and subtraction respectively and are typically used to add or subtract displacement (8 or 16 bit) to base or index registers or stack or base pointers. Ex: MOV AL, [SI +2]
  • 23. 8086 Stack • The Stack is a section of memory we set aside for storing return address. And used to save the contents of registers for the calling program while a procedure executes. It also used to hold data or addresses that will be acted upon by a procedure. • 8086 contains stack segment (SS) register and stack pointer (SP) register. • SS reg. is used to hold the upper 16 bits of the starting address we give to the stack segment. SP reg. is used to hold the offset of the last word written on the stack. • 8086 produces the physical address for a stack location by adding the offset contained in the SP reg. to the stack segment base address represented by the 16-bit number in the SS reg. • SP reg. is automatically decremented by 2 before a word is written to the stack i.e. initialize the SP reg to point to the top of the memory you set aside as a stack.
  • 24. • If the CALL is to a procedure in the same code segment then the CALL is NEAR, and the Instruction Pointer (IP) contents will be saved on the stack. • A RET at the end of the procedure copies IP value from the stack back to the IP to return execution to the calling program. • If the CALL is to a procedure in another code segment, the CALL is FAR, and both the IP & CS register contents will be saved on the stack. • A RET instruction at the end of the procedure copies these values from the stack back into the IP & CS registers to return execution to the mainline program.
  • 25. Procedures • Procedure is a group of instructions used at several different points in a program. Procedure name PROC arguments ---- ---- RET ENDP • CALL instruction is used to call a particular procedure • RET instruction at the end of the procedure returns execution to the next instruction • CALL instruction executes, it automatically stores the return address in the stack memory.
  • 26. Passing parameters to procedure 1. Passing parameters in Registers DATA SEGMENT BCD_INPUT DB 20H BIN_VALUE DB ? DATA ENDS CODE SEGMENT --- MOV AL, BCD_INPUT ;Moving input into AL reg. CALL BCD_BIN ; call procedure BCD_BIN --- NOP ;Procedure to convert BCD to Binary no. BCD_BIN PROC NEAR ---- --- RET BCD_BIN ENDP --- CODE ENDS END
  • 27. 2. Passing parameters in General Memory DATA SEGMENT BCD_INPUT DB 20H BIN_VALUE DB ? DATA ENDS CODE SEGMENT --- CALL BCD_BIN ; call procedure BCD_BIN --- NOP ;Procedure to convert BCD to Binary no. BCD_BIN PROC NEAR ---- MOV AL, BCD_INPUT ;Load input from memory ------ MOV [DI], AL ; Store result in memory RET BCD_BIN ENDP ---- CODE ENDS
  • 28. 3. Passing Parameters using Pointers DATA SEGMENT BCD_INPUT DB 20H BIN_VALUE DB ? DATA ENDS CODE SEGMENT --- MOV SI, OFFSET BCD_INPUT ;create pointer to BCD input MOV DI, OFFSET BIN_VALUE ; Store result CALL BCD_BIN ; call procedure BCD_BIN --- NOP
  • 29. ;Procedure to convert BCD to Binary no. BCD_BIN PROC NEAR ---- MOV AL, [SI] ;Load input from memory ------ MOV [DI], AL ; Store result in memory ---- RET BCD_BIN ENDP ---- CODE ENDS END
  • 30. MACROS • A macro is group if instructions we bracket and give a name to at the start of our program. Each time we “call” the macro in our program, the assembler will insert the defined group of instructions in place of the “call”. • Every time a macro name in the program, replace it with the group of instructions defined as that macro at the start of the program. This process is known as expanding the macro or macro expansion. • Using a macro avoids the overhead time involved in calling, returning from a procedure. • A disadvantage of generating in-line code each time a macro is called is that this will make the program take up more memory than using a procedure.
  • 31. Defining a MACRO: Macro_name MACRO dummy parameters ------ ----- ENDM Ex: Move_ASCII MACRO Number,Source,Destination Mov CX,Number ; No. of characters to be moved in CX LEA SI,Source ; Point SI at ASCII source LEA DI,Destination ; Point DI at ASCII destination CLD ; Autoincrement pointer after move REP MOVSB ; Copy ASCII string to new location ENDM A macro may be defined in another macro or a macro may be called from inside a macro. This type of macro is called a nested macro.