Write an arm assembly function that takes an array

Assignment Help Assembly Language
Reference no: EM13166265

Write an ARM assembly function that takes an array of integers and insures that all entries are positive. Remember the initial integer in the array is at index zero.

 

The C language program is:

 

/* absdriver.c - driver for absarray function */

#include <stdio.h>

#include <stdlib.h>

 

extern int absarray( int array[], int size ) ;

 

int main( int argc, char * argv[] )

{

         int array[] = {1, 3, -5, -252, 280, -332 } ;

            int asize = sizeof(array) / sizeof(int) ;

            int result ;

            int i ;

 

            result = absarray( array, asize ) ;

            for( i = 0 ; i < asize ; i++ )

                        printf( " %d ", array[i] ) ;

            printf( "\n" ) ;

            exit( 0 ) ;

 

}

 

The input to the ARM assembly language function is a pointer to the first element of the array in register a1. The size of the array is in a2 and is the number of integers. Remember an integer is 4 bytes long.

 

Recall that the ldr instruction does not affect the condition codes. Also consider the reverse subtract instruction, rsb.

 

 

Reference no: EM13166265

Questions Cloud

How many grams of iodine : A compound of iodine and cesium contains 63.94g of metal and 61.06g of nonmetal. How many grams of cesium are in 38.77g of the compound? How many grams of iodine?
Compute the predetermined overhead rate for the year : Compute the predetermined overhead rate for the year. Break the rate down into variable and fixed components. (Omit the "$; sign in your response.)
How many grams of this gasoline would fill a tank : A brand of gasoline has a density of 0.737 at 25 degrees Celsius . How many grams of this gasoline would fill a 13.4 tank?
Calculate gallon of liquid ethanol : The density of ethanol is 0.7893 g/mL. Calculate the maximum work that could be obtained by burning 1.000 gallon of liquid ethanol
Write an arm assembly function that takes an array : Write an ARM assembly function that takes an array of integers and insures that all entries are positive. Remember the initial integer in the array is at index zero.
You are given for input the student name : Draw a flowchart to illustrate the following problem. You are given for input the student name, number of credits, and cost per credit. You need to output the student name, number of credits and total tuition.
What mass of o2 does the tank contain : Consider a steel tank whose volume is 65.0 L and which contains O2 gas at a pressure of 18100 kPa at 22°C. What mass of O2 does the tank contain?
Calculate the number of moles of o2 required to react : Calculate the number of moles of O2 required to react with phosphorus to produce 5.50 g of P4O6. (Molecular mass P4O6 = 219.9 g/mol.)
Program to build a database concerning employee information : Company XYZ needs a program to build a database concerning employee information.

Reviews

Write a Review

Assembly Language Questions & Answers

  Write a sequence of two instructions

Write a sequence of two instructions that copies the inter in 4-7 from the AL registers into bits 0-3 of the Bl register. The upper 4 bits of AL will be cleared as will the upper 4 bits of BL. (Microsoft Assembly Language)

  Program in assebly language to solve first degree equations

Create the program on Assebly language which can solve First Degree Equations in form of Ax + B = 0. Coefficients of equation must be entered from keyboard.

  Hexadecimal number that can be stored in eax

The largest 24 bits signed hexadecimal number that can be stored in EAX and table with hexadecimal numbers only.

  Draw a flow chart for this

Draw a Flow Chart for this 8051 assembly language program below. This program calculate y=x^2+ 2x+9. Register R0 has the x, and at the end of the program R2 should have y. (Test program for x=9).

  Assembly-language program

Write an assembly-language program to add each element of list1 to the corresponding element of list2 and store it in the same location of list2. Use a loop.

  Assembly language program that generates and displays

Write a assembly language program that generates and displays 20 random strings, each consisting of ten letter(A-Z, a-z)s or number(0-9)s.

  Write an assembly program

Prepare an Assembly program that reads in a number of cents.

  Provide the rtl instructions

Provide the RTL instructions and the time steps that will facilitate the execution of the following assembly language instructions  LDA addr,x  STX addr,x

  Program a maze-type game using assembly language

This project requires you to program a maze-type game using Assembly Language. It is not acceptable to use any other programming language for this project. T

  What would be the ieee 754 double precision binary

What would be the IEEE 754 double precision binary representation of the floating point value 2.71828×10-13? Express your final answer as a 16-hexdigit number and explain how your answer was obtained for full credit.

  Implement a simple 32 bit calculator program

Operand A  and  Operand B  have to be  signed  32 bit integers. So an operand can be a negative number. For example, if you input is (-1 + 3), it should return 2. Operator  must be one of the characters(' + ', ' - ', ' * ', ' / ', ' % ')

  Program that converts the temperature

Write a program that converts the temperature F in Farenheit to C in Celsius using C = (F-32)*5/9. For ease of programming you can display the result in fractions

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