Machine Language Programming Worksheet R1 SolutionHere the f

Machine Language Programming Worksheet R1

Solution

Here the flowchart is given as

R1 <- x3100 , R3 <- 0 and R4 <- M[R1]

if R4 == -1

exit(0)

else

R3 <- R3+ R4 and R1 <- R1+1 and R4 <- M[R1]

goto if

Here this algorithm is used to find the sum of all the values from the memory location x3100 to the location in which the data stored is -1

let us consider that

0x3100 5

0x3101 4

0x3102 3

0x3103 2

0x3104 1

0x3105 -1

First R4 is loaded with 5 and since R4 != -1

R3= R3(0) + R4(5)

R3=5 and R1 =x3101 and R4=[x3101]=4

Now R4(4) != -1

R3=R3(5)+R4(4)

R3=9 and R1 =x3102 and R4=M[x3102]=3

since R4(3) != -1

R3=R3(9) + R4(3)

R3=12 and R1=x3103 and R4=M[x3103] = 2

since R4(2) != -1

R3= R3(12) + R4(2)

R3= 14 and R1=0x3104 and R4=M[x3104] = 1

since R4(1) ! = -1

R3 = R3( 14) +R4(1)

R3 =15 and R1=x3105 and R4=M[x3105] =-1

and R4 (-1) ==-1

exit

hence values are

R1 = x3105

R3 =15

R4 =-1

 Machine Language Programming Worksheet R1 SolutionHere the flowchart is given as R1 <- x3100 , R3 <- 0 and R4 <- M[R1] if R4 == -1 exit(0) else R3 <
 Machine Language Programming Worksheet R1 SolutionHere the flowchart is given as R1 <- x3100 , R3 <- 0 and R4 <- M[R1] if R4 == -1 exit(0) else R3 <

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site