Program 6

String Manipulation

Due: Monday, April 24

We will be using pointers in assembly language to manage dynamic structures.  We will use syscall 9 to acquire memory space from the heap at run time.  Read about the arguments and how to use syscall 9.  A dynamic string is dynamically allocated to be the proper size and ends in the null character (0)

Write an assembler language program with the following 4 functions:

The main will perform the following actions

  1. Dynamically create a string (str1) containing "This is a test".  The value is passed via an asciiz string declared in the .data section
  2. Create a string (str2) containing "of our string routines".  Same as above
  3. Create a string (str3) by appending str1 to str2.
  4. Print a title, followed by str1, str2 and str3; all properly labeled.

Write a second program that:

  1. Reads a string from the first line of a file, reads a string from the next line, concatenates them (without new lines) and prints out the new string.