1. Write a program to find the sum of the elements of an array called list1. The
ID: 1813099 • Letter: 1
Question
1. Write a program to find the sum of the elements of an array called list1. The size of list1 is four bytes. The values of list1 are $FF, $1, $FE, and $02. To check your work, the sum should become $0200.
The requirements for writing this program are as follows.
-You must use a loop and count variable (i.e. count must be defined in the data section) as a loop counter.
- Clear both Registers A and B using CLRA and CLRB instructions.
-Use indexed addressing mode to access the elements of the array using Register X as the index register. The instruction LDX #list1 places the array list1 address into Register X.
-Add each element to Register B.
-Use the branch instruction BCC to check if there is a carry after the addition of each element. BCC means the Branch if Carry flag is clear.
-If there is a carry, add 1 to Register A.
-The final result should be in Register A and B.
Explanation / Answer
http://www.chegg.com/homework-help/questions-and-answers/introduction-loops-subroutines-assembly-language-i-objectives-1-familiar-conditional-branc-q3567353 CHECK THE LINK
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.