Use a subroutine to find the sum of the array elements

Assignment Help Other Engineering
Reference no: EM13805290

Write a program to use a subroutine to find the sum of the array elements. For simplicity, assume that the sum of the data values is less than $FF. You do not need to use the BCC to check for carry flag. Follow the following steps to write this program.

- Define two arrays called List1 and List2 using DC.B directive. Initialize List1 with byte-size values of $6, $12, $4, $0F, and $11. Initialize List2 with byte-size values of $4, $5, and $7. Reserve two byte-size locations called Sum1 and Sum2 using DS.B directive.

- The subroutine must find the sum of the elements of the array list1. Before calling the subroutine, the main program must initialize Register X to have the address of the array and Register B to have the size of the array. 

- The subroutine must use a loop and indexed addressing mode using Register X as the index register and Register B as the loop counter. The subroutine must return the sum in Register A.

- The main program must call the subroutine two times. The first time, the subroutine will find the sum of the array List1. After returning from the subroutine, the main code must save Register A in Sum1. Then, the subroutine is called for a second time to find the sum of the elements in List2. After the return from the subroutine, the value of Register A is saved in Sum2.

- Since this code is using a subroutine, make sure to initialize the SP register using: LDS   #$4000.

This line must be added to the main code before calling any subroutines.

Reference no: EM13805290

Questions Cloud

Create graphic organizer that includes definition for voice : Create a graphic organizer that includes a definition for the Voice, as well as an activity that supports learning. Voice is the author's fingerprint on the page.
Mprove the tracking of voice over ip : As the lead software engineer for a medium-sized hospital, you have been asked to spearhead an effort to improve the tracking of Voice Over IP (VOIP) calls made within the hospital system
Write an assembly language program to load register : Write an assembly language program to load Register A with number 7, and Register B with number 8. Add these two registers
Create a graphic organizer that includes organization : Create a graphic organizer that includes a definition for the Organization, as well as an activity that supports learning.
Use a subroutine to find the sum of the array elements : Write a program to use a subroutine to find the sum of the array elements. For simplicity, assume that the sum of the data values is less than $FF
Explain the organization''s motives : Create a word document or powerpoint presentation detailing the events you selected. Include the following in your document or powerpoint presentation
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
Create a graphic organizer that includes ideas and content : Create a graphic organizer that includes a definition for the Ideas and Content, as well as an activity that supports learning.
Exchange rate between the mexico pesoand australian dollar : Which economist believes that there is a continuing trend in the development of the exchange rate and which economist believes that there is a reversal in the development of the exchange rate?

Reviews

Write a Review

Other Engineering Questions & Answers

  Characterization technology for nanomaterials

Calculate the reciprocal lattice of the body-centred cubic and Show that the reciprocal of the face-centred cubic (fcc) structure is itself a bcc structure.

  Calculate the gasoline savings

How much gasoline do vehicles with the following fuel efficiencies consume in one year? Calculate the gasoline savings, in gallons per year, created by the following two options. Show all your work, and draw boxes around your answers.

  Design and modelling of adsorption chromatography

Design and modelling of adsorption chromatography based on isotherm data

  Application of mechatronics engineering

Write an essay on Application of Mechatronics Engineering

  Growth chracteristics of the organism

To examine the relationship between fermenter design and operating conditions, oxygen transfer capability and microbial growth.

  Block diagram, system performance and responses

Questions based on Block Diagram, System Performance and Responses.

  Explain the difference in a technical performance measure

good understanding of Mil-Std-499 and Mil-Std-499A

  Electrode impedances

How did this procedure affect the signal observed from the electrode and the electrode impedances?

  Write a report on environmental companies

Write a report on environmental companies

  Scanning electron microscopy

Prepare a schematic diagram below of the major parts of the SEM

  Design a pumping and piping system

creating the pumping and piping system to supply cool water to the condenser

  A repulsive potential energy should be a positive one

Using the data provided on the webvista site in the file marked vdw.txt, try to develop a mathematical equation for the vdW potential we discussed in class, U(x), that best fits the data

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd