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

Determine the output of T-flipflops in cascade, If  the input to T-flipflop...

If  the input to T-flipflop is 100 Hz signal, the final output of the three T-flipflops in cascade is ? Ans. The  final  output  of  the  three  T-flip-flops in cascade is 12.5 H

Interrupt handling - computer architecture, Interrupt handling: Handlin...

Interrupt handling: Handling Interrupts  Several  situations where the processor should avoid interrupt requests Interrupt-enable Interrupt-disable  Typical

Can link and association applied interchangeably, No, You cannot apply the ...

No, You cannot apply the link and Association interchangeably. Since link is used show the relationship among the two objects. But Association is used signify the relationship

Illustrate the purchase consummation activity, Illustrate the Purchase Cons...

Illustrate the Purchase Consummation activity? Purchase Consummation: This model lists three activities in the purchase consummation phase: • Receipt of product. • Pl

Explain management information base variables, Explain MIB (Management Info...

Explain MIB (Management Information Base) variables. MIB is a set of named items which an SNMP agent knows. To control or monitor a remote computer, a manager should fetch or s

Feature Extraction and clustering, Hi, I have a CSV file that has numbers ...

Hi, I have a CSV file that has numbers data set. The data set contains images of handwritten digits. Recognizing handwritten digits is already a mature technology By using R code

Determine the example - fork-join, Determine the Example - "fork-join" ...

Determine the Example - "fork-join" module initial_fork_join(); reg clk,reset,enable,data; initial begin $monitor("‰g clk=‰b reset=‰b enable=‰b data=‰b", $time, cl

Can matchcode object contain ids with different update types, Can matchcode...

Can matchcode object contain Ids with different update types? Yes.

Dhcp, how to set up dhcp

how to set up dhcp

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