Invitation to Computer Science 8th Edition

Published by Cengage Learning
ISBN 10: 1337561916
ISBN 13: 978-1-33756-191-4

Chapter 5 - 5.2 - The Components of a Computer System - Practice Problems - Page 256: 2

Answer

Assuming that variables $a, b, c,$ and $d$ are stored in memory locations $100,$ $101,102,$ and $103,$ respectively: $\begin{array}{llll} {\text {Memory}} & {\text {} } & {\text {Address} } & {\text {} }\\ {\text {Location }} & {\text {Op Code} } & {\text {Field} } & {\text {Comment} }\\ {50} & {\text { LOAD }} & {101} & {\text { Register } \mathrm{R} \text { contains the value of } b} \\ {51} & {\text { MULTIPLY }} & {103} & {\text { R now contains the product } b \times d} \\ {52} & {\text { STORE }} & {101} & {b \text { now has the value } b \times d} \\ {53} & {\text { LOAD }} & {102} & {\text { R contains the value of } c}\\ {54} & {\text { DIVIDE}} & {103} & {\text { R now contains the quotient c/d} }\\ {55} & {\text { STORE}} & {103} & {\text { d now has the value c/d} }\\ {56} & {\text { LOAD}} & {101} & {\text { Load the product b 3 d back into R} }\\ {57} & {\text { SUBTRACT}} & {103} & {\text { R now contains (b 3 d) 2 (c/d)} }\\ {58} & {\text { STORE}} & {100} & {\text { Store the result into a} }\\ \end{array}\\$

Work Step by Step

Assuming that variables $a, b, c,$ and $d$ are stored in memory locations $100,$ $101,102,$ and $103,$ respectively: $\begin{array}{llll} {\text {Memory}} & {\text {} } & {\text {Address} } & {\text {} }\\ {\text {Location }} & {\text {Op Code} } & {\text {Field} } & {\text {Comment} }\\ {50} & {\text { LOAD }} & {101} & {\text { Register } \mathrm{R} \text { contains the value of } b} \\ {51} & {\text { MULTIPLY }} & {103} & {\text { R now contains the product } b \times d} \\ {52} & {\text { STORE }} & {101} & {b \text { now has the value } b \times d} \\ {53} & {\text { LOAD }} & {102} & {\text { R contains the value of } c}\\ {54} & {\text { DIVIDE}} & {103} & {\text { R now contains the quotient c/d} }\\ {55} & {\text { STORE}} & {103} & {\text { d now has the value c/d} }\\ {56} & {\text { LOAD}} & {101} & {\text { Load the product b 3 d back into R} }\\ {57} & {\text { SUBTRACT}} & {103} & {\text { R now contains (b 3 d) 2 (c/d)} }\\ {58} & {\text { STORE}} & {100} & {\text { Store the result into a} }\\ \end{array}\\$
Update this answer!

You can help us out by revising, improving and updating this answer.

Update this answer

After you claim an answer you’ll have 24 hours to send in a draft. An editor will review the submission and either publish your submission or provide feedback.