Write a program to find the sum of the elements of an array


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.

Request for Solution File

Ask an Expert for Answer!!
Other Engineering: Write a program to find the sum of the elements of an array
Reference No:- TGS01085545

Expected delivery within 24 Hours