Calculate the number of elements in an array not counting

Assignment Help Computer Engineering
Reference no: EM132214032

Write a subroutine which satisfies the following:

Name: NElements When the subroutine is entered it expects the stack to look as follows (as looked in word increments):

Top of the stack -> PC counter value

Space for output

Input

Runs Properly on launch pad using Code Composer w/ Assembly Language

Subroutine expects the Input on the stack as shown above: The input is the starting address of an array consisting of word length elements. The last element of the array is expected to be -999.

Subroutine will place one word of output on the stack in the space as shown above: Output is the number of words in the array (not counting the last word which equals -999) whose starting address is in the input.

The subroutine only works with arrays whose last element is -999. It calculates the number of elements in an array not counting the last element -999.

For example the array: 2, 45, 67,-34, 1, -999 has 5 number of elements.

The subroutine should save all local variables on the stack. You will need to use Indirect Register Mode for iterating through the array for which you will need to use a core register. Use R10 for this purpose. As soon as you enter the subroutine, save the existing value of R10 by pushing it on the stack. Just before exiting the subroutine pop the saved value back into R10.

Test this subroutine in main code by using an array Named MyArray with word elements [2, 3, 67, -34, 1, -999] placed in the .text region and storing the output in a variable named "Result". Use loops for repeated tasks.

Include pseudo code (subroutine only), flow chart (subroutine only) and the text of the assembly file (main program + subroutine). Also include a screen shot of the memory browser which shows the variable "Result" clearly.

Reference no: EM132214032

Questions Cloud

Write a stored procedure that inserts a new row : Write a stored procedure that inserts a new row into the Supplier table and then adds at least one new product that the new supplier stocks.
Compute the checksum for a data table : Write a subroutine that computes the CHECKSUM for a data table (by XO Ring all the data bytes).
Find the cyclic rotation that is the smallest lexicographic : Write a SuffixArray client that, given a string, finds the cyclic rotation that is the smallest lexicographically in linear time.
Write and test a data structures template : Write the template for an array of capacity =2 (default constructor) of unspecified type.
Calculate the number of elements in an array not counting : MSP430G2553 :Subroutine expects the Input on the stack as shown above: The input is the starting address of an array consisting of word length elements.
Remove occurrences of a given character in a string : Write a subroutine in assembly that removes occurrences of a given character in a string if it is after or before the space.
Write and test a c implementation of the mobius function : Write and test a C implementation of the Mobius function M(n) defined as follows.
Determine your clients net capital gain or net capital loss : HI6028 Taxation Theory, Practice & Law - Advise Rapid-Heat of its FBT consequences arising out of the above information, including calculation of any FBT
Write the assembly language for the subroutine : Write the assembly language for the subroutine (called by a main program) and simulate using the sample data table: 24, 65, F0.

Reviews

Write a Review

Computer Engineering Questions & Answers

  Mathematics in computing

Binary search tree, and postorder and preorder traversal Determine the shortest path in Graph

  Ict governance

ICT is defined as the term of Information and communication technologies, it is diverse set of technical tools and resources used by the government agencies to communicate and produce, circulate, store, and manage all information.

  Implementation of memory management

Assignment covers the following eight topics and explore the implementation of memory management, processes and threads.

  Realize business and organizational data storage

Realize business and organizational data storage and fast access times are much more important than they have ever been. Compare and contrast magnetic tapes, magnetic disks, optical discs

  What is the protocol overhead

What are the advantages of using a compiled language over an interpreted one? Under what circumstances would you select to use an interpreted language?

  Implementation of memory management

Paper describes about memory management. How memory is used in executing programs and its critical support for applications.

  Define open and closed loop control systems

Define open and closed loop cotrol systems.Explain difference between time varying and time invariant control system wth suitable example.

  Prepare a proposal to deploy windows server

Prepare a proposal to deploy Windows Server onto an existing network based on the provided scenario.

  Security policy document project

Analyze security requirements and develop a security policy

  Write a procedure that produces independent stack objects

Write a procedure (make-stack) that produces independent stack objects, using a message-passing style, e.g.

  Define a suitable functional unit

Define a suitable functional unit for a comparative study between two different types of paint.

  Calculate yield to maturity and bond prices

Calculate yield to maturity (YTM) and bond prices

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