Programming Assignments
- As stated in the syllabus, programming assignments constitute 10% of your final grade.
- Each assignment has a window of opportunity during which you can get credit for a correct solution.
- Standard practice will be for these windows to close one second before midnight on the given day.
- The web site for processing these assignments is now up.
- You have been assigned a user name and a password for this site.
The user name is derived from your campus email address.
- For example, if your address is "youngwildandwasted@g.cof.edu",
then your user name is "youngwildandwasted".
- Your password is your 8-digit campus-wide ID number.
You should immediately change this to something more secure.
- Here is the address of the web site. You can copy it and paste it into your browser.
153.9.220.145:8000/grader
- The first page you see after logging in has a choice button
that lets you choose from among the available assignments.
- Once you choose an assignment, you get a page with a text area and a "submit" button.
- Paste your code into the text area and push the button.
- The web site will assemble and run your code and test the results that it gets.
- During the assignment's window of opportunity,
the site will record success or failure for each attempt that you make.
- For purposes of your grade, the only thing that matters is whether or not your number of successes is 0.
- I.e. 10 failures and 1 success is the same as 14 successes and no failures.
- Because of the campus firewall, you have to be on campus to get to the grading site.
- You can get to this page from anywhere,
so we will keep a list of all the available programming assignments here.
- This page will tell you when any particular assignment is due and what it requires your solution to do.
Here is your workflow for programming assignments.
- come here to this page and find out what your program needs to do
- write and debug a solution in MARS
- next time you are on campus, go to the grading site, copy your code from MARS,
paste it into the grading window, and push the "submit" button
- if you have properly debugged your program, that's it; log out and do something else
Here are some suggestions for doing the programs that involve subroutines.
- In some cases the grader supplies part of the program, and you supply the rest.
- Nevertheless, you need to write all of it in order to test it in MARS.
- The grader replaces your variables in the data segment with its own,
so the relevant part of the text segment is all that you need to submit.
- Once you have a working program, you can copy the part that you need to submit for grading and
paste just that much into the grading window on the web site.
- Always include this line: ".globl main" in your program. A good place for it is right before
the label "main:". That is the correct spelling -- ".globl".
- Any subroutine that you submit will begin with a label;
that label should also be declared global in the same way.
- Your main program should always end with these two lines: "li $v0 10; syscall".
- You don't have to, but I find it convenient to put the part that you need to submit
at the beginning of the text segment.
- There's a prototype of your complete file for program 7 below. You can copy it from here,
paste it into the edit window in MARS, and replace the parenthesized parts with your code.
- Once you have it working, submit the indicated part.
- You can use the same prototype for program 8, but in that case,
you should submit the code below the second long comment line.
.data
(your variables here)
################# for program 7 submit the part between this line and the next comment line ################
.text
.globl main
main:
(your main program code here)
li $v0 10 # exit program
syscall
############################## for program 8 submit the part below this line #####################
.globl inc3
inc3:
(your code for inc3 here)
jr $ra
Here is the list of the programming assignments that are on the grading site.
- Load the value 1 into register $t0 and the value 2 into register $t1.
- Add the value in memory location x to the value in memory location y
and put the answer into memory location z.
- Write a program that implements this python statement: z = a + b + c - d
- Due 18 March -- Write this in assembly language:
if (x == y) {
z = 14;
w = 23;
}
u = x + 5;
- Due 20 March -- Write this in assembly language:
if x == y:
z = 21
w = 15
else:
u = 17
x = 29
- Due 20 March -- Write this in assembly language:
if x == y:
z = 21
w = 15
else:
z = 15
w = 21
x = y = 76
- Due 23 March -- We have a function already written:
public int inc3(int i)
that adds 3 to its parameter and returns the result.
Write this main program that calls it:
int x = inc3(x);
- Due 27 March: Write a function inc5 that adds 5 to its parameter. I will call it.
- Due 1 April: Take the strcount1 program on OAKS and turn it into a function
- the function's name is strcnt
- it takes one parameter: the address of the string that it is to count
- it returns the number of characters in the string
- obviously you'll have to write a main program to call strcnt for testing
- submit the function for grading, not the main program
- Due 4 April: Write a function that copies a string.
- the function's name is strcpy
- it takes two parameters: the address of the string that it is to count
and the address of the location in memory that is to receive the copy
- there is no returned value
-
there's a .space assembler directive that reserves memory bytes
- submit the function for grading, not the main program that calls it
- the test strings won't be insanely long; no more than 80 characters
- Due 7 April: Write a program that makes y the same as x but with bit4 and bit10 set.
- Due 9 April: Write a program that makes y the same as x but with bit2 and bit14 cleared.
- Due 19 April: Write a function named clrfun that clears bit5, bit6,
and bit11 in its parameter and returns the result.
- Due 19 April: Write a function named setfun that sets bit3, bit9,
and bit14 in its parameter and returns the result.