Wed, 19 Oct 2011, 22:57
A student writes: > Dr. Patt, > > I have a question about Programming Assignment 2. > > Regarding the "input" to the program, do we have to design a method for the > user to input the grades when the program is executed or will values be set > in x3200 - x320F prior to running the program? > If we do have to implement the input method into our program, is there any > way to input more than one character at a time on LC-3? > > Thank you very much, > <<name withheld to protect the student who wonders where the grades come from>> Your job in Lab 2 is to write a program that will take a set of grades, sort them, and figure out how many get A and how many get B. As was the case with Lab 1, the input data will be supplied to you. Your program can assume that the 16 grades are already in locations x3200 to x320F when your program starts executing. Your program must work regardless of what those 16 grades are, with the one small simplifying assumption that we will not allow duplicate grades in the input. This is the third time I have gotten this type of question, so maybe I need to make the following point: A program operates on data. It is almost always the case that we would like the program to work properly on all instances of the input data. You, the programmer, do not supply the input data. If you did, then you would not have to run the program. You could just look at the data and supply the answer! So, you can always assume that someone else is supplying the data. Your job: write a program to take whatever data is supplied and perform the task required on that input data. NOTE: an important part of writing a program is to test it on multiple instances of data to be sure it works. In fact, tests should include the most odd-ball instances that you can think of. A program must work on all data, not just on convenient data. The way you test your program is to run it on the Simulator AFTER loading x3200 to x320F with data. This you do by hand. Do it for as many cases as you can think of. Set a breakpoint at TRAP x25 so you can examine x4000 to x400F and x4100 and x4101 to check if your test case produced correct results. When your test cases convince you that your program is working correctly, you are ready to submit the sort.asm file for grading. Good luck. Yale Patt