EEE MICROPROCESSORS. CHAPTER 5. M. Fatih In the , the stack is defined by setting the SP A subroutine is a group of instructions that will be. In computer programming, a subroutine is a sequence of program instructions that performs a . The earliest computers and microprocessors, such as the Manchester Baby and the RCA , did not have a single subroutine call instruction.‎Main concepts · ‎Language support · ‎History · ‎Local variables. The CALL instruction interrupts the flow of a program by passing control to an internal or external subroutine. An internal subroutine is part of.


Author: Carson Kertzmann II
Country: Ghana
Language: English
Genre: Education
Published: 3 June 2014
Pages: 488
PDF File Size: 42.3 Mb
ePub File Size: 21.15 Mb
ISBN: 285-1-99343-724-5
Downloads: 10993
Price: Free
Uploader: Carson Kertzmann II


Indeed, a common use of subroutines is to implement mathematical functionsin which the purpose of the subroutine is purely to compute one or more results whose values are entirely determined by the arguments passed subroutine in microprocessor 8085 the subroutine.

Examples might include computing the logarithm of a number or the determinant of a matrix.

Subroutine - Wikipedia

subroutine in microprocessor 8085 A subroutine call may also have side effects such as modifying data structures in a computer memoryreading subroutine in microprocessor 8085 or writing to a peripheral devicecreating a filehalting the program subroutine in microprocessor 8085 the machine, or even delaying the program's execution for a specified time.

A subprogram with side effects may return different results each time it is called, even if it is called with the same arguments.

An example is a random number functionavailable in many languages, that returns a different pseudo-random number each time it is called.

The widespread use of subroutines with side effects is a characteristic of imperative programming languages. A subroutine can be coded so that it may call itself recursivelyat one or more places, to perform its task.

This method allows direct implementation of functions defined by mathematical induction and recursive divide and conquer algorithms. In logic programming languages, often[ vague ] all subroutines are called predicates, since they primarily[ vague ] determine success or failure.


Some programming languagessuch as PascalFortranAda and many dialects of BASICdistinguish between functions or function subprograms, which provide an explicit return value to the calling program, and subroutines or procedures, which do not. In those languages, function calls are normally embedded in expressions e.

Procedure calls either behave syntactically as statements e. Other languages, such as C and Lispdo not distinguish between functions subroutine in microprocessor 8085 subroutines. In strictly functional programming languages such subroutine in microprocessor 8085 Haskellsubprograms can have no side effectswhich means that various internal states of the program will not change.


Functions will always return the same result if repeatedly called with the same arguments. Such languages typically only support functions, since subroutines that do not return a value have no use unless they can cause a side effect.

A language's compiler will usually translate procedure subroutine in microprocessor 8085 and returns into machine instructions according to a well-defined calling conventionso that subroutines can be compiled separately from the programs that call them.


The instruction sequences corresponding to call and return statements are called the procedure's prologue and epilogue. Advantages[ edit ] The advantages of breaking a program into subroutines include: Decomposing a complex programming task into simpler steps: This makes the calling code concise and readable even if the function is not subroutine in microprocessor 8085 to be reused.


A subroutine typically requires standard housekeeping code — both at entry to, and exit from, the function function prologue and epilogue — subroutine in microprocessor 8085 saving general purpose registers and return address as a minimum.

History[ edit ] The idea of a subroutine was worked out after computing machines had already existed for some time. The arithmetic and conditional jump instructions were planned ahead of time and have changed relatively little; but the special instructions used for procedure calls have changed greatly over the years.

The earliest computers and microprocessors, such as the Subroutine in microprocessor 8085 Baby and the RCAdid not have a single subroutine call instruction.

Subroutines could be implemented, but they required programmers to use the call sequence—a series of instructions—at each call site. Goldstine and von Neumann wrote a paper dated 16 August discussing the usefulness of subroutines.