Question: Fill in the blanks for the assembly program below for the following C code, which computes the sum of the first N positive integers

 Fill in the blanks for the assembly program below for the following  

Fill in the blanks for the assembly program below for the following C code, which computes the sum of the first N positive integers (from 1 to N), where N is another name for D[9] and stores the sum in D[10] at the end of the program. Assume N is a positive integer and N>0. For the JMPZ instruction, the offset is signed and can be -128 to +127. (Answers are case sensitive) i=N; sum=0; while (i!=0) { sum sum + i; i = i -1; } MOV R5, 9 // R5 is "i" MOV R1, #0 // R1 is "sum" MOV R2, #1 // R2 is the constant "1" MOV RO, #0 // RO is the constant "O" (for looping) loop: JMPZ , done ADD R1, SUB R5, R5, JMPZ RO, : MOV 10, R1 R5

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!