What help with this Assembly language Subroutine, Basic Computer Science

Assignment Help:
Write an ARM subroutine which will extract a substring from a string. You will need to use the library routine malloc to allocate memory for the new string.

The subroutine signature is:
char * mysubstring( char string[], int start, int end ) ;

where char string[] is the string to extract the substring from; it is passed into the ARM routine as a pointer in a1 to the first element of the character (byte) array,
int start is the first character to extract from the string to the substring; it is passed into the ARM routine as a value in a2,
int end is the last character to extract from the string to the substring; it is passed into the ARM routine as a value in a3.
The return is a pointer to the new string.

#include
#include

extern char * mysubstring( char string[], int start, int end ) ;

int main( int argc, char * argv[] )
{
char tosub[] = "this is the string to substring" ;
char * result ; /* pointer to new string */

result = mysubstring( tosub, 12, 17 ) ;
printf( "String: %s\nSubstring: %s\n", tosub, result ) ;

exit( 0 ) ;

}

To use the library routine malloc you need to calculate the number of bytes of memory you are requesting, put that number in a1 and bl malloc. Upon return from the library routine a1 will have a pointer to the allocated memory.

You may assume that the start and end values are within the string and malloc returns a proper pointer value.

Related Discussions:- What help with this Assembly language Subroutine

Database management, Suppose you are designing a database for an art museum...

Suppose you are designing a database for an art museum that owns a large volume of works of art. Each work of art is described by a unique item code, a title, a type, and a size. T

What is vpn? list the different types of vpn, Question 1 What is routing? ...

Question 1 What is routing? Explain the principles of routing Question 2 Explain different types of server operations in Enterprise Networking Question 3 Briefly d

Android database file not loading on real device, i have an android app whi...

i have an android app which uses a database file called question db which is stored in the assets file. I have tried a database example called android application development but f

About the faculty posts, is there any oppurtunity for a mca to teach mcasub...

is there any oppurtunity for a mca to teach mcasubjects online

#algorithm, #to determine whether given year is leap year or not

#to determine whether given year is leap year or not

Python Help, I need help! import cgi, cgitb cgitb.enable() HTML_head = ''C...

I need help! import cgi, cgitb cgitb.enable() HTML_head = ''Content-type: text/html\n\n'' HTML_top = '''''' Restaurant Results '' Restaurant Results '''''' HTML_bottom =

Describe any five requirements of clustering in data mining, Question 1...

Question 1 What is data mining? What are the major issues in data mining? Explain 2 What is meant by data reduction? Explain any three techniques of data reduction 3 Define a b

Cp, I NEED FLOW CHART ANT DRAWINGS OF BASIC OPERATIONS OF COMPUTER

I NEED FLOW CHART ANT DRAWINGS OF BASIC OPERATIONS OF COMPUTER

Programming, create a simple Visual Basic project

create a simple Visual Basic project

Write Your Message!

Captcha
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