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

What is computer, how to use computer and how we can manage it

how to use computer and how we can manage it

Wat do u do, can u write my assignment for me

can u write my assignment for me

Ip basics, IP provide connectionless service to upper layer IP protocol is ...

IP provide connectionless service to upper layer IP protocol is very simple could not guarantee the reliability of transportations IP protocol is Point to Point IP provide the unif

Operating system problems, 1. In discussing software algorithms for mutual ...

1. In discussing software algorithms for mutual exclusion, we noted that optimizing compilers and out-of-order execution by processors could invalidate most of these algorithms bec

Applications software, Applications Software: General aspects on appli...

Applications Software: General aspects on applications software. Applications software is the program that allow the user to get the required work done. In other words, applic

Diskless workstations, Diskless workstations:    Most people assume th...

Diskless workstations:    Most people assume that the operating system is stored on a disk that is connected directly to the computer, but this is not necessarily true. If the

Importance of good database design , Importance of Good Database Design Poo...

Importance of Good Database Design Poor database design may have results in unwanted data redundancy Poor database design keeps errors leading to bad decisions and results Practica

Project, how to set up the location (e.g. plaza, hall of fame, lecture thea...

how to set up the location (e.g. plaza, hall of fame, lecture theater or etc.) and services that will be used during the exhibition; devices needed; and finally produced a compreh

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