IUP Computer Science
CO 300 Assembly Language
Spring 1995

Program #6 (Due 2 May 1995)

Make a MACRO library that will allow a program written in IBM mainframe assembly language, such as the one in PROJECT:SORT.BAL, to be assembled, linked, and run on the VAX.

The accompaning handout describes how the IBM instructions, directives, and macros are supposed to work. You must make one macro for each IBM instruction, directive, and macro that will expand into appropriate VAX assembly language instructions, directives, and macros which do the equivalent of the IBM code. To help you get started and to avoid the macros that are trivial or messy, I am providing a file containing macros for the IBM instructions: B, BR, and MVC; for the directives: CSECT, DS, END, and PICKIT (useful for DC and DS); and for the macros: OPEN and CLOSE. This leaves you to write macros for L, A, S, BP, BNP, CLC, DC, GET, and PUT. My macros are in the file PROJECT:IBM.MAR.

You should copy PROJECT:IBM.MAR to your directory and add to it the macros for the other IBM instructions/directives/macros. Then, form a MACRO library with the completed IBM.MAR file by using a command such as

$ LIBRARY/MACRO/CREATE  IBM  IBM    
Copy the PROJECT:SORT.BAL file and associated data file, PROJECT:ORIGINAL.FILE, to your directory. Using the library, assemble the program in SORT.BAL by using a command such as
$ MACRO  SORT.BAL+IBM/LIBRARY  
Then, link the resulting .OBJ file and run the .EXE file. After the run, you should have a file called SORTED.FILE in your directory that holds the same records as in ORIGINAL.FILE but in sorted order.

Hand in a listing of IBM.MAR and a .LIS listing of SORT.BAL. Also, copy the .EXE file you produced to the HANDIN: directory and name the file in HANDIN: after yourself (using you last name). For example, I would copy to HANDIN:WOLFE.EXE.

Extra Credit

Change program #5 so that it can read the data from any file. Have the program prompt for a file name. Let the program read from the file into the array and count the records just as LOAD did. Read until end of file is reached.