retagged by
466 views
1 votes
1 votes

In a certain computer system, there is special instruction implemented to call subroutines. The instruction is

                JSR Reg.Sub
Microsequence:  Temp ← Sub
                SP ← (SP)+2
                (SP) ← (Reg)
                Reg  ← (PC)
                PC ← (Temp)

Where

  • Temp is an internal CPU register
  • Sub is calling routine address specification
  • Reg is any register in the system
  • SP is stack pointer
  • PC is program counter
  • (SP) refers to the contents of SP.

The system supports indirect addressing and autoincrement addressing modes. PC can be used as a link register. Sub field in the JSR instruction allows any operand specification, including the use of stack pointer along with some addressing modes.

Explain how you would implement co-routine using the JSR instruction. Show the control flow diagram and the contents of the stack before and after the call.

retagged by

Please log in or register to answer this question.

Related questions

3 votes
3 votes
1 answer
3
makhdoom ghaya asked Nov 30, 2016
801 views
Express the following list in terms of a linked list structure suitable for internal representation.$(((ab)c)d((e)))$
1 votes
1 votes
1 answer
4
makhdoom ghaya asked Nov 30, 2016
742 views
Consider the definition of macro $B,$ nested within the definition of a macro $A.$ Can a call to macro $B$ also appear within macro $A?$ If not, why not? If yes, explain ...