Assn5 - li $v0, 4 la $a0, result $ syscall #printout result...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
#Angel Ortiz CDA 3101 Assingment No 5 # .data in_mess1: .asciiz " Enter the Base (X): " in_mess2: .asciiz "\n Enter the power (y): " result: .asciiz "\n Result of X^y: " .globl main .text main: m li $v0, 4 la $a0, in_mess1 #ask for base input syscall s li $v0, 5 #store base in $v0 syscall s move $t0, $v0 #transfer base to register li $v0, 4 la $a0, in_mess2 #ask for power input syscall s li $v0, 5 #store power in $v0 syscall s move $t1, $v0 #transfer vo to t1 jal power #call fuction
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: li $v0, 4 la $a0, result $ syscall #printout result li $v0, 1 move $a0, $s0 #transfer output to a0 syscall #printout output # quit: j quit #quit program # power: p li $s0, 1 #when power equal 0 beq $t1, $zero, exit move $s0, $t0 #when power equal 1 li $s1, 1 beq $t1, $s1, exit addi $t1, $t1, -1 a loop: mult $s0, $t0 #when power > 1 mflo $s0 addi $t1, $t1, -1 bne $t1, $zero, loop $ exit: jr $ra...
View Full Document

This note was uploaded on 12/02/2009 for the course CDA 3101 taught by Professor Small during the Spring '08 term at University of Florida.

Ask a homework question - tutors are online