Machine Problem 3, due Mar 31

Part of the homework for 22C:60 (CS:2630), Spring 2014
by Douglas W. Jones
THE UNIVERSITY OF IOWA Department of Computer Science


Consider the following series of figures:

0    1        2
[]     [][]           [][]  [][]
     [][]           [][]  [][]
         []             []    []
                [][]  [][]
              [][]  [][]  
                  []    []

Each cell in the figure is either two blanks or it is composed of a pair of square brackets []. The following induction rule is used to compose each figure:

Write a program to plot the largest figure that will fit on your screen, centered on the screen.


This problem cannot be solved without writing a recursive subroutine to plot an order n figure at some coordinates on the screen. You should separate that problem from:

a) the problem of centering the figure on the screen. Do that later.

b) the problem of finding the largest order figure that will fit on the screen. Do that last.

A subsidiary problem will show up: Computing 3 to the n. Do this by repeated multiplication by 3, and most definitely, do not use any multiply subroutine. Rather, just use the appropriate add-and-shift instruction.

When you test your routine, try different window sizes. Once it seems to work pretty well, try setting your window's font size tiny and running the program in a huge window.



As mentioned above, the assignment number mp1 and your name must appear on the title of the listing. In addition, the file name of the file you submit must be mp1.a. No upper case, no alternatives.


If you ask for help debugging your code, your code must be well commented. We will not look at "naked" assembly code with no comments to suggest what it is intended to do, and when we find poor comments or discrepancies between the comments and the code, we may ask you to fix those before we look at the code in any detail. Of course, if you ask for help with the comments themselves, we will be glad to offer suggestions.