Answered step by step
Verified Expert Solution
Question
1 Approved Answer
sortArray1 Write a MIPS assembly language program that can read a file called ints.dat which contains an unspecified but no more than 200 binary
sortArray1 Write a MIPS assembly language program that can read a file called "ints.dat" which contains an unspecified but no more than 200 binary integers and subequently write a filed called "ints 62.dat" which contains the exact same data. Hardcode the file names into your program by declaring them as null-terminated ASCII strings. Note: You need to specify the full path for both files. The TAs will change these when grading since they can't run them as you. Use MARS syscalls 13-15 to open, read write, and close the files. Declare a 200-word array called BUF that you use to hold the data. Write your program as one long sequence of instructions. Consider logically dividing it into segments, eg. one for opening the input file. one for reading the input file, ete. You will need to define labels for branch instructions. Consider calling them CXY where X is the segment and Y is the label index, eg.. C00, Co1, etc. Check for syscall enor conditious. That is, if file open fails and a file descriptor of -1 is retuned, e.g., if the file doesn't exist, print the message "Error: input file open error" for the imput file and "Eror: output file open eror" for the output file: if trying to read an empty file, e.g, ints_0.dat, print the message "Eror: input file read eror"; and if not writing as many bytes as expected, print the message "Error: output file write error" (this is difficult to test as it hopefully won't occur). Add meaningful comments that describe the overall computation as well as comments that document cach (most of them anyway) assembly langnage instruction. Include a listing of which Ss and St-registers are used for what subcoumputation. sortArray2 Add code for printing out a message that says "Processed X ints" when the input file contains a single-digit number of integers, "Processed XY ints" when the input file contains a double-digit number of integers, and "Processed XYZ ints" when the input file contains a triple-digit number of integers, e.g. "Processed 7 ints" for ints 7.dat. "Processed 33 ints" for ints 33 dat, and "Processed 195 ints" for ints 195.dat Specifically, declare the null-terminated ASCII string "Processed ints" and have code update the space field in accordance with the number of integers read from the input file. Use integer division to determine quotient and remainder numbers that you add to 'O which is then injected into the mentioned ASCII string The is an exercise in binary-to-decimal nunber conversion as well as in-place ASCII string manipulation, and register plus offset based addressing. Do NOT implement this by printing the first part of the text string following by an integer followed by the end of the text string. Implement it by modifying the text string in place and then printing it in its entirety.
Step by Step Solution
★★★★★
3.42 Rating (152 Votes )
There are 3 Steps involved in it
Step: 1
data BUF space 800 Buffer that can hold 200 words of data inputFile asciiz intsdat outputFile asciiz ints62dat inputError asciiz Error input file open error outputError asciiz Error output file open e...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