!!  create a 1D array of size TOTAL and fill
!!  each element with the value of it's position
!   in the array

	.data

	.set TOTAL, 10
array:	.skip TOTAL*4

	.text

	set 	array, %r1	! get base address of array
	set 	0, %r2		! initialize i index

i_loop:
! fill each array element with the value of it's position
	cmp 	%r2, TOTAL	! are we done yet?
	be	end_i_loop
	sll	%r2, 2, %r3	! scale index: shift to next word
	st	%r2, [%r1 + %r3]! store index into array	
	ba	i_loop
	inc	%r2	

end_i_loop: 

! print out the array to verify correct initialization
	set	0, %r2		! re-init index counter
print_loop:
	cmp	%r2, TOTAL	! are we done yet?
	be	end_print_loop
	sll	%r2, 2, %r3	! scale index: shift to next word
	ld	[%r1 + %r3], %r8
	add	%r8, '0', %r8	! print out array contents
	ta	1
	mov	0x20, %r8	! print out a blank space
	ta	1
	ba	print_loop
	inc	%r2

end_print_loop:
	ta	0