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

  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 function in linux assembly

Write a function in Linux assembly

  Analog measurements

Prepare an assembly program for the correctly measures the wind direction

  Design a simple digital clock

Design a simple digital clock

  Write an assembly program

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

  Write an assembly language program

Write an assembly language program for encrypting alphabates of a string

  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 assembly program-find right admission price to movie

Write the Assembly program to find correct admission price to movie. Price of admission to a movie is $7 for kids (under 12) and $9 for adults.

  Create simple 8-bit alu using add-subtract-shift functions

Create a simple 8-bit ALU. Requirements:The eight functions that you will implement are: add, subtract, and, or, shift left logical, less than, shift right logical.

  Write assembly program print binary representation-integers

Write the assembly program called hw6_ex1, stored in file hw6_ex1.asm. This program must prompt user to enter signed 32-bit integer. Program must print out binary representation of the integer.

  Allot op-codes and add microcode to microprogram

Allot op-codes and add microcode to microprogram of Mic-1 to implement following instructions which are then included with IJVM instruction set.

  Write mips assembly program to read two non-negative numbers

Write MIPS assembly program to repeatedly read two non-negative integers and print integer product and quotient without using multiplication and division instructions.

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