in 8085 microprocessor a subroutine is a separate program written aside from main program ,this program is basically the program which requires to be executed several times in the main program.
the microprocessor can call subroutine any time using CALL instruction .
after the subroutine is executed the subbroutine hands over the program to main
program using RET instruction.
a subroutine is a portion of the code within a larger program which performs a specific function and is independent of remaining code.....delay routines are subroutines used for maintaining the timings of various operations in microprocessor
In the 8085 microprocessor, the instruction CALL 06FA is used to call a subroutine located at the memory address 06FA. When this instruction is executed, the current program counter (PC) value is pushed onto the stack, and the PC is then updated to 06FA, allowing the microprocessor to execute the subroutine at that address. This enables structured programming by allowing the main program to temporarily transfer control to a subroutine and return afterward.
In the 8085 microprocessor, a "near call" refers to a subroutine call within the same memory segment, typically allowing for a return to the next instruction using a simple return instruction (RET). A "far call," on the other hand, is used to call a subroutine located in a different memory segment, requiring the processor to save both the program counter and the segment information. This distinction affects how memory addresses are handled and how the stack is utilized during subroutine calls and returns.
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.
Subroutine mean what (in java)?
The Mechanism that makes possible to transfer control between the calling program and Subroutine is reffered to as SUBROUTINE LINKAGE
In a subroutine, the primary variables are parameters and local variables. Parameters are the inputs passed to the subroutine, allowing it to process specific data. Local variables are declared within the subroutine and are used for temporary storage of data during execution, remaining inaccessible outside the subroutine's scope. Together, these variables facilitate the subroutine's functionality and data manipulation.
8085 is a microprocessor designed by Intel
To include a subroutine VACKRL in Synon generated code, you need to first define the subroutine in the Generate All Model. In the action diagram, call the subroutine using the CALL operation passing any required parameters. Finally, regenerate the code for the model to incorporate the changes and ensure the subroutine is included in the generated code.
marco expand where it invoked ,subroutine will go where the subroutine is defined....
A call to a subroutine. A subroutine is a named/labeled set of commands.
The stack plays a crucial role in managing subroutine calls and returns by storing the return address and local variables. When a subroutine is called, the address of the instruction following the call is pushed onto the stack, allowing the program to resume execution after the subroutine completes. Additionally, the stack is used to allocate space for local variables within the subroutine. Upon returning, the return address is popped from the stack, directing the program back to the correct location in the code.