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: 4

Answer

Assuming that variables $a, b, c,$ and $d$ are stored in memory locations $100,$ $101,102,$ and $103,$ respectively: $\begin{array}{llll} {\textbf {Memory}} & {\textbf {} } & {\textbf {Address} } & {\textbf {} }\\ {\textbf {Location }} & {\textbf {Op Code $\quad$$\quad$} } & {\textbf {Field $\quad$ $\quad$} } & {\textbf {Comment} }\\ {50} & {\text { COMPARE}} & {100, 101} & {\text {Compare a and b and set condition codes} } \\ {51} & {\text { JUMPNEQ}} & {54} & {\text { if they are not equal, go to address 54} } \\ {52} & {\text { LOAD}} & {103} & { \text {Otherwise load R with the value of d} } \\ {53} & {\text { STORE}} & {102} & {\text {And store it into c} }\\ {54} & {\text { }} & { } & {\text {The next instruction begins here} }\\ \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} {\textbf {Memory}} & {\textbf {} } & {\textbf {Address} } & {\textbf {} }\\ {\textbf {Location }} & {\textbf {Op Code $\quad$$\quad$} } & {\textbf {Field $\quad$ $\quad$} } & {\textbf {Comment} }\\ {50} & {\text { COMPARE}} & {100, 101} & {\text {Compare a and b and set condition codes} } \\ {51} & {\text { JUMPNEQ}} & {54} & {\text { if they are not equal, go to address 54} } \\ {52} & {\text { LOAD}} & {103} & { \text {Otherwise load R with the value of d} } \\ {53} & {\text { STORE}} & {102} & {\text {And store it into c} }\\ {54} & {\text { }} & { } & {\text {The next instruction begins here} }\\ \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.