loader image

Subroutines in 8085

A subroutine is a set of instructions that will be used repeatedly in different locations of the program. Instead of repeating the same instructions several times, they can be combined into a subroutine that is called from various locations. A subroutine in Assembly language can exist anywhere in the code. However, It is a common practice to separate subroutines from the main program.

subroutine call return 8085 example 2
Subroutine Call and Program Transfer

The 8085 microprocessor has two instructions to implement subroutines. The CALL instruction is used to redirect program execution to a subroutine. The RET instruction is used to return the execution to the calling routine. They are described in the following table.

MNEMONIC DESCRIPTION
CALL 16-bit address 3-byte instruction.
Jumps unconditionally to the memory location specified.
RET 1-byte instruction.
Unconditionally returns from the subroutine.

When the CALL instruction has been executed the contents of the program counter is saved to the top of the stack. This return address is retrieved from the stack when the RET instruction is executed.

Subscribe
Notify of
guest
3 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
suryadas

my teacher take class by using this post
this is very use full.
thank you for posting this
by the by my name is suryadas
lot of thanks

Devraj kumar sahu

yeah…in my college also our faculties used to teach from this website it is very usefull.
My name is devraj from kolkata.
and i am in brainware university

Scroll to Top