Write an assembly language program that examines a series of text lines entered at the terminal and produces a frequency count of the occurrences of every three-letter word in the text.
To help you write this program two separately-compiled routines have been written. One routine, called CLEAN, is written in Pascal. It accepts two arguments: the address of a string and the address on a four-byte integer (the number of characters in the string). CLEAN replaces any punctuation marks in the string with blanks (space characters). It also converts uppercase characters to lowercase with the help of a procedure called MAKELOWER that you must write. Finally, CLEAN replaces the terminator character with a space. The other routine, called ORDER, is written in FORTRAN. It accepts three arguments: the address of a fixed-length string descriptor for an array of strings, the address of an array of two-byte frequency counts, and the address of the two-byte integer (number of entries in these arrays). ORDER sorts the two parallel arrays so that the strings are in alphabetical order. It does this with the help of a procedure called INTEXCH that you must write.
Your program should proceed as follows:
1.Display a line or two of explanation telling the user what to do. Then, repeatedly prompt the user with just "? " and read in
lines of text. Each line must be no more than 78 characters long.
2.For each line that is read in,
In the PROJECT directory, referenceable as P:, you will find the source and object files for CLEAN and ORDER. I recommend that you copy the two object files to your own directory for this project. After you have written and assembled your project #5 program and MAKELOWER and INTEXCH, you must link all four object files to make the executable file for this project.
Hand in a .LIS printout for the program and for MAKELOWER and INTEXCH. Also, hand in an image of the execution of the program (captured with CARBON) in which you enter 5 to 8 lines of text, in which there are at least 5 or 6 three-letter words, several of which occur more than once.
* * * * *
EXTRA CREDIT SECTION
For extra credit use the object file ORDERALT.OBJ instead of ORDER.OBJ. This alternate file contains an
ORDER subroutine that relies upon two subroutines to exchange entries in the arrays of three-letter words
and frequency counts. One of these subroutines is INTEXCH which is described above; the other is named CHAREXCH
and is used to exchange entries in the array of three-letter words; this subroutine takes two arguments both of
which are addresses of fixed-length string descriptors. All that CHAREXCH should do is exchange the contents
of the two strings that are pointed to by the descriptors whose addresses are the arguments.
You must write the CHAREXCH subroutine in assembly language to get the extra credit. Put this subroutine in the same file as MAKELOWER and INTEXCH.