Due date: See Class Webpage
The alternative method to get the prepared files is to enter these commands in the EGTAPI terminal:
mkdir ~/cs255/pj9 For CS255-1 students: cp /home/cs255001/Handouts/pj9/* ~/cs255/pj9 For CS255-2 students: cp /home/cs255002/Handouts/pj9/* ~/cs255/pj9 |
The List structure is as follows:
class List { int Value; <--- list elements ordered by this value List Next; } |
More details of the assignment are given below.
List InsertList(List head, List elem) { ... } |
The parameters are as follows:
|
The InsertList() function must return the address of the first element of the new list (= the list with the element inserted)
(I.e.: the parameters and the return value have the same meaning as the Insert() function discussed in this web page: click here
Requirement:
|
Develop your algorithm first
|
I have written a skeletal Java program that you can use to develop your recursive list insert algorithm. You should have copied this file in the preparation step above.
Use the file HelpList.java in your project directory and write a recursive InsertList( ) method in Java. You can compile and run the HelpList.java program and make sure that your InsertList( ) method in Java is correct first before you write your program in ARM assmbler - because debugging assembler code is much harder than Java code.
If the InsertList( ) algorithm is correct, the output of the HelpList.java program is:
List = 30 List = 30 50 List = 10 30 50 List = 10 30 40 50 List = 10 20 30 40 50 |
You can use this program test your project.
After you can written your InsertList function, you can compile the project using this command:
/home/cs255001/bin/as255 pj9.s InsertList.s |
Use Egtapi to run the pj9 program.
Correct behavior of the InsertList project:
|
Use the following command to compile project 9
Open the Terminal in EGTAPI and type these commands:
cd ~/cs255/pj9 /home/cs255001/bin/as255 pj9.s InsertList.s |
You can also compile it with EGTAPI's file browser:
1. First: press the CONTROL key and select pj9.s 2. THEN: On a Windows PC: press the CONTROL key and select InsertList.s On a Mac PC: press the COMMAND key and select InsertList.s NOTE: the ORDER of clicking is VERY IMPORTANT DO NOT click on recursion.s first !!!! (If you do, EGTAPI will generate the output "recursion.arm" and not pj9.arm) 3. Finally: click "Compile" |
Use Egtapi to run the program compiled program pj9.arm.
|
|
(In EGTAPI, select: File Browser, Turnin, click on the file you want to turn in (InsertList.s), use the turn in code: pj9)
You can also use the turnin command (executed while you're in your cs255 directory)
Open the Terminal in EGTAPI and type in these command:
cd ~/cs255/pj9 /home/cs255001/turnin InsertList.s pj9 // If you're in section 1 or /home/cs255002/turnin InsertList.s pj9 // If you're in section 2 |
As usual, I want the source (so I can read it). DO NOT turn in the executable or the object code !
6. Extension request
However, you need to use pj9 as homework code to make extension for this homework/project.
/home/cs255001/req-ext pj9 // IF you're in section 1 or: /home/cs255002/req-ext pj9 // IF you're in section 2 |
You request will be successful if you have not exceeded the maximum number of "free" (no-questions-asked) requests allowed