MIPS assembly language program

 

• 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, e.g., one for opening the input file, one for reading the input file, etc. You will need to define labels for branch instructions. Consider calling them CXY where X is the segment and Y is the label index, e.g., C00, C01, etc.
Check for syscall error conditions. That is, if file open fails and a file descriptor of -1 is returned, e.g., if the file doesn’t exist, print the message “Error: input file open error” for the input file and “Error: output file open error” for the output file; if trying to read an empty file, e.g., ints_0.dat, print the message “Error: input file read error”; 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 each (most of them anyway) assembly language instruction. Include a listing of which $s and $t-registers are used for what subcomputation.
• 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 ‘0’ which is then injected into the mentioned ASCII string. The is an exercise in binary-to-decimal number 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.
• sortArray3
Add sorting in between the file I/O read and write operations. Specifically, implement the following so-called selection sort algorithm (which is different from the bubble sort algorithm you read about in the textbook). Assume N integers are stored in array called data, then selection sort works as follows:
int j = N-1; while (0
As you will learn in CS302, this is neither a good nor a popular sorting algorithm, but it’s easy to understand and implement, so we use it for now. Test the algorithm by making sure the data in the output file appears in ascending order (from smallest to largest value). How do you inspect a binary file? Fear not,
UNIX> cp ints_7.dat ints.data UNIX> od -D ints.dat 0000000 949 6898 9925 918 0000020 7861 6442 6637 UNIX> execute sortarray3 (using MARS) UNIX> od -D ints_62.dat 0000000 918 949 6442 6637 0000020 6898 7861 9925
Also, the swap by copying the compared data elements back to the other index slot in the array. That is, you don’t need a swap function per se. Instead, extract data[j] into say register $rj and data[k] into say register $rk, then write back $rk to data[j] and $rj to data[k]. This will make more sense once you start writing the program.
• sortArray4
Saving best for last, refactor your code to use function calls. In particular, you need to implement a main function that calls four functions, namely, fread(), sort(), fwrite(), and prstxt(). You must also implement support function prmsg() that prints a given text string to stdout. Consider the following C-style declarations of these functions:
int N = fread(char *fname, int *buf, int Nmax); void sort(int *but, int N); int M = fwrite(char *fname, int *buf, int N); void prstxt(char *status_text, int N); void prmsg(char *text);
The fread() function opens the named file, prints the above mentioned error message if the operation fails and returns -1. Conversely, succesful opening leads to the file being read and the Nmax or fewer ints being stored in the given array with the number of ints read returned. The main function checks the returned integer, exits if it equals 0 or less and continues otherwise.
The sort function carries out the selection sort.
The fwrite() function opens the named file, prints the above mentioned error message if the operation fails and returns -1. Conversely, succesful opening leads to the buf-data being written to file. If fewer than the expected number of ints are written, the above mentioned error message is printed and the function returns a -1; otherwise the number of ints written is returned and checked by the main function. If it equals 0 or less, the program exits. Otherwise, it continues.
The prstxt() function prints the status message which says how many ints were processed. The prmsg() function must be used to print ALL text strings.
Each called function must save the return address on the call stack as well as any $s-registers it uses. When done, these registers must all be restored after the return value has been copied to register $v0 as appropriate (not needed for void functions).
The fread() function must store the file descriptor returned from the open syscall (fid) in $s0, the pointer to the data buffer (BUF) in $s1, and the max number of ints to be read (Nmax) in $s2. The fwrite() function must store the file descriptor returned from the open syscall (fid) in $s0, the pointer to the data buffer (BUF) in $s1, and the number of ints to be written (N) in $s2. The sort(), prstxt() and prmsg() functions may but need not use $s-registers.
• General requirements: Use $s-registers for variables that should be preserved during the computation. Use $t-registers for storing temporary variables. Add meaningful comments. These could be plain text or psedo-C like. Document which registers are used and for what.

This page of the exposition has 663 words. Download the full form above.

Music is a fundamental human encounter which tends to one of a kind and major needs, and has been maintained as a basic piece of each human culture for a great many years. In antiquated Greece, music was viewed as one of the seven aesthetic sciences, alongside punctuation, talk, rationale, geometry, number juggling, and space science. An all encompassing way to deal with training should support and sustain brain, body, and soul. Music adds to these parts of human advancement in different manners. The training and execution of music permits understudies to investigate and find their internal identities and figure out how to explain their feelings through imaginative articulation.

Notwithstanding the stylish and emotive estimation of music, science has shown that music practices and invigorates the cerebrum in different manners. Indeed, even in during the pre-birth phase of advancement, babies can hear and react to music. Introduction to music at a youthful age helps in the improvement of deftness and both gross and fine engine abilities. Playing music draws in the two sides of the cerebrum all the while, which is basic to solid mental health and assists understudies with exceeding expectations in other center subjects, for example, math, science, perusing, and composing.

Music programs are fundamental since they advance individual character improvement by cultivating aptitudes, for example, duty, discipline, time the board, imagination, tolerance, and tirelessness. Through the in a general sense communitarian part of music, understudies likewise manufacture significant social aptitudes, for example, correspondence, adaptability, participation, and administration. A comprehension and energy about music positively affects kids’ capacity to learn in every other experience for the duration of their lives, and understudies who study music are presented to circumstances that make an all the more balanced person.

 

33.

Music ought to be a center component of the instructive educational plan at each evaluation level. The national guidelines for music training are significant on the grounds that they give a structure that empowers instructors to continually assess and improve their educating. Jerome Brunner’s winding educational program learning hypothesis keeps up that ideas can be instructed at any age as long as they remain mentally genuine to the youngster’s level. Primary music ideas can be educated even at the most punctual evaluation levels and consistently based upon as the understudy develops. Each understudy ought to be allowed the chance to learn music, paying little mind to financial status, physical or scholarly capacity.

A decent music educator must be on a very basic level patient, compassionate, and adaptable, while as yet keeping up a sorted out and organized homeroom. Understudies ought to be shown both a stylish and scholastic comprehension of music, just as down to earth music abilities. It significant for a music instructor to utilize various showing methods so as to reach however many understudies as could be allowed, giving music exercises that invigorate sensation, visual and sound-related students the same. Thusly, a compelling music instructor must be both in fact talented as a performer and have a wide information base of hypothesis, history, and different parts of music.

The greatest blessing we can give our understudies is instruction that is understudy focused. As a teacher, my job is to give a sheltered and inviting condition for understudies to learn and develop. It is significant for figuring out how to happen in such a situation in this way, that understudies are liberated to act naturally, however allowed to commit errors. The best learning happens when it is helpful and collective in nature, letting understudies gain from one another and turn out to be all the more effectively occupied with their learning. I expect to enhance the melodic abilities of my understudies and help make the up and coming age of free and innovative artists.

34.

 

Music is a remarkable control, holding inherent worth that can’t be resembled or supplanted b

This question has been answered.

Get Answer
WeCreativez WhatsApp Support
Our customer support team is here to answer your questions. Ask us anything!
👋 Hi, Welcome to Compliant Papers.