Homework 6

Sorting out some MIPS assembly language.

This program is work 15 points.


When you complete this homework you should
Write a program in MIPS assembly language which will

Your output should print the entire list on a single line, separated by spaces. Thus you should have four lines of numbers in your final output.

We will be learning functions next. If you wish to read ahead and employ functions, feel free. You must, however follow the calling convention to receive full credit.

The following program might be helpful.

.data
endl:	.asciiz "\n"
space:	.asciiz " "

.text
main:
	li	 $v0, 30	# a0,a1 = time
	syscall
	
	li 	$v0,  40	# srand(time(NULL))
	move	$a1, $a0
	li	$a0,   1
	syscall
	
	li	$t0, 0		# i = 0
	
top:	beq	$t0, 10, out	# while i < 10
	
	li	$v0, 42		# 	t = randbetween(0,100)
	li	$a1, 100
	li	$a0, 1
	syscall
	
	li	$v0, 1		# 	print the new value
	syscall
	
	
	la	$a0, space	# 	print a space
	li	$v0, 4	
	syscall
	
	addi	$t0, $t0, 1	#	 i++
	b top			# endwhile
	
	
out:	
	la	$a0, endl	# print new line
	li	$v0, 4
	syscall
	
	li $v0, 10
	syscall

Your code should be well documented. One comment per high level C++ code at least.

Your code should be well formatted.

Submission

Send the final assembly code to your instructor via email. The assembly file should be sent as an attachment.