I have to write a program that will input a list of positive 2-digit integrs and will compute the sum of all the numbers that are multiples of three and print out the sum. The numbers are to be input from the keyboard after a prompt is written on the monitor. The value zero will act as a sentinel value at the end of the data.
Well so far I have the program working with an input of a list of positives 1-digit integers; now I want you to help me to change the program so it will have a input of a list of 2-digit integers.
Please help me I really need your help. Here is the code that I have:
.ORIG X3000 LD R2, CHANGE;FFD0 in R2 LD R4, CHANGE2;0030 in R4 AND R6, R6, #0; ADD R1, R5, #1;1 in R1 LOOP ADD R5, R1, #0; 1 in R5 BRz END;if R5 = 0 then go to END TRAP x23;print a prompt on the screen and read a single;character from the keyboard its ascii code àR0 ADD R1, R0, R2;ASCII prompt + ffd0 à R1 ADD R7, R1, #-3;result in R1 - 3 à R7 BRz GETNUM;if R7 = 0 go to GETNUM ADD R7, R1, #-6;result in R1 -3 à R7 BRz GETNUM;if R7 = 0 go to GETNUM ADD R7, R1, #-9;result in R1 -3 à R7 BRz GETNUM;if R7 = 0 go to GETNUM BR ENDIF;Go to ENDIF GETNUM ADD R6, R6, R1;Ascii value goes to R6 ENDIF BR LOOP;Go to LOOP END AND R1, R1, #0;clear R1 AND R2, R2, #0;clear R2 AND R3, R3, #0;clear R3 ADD R1, R6, #0;Ascci value goes to R1 BRz RESULT1;if R1 = 0 go to RESULT1 BRp RESULT2;if R2 = positive # go to RESULT2 ; RESULT1 LEA R0, ERROR;address of ERROR à R0 TRAP x22;write a string of ascii characters to the console TRAP x25;halt execution and print a message on the console ; RESULT2 LEA R0, MESSAGE;address of MESSAGE à R0 TRAP x22;write a string of ascii characters to the console ADD R1, R6, #-9; BRnz RESULT3;If R1 = - or 0 go to RESULT3 BR RESULT4;Go to RESULT4 ; RESULT3 ADD R6, R6, R4;ASCII value + 0030 à R6 ADD R0, R6, #0;what is in R6 à R0 TRAP x21;Write a character in R0 to the console display TRAP x25;halt execution and print a message on the console ; RESULT4 ADD R0, R6, #0; what is in R6 à R0 WHILE ADD R0, R0, #-10;what is in R6 - 10 à R0 ; BRzp DOBODY;if R0 = 0 or positive go to DOBODY BR ENDWHILE;go to ENDWHILE ; DOBODY ADD R3, R3, #1;increment R3 BR WHILE;go to WHILE ; ENDWHILE ADD R2, R0, #0;result of R0 goes into R2 ADD R2, R2, #10; ADD R0, R3, R4; TRAP x21;Write a character in R0 to the console display ; ADD R0, R2, R4; TRAP x21;Write a character in R0 to the console display TRAP x25;halt execution and print a message on the console ; MESSAGE .STRINGZ " The sum of the multiples of three is:" ERROR .STRINGZ "There are no multiples of three in the list" CHANGE .FILL XFFD0 CHANGE2 .FILL x0030 .END
please I would appreciate your help. Thank you











