Find the sum of the array elements

Assignment Help Electrical Engineering
Reference no: EM13307065

Write a program in machine code 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.
Copy and paste the source code.
Copy and paste the assembly, register, and memory after the first JSR instruction to verify that stack holds the return address.
Copy and paste the memory window to show the values of Sum1 and Sum2.

Reference no: EM13307065

Questions Cloud

Determine maximum moment in the beam if spinned at both ends : If the live load on a 30 foot long beam is 1.2 kip/feet and the dead load is 0.8 kip/feet determine the maximum moment in the beam (kip-ft) if it is pinned at both ends. Assume the weight of the steel is 0.3 kip/feet.
Describe the general tree adt : Describe the General Tree ADT. Discuss different ways for implementing general trees, and compare them in terms of the efficiency of search operations.
Obtain the work done by air resistance : A ball (mass 100g) is recorded to have a speed of 2m/s after falling 5m under gravity. What is the work done by air resistance
What kind of a binary tree is the heap : What kind of a binary tree is the heap? Explain different operations of heaps. Compare heaps to binary search trees in term of efficiencies of main operations.
Find the sum of the array elements : Write a program in machine code 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 ste..
Challenge creating a national health system : In your opinion, what you do you believe will be our nation's greatest challenge creating a national health system?
Find the broadcast throughput of the network. : Find the broadcast throughput of the network.
How many days will contractor require to complete the work : A contractor has both a 3-cy and a 5-cy shovel in the equipment fleet. Select the minimum-size shovel that will excavate 400,000 bcy of common earth in a minimum of 130 working days of 8 hr each.
Egyptians buried with books of going forth by day : Why were Egyptians buried with Books of Going Forth by Day (Books of the Dead)?

Reviews

Write a Review

Electrical Engineering Questions & Answers

  Lithium ion battery technology

The paper includes Lithium ion battery technology with its advantages and disadvantages. The paper discusses about the Lithium air battery in which detailed reactions of Lithium with air including nonaqueous as well as aqueous are given.

  Power transformers and tariffs

Construction of different types of power transformer, significant energy savings

  Paper on orthogonal frequency-division multiplexing

This document is shown a paper on Orthogonal frequency-division multiplexing with advantages, disadvantages and uses.

  Function of the hmi in a scada system

This assignment contains electronics engineering questions like State the commonly found components of a SCADA (Supervisory control and data acquisition) system. and decribe the function of the HMI in a SCADA system.

  Resultant waveform of the odd harmonic series

Prepare an Excel graph showing the individual components and summated resultant waveform of the odd harmonic series resulting in an approximate square wave.

  Explain scada system

Explain the function of the HMI in a SCADA system.

  Design a 2-digit 24 second shot-clock

Design a 2-digit 24 second "shot-clock" countdown timer with pushbutton controller.

  Model a discrete-time system

To understand di erent signal models To be able to model a discrete-time system and design simple signal processing algorithms.

  Draw a relay construction diagram

Draw a relay construction diagram and briefly explain the operation of a relay.

  Frequency division multiplexing

Write a short technical report on Frequency Division Multiplexing

  Impact of electron energy

Briefly discuss the impact of electron energy, electron current and target on the Bremsstrahlung generated.

  Traffic light controller

The schematic of the traffic light controller

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