Write an arm subroutine which will extract a substring

Assignment Help Assembly Language
Reference no: EM13166999

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. Use the pointers(a1,a2,a3) as stated below for writing ARM PROGRAM

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

#include <stdlib.h>

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. Please use the pointers(a1,a2,a3) as stated above.

Reference no: EM13166999

Questions Cloud

The village of marengo conducted a census : But instead of writing your pseudocode/program for "fewer than 300" households, write your pseudocode/program for EXACTLY 7 households.
Write a program that uses a bar : Write a program that uses a bar chart to display the percent-ages of the overall grade represented by the project, quizzes the midterm exam and the final exam
Produce a diagram showing schema : Produce a diagram showing schema and the partial and transitive dependencies in your 1NF. b. Produce a diagram showing table schema and any transitive dependencies in your 2NF
Write a java program that asks the user for his/her gender : According to researchers at Stanford Medical School, the ideal weight for a woman is found by multiplying her height in inches by 3.5 and subtracting 108.
Write an arm subroutine which will extract a substring : 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. Use the pointers(a1,a2,a3) as stated below for writing ARM PROGRAM
Write a program that will read in 4 test scores per line : Write a program that will read in 4 test scores per line. Print the total number of points earned, your program should work for any number of lines of data.
Determine if the string s=s1s2...sk : Suppose we want to determine if the string s=s1s2...sk is a substring much larger string a1a2...an. One approach is to compute h(s) with some hash function h.
Derive the state equations : Derive the state equations A(t+1) and B(t+1) by substituting the input equations for the J and K variables, and draw the state diagram of the circuit.
Write a program that declares three one dimensional : Write a program that declares three one dimensional arrays named miles, gallons, and mpg . Each array should be declared in main( ) and should be capable of holding ten double

Reviews

Write a Review

Assembly Language Questions & Answers

  Displays a single character at 100 random screen

Write a program that displays a single character at 100 random screen locations, with a delay factor of 100 milliseconds.Hint: set the console window screen height to 200 at runtime.

  Write an isr and startup code for a system that lights up le

Write an ISR and startup code for a system that lights up LED0 on the PSoC Eval1 board (assuming that a wire is connecting P1[0]) to indicate "Low Voltage"

  Create simple 8-bit alu using add-subtract-shift functions

Create a simple 8-bit ALU. Requirements:The eight functions that you will implement are: add, subtract, and, or, shift left logical, less than, shift right logical.

  Implement a simple 32 bit calculator program

Operand A  and  Operand B  have to be  signed  32 bit integers. So an operand can be a negative number. For example, if you input is (-1 + 3), it should return 2. Operator  must be one of the characters(' + ', ' - ', ' * ', ' / ', ' % ')

  The arm assembly language routine

For the ARM assembly language routine below, what function does it perform for the calling program?

  Write an assembly program

Prepare an Assembly program that reads in a number of cents.

  Problems does an assembler have to overcome

What problems does an assembler have to overcome in order to produce complete binary code with only one pass over the source code? How would code written for a one-pass assembler be different from code written for a two-pass assembler?

  Program a maze-type game using assembly language

This project requires you to program a maze-type game using Assembly Language. It is not acceptable to use any other programming language for this project. T

  Write a hla assembly program

Write a HLA assembly program that Read 2 hex digits with the bits abccdddd. "a" is for determining if the person female or male(1 male, 0 female) "b" is for determining if the person student or not (1 yes, 0 no) "cc" is for determining which semes..

  Design a simple digital clock

Design a simple digital clock

  Program in assebly language to solve first degree equations

Create the program on Assebly language which can solve First Degree Equations in form of Ax + B = 0. Coefficients of equation must be entered from keyboard.

  Secant method to try to find a root

Create a function that will use the Secant method to try to find a root. (Hint modify the posted version of False Position.) Because this method may diverge, you should limit the number of time the loop repeats.

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