answersLogoWhite

0


Best Answer

That varies between different processors:

  • Many put it on the stack automatically.
  • The PowerPC stores it in a register called the Link register and leaves it up to the software to determine where to save it.
  • The i960 pushes its internal general register stack automatically then stores it in one of the newly allocated general registers (along with a new frame pointer, etc.).
  • Some early computers (e.g. DEC PDP-1) stored it in the memory address preceding the subroutine itself.
  • Many computers in the 1960s (e.g. IBM System 360) stored it in one of the general purpose register specified in the call instruction.
  • etc.
User Avatar

Wiki User

โˆ™ 9y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: When a subroutine is called where is the address of the instruction following the call stored?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Engineering

What are stacks subroutines in 8085 microprocessor?

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.


When a function does not return a value what kind of function is it called?

In most computer languages, a procedure that returns a value is called a function and a procedure that does not return a value is called a subroutine or subprogram. Usually the languages treat the passing of arguments/parameters differently between functions and subroutines. The C language does not distinguish between them. A subroutine that does not return a value is define as a "void" function indicating that no return value is used or available.


What is an instruction that causes a program to perform a specific action called?

command


An instruction book or program that takes users through a prescribed series of steps to learn a complex program is called a?

An instruction book or program that takes users through a prescribed series of steps to learn a complex program is called a tutorial.


How does a function differ from a procedure?

In closed subroutine a subroutine stored outside the main routine can be connected to it by linkages at one or more locations. whereas in open subroutine is a set of computer instructions i.e. a subroutine that performs some particular program and insert them directly each and every time that particular function is required

Related questions

What are stacks subroutines in 8085 microprocessor?

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.


How can a stack be used for implementing a subroutine call?

A stack can be used to implement a subroutine call because the return address is pushed onto the stack, and control transfers to the subroutine. If the subroutine were to then call another subroutine, or even itself, a second return address would be pushed. When the subroutine returns control, the return address is popped off of the stack and control transfers to the return address.In addition, the stack can be used to pass arguments. The caller can push the arguments onto the stack before calling the subroutine. The subroutine can then access the arguments by making references relative to the stack pointer. When the subroutine returns control, the caller then pops the arguments off of the stack.Further, the subroutine can use the stack to store local variables. It adjusts the stack pointer in the direction of pushing things onto the stack, and then make references to that region of memory between the original value of the stack pointer and the new value of the stack pointer.This is exactly how most subroutines work on the 8086/8088 (and higher) processors...The caller pushes arguments on the stackThe caller calls the subroutine, pushing the return address on the stackThe subroutine pushes caller registers onto the stack, if that is the agreed convention for that callThe subroutine pushes the BP register on the stack and then copies the stack pointer (SP) to BPThe subroutine adjusts SP downward, allocating the required local memoryThe subroutine accesses arguments with [BP+offset] addressingThe subroutine accesses local variables with [BP-offset] addressingWhen the subroutine is done, it sets SP back to BP, pops caller's registers off of the stack, pops caller's return address off of the stack, and then returns to the callerThe caller then pops the arguments off of the stack.The structure in memory, representing arguments, return address, saved registers if needed, and local variables, with BP in the center, is called a stack frame.Done properly, a subroutine can be fully recursive, even able to call itself, or be called by other threads, because all local variables and the registers if saved are stored on the stack. The ability to be recursive is also called reentrancy.


What is difference between vectored and non vectored interrupts?

Vector interrupt --> when processor directly call the respective isr when interrupt occurs so, address of respective isr is usually save in register. Non interrupt Vector --> In this case when interrupt occurs the processor calls a generic isr and in generic isr uaer has to call respective isr by checking status register.


What are subroutines?

In computer programming, a subroutine is an identified sequence of instructions with a start and an end point which may be invoked from another part of the program. When a subroutine is called, the processor executes the instructions until it reaches the end of the subroutine, at which point control is returned to the point in the program immediately following the call. In most programming languages, a set of conventions are followed which allow values to be passed into the subroutine and for a result to be returned, so that the subroutine can be used in many different contexts. This is the most basic form of reusable software. In higher-level languages, functions and methods are specialized forms of subroutines.


Difference between open subroutine and closed subroutine?

A closed subroutine is a normal unit like a function in C or a method in Java. When a closed subroutine is called, the program branches to the file/section of code, executes, and then returns to the line after the calling line.For example, if you had the following code in Java:main(...) {int a = 1;int b = 4;multiply(1,4);System.out.println("done!");}multiply(int a, int b) {int answer = 0;for(int i = 0; i < 4; i++)answer*=a;return answer;}Over here, the main method executes until it reaches multiply(1,4) and then jumps to the function (declared below main) and executes that. After it finishes executing multiple, it returns to the line after the function call, which in our case is System.out.println, and executes that.An open subroutine is a subroutine that adds the instruction to the already existing block of code. That is, it replaces the one line call with the entire set of instructions.For example, if you had the following code:startsave 1 in asave 4 in bmultiply a b-timesendThe command "multiply a b-times" is an open subroutine because the command will add lines at compile time to the existing code to return the following (this is best understood when thinking of the code as machine code):(translated from machine code)startsave 1 in asave 2 in bADDED CODEsave a * a in csave c * a in dsave d * a in ereturn eendAs you can see, the "multiply" command has been replaced with the entire set of instructions (under ADDED CODE).In short, an open subroutine adds lines to your main code while a closed subroutine is code stored in a separate block of code. Both subroutines are called with a single line of code.


What is execute cycle in microprocessor?

The sequence of operations that the cpu has to carry out while execution is called instruction cycle. 1:- Read an Instruction 2:- Decode the instruction 3:- Find the address of operand 4:- retrieve an operand 5:- perform desired operation 6:- find the address of destination 7:- store the result into the destination


Similarities between macro and subroutine?

Both Macro &amp; Subroutine are set of instructions that are called several times to perform a specific task. They act like functions that have a sequence of instructions stored and is often called by the program.


3 What is the difference between a function procedure and a subroutine procedure?

Both a function and a subroutine are examples of out-of-line execution calls to code. The main difference is that a function call can be part of an expression and returns a value, whereas the subroutine can be called standalone and does not return a value.


What is the function of the PC register in the 8086 CPU?

There is no PC register in the 8086/8088. It is called the IP register by Intel and it stands for the Instruction Pointer. It contains the address of the current/next instruction to be executed.


What are operands?

Every instruction contains to parts: operation code[opcode],and operand. The first part of an instruction which specifies the task to be performed by the computer is called opcode. The second part of the instruction is the data to be operated on.,and it is called operand. The operand[or data]given in the instruction may be in various forms such as 8-bit or 16-bit data, 8-bit or 16-bit address, internal register or a register or memory location.


What is the place where instruction in taekwondo takes place called?

The place where instruction in taekwondo takes place is called a dojang.


What is an instruction phase together with the execution phase called?

The instruction phase together with the execution phase is called a "Machine Cycle".