Hi. Can someone help me write the the code for this assignment. There are 4 func
ID: 3782622 • Letter: H
Question
Hi. Can someone help me write the the code for this assignment. There are 4 functions in the program, but only two of them need to be completed. I will list the instructions and then the .asm file that is used.
Instructions:
.asm file:
Assignment 2 The file ass asm holds a partial program. The purpose of the program is to read in a list of 10 integers and then print them out. There are 4 functions in the program, 2 of which you are to complete Main: This function will call getdata and print. Main is complete and should not be changed. Getdata: This function reads 10 integers and stores them into memory. There is one parameter ($a0) which holds the address of where the list of numbers is to be stored. Getdata calls the function printstr to print the prompt. Getdata is complete and should not be changed. Printstr: This function is to print a string. There is one parameter (Sa0 which holds the address of the string to print. You are to complete this function so it performs as required. This function is call from the getdata function and the print function. Print: This function is to print the list of integers. The integers must all be on the same line of output and be separated by a comma and space (already in the data segment). See the example input and output below. This function must call the printstr function to print the comma string. Remember that as this function calls another, it must save and restore the $ra. Specifics Use only the instructions covered to date. Do not use pseudo-instructions. See the information under MARS for preventing the use of pseudo-instructions Make sure that your print function calls the printstr function correctly and that the stack is used correctly. Documentation: Comment the beginning of your programs with your name, plass, and assignment number. Comment every instruction. Assignment submittal: Upload your assembly language program (asm file) using this link on Blackboard Hints on getting started: Load the assi asm file into the MARS simulator Write the code for printstr and make sure that it works correctly. Write the code for printExplanation / Answer
Normally the C’s program building process involves four stages and utilizes different ‘tools’ such as a preprocessor, compiler, assembler, and linker.
At the end there should be a single executable file. Below are the stages that happen in order regardless of the operating system/compiler and graphically illustrated in Figure w.1.
Preprocessing is the first pass of any C compilation. It processes include-files, conditional compilation instructions and macros.
Compilation is the second pass. It takes the output of the preprocessor, and the source code, and generates assembler source code.
Assembly is the third stage of compilation. It takes the assembly source code and produces an assembly listing with offsets. The assembler output is stored in an object file.
Linking is the final stage of compilation. It takes one or more object files or libraries as input and combines them to produce a single (usually executable) file. In doing so, it resolves references to external symbols, assigns final addresses to procedures/functions and variables, and revises code and data to reflect new addresses (a process called relocation).
Bear in mind that if you use the IDE type compilers, these processes quite transparent.
Now we are going to examine more details about the process that happen before and after the linking stage. For any given input file, the file name suffix (file extension) determines what kind of compilation is done and the example for GCC is listed in Table w.1.
In UNIX/Linux, the executable or binary file doesn’t have extension whereas in Windows the executables for example may have .exe, .com and .dll.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.