The Gateway to Computer Science Excellence
0 votes
119 views

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.

in CO and Architecture by Boss (30.7k points)
retagged by | 119 views

Please log in or register to answer this question.

Related questions

Quick search syntax
tags tag:apple
author user:martin
title title:apple
content content:apple
exclude -tag:apple
force match +apple
views views:100
score score:10
answers answers:2
is accepted isaccepted:true
is closed isclosed:true
50,737 questions
57,257 answers
198,086 comments
104,734 users