Machine Problem 2, due Feb 25

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

Background: The triangular numbers are defined as:

n
Tn = Σ i
i = 0

Alternatively,

T0 = 0

Ti = Ti–1 + i

Whichever definition you use, the first 5 triangular numbers are:

T0 = 0
T1 = 1
T2 = 3
T3 = 6
T4 = 10

The Assignment: Write a SMAL Hawk program that outputs the first 20 triangular numbers, starting at screen coordinates 2,2 and continuing left to right, with a single blank separating each number from the next. The first 5 numbers should look like this on the screen

0 1 3 6 10

Your code should consist of a main program, and it will need to call two of the hawk monitor routines, PUTAT to set the initial screen coordinates, and PUTDECU to output each of the successive values. (use PUTDECU instead of PUTDEC because the integer values are all unsigned.)

Nothing in this assignment limits you to calling only the above mentioned monitor routines. This assignment should not involve complex code. Half the credit for this assignment will be granted for the clarity and readability of your work. Correctly functioning but illegible code will earn only half credit.

Turn in your work: Use the divms coursework submission tools to submit your solved work. Your assignment must be in a file named mp2.a and you must submit it as a solution for mp2 in the course c_060. You may re-submit your work, so if you have something you think might be worth submitting, submit it, and if you improve on that solution, submit again.