Write an arm assembly function

Assignment Help Basic Computer Science
Reference no: EM13306261

Write an ARM assembly function that takes a string and two characters and returns a pointer to a new modified string. The first character is the character to replace and the second is the character to replace it with. The C program below changes the character 'i' to an 'X'

The C language program is:

#include <stdio.h>

extern newsubst( char * string, char this, char that ) ;

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

{

            char * result ;

            char this = 'i' ;

            char that = 'X' ;

            char string[] = "Another string to modify" ;

 

            result = newsubst( string, this, that ) ;

            printf( "Original: %s\nModified: %s\n", string, result ) ;

}

The input to the ARM assembly language function is a pointer to the first element of the string in register a1. The character to look for is in a2 as a byte in the low part of the register and the character to replace it with is in a3 as a byte in the low part of the register. Remember a character is 1 byte long. A string in C is terminated with a null byte (one equal to zero).

To determine the length of the string you can use the library subroutine strlen. The input to this subroutine is a pointer to the string in a1. The subroutine returns the length of the string not counting the terminating null byte in a1.

To obtain space for the new string you can use the library subroutine malloc. The input to this subroutine is a number of bytes of space to obtain in a1. The subroutine returns a pointer to the allocated space in a1.

 

Reference no: EM13306261

Questions Cloud

List the volcanic hazards associated with shield volcanoes : You have been hired to plan and build a subdivision on the volcanic island of Hawaii. As you know, this island is made of several shielf volcanoes. A) List the volcanic hazards associated with shield volcanoes.
What is probability that the wave height will exceed 6 meter : A nuclear facility in a coastal region is built to withstand ocean wave forces. Suppose the annual maximum wave height of the ocean waves (above the sea level) is a lognormal random variable with mean height of 4.0 meters and a c.o.v. of 0.8
Discuss the benefits of traditional linux file permissions : Discuss the benefits of the traditional Linux file permissions scheme. How might it be superior to permission methodologies employed in other operating systems and what are the differences in overall approach to permissions, privilege, and securit..
Illustrate and draw the transformation for each case : Illustrate and draw the transformation for each case.
Write an arm assembly function : Write an ARM assembly function that takes a string and two characters and returns a pointer to a new modified string. The first character is the character to replace and the second is the character to replace it with. The C program below changes t..
Calculate the minimum required minimum wall thickness : A tubular aluminium bar (G=28GPa) of square cross section with outer dimensions 50mm x 50mm must resist a torque T=300Nm. Calculate the minimum required wall thickness t_min if allowbale shear stress is 20MPa
What makes these pairs transitive : What I dont understand is how these pairs are considered transitive. My question is what makes these pairs transitive?
What is the minimim required diameter d-min of the pins used : A plane truss has joint loads P, 2P, and 3P at joints D, C and B, respectively where load variable P=23kN. All members have two end plates which are pin-connected to gusset plates.
Why a monopoly can potentially earn super-normal profit : Explain, using diagrams, why a monopoly can potentially earn super-normal profit in both the short run and the long run, while perfectly competitive firms can only earn normal profit in the long run.

Reviews

Write a Review

Basic Computer Science Questions & Answers

  Provide permission to get financial amounts

System to have employees register and provide permission to get financial amounts from dental insurance and retirement companies.

  Describe in english the language defined following grammer

Describe in English the language defined by the following grammar with start symbol S

  A fuel economy study was carried out

A Fuel economy study was carried out for five models of cars. each car was driven 100 miles, and then the model of the car and the number of gallons used were placed in a line of the file Mileage.txt. Table 7.22 shows the data for the entries of t..

  Determine size of one minute mono audio file

Digital audio transducer samples real sound at the rate of 40 kHz and assigns 8 bits to each sample. Determine the size of one minute mono audio file?

  Create and conducting an online questionnaire

Create a free SurveyMonkey or QuestionPro online questionnaire account. If you did not create one, revisit the Week 5 e-Activity to create an account before attempting this assignment.

  Write a program that reads three integers and print

Write a program that reads three integers and print "In order" if they are sorted in ascending order or descending order, or "not in order" otherwise. For example: 1 2 5 in order 1 5 2 not in order 5 2 1 in order 1 2 2 in order 5 1 2 not in order.

  Action of violation of principle of least common mechanism

Discuss how this technique might prevent legitimate users from accessing the system. Why is this action a violation of the principle of least common mechanism?

  Business intelligence and data warehouses

Business Intelligence and Data Warehouses

  Profit do you make on each wafer

If your demand is 50,000 Woods chips per month and 25,000 Markonchips per month, and your facility can fabricate 150 wafers a month, how many wafersshould you make of each chip?

  Hand coding

Are you beginning to develop a sense of what is happening with this coding, and the html document?

  Use rfid for inventory and theft prevention

Write clearly and concisely about information security legal issues and topics using proper writing mechanics and technical style conventions

  Explain ibm plan to give its it assets-intellectual property

Will IBM's plan to give away some of its IT assets and intellectual property also increase its support of open-source software products like Linux.

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