Write an assembly language program for the IAS computer that analyzes and sorts a vector of IAS integers.
Load the vector into memory from cards. The first element of the vector contains the length of the vector. Put the vector and its length into memory starting at address 2000. The loading of the vector can be done via a separate program, consisting of a single INCARD instruction, in a manner similar to how we load programs into memory. That is, first load the data into memory, then load your program into memory, then run your program.
For partial credit the program should find the minimum and the maximum values in the array. The minimum value should be placed in the first element of the vector (right after the length). The maximum value should be placed in the last element of the vector.
For full credit the program should sort the array in place. Sort the vector starting with the first element after the length.
IAS assembly language programs are assembled using the IAS assembler.
IAS programs are loaded and executed using the IAS simulator.
The IAS simulator reads console commands from stdin. You should prepare two files containing sequences of console commands for loading the data, executing your program, and displaying the results. One file should load a vector contained on a single card. The single-card card-deck file should be called "data1". The second file should load a vector contained on twenty cards. The twenty-card card-deck file should be called "data20". To display the results for the one-card case use the following console command: show mem 2000 12. To display the results for the twenty-card case use the following console command: show mem 2000 240.
Use ~cs611/bin/punchcards to prepare a file for connecting to the IAS card reader. This program reads a sequence of decimal values from stdin and writes the corresponding sequence of IAS 40-bit values to stdout. The input is in ASCII and the output is in binary. The program pads the output to a card boundary with zero values. (Each card holds twelve 40-bit values.)
Note that the punchcards program only works with input values that fit in 32 bits. We will only use files produced by punchcards to test your program.
A good first step is to experiment with the factorial program that was one of the Program 2 test files: ~cs611/public/prog2/fact.asm. Be sure that you can build an input card deck for this program and that you can run the program.
A good second step is to take the output cards from the factorial program, load them into memory and use the console "show mem" command to display the results.
After successfully completing those two steps you should be ready to tackle this assignment.
Grading will be based upon completed, correct functionality:
Put your assembly language code in a file called sort.asm. Put the console commands for a one-card run in a file called sort.run1. Put the console commands for a twenty-card run in a file called sort.run20.
Your assignment should be submitted for grading from a
CIS Linux machine (e.g. turing.unh.edu).
To turn in this assignment, type:
~cs611/bin/submit prog3 sort.asm sort.run1 sort.run20
Do not turn in any other files!
Submissions can be checked from a CIS Linux machine by typing:
~cs611/bin/scheck prog3
To receive full credit for the assignment, you must turn in your files prior to 8am on Monday October 14. Late submissions will be accepted at the penalty of 5 points per day up to one week late.
Remember: as always you are expected to do your own work on this assignment. Copying code from another student or from sites on the internet is explicitly forbidden!
If you developed your code on a DOS/Windows system, be sure to appropriately transfer your files to a CIS Linux system before submitting them. You need to convert the DOS ASCII file format to UNIX format. If you need help with this, please see me.
Comments and questions should be directed to hatcher@unh.edu