(Solved) : Figure 521 Address 100 101 102 Contents Value Value Ofb Value C Algorithmic Notation Machi Q35375039 . . .


Textbook is Invitation to Computer Science 7th edition
FIGURE 5.21 Address 100 101 102 Contents Value of a Value ofb Value of c Algorithmic notation Machine language instruction sequences Address Contents (commentary) LOAD 101 ADD 102 STORE 100 Put the value of b into register R Add c to register R. It now holds &+C Store the contents of register R into a 1. Set a to the value b+ 50 51 52 Compare aand b 2. If a >b then 50 COMPARE 100, 101 and set candition JUMPGT 54 MOVE 101, 102 JUMP 55 MOVE 100, 102 codes. Go to location 54 a>b Get here if a sb, so move b into c and skip the next nstruction. set c to the value a 51 Else set c to the value b 53 54 Move a into c 3. [56%) Assume that (i) the variables a, b, and c are stored in memory locations 100, 101, and 102, respectively, (ii) the five integer values +4, -1, 0, +12, and +1 are stored in memory locations 300, 301, 302, 303, and 304, respectively. and (iii) the code sequence you are writing begins in memory location 40. Using any of the machine language instructions shown in Section 5.2.4 of the Textbook, translate the following algo- rithmic operations into machine language code. Do not give binary but rather use the style of instruction presentation shown in Figure 5.21 on page 255 of the Textbook. Set c to the value of-1 for b-4 to 12 do if a 0 then Set c to the value of c – a else Set a to the value of b – c Set c to the value of c+1 Show transcribed image text
Expert Answer
Answer to Figure 521 Address 100 101 102 Contents Value Value Ofb Value C Algorithmic Notation Machi Q35375039 . . .
OR