(Solved) : Question 3 25 Points Consider Following Assembly Language Program Example Language Explain Q42783990 . . .

Question 3: [ 25 points ] Consider the following assembly language program for the example language explained in class. Recal

Table 2: CPU register contents during loop Register 1st iteration 2nd iteration 3rd iteration 4th iteration Initial value bef

Question 3: [ 25 points ] Consider the following assembly language program for the example language explained in class. Recall that in this language, the following conventions are used: # indicates immediate data indicates that indirection is to be used as the addressing mechanism Instructions are represented in the following format: opcode source, destination opcode sourcel, source2, destination ; This is the program ANSWER EQU 1000 MOV #1, RO MOV #1, R1 CLR R2 MOV #4, R3 MOV #ANSWER, R4 ; clear the sum” ; initialize loop counter R4 used as a “pointer” to memory RABBIT: ADD RO, R1, R2 R2 = RO + R1 MOV R2, (R4) ; store R2 into memory MOV R1, RO MOV R2, R1 INC R4 ; point to next memory location DEC R3 ; decrement loop counter BRANCH > O RABBIT ; go back and do it again if not ; yet finished the loop HALT ; else we stop the computer and end (a) Complete the following table in your answer booklets) which shows the contents of the CPU registers RO, R1, R2, R3, and R4 at the end of each iteration of the loop designated by the label RABBIT. Table 2: CPU register contents during loop Register Initial value before loop 1st iteration 2nd iteration 3rd iteration 4th iteration Table 2: CPU register contents during loop Register 1st iteration 2nd iteration 3rd iteration 4th iteration Initial value before loop you figure it out (b) What values will be stored in the 4 consecutive memory locations starting at address 1000? (c) Express in a few clear, concise English language sentences what this program does. Here is an example of how you should express your answer: “This program computes the value of the factorial of the Integer stored in memory location ANSWER. The value of ANSWER! is stored in CPU register R2 upon program termination” Of course, the program actually performs something completely different. DO NOT express your answer in terms similar to: “This program, moves the immediate data / into register RO and RI and then clears register R2 and moves immediate data 4 into register R3. It then moves the immediate value represented by the symbolic label ANSWER into register R4. The program then enters a loop in which it adds registers RO and RI together and stores the resulting sum into register R2 blah blah blah…” In other words, do not simply perform a literal translation from assembly language to English. Answers of this type will result in a grade of 0. Show transcribed image text Question 3: [ 25 points ] Consider the following assembly language program for the example language explained in class. Recall that in this language, the following conventions are used: # indicates immediate data indicates that indirection is to be used as the addressing mechanism Instructions are represented in the following format: opcode source, destination opcode sourcel, source2, destination ; This is the program ANSWER EQU 1000 MOV #1, RO MOV #1, R1 CLR R2 MOV #4, R3 MOV #ANSWER, R4 ; clear the sum” ; initialize loop counter R4 used as a “pointer” to memory RABBIT: ADD RO, R1, R2 R2 = RO + R1 MOV R2, (R4) ; store R2 into memory MOV R1, RO MOV R2, R1 INC R4 ; point to next memory location DEC R3 ; decrement loop counter BRANCH > O RABBIT ; go back and do it again if not ; yet finished the loop HALT ; else we stop the computer and end (a) Complete the following table in your answer booklets) which shows the contents of the CPU registers RO, R1, R2, R3, and R4 at the end of each iteration of the loop designated by the label RABBIT. Table 2: CPU register contents during loop Register Initial value before loop 1st iteration 2nd iteration 3rd iteration 4th iteration
Table 2: CPU register contents during loop Register 1st iteration 2nd iteration 3rd iteration 4th iteration Initial value before loop you figure it out (b) What values will be stored in the 4 consecutive memory locations starting at address 1000? (c) Express in a few clear, concise English language sentences what this program does. Here is an example of how you should express your answer: “This program computes the value of the factorial of the Integer stored in memory location ANSWER. The value of ANSWER! is stored in CPU register R2 upon program termination” Of course, the program actually performs something completely different. DO NOT express your answer in terms similar to: “This program, moves the immediate data / into register RO and RI and then clears register R2 and moves immediate data 4 into register R3. It then moves the immediate value represented by the symbolic label ANSWER into register R4. The program then enters a loop in which it adds registers RO and RI together and stores the resulting sum into register R2 blah blah blah…” In other words, do not simply perform a literal translation from assembly language to English. Answers of this type will result in a grade of 0.

Expert Answer


Answer to Question 3: [ 25 points ] Consider the following assembly language program for the example language explained in class. …

Leave a Comment

About

We are the best freelance writing portal. Looking for online writing, editing or proofreading jobs? We have plenty of writing assignments to handle.

Quick Links

Browse Solutions

Place Order

About Us