Details of this Paper

1. Write a program to find the sum of the elements

Description

solution


Question

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.A. Copy and paste the register window at the second iteration where the carry becomes set. Highlight the carry flag to show that it is set.B. Copy and paste the register window to show the final result.

 

Paper#36711 | Written in 18-Jul-2015

Price : $20
SiteLock