Question: please help me fix this 1 line of code Ive asked but im not getting a staight answer whatsoever and I really cant figure out

please help me fix this 1 line of code Ive asked but im not getting a staight answer whatsoever and I really cant figure out why it is not working, this assembly code below shoud ask for the width legnt and depth and display the amount of square footage and the amount of mulch needed but there is an error somewhere(it looks to be in line 102-104) that is causing it to print out incorrectly as the screenshot below shows (where it says 'you need 4268501152')

please help me fix this 1 line of code Ive asked but

I just would love the tweek in the code that would fix the issue, thanks

CODE

.data

getWidth: .asciiz "Enter width of area to mulch in feet: " getLength: .asciiz "Enter length of area to mulch in feet: " getDepth: .asciiz "Enter depth of of mulch in inches: " outMsg1: .asciiz " You need to cover " outMsg2: .asciiz " square feet " outMsg3: .asciiz "You need " outMsg4: .asciiz " cubic yards of mulch " .align 2

width: .word 0 length: .word 0 depth: .word 0

.text .globl main

#register map for main # # $s0 # $s1 mulch # # $t0 temporary for loading values

main:

# input data with prompts # input "Enter width in feet: ", width la $a0, getWidth li $v0, 4 syscall li $v0, 5 syscall sw $v0, width # input "Enter length in feet: ", length la $a0, getLength li $v0, 4 syscall li $v0, 5 syscall sw $v0, length # input "Enter depth in inches: ", depth la $a0, getDepth li $v0, 4 syscall li $v0, 5 syscall sw $v0, depth # compute area = width * length lw $t0, width lw $s0, length mul $s0, $t0, $s0 #compute volume = (area * depth + 11) / 12 lw $t0, depth mul $s1, $s0, $t0 addi $s1, $s1, 11 div $s1, $s1, 12 #compute mulch = (volume + 26) / 27 #this rounds up if result would have a remainder addi $s1, $s1, 26 div $s1, $s1, 27

#output #print "You need to cover ", area, " square feet" la $a0, outMsg1 li $v0, 4 syscall move $a0, $s0 li $v0, 1 syscall la $a0, outMsg2 li $v0, 4 syscall #print "You need ", mulch, " cubic yards of mulch" la $a0, outMsg3 li $v0, 4 syscall move $a0 , $s1 li $v0, 1 syscall la $a0, outMsg4 li $0, 4 syscall

Enter width of area to mulch in feet: 20 Enter length of area to mulch in feet: 10 Enter depth of of mulch in inches: 5 You need to cover 200 square feet You need 4268501152 -- program is finished running (dropped off bottom)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!