sortArray1 Write a MIPS assembly language program that can read a file called ints.dat which contains...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
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. 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.
Expert Answer:
Answer rating: 100% (QA)
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... View the full answer
Related Book For
Digital Systems Design Using Verilog
ISBN: 978-1285051079
1st edition
Authors: Charles Roth, Lizy K. John, Byeong Kil Lee
Posted Date:
Students also viewed these programming questions
-
Write and test a MIPS assembly language program to compute and print the first 100 prime numbers. A number n is prime if no numbers except 1 and n divide it evenly. You should implement two routines:...
-
Write a MIPS assembly language program that a) Prompt the user for an integer in the range of 0 to 50. If the user inputs 0 the program stops. b) Otherwise, the program stores the numbers from 0 up...
-
You will write a simple assembly language program that performs a few arithmetic operations. This will require you to establish your programming environment and create the capability to assemble and...
-
Use the approximations obtained in Exercise 3 to approximate the following integrals, and compare your results to the actual values. a. b. c. d. (cos --2 sin ) dr (x cos x2 + er cos ex) dx
-
Find the tax on the following taxable incomes: $161,200 (head of household)
-
The following data represent the number of grams of fat in breakfast meals offered at a local fast food restaurant. (a) construct a stem-and-leaf plot and (b) describe the shape of the distribution....
-
CD Real Estate specializes in residential real estate services in the state of California. To complement the experience and local market knowledge of its licensed realtors, CD Real Estate wants to...
-
Journal entries and T-accounts. Prepare journal entries and post them to T-accounts for all transactions in Exercise 7-26, including requirement 2. Summarize how these journal entries differ from the...
-
Without invoking Java, given the following Java program fragment Scanner console nev Scanner (System.in); int int . int int 1-0; evenSum 12 count; evenSum: oddSum; 0; oddSum 0; for (count...
-
A fuel oil is analyzed and found to contain 85.0 wt% carbon, 12.0% elemental hydrogen (H), 1.7% sulfur, and the remainder noncombustible matter. The oil is burned with 20.0% excess air, based on...
-
Gerazelle Company produces a product that sells for P900.00. The variable cost is P480 for direct materials, P300 for labor, P85 for variable overhead and P45,000 for fixed overhead. The units sold...
-
Kuala Lumpur Kepong Berhad stock currently sells for RM21.40 per share. The next expected annual dividend is RM0.80, and the growth rate is 4%. a. Find the expected rate of return on this stock. b....
-
In algebra, a quadratic or 'square' equation is any equation that can be written as , where x represents an unknown value while a, b, and c represent the known coefficients of the equation where a #...
-
Define the concept of Organizational Behavior and Identify and explain the three key levels of analysis in OB.
-
Alexandra bought a 7-year bond at a 7.50% discount to its par value of $1,000 three years ago. The bond has a 4.70% coupon rate payable semiannually. What was her effective annual rate of return if...
-
Why should bond investors be cautious when relying on yield to maturity? Is it an accurate measure of rate of return for investors who might not hold their bonds to maturity?
-
Linden textbook - read Chapter 6. Personal Learning Journal post -- Unlike your initial journal post where your shared your course expectations, this and your subsequent journal posts are open topic...
-
Place a tick in the appropriate grid to identify the balance that would be brought down in each of the following named accounts, in the books of Rizwy Mohamed: (a) In the Cash account: if Rizwy...
-
Design a 4-bit right-shift register using an FPGA with logic blocks as shown in Figure 6-1(a). When the register is clocked, the register loads if Ld = 1 and En = 1; it shifts right when Ld = 0 and...
-
A 4-bit magnitude comparator chip (e.g., 74LS85) compares two 4-bit numbers A and B and produces outputs to indicate whether A < B, A = B, or A > B. There are three output signals to indicate each of...
-
Design a memory-test system similar to that of Problem 8.18, except write a checkerboard pattern into memory (01010101 into address 0, 10101010 into address 1, etc.). Draw the block diagram and the...
-
The following is the trial balance of Sanjay Industries Ltd. as on 31st March 2006. Further information 1.Outstanding rent amounted to 7,200 while outstanding salaries 8,100 at the end of the year....
-
Refer to the case of Monik Traders given in the exercises of the last chapter. Monik Varma now wants to know as to where his firm stands after one month of running of the business. Help him. Towards...
-
The accountant of Pushpa Engineering Company Ltd. has prepared the following trial balance of the company as on 31st March, 2006. Further information 1. Authorised equity share capital of the company...
Study smarter with the SolutionInn App