answersLogoWhite

0

A subroutine is a group of instructions that will be used repeatedly in diff locations

of the program..........rather than repeating the same instructions several times, they can be grouped into a subroutine that is called from diff locations.

8085 has 2 instruction set for dealing with subroutines:

1.CALL -direct the program execution to the subroutine. Generally it pushes address of next instruction of program counter onto the stack,then goes to the address of subroutine.

2.RET:- pops the address of next instruction from the stack and places it in the program counter and returns to that address to continue processing.

For example, you have an often used value stored in HL. You have to call a subroutine that you know will destroy HL (with destroy I mean that HL will be changed to another value, which you perhaps don't know). Instead of first saving HL in a memory location and then loading it back after the subroutine, you can push HL before calling and directly after the calling pop it back. Of course, it's often better to use the pushes and pops inside the subroutine.

User Avatar

Wiki User

12y ago

Still curious? Ask our experts.

Chat with our AI personalities

RafaRafa
There's no fun in playing it safe. Why not try something a little unhinged?
Chat with Rafa
EzraEzra
Faith is not about having all the answers, but learning to ask the right questions.
Chat with Ezra
BlakeBlake
As your older brother, I've been where you are—maybe not exactly, but close enough.
Chat with Blake

Add your answer:

Earn +20 pts
Q: What are stacks subroutines in 8085 microprocessor?
Write your answer...
Submit
Still have questions?
magnify glass
imp