Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

1. A BSR instruction at address $80006 calls a subroutine located at address $80

ID: 666624 • Letter: 1

Question

1. A BSR instruction at address $80006 calls a subroutine located at address $80500. What address is pushed onto the stack? Note: Address A7 contains $6004.

2. If A5 contains 0001F400, at what location does the processor resume execution if JMP(A5) is encountered?

3. The stack pointer contains $75800 when an RTR (Return and restore condition codes) instruction is encountered. The contents of stack memory are:

Address

Data

75800

00

8A

75802

00

06

75804

6A

40

What is loaded into the condition codes? And what is the return address?

4. Memory locations 7F80 through 7F83 contain the following bytes: 00, 04, 3E, 2C. The stack pointer contains 007F80. Where will the program execution resume when RTS executes?

Address

Data

75800

00

8A

75802

00

06

75804

6A

40

Explanation / Answer

Solutions:

1.
Given Address A7 contains $6004.
   BSR instruction present at address $80006.
   Therefore, [PC] = Address of next Instruction to BSR or returning address <-$80006 +4 <-$80010  
   subroutine located at address $80500.
   BSR used to Branch(Jump) to a SubRoutine
BSR performs three operations
  
a.Decrement the stack pointer (i.e)
   [A7] [A7]-4
    <-$6004 -4
   A[7] <-$6000
b.Push the program counter on the stack (i.e) [M([A7])] [PC]
   M[$6000] <- $80010
c.Load the program counter with the target address (i.e)
   [PC] $80500 (i.e) Subroutine address
  
2. A5 contains 0001F400
JMP (A5)
After this instruction is encountered [PC] (i.e) program counter is loaded with A5 value.
the processor resume execution to the location specified in [PC]

3. Given
The stack pointer[SP] <- $75800
The contents of stack memory are:
Address Data
75800 00 8A
75802 00 06
75804 6A 40

a)After Encountering RTR instruction,transfers the value at the top of the system stack into the condition
code register as follows:
CCR <- [SP]
CCR <- [$75800]
CCR <- 008A
binary value of 008A is 0000 0000 1000 1010
  
b)System stack pointer is incremented to fetch the return address from the top of the system stack
SP<-SP+1
Now SP <- $75802
Return Address <- [SP]
Return Address <- 0006

4. GIVEN:Memory locations 7F80 through 7F83 contain the following bytes:
00, 04, 3E, 2C.
The stack pointer contains 007F80.
SP<-007F80

After the execution of RTS, content available in the location pointed by Stack pointer
will be loaded in to PC.
PC <- [SP]
<-[007F80]
PC <- 00
Program execution resumes at the location pointed by program counter.