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

Software Exploration, I need to review 2 different softwares one is windows...

I need to review 2 different softwares one is windows based and the other is Linux Based. Please Ask for further details

Describe counting instructions, They are used to reduce or enlarge the cont...

They are used to reduce or enlarge the content of the counters. DEC INC DEC INSTRUCTION Idea: To diminish the operator. Syntax: DEC destiny This action subtracts 1 from the destiny

Output devices, Output Devices: Each output unit of computer system tr...

Output Devices: Each output unit of computer system transmits information from the CPU and converts the electrical pulses to an appropriate output form. A printer, for example

Microprocessors, what is the role of microprocessors in IT? how they are us...

what is the role of microprocessors in IT? how they are used in medical field? how they are used in our real lifes? how they are used in latest technology?

Python Strings and Python Lists, Python Strings: Strings in Python are rec...

Python Strings: Strings in Python are recognized as an adjacent set of characters in among quotation marks. Python permits for either pairs of single or double quotes. Subsets of s

Explain any two issues in web design, Question 1 Explain any two issues in...

Question 1 Explain any two issues in web design Question 2 Mention the factors considered for good design Question 3 What are the advantages of graphical system?

Languages used in artificial intelligence, R e presentations/Languages Us...

R e presentations/Languages Used: Many people are taught Artificial Intelligence with the opening line: "The three most essential things in Artificial Intelligence are repres

Unix/linux, I need someone to help me with my Unix/Linux homework.

I need someone to help me with my Unix/Linux homework.

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