Machine Problem 1, due Sep 12
Part of
the homework for 22C:60 (CS:2630), Fall 2010
|
Machine problems must be turned in on line before midnight on the due date. Exceptions will only be made advance arrangement except in cases that insurance companies call "acts of God" - things outside your control.
Build a linked-list data structure containing 4 or more items, where each item consists of a pointer to the next item and a pointer to a null-terminated string. Assembling your program should export the symbol HEAD, the address of the first item in your list. Traversing the list and printing the text of each string in order should produce your name. Null pointers are represented by the value zero. The source file should include a title directive that includes the project identifier MP1, a colon, and your name as it appears on your ID card.
Here is an example solution, with a few hidden problems you may have to solve when you change the content to match the assignment. The output from traversing this data structure is the phrase No One:
TITLE "MP1: No One" INT HEAD NULL = 0 HEAD: W NEXT,S1 S1: ASCII "No ",0 NEXT: W NULL,S2 S2: ASCII "One",0 END
You may test the above by assembling it, linking it and the following commands at the shell prompt on the departmental Linux system:
smal mp1.a link mp1.o mp1test.o hawk link.o
You will have to press the r key once to launch the test program inside the Hawk emulator. Note that the mp1test program is the main program.
From a maximum possible of 5 points, the following penalties will be assessed:
The above add up to more than the total points for the assignment, but most of these penalties are easily avoided.
All machine problems in this course should be submitted using the submit command on the divisional Linux system. Specifically, your solution to this assignment should be in a file called mp1.a and you should see this dialogue when you submit your work:
[yourname@serv16 hw]$ submit
... several lines of long-winded instructions ...
File/directory name: mp1.a
File/directory name:
course: c_060
... several lines of long-winded instructions ...
Choice: mp1
In the above, what you should type is shown in bold face.