Program 4

String Manipulation

Due: Monday, March 30

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.  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. Create a string (str1) containing "This is a test".
  2. Create a string (str2) containing "of our string routines".
  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. Create an empty string (str4).
  2. Performs a loop 5 times that:
    a.    Inputs a string from the keyboard (str5) - using memory mapped I/O functions
    b.    Appends str5 to str4
    c.    Prints str4

Write a third program that:

  1. Reads a string from a file on one line, reads a string from the next line, concatenates them (without new lines) and print out the new string.