Explain call and return statements, Computer Engineering

Assignment Help:

Q. Explain Call and Return Statements?

CALL:

      CALL X    Procedure Call to procedure/function named X

  CALL instruction causes the following to happen: 

1.  Decrement the stack pointer so that we won't overwrite last thing put on stack

(SP <---SP - 1)

901_Call and Return Statements.png

Figure: Call and Return Statements

2.  The contents of PC that is pointing to NEXT instruction the one just after CALL is pushed onto stack and M [SP] <--- PC.

3.  JMP to X address of the start of subprogram is put in PC register.This is all a jump does. So we go off to the subprogram though we have to remember where we were in calling program which means that we should remember where we came from so that we can get back there again. 

PC <--- X 

RETN:

RETN      Return from procedure.   

RETN instruction causes following to happen: 

1.  Pops the stack to produce an address/label.If correctly used, the top of the stack will comprise the address of next instruction after the call from that we are returning; it's this instruction with that we want to resume in calling program.

2.  Jump to popped address it implies that put the address into PC register.

 PC <---  top of stack value; Increment SP.


Related Discussions:- Explain call and return statements

Explain the storage class auto, Explain The Storage Class auto The Stor...

Explain The Storage Class auto The Storage Class auto : Variables declared within function bodies are automatic by default. Thus, automatic is the most common of the four stora

Selecting integerated learning experiences, Q. Selecting integerated learni...

Q. Selecting integerated learning experiences? It is important that we select appropriate experiences for children, more so those that are from the child's world and emerge fro

Corresponding port numbers, A) Around how many entries are there in this fi...

A) Around how many entries are there in this file on your VM? B) Select and list names and corresponding port numbers for four well-liked services listed in this file?

Display methods, Describe a console application project to show the differe...

Describe a console application project to show the different formatting styles used in display methods(i.e.Console.writeLine()).

Introduction to information distribution, INTRODUCTION : Like any other of...

INTRODUCTION : Like any other office we need equipment to provide for information distribution in the laboratory office also. For information distribution we require multiple copi

Performance and issues in pipelining-throughput, Performance and Issues in ...

Performance and Issues in Pipelining Throughput:  Throughput of a pipeline can be defined as the number of results that have been getting per unit time. It can be denoted as:

How many instructions in a computer, Q. How many instructions in a Computer...

Q. How many instructions in a Computer? A computer can have a vast number of instructions and addressing modes. Older computers with the growth of Integrated circuit technolog

What is bus arbitration, What is bus arbitration? It is method by which...

What is bus arbitration? It is method by which the next device to become the bus master is selected and bus mastership is transferred to it. There are two ways for doing this:

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd