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

  Write the complete myfnc function to return the value 1

Write the complete myfnc function to return the value 1 if they are equal and return the value 0 if they are not equal.

  Compare with that of a general pda

c) Could the Mark 100 or Mark 200X process this string: 0n1n? How about 1n0m1m0n? Succinctly justify you answer. d) How does the power of the Mark 100 and Mark 200X compare with that of a general PDA? Succinctly justify your answer.

  Solve reasoning problem

If Abby is communicating, so is Randy. Vijay and Kevin are either both communicating or neither is. If Heather is communicating, then so are Abby and Kevin. Describe your reasoning.

  Create a class includes instance variables

Create a class called Employee that includes three pieces of information as either instance variables or automatic properties - a firstname (type string), a last name (type string) and a monthly salary (decimal) Your class should have a constructo..

  What techniques have greatest impact on website

What web design techniques would you use to help a user with these disabilities? What techniques might have the greatest impact on your website and why?

  How each room is identified by a room number

Each resident patient will stay in only one room. Every room must have had a patient, and every resident patient must have a room.

  Find an article that describes a computerized database

Find an article that describes a computerized database system that is in use in the field in which you work

  Features of organization to make and use information systems

Write down the features of organizations do managers require to know about to make and use information systems successfully?

  Create a new group called mygroup

Directions: As you complete each of the following steps, keep track of what occurs at each point, including what you type, the output given, and if you experience any errors.

  Why can i only see up to the index of this book

Why can I only see up to the index of this book? I understand it's a large book and you may only want to give the reader access to part of the book, but if it's read only until I get my book in the mail, why can't I see the whole book

  Discuss the fundamental advantages and disadvantages

Companies that currently use expert systems. Next, discuss the fundamental advantages and disadvantages of using expert systems instead of human expertise within the companies that you have selected. Provide a rationale to support your response..

  Use strong induction to show that every positive

Use strong induction to show that every positive integer n can be written as a sum of distinct powers of two, that is.

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