All pastes #966947 Raw Edit

Miscellany

public text v1 · immutable
·published 2008-04-02 02:57 UTC
rendered paste body
.text


#
# SWAP
#

.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



#
# Main
#
main:



li $a0, 6
li $a1 11
jal swap

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

	# Print endl
	la $a0, endl	# Load the address 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