Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write an ARM assembly function that takes a mixed case string and returns the string in all upper case characters. The input string to the

Write an ARM assembly function that takes a mixed case string and returns the string in all upper case characters. The input string to the function is immutable (cannot be changed). You must return a pointer to the new string.

To obtain a pointer to the new string you first need to determine the string length using the strlen function in the library routines. The input to the function is a pointer to a string in a1 and its output is the string length in a1. This number does not include the null byte sentinel at the end of the string so you should add 1 before the next step.

To obtain a pointer to the space for the new string use the malloc library routine. The input to the function is the number of bytes requested for the new space in a1. The output of the function is a pointer to the space requested in a1.

To change a lower case character to upper case change bit 5 in the ASCII character code to zero. For example to change a, 0x0110 0001, to A, 0x0100 0001, reset bit 5 (from the right starting the count at 0) to zero.

The C language program is:

#include

extern char * upcase( char * str ) ;

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

{

char str[] = "This Is tHe strINg to Upper Case" ;

char * result ;

result = upcase( str ) ;

printf( "Original string: %s ", str ) ;

printf( "Upcased string: %s ", result ) ;

}

The input to the ARM assembly language function is a pointer to the first element of the string in register a1. Remember a character is 1 byte long. A string in C is terminated with a null byte (one equal to zero).

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Machine Learning And Knowledge Discovery In Databases European Conference Ecml Pkdd 2015 Porto Portugal September 7 11 2015 Proceedings Part 1 Lnai 9284

Authors: Annalisa Appice ,Pedro Pereira Rodrigues ,Vitor Santos Costa ,Carlos Soares ,Joao Gama ,Alipio Jorge

1st Edition

3319235273, 978-3319235271

More Books

Students also viewed these Databases questions

Question

How do the degree of confidence and the degree of precision differ?

Answered: 1 week ago

Question

draw curved arrows for the mechanism Transcribed image text

Answered: 1 week ago

Question

Q.No.1 Explain Large scale map ? Q.No.2 Explain small scale map ?

Answered: 1 week ago

Question

Know how to use reservations systems to inventory demand.

Answered: 1 week ago

Question

Be familiar with the integrative servicescape model.

Answered: 1 week ago