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 an assembly program

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

  Create a strcat procedure

Create a strcat procedure (like C's strcat function). Your procedure will be given the addresses (using the method presented in Chapter 8) of two string arrays.

  Build an 8088 assembler

In this project, you will build an 8088 assembler. The job of your assembler is to turn 8088 assembly code (i.e., the 8086 assembly code language) into 8088 machine code that executes in an DOS emulator.

  Application that finds all 4 digit numbers

Create an application that finds all 4 digit numbers (those would be the numbers in the range 1000-9999) whose value is equal to the sum of each digit raised to the fourth power. MEANINGFUL output should be sent to the screen.

  Greatest common divisor of integers-masm assembly language

Must be done in MASM assembly language: Greatest common divisor of two integers is largest integer which will evenly divide both integers. GCD algorithm involves integer division in a loop.

  Write a mips assembly language program

Write a MIPS assembly language program that prompts for a user to enter a series of floating point numbers and calls read_float to read in numbers and store them in an array. Then the program should display the array content on the console window. Th..

  Assembly language point-of-view

From an Assembly Language point-of-view, any registers that are touched by a function need to first be preserved and then later restored to their original value when that function ends, if that functions wishes to leave no side-effects after its exec..

  Design a calculator in assembly

Design a calculator in assembly that can handle +,-,/,%, * and expresses errors in the case of division by zero or invalid characters using the template below.

  Create a assembly language subroutine

Create a assembly language subroutine MULSUM that takes an array named A containing n bytes of positive numbers, and fills two arrays, array B containing n words and array C containing n long words

  Write a program in assembly code for the simulator

Write a program in assembly code for the simulator that will count from 107 to 14 backwards by 3 and display the counter in the output on each iteration of the loop. (Must be in R1, R2, load and add form)

  Write a function in linux assembly

Write a function in Linux assembly

  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

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