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

No class can derive, Make a console application. Add class 'Account' having...

Make a console application. Add class 'Account' having variables as num (integer) name (String), bal (double), ac_code (byte). Describe four different constructors to initialize th

Functions of an operating system, Question a) In multitasking Operatin...

Question a) In multitasking Operating Systems, there are two kinds of multitasking such as the "Preemptive Multitasking" and the "Cooperative Multitasking". Explain the two me

What are set up time & hold time constraints, What do they signify Which on...

What do they signify Which one is critical for calculating maximum clock frequency of a circuit? Ans) Set up time constraint implies how late the input signal can arrive befor

List the allowed register pairs of 8085, List the allowed register pairs of...

List the allowed register pairs of 8085. B-C register pair D-E register pair H-L register pair

What are the standard types of files produced, What are the standard types ...

What are the standard types of files produced? A PDF file is universally recognized by the internet and is also a secure image, given that an electronic footprint remains when

Explain about mainframes computer, Q. Explain about Mainframes computer? ...

Q. Explain about Mainframes computer? Mainframes, capable of executing in excess of 53 MIPS, are high-performance, general- purpose computers supporting very large databases, r

Explain the working of light pens, Explain the working of light pens Li...

Explain the working of light pens Light pens still exist, but due to several disadvantages they are not as popular as other input devices that have been developed. For example,

Perform multiplication with showing content of accumulator, Perform multipl...

Perform multiplication with showing the contents of accumulator, B register and Y register during each step. (Accumulator, B, Y are 4-bit registers) B=06 Y=02

Working on dreamweaver, Write your text, format text, insert picture throug...

Write your text, format text, insert picture through Object window or INSERT -> IMAGE. Insert Menu provides you all features which are available under the Object window. Modify men

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