Вы находитесь на странице: 1из 6

INTRODUCTION TO MICROPROCESSOR, UNIT 3

ER.SARBESH CHAUDHARY

UNIT 3
ASSEMBLY LANGUAGE PROGRAMMING FOR 8085
8085 Microprocessor pins description
Figure below shows the functional pin diagram of 8085 microprocessor. Intel 8085 contains 40
pins as shown in figure. Functions of each pin are described below.

DEPARTMENT OF ELECTRONICS, MMP

INTRODUCTION TO MICROPROCESSOR, UNIT 3

ER.SARBESH CHAUDHARY

X1 & x2: These are input pin 1 & 2. These are terminals to connect to an external crystal
oscillator which drives on internal circuitry of the microprocessor to produce a suitable clock for
the operation of microprocessor.
RESET OUT: This is output pin 3. This signal indicates that the CPU is being reset.
_______
RESET IN: this is input pin 36. When this signal is low, then the microprocessor resets.
SOD: This is output pin 4. It is a data line for serial o/p. It can be used to o/p the most
significant bit of the accumulator.
SID: This is input pin 5. It is a data line for serial i/p. The data on this line is loaded into the
most significant bit of the accumulator.
CLK: This is output pin 37. It is a clock output for user which can be used for other digital ICs. Its
frequency is same at which processor operates.
VCC: This is input pin 40. It provides +5v DC supply for the microprocessor.
Vss: This is input pin 20. This is the ground reference.
RST 5.5, RST 6.5, RST 7.5 & TRAP: These are Pin 9, 8, 7 & 6 respectively. These are interrupt
signals. When interrupt is recognized, the next instruction is executed from a fixed location.
INTR: This is input pin 10. It is an interrupt request signal. When it goes high the program
counter does not increment its content. The microprocessor suspects its normal sequence of
instruction at hand it goes to the CALL instruction.
___
INTA: This is output pin 11. The microprocessor sends as interrupt acknowledgement signal
after INTR is received.
AD0 AD7: These are input/output pins 12-19. These are time multiplexed address/data bus
which carries both data and address. It carries lower address bits A0 to A7, as well as it can be
used as data bus which Carries data of 8 bit.
A8 to A15: These are output pins 21 to 28. These lines are used for the most significant 8-bits
of the 16-bits address lines.
ALE (Address latch enable): This is output pin 30. It goes high during first clock cycle of a
machine cycle. When high, AD0 AD7 is used as address bus.
___
WR: This is output pin 31. It controls WRITE operation. A low indicates a write operation being
performed into the selected memory or I/P device.
___
RD: This is output pin 32. It controls READ operation. When it goes low, the selected memory or
I/O device is read.
DEPARTMENT OF ELECTRONICS, MMP

INTRODUCTION TO MICROPROCESSOR, UNIT 3

ER.SARBESH CHAUDHARY

S0, S1: These are output pins 29 & 33. These are status signals and indicate the type of
operation performed.
S0 S1
Operation
0 0
HALT
0 1
READ
1 0
WRITE
1 1
FETCH (bring information from the memory to microprocessor)
__
IO/M: This is output pin 34. It distinguishes whether the address is fir memory or I/O. When
high the operation is performed between I/O and microprocessor. When low the operation is
performed between memory and microprocessor.
READY: This is input pin 35. It is used to sense whether a peripheral is ready to transfer data or
not. If READY is high, the peripheral is ready, if it is low, the p waits till it goes high.
HOLD: This is input pin 39. When high it indicates another device is requesting the use of buses.
Having received a HOLD request the P stops the use of the buses as soon as the current
instruction is completed. The processor regains the bus after the removal of the HOLD signal.
HLDA: This is output pin 38.This is a signal for HOLD acknowledgement. It indicates that the
HOLD request has been received. After the removal of a HOLD request the HLDA goes low.
ASSEMBLY LANGUAGE PROGRAMMING
Assembly languages are called 2nd generation language. In assembly language program,
programmer can easily write a program in alphanumeric symbols instead of 0s and 1s as used in
machine language. This is programming level in between the machine language and the high
level language. However the microprocessor can only understands the binary numbers and
hence a translator is used to convert assembly or high level program into binary machine
language so that microprocessor can execute the program.
ASSEMBLER
It is a program that translates assembly language mnemonics or source code into binary code
or object code. This translation requires that the source program be written strictly according
to the specified syntax of the assembler.
STACK
The stack is a portion of read/write memory set aside by the user for the purpose of storing
information temporarily. When the information is written on the stack, the operation is called
PUSH. When the information is read from the stack, the operation is called POP.

DEPARTMENT OF ELECTRONICS, MMP

INTRODUCTION TO MICROPROCESSOR, UNIT 3

ER.SARBESH CHAUDHARY

Stack is a last-in first-out or LIFO type of memory. This means that data which is pushed last
into stack is popped out of it first. The stack is implemented with the help of special 16-bit
memory pointer register which is known as stack pointer (SP). During PUSH and POP operation
stack pointer register gives the address of the memory where the information is to be stored or
to be read. The stack pointers contents are automatically manipulated to point to the top of
stack. The memory location currently pointed by stack pointer is called top of stack.
The Size of the stack is limited only by the available memory. In the 8085, the stack is defined
by setting the SP (Stack Pointer) register; for eg:
LXI SP, FFFFH ; This sets the Stack Pointer to location FFFFH (end of memory for the 8085).
PUSH & POP INSTRUCTIONS
The 8085 provides two instructions i.e. PUSH and POP for storing information on the stack and
retrieving it back. Both PUSH and POP are 1 byte instructions and work with register pairs only.
PUSH Operation
The PUSH instruction decrements stack pointer by two and copies a word from some source to
the location in the stack where the stack pointer points. Here the source must be a WORD (16bit). The source of the word can be a general purpose register pair or memory. An example of
PUSH instruction is given below with the changes in stack.
Address
FFFB
FFFC
FFFD
FFFE
FFFF

Address

STAK POINTER

Figure (a): Stack before PUSH B operation

FFFB
FFFC
FFFD
FFFE
FFFF

3C
25

STAK POINTER

Figure (b): Stack after PUSH B operation

PUSH B: It is a one byte instruction. This instruction performs the following steps
1. Decrement SP
2. Copy the contents of register B to the memory location pointed to by SP.
3. Decrement SP
4. Copy the contents of register C to the memory location pointed to by SP.
POP Operation
The POP instruction copies a word from the stack location pointed by the stack pointer to the
destination. The destination can be general purpose register pair or memory location. After the
DEPARTMENT OF ELECTRONICS, MMP

INTRODUCTION TO MICROPROCESSOR, UNIT 3

ER.SARBESH CHAUDHARY

word is copied from the specified destination, the stack pointer is automatically incremented by
2. An example of POP instruction is given below with the changes in stack.
Address
FFFB
FFFC
FFFD
FFFE
FFFF

Address

3C

STAK POINTER

25

Figure (a): Stack before POP B operation

FFFB
FFFC
FFFD
FFFE
FFFF

STAK POINTER

Figure (b): Stack after POP B operation

POP B: It is a one byte instruction. This instruction performs the following steps;
1. Copy the contents of the memory location (i.e. Lower order byte) pointed by the SP to
register C.
2. Increment SP
3. Copy the contents of the memory location (i.e. Higher order byte) pointed by the SP to
register B.
4. Increment SP.
SUBROUTINE
A subroutine is a group of instructions that perform a subtask. A subroutine is written as a
separate unit apart from the main program and the microprocessor transfers the program
execution sequence from main program to subroutine whenever it is called to perform a task
by using the CALL instruction. After the completion of subroutine task microprocessor returns
to main program using RET instruction. The subroutine technique eliminates the need to write a
subtask repeatedly, thus it uses memory efficiently. Before implementing the subroutine, the
stack must be defined; the stack is used to store the memory address of the instruction in the
main program that follows the subroutines call.
To implement subroutine there are two instructions CALL and RET.
CALL: This instruction is a 3 byte instruction and is used to call the subroutine unconditionally. It
saves the contents of program counter on the stack pointer. Loads the PC by jump address (16
bit memory) and executes the subroutine as shown in the figure below.
RET: This instruction is a 1 byte instruction. The RET instruction returns from the subroutine
unconditionally. It will return execution from the subroutine to the next instruction after the
CALL instruction in the calling program (i.e. Main program) as shown in the figure below.

DEPARTMENT OF ELECTRONICS, MMP

INTRODUCTION TO MICROPROCESSOR, UNIT 3

ER.SARBESH CHAUDHARY

Figure: Program execution flow while calling subroutine.

CC, CNC, CZ, CNZ, CP etc.


Call subroutine conditionally.
Same as CALL except that it executes on the basis of flag conditions.
RC, RNC, RZ, RNZ, RP etc.
Return subroutine conditionally.
Same as RET except that if executes on the basis of flag conditions.
E.g. Write an ALP to add two numbers using subroutines.
Main program
2000
2002
2004
2007
2008

MVI B, 4AH
MVI C, A0H
CALL 3000H
MOV B, A
HLT

Subroutine
3000
3001
3002

MOV A, B
ADD C
RET

END OF UNIT 3

DEPARTMENT OF ELECTRONICS, MMP

Вам также может понравиться