Answered step by step
Verified Expert Solution
Question
1 Approved Answer
USING ASSEMBLY LANGUAGE -MIPS FOR THE ASSIGNMENT. MIPS Assignment 5 Branching Tutorial Before attempting this assignment, navigate back to the assembly tutorial mentioned in MIPS
USING ASSEMBLY LANGUAGE -MIPS FOR THE ASSIGNMENT.
MIPS Assignment 5 Branching Tutorial Before attempting this assignment, navigate back to the assembly tutorial mentioned in MIPS Assignment 1. Complete the tutorial up to Chapter 20. Program Write a program that echos back any inputted integer greater than 1, and exits when a 0 is entered. Your program should use a conditional branch when deciding whether to echo back the integer or exit the program. It should use a jump when looping back up to run the input-echo again. (hint: A jump isn't technically needed to do this, but is still part of your assignment!) Pseudo-code Your program should behave like the following pseudo-code: MAINLOOP X = input() if X == 0 then goto EXIT print X print " " goto MAINLOOP EXIT exit() Note the following: It is expected that the goto statement on line 3 is either comparison instruction followed by a branching instruction, or just a conditional branching instruction. It is expected that the goto statement on line 5 is a conditionless jump instruction. The Input As with previous assignments, integers will be entered on a single line. The Output Your program will take an integer from standard input, and use it to decide the next course of action: If a 0 was inputted, your program will exit immediately. If any other integer was inputted, your program will print that integer back out to standard output, then loop back up to get another integer. Take, for example, the following input sequence: moo +o A correct program would output the following: MooitStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started