homeWork4Que1

.asm

School

San Jose State University *

*We aren’t endorsed by this school

Course

102

Subject

Computer Science

Date

Feb 20, 2024

Type

asm

Pages

2

Uploaded by GrandGrousePerson1016

Report
.data prompt1 : .asciiz " Enter the a value for x: " Prompt2 : .asciiz " The answer of the polynomial equation is : " prompt3 : .asciiz " Enter the power of the highest polynimial: " newline: .asciiz "\n" prompt : .asciiz " The value is : " .text main: #Displaying prompt 1 li $v0,4 la $a0,prompt1 syscall #Taking the input from the user li $v0, 5 syscall move $a1, $v0 #[ value of x ] #Displaying prompt3 li $v0,4 la $a0,prompt3 syscall #Taking the input from the user for prompt3 li $v0, 5 syscall move $a2, $v0 # [ the highest power value ] #Exit li $v0, 10 syscall # calling poly function jal poly #Start of poly function poly: #Calling pow function jal pow li $v0,4 la $a0,prompt syscall li $v0, 1 syscall move $t2,$v0
#Start of pow function pow : # $a1 = x , $a2 = exponent move $a2, $t3 li $t1,0 loop1: blez $t3,$t1, exit move $a1, $t6 mul $t6, $t6, $t6 j loop1 jr $ra exit:
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help