Computer Science, asked by dharaniveluswamy123, 8 months ago


When BSR instruction is executed in 68k assembly program, what BSR do immediately?

a) transfer control to subroutine
b) pushes the PC onto stack
c) sets PC to the address of the first instruction of the subroutine
d) pops the return address from the stack into PC​

Answers

Answered by Anonymous
25

Answer:

c) sets PC to the address of the first instruction of the subroutine

Explanation:

Subroutine Invocation in m68k Assembler

When we write a subroutine in a m68k assembler program we start by giving it a label which will identify it.  This label is a programmer friendly way to refer to the subroutine: it represents in reality the address in memory of the subroutine that will be computed by the assembler at compile time (this is not the whole truth: the ultimate location in memory of the subroutine in memory depends on the assembler/linker/loader team as a whole.  This topic will be addressed in lecture19   Having labeled our subroutine, we proceed to write a sequence of instructions that correspond to the body of the subroutine.  Finally, once the subroutine is written, we use the rts instruction , which expects no arguments, to return to the original flow of execution.

The bsr Instruction

Syntax:        bsr     <label | literal>

Attributes:    size= b,w

This is a mnemonic for "Branch to Subroutine".  This instruction can be used to branch to the subroutine designated by the given label or the given memory address literal.  The semantics of the bsr instruction are similar to the branch instruction seen previously: at compile time, the assembler will calculate the difference between the current value of the PC and the label or memory address specified as an argument .  This offset will be stored following the instruction word, ready to be added to the PC at run time when the instruction is reached.  The offset will either be an 8 bit or a 16 bit signed two's complement number.  In the first case, we call the bsr instruction a short branch, and in the latter, a long branch.  To specify a short branch, use bsrb;   to specify a long branch, use bsrw.  Usually though, the plain vanilla bsr instruction is used in programs as most assemblers will, if possible, normally try to generate a short branch instruction out of a bsr instruction.

Answered by Qazwsx1234
0

Explanation:

mark her brainliest please

Similar questions