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.
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.
|