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

  What ip range would an isp provide to a customer

Using the IP ranges below: a) What IP range would an ISP provide to a customer, if the customer wanted a range of Public IP's for use on theInternet? Explain your choice and why you feel the other choices are not adequate ?

  What does this value indicate

The value of the Destination Address in a given Ethernet frame contains ff:ff:ff:ff:ff:ff. What does this value indicate?

  Write dissolve method for three color components

It does this by incrementing (by 1) all three color components (using the above accessor and mutator methods) as well as the alpha component value. Write down dissolve method.

  Maslow hierarchy of needs

Discuss and explain how the theory designates the team member roles and responsibilities also discuss how Maslow's Hierarchy of Needs applies to professional work dynamics.

  Find whether bit string contains two consecutive one bits

You wish to find out whether bit string contains two consecutive 1 bits. Obviously, you can do this using n probes. For which values of n in range {3, 4, 5, 6, 7} can this be done using fewer than n probes?

  Derive and estimate the error

Derive and estimate the error of Simpson's 3/8 Rule using the Newton's Interpolating Polynomials.

  Discuss the role of the project manager or team

Summarize how the project manager or team exhibited exceptional and ethical project management practices. 2.Discuss the role of the project manager or team

  How old are they now

A good old-fashioned word problem. Don't forget use rref() and the backslash method to solve it. Peter is four times older than Mary. In four years, he will be two times older. How old are they now? How to solve using matlab?

  Representing information by predicate-calculus sentences

Represent this information by predicate-calculus sentences in such a way that you can represent the question Is there a member of the alpine club

  Determine the monthly charges for checking accounts

The billing department at the bank has asked for your team's help. They want to develop a program that will determine the monthly charges for checking accounts.

  Write a program for line clliping

Write a program for line clliping. Take co-ordinate of 2 point as input and also take 4 co-ordinates of window. It should clip the line outside the window. Dont use built in function like line or rectangle to draw line or rectangle.Use dda line al..

  Steps to follow to verify local police department-s findings

Your computer investigation firm has been hired to verify the local police department's findings on a current case. What do you need to ask the police investigator for, and what procedures should you follow?

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