---
# System prepended metadata

title: Skrip Procedure Call
tags: [assignment]

---

---
tags: assignment
title: Skrip Procedure Call
---

### Dzaqwan

In Transfer of control, there is procedure call instruction. Here how it works.

Basically, a procedure encapsulate a code block, so that it can be used in multiple parts of a program. They also isolate context, and they can call another procedure and stuff.

The procedure mechanism involves two basic instructions: a call instruction that branches from the present location to the procedure, and a return instruction that returns from the procedure to the place from which it was called.

<br>

### Qilol

- A procedure can be called from more than one location
- A procedure call can appear in a procedure. This allows the nesting of procedures to an arbitrary depth
- Each procedure call is matched by a return on the called program

Because we would like to be able to call a procedure from a variety of points, the processor must somehow save the return address so that the return can take place appropriately. In this example, we are using **Top of stack** approach

<br>

### Daanish

Baca powerpoint *Call Stack* dari awal sampai habis

<br>


### Afham

The two principal reasons for the use of procedures are economy and modularity. A procedure allows the same piece of code to be used many times. This is important for economy in programming effort and for making the most efficient use of storage space in the system (the program must be stored). Procedures also allow large programming tasks to be subdivided into smaller units. This use of modularity greatly eases the programming task.