created 12/31/2003


Chapter 36 Programming Exercises


In the Settings menu of SPIM set Bare Machine OFF, Accept Pseudo Instructions ON, Enable Branch Delays ON, Enable Load Delays ON, Enable Mapped IO OFF, Load Exception Handler ON.


*Exercise 1 -- Jump Table

Add a third subroutine that prints "Wonderful" to the Full, Impractical, Program of the chapter (ass36_6.html). Add an entry to the jump table and a call to the new subroutine to the main routine of the program.

Click here to go back to the main menu.


*Exercise 2 -- Jump Table with Loop

Add several more subroutines that print out various words to the Full, Impractical, Program of the chapter. Put each new entry point into the jump table. Write a loop in the main program so that the entry points in the jump table are invoked in order, one per loop iteration.

Click here to go back to the main menu.


*Exercise 3 -- Static Objects

Add several additional objects to the Complete Program of ass36_19.html. Modify the main program so that it exercises several of the methods of the objects.

Click here to go back to the main menu.


*Exercise 4 -- More methods with Static Objects

Add two methods to the Complete Program> (above). Add a clear() method that makes the first byte of an objects string the null byte (in effect deleting the string). Add a capitalize() method that changes each lower case character of the object's string to a capital letter. Do this by adding 0x20 to each lower case letter. Modify main to test the new methods.

Click here to go back to the main menu.


**Exercise 5 -- Dynamic Objects

Design an object that has an integer for its data. Its methods are set(), double(), and print(). The set() method is passed a parameter in $a0 and sets the object's data to that value. The double() method doubles an object's integer, and the print() method prints out the integer.

Write a main routine that creates several objects and tests their methods.

Click here to go back to the main menu.


   * == easy program
  ** == moderately easy program
 *** == harder program
**** == project

End of Exercises