All pastes #969858 Raw Edit

Something

public text v1 · immutable
·published 2008-04-03 19:25 UTC
rendered paste body
.text

.globl swap
swap:
		sll $t1, $a1, 2
		add $t1, $a0, $t1

		lw $t0, 0($t1)
		lw $t2, 4($t1)

		sw $t2, 0($t1)
		sw $t0, 4($t1)

		jr $ra			# Return


.globl	main

main:
li $a0, 2
li $a1, 3

jal swap
 
	# Print the integer result in a0
	li $v0, 1	# Load the system call number
	syscall

	# Print endl
	la $a0, endl	# Load the adress of the string
	li $v0, 4	# Load the system call number
	syscall
	
	# Return.
	li $v0, 0	# Load return value in v0
	


	#jr $ra		# Return.

.data

endl: .asciiz "\n"

# End of program