! declare a 2-D array of integers; initialize each position to the
!   sum of its row/colmn position; use zero based indexing
		.data
	
		.set ROWS, 6
		.set COLS, 6
array:		.skip (ROWS*COLS)*4

		.text
start:
		set 	array, %r2	! get base address of array
		set	0, %r3		! initialize i index
        	set	0, %r4		! initialize j index
i_loop:  	cmp	%r3, ROWS	!   are we done looking at the rows?
		bge	end_i_loop
		nop
j_loop: 	cmp	%r4, COLS	! per the current row, are we done looking at the cols?
		bge	end_j_loop

! compute a total offset from the base address to the current i,j element
                umul    %r3, ROWS, %r7	! compute i (ROW) offset from base address
		sll	%r7, 2, %r7
		sll	%r4, 2, %r8	! compute j (COL) offset from base address
                add	%r7, %r8, %r1	! compute total offset from base address
		add	%r3, %r4, %r5	! compute sum of indexes
		st	%r5, [%r2+%r1]	! initialize array element to sum of indexes

! verify what has just been done:
!   pull out array element back out from memory, load into %r8
!   and print out the contents to the console output

                ld	[%r2+%r1], %r8	! pull array element into register
		cmp	%r8, 10		!   (ugly) little hack to print out a 10 in decimal
		bl	printout
		nop
		set	'1', %r8	! print out for ten hardcoded for this problem
		ta	1		!  code is not generic!
		mov	%g0, %r8
printout:       add	%r8, '0', %r8
		ta	1		! print it as a check
		mov	0x20, %r8	! 0x20 is the hex rep of an ascii space character
		ta	1
		add	%r4, 1, %r4	! increment j index
		ba	j_loop		! continue to loop through the columns of the current row 
		nop			! yuck:  can't think of anything useful to do here	
end_j_loop:	add	%r3, 1, %r3	! increment i index
		mov	0x0a, %r8	! 0x0a is the hex rep of an ascii newline character
		ta	1
		ba 	i_loop		! continue to loop through the rows
                set     0, %r4		! reset j (COL) index
end_i_loop: 	
		ta	0