Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Assignment 4 Directions Create an algorithm to sort the numbers in ascending order in a list of 3 - 5 numbers using at least one

Assignment 4 Directions
Create an algorithm to sort the numbers in ascending order in a list of 3-5 numbers using at least one function called by the main program.
Implement the program in a high level language like C, C++, or Java. Use the code in the comments of your program to show it was written in a high level language first.
Implement the program in MIPSzy Assembly language.
If you write that MIPSzy program in a text editor, you should then paste it into the simulator box in 11.1.2. You can run the simulation there to test the code.
The input value values should be entered in the input box. Enter the numbers to test separated by spaces. Do not worry about whether they move to another line or not.
Input works by placing the value to be read in in memory location 8196 and a 1 in memory location 8192. If there is no more input a 0 will be placed in memory location 8192.
Results should be written to memory location 8200 which will cause them to be written to the output window.
Include a comment at the top of the program with your name and Panther id.
Export the file by clicking the More Options button and then Export on the right side. That will paste your program into a small box on the right. Copy and paste that into a text document. Call that document FirstnameLastnameA4.txt.
Zip up FirstnameLastnameA4.txt into a zip file called FirstnameLastnameA4.zip. Do not use any other kind of zip file formats. I do not need the high level language program.
I will show how to work with the input output simulation window during the live Zoom session which can be watched in the recording if you miss the live class.
Here is a sample of the input and output:
Input: 9945682100
Output: 6358299100
A sample program to show how to manage input and output is as follows. Type a single digit positive integer number in the Input box and run the program.
addi $t0, $zero, 8200 # Output loc
BegLoop:
addi $t6, $zero, 8192 # Input ready?
lw $t5,0($t6)
beq $t5, $zero, NoInput
addi $t6, $zero, 8196 # Input loc
lw $t1,0($t6)
addi $t2, $zero, 1
sw $t2,0($t0) # Output to screen
mul $t2, $t2, $t1 # Times Input
sw $t2,0($t0) # Output to screen
mul $t2, $t2, $t1 # Times Input
sw $t2,0($t0) # Output to screen
mul $t2, $t2, $t1 # Times Input
sw $t2,0($t0) # Output to screen
j BegLoop
NoInput:

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

Concepts of Database Management

Authors: Philip J. Pratt, Joseph J. Adamski

7th edition

978-1111825911, 1111825912, 978-1133684374, 1133684378, 978-111182591

More Books

Students also viewed these Databases questions

Question

What penalty (if any) should Foster receive?

Answered: 1 week ago

Question

=+1. What is the schedule for this project?

Answered: 1 week ago