Question: You are given following subroutine and contract ` ` ` mystery _ subroutine input: 1 6 - bit unsigned number in R 1 1 output:

You are given following subroutine and contract
```
mystery_subroutine
input: 16-bit unsigned number in R11
output: 16-bit unsigned number in R12
; modifies both R11 and R12
```
```
mystery_subroutine:
```
```
clr.w R12
loop:
add.w R11, R12
dec.w R11
jnz loop
ret
```
(a) What does this subroutine do? What will be the value of the output in R12 when the value in R11 is, say \(\mathbf{n}=10\).
(b) What is the largest value of \(\mathbf{n}\) that this subroutine can handle correctly (i.e., return a correct output)?
Both parts are set up as a numerical answer
Question 2- Find the larger number
You see following values in the core registers R4 and R5.
Which statement is correct: is it R4> R5 or is it R5> R4? multiple choice
Question 3- Status Flags
You are given following two lines of code. Note that these are byte instructions.
\[
\begin{array}{ll}
\text { mov.b } & \# 83,\text { R5}\\
\text { add.b } & \# 53,
\end{array}
\]
What will be the value of the status bits after executing these two lines of code?
(a)\(\mathrm{C}=\)?
(b)\(\mathrm{N}=\)?
(c)\(\mathrm{V}=\)?
(d)\(\mathrm{Z}=\)?
You are given following subroutine and contract `

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!