Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

My problem is that this loops infinitely until i press enter without entering a value in MARS but i need to only loop 3 times

My problem is that this loops infinitely until i press enter without entering a value in MARS but i need to only loop 3 times all this code does is take 2 values given by the user and plugs into a formula

MIPS Code :

.data prompt1: .asciiz "Enter a value for f: " prompt2: .asciiz " Enter a value for g: " result: .asciiz " Answer for f = g - (f + 5): "

.text li $t2,1 li $t3, 0 li $t4, 3 for1: beq $t3, $t4, Exit li $v0,4 la $a0,prompt1 syscall li $v0,5 syscall #takes input move $s1,$v0 li $v0,4 la $a0,prompt2 syscall li $v0,5 syscall #takes second input move $t0,$v0 Add $t1,$s1,$t2 sub $s1,$t0,$t1 # does the formula required for this lab li $v0,4 la $a0,result syscall li $v0,1 move $a0,$s1 syscall j for1 Exit: li $v0,10 syscall #ends

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Beginning C# 5.0 Databases

Authors: Vidya Vrat Agarwal

2nd Edition

1430242604, 978-1430242604

More Books

Students also viewed these Databases questions