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

  Identifies the cost of computer

identifies the cost of computer components to configure a computer system (including all peripheral devices where needed) for use in one of the following four situations:

  Input devices

Compare how the gestures data is generated and represented for interpretation in each of the following input devices. In your comparison, consider the data formats (radio waves, electrical signal, sound, etc.), device drivers, operating systems suppo..

  Cores on computer systems

Assignment : Cores on Computer Systems:  Differentiate between multiprocessor systems and many-core systems in terms of power efficiency, cost benefit analysis, instructions processing efficiency, and packaging form factors.

  Prepare an annual budget in an excel spreadsheet

Prepare working solutions in Excel that will manage the annual budget

  Write a research paper in relation to a software design

Research paper in relation to a Software Design related topic

  Describe the forest, domain, ou, and trust configuration

Describe the forest, domain, OU, and trust configuration for Bluesky. Include a chart or diagram of the current configuration. Currently Bluesky has a single domain and default OU structure.

  Construct a truth table for the boolean expression

Construct a truth table for the Boolean expressions ABC + A'B'C' ABC + AB'C' + A'B'C' A(BC' + B'C)

  Evaluate the cost of materials

Evaluate the cost of materials

  The marie simulator

Depending on how comfortable you are with using the MARIE simulator after reading

  What is the main advantage of using master pages

What is the main advantage of using master pages. Explain the purpose and advantage of using styles.

  Describe the three fundamental models of distributed systems

Explain the two approaches to packet delivery by the network layer in Distributed Systems. Describe the three fundamental models of Distributed Systems

  Distinguish between caching and buffering

Distinguish between caching and buffering The failure model defines the ways in which failure may occur in order to provide an understanding of the effects of failure. Give one type of failure with a brief description of the failure

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