1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
kiruha [24]
3 years ago
11

simpley convert the code below to assembly languageYour proof-of-study task is to hand-compile the code below into an assembly l

anguage function (a procedure), then place it in the provided .asm file, test it, and turn it in. Your function must adhere to the procedure calling conventions covered in class. You must also use specific registers when storing local variables, see below.Before you start: You may use my tests -- I've set them up to make it easy for you to test your code, and I have examples in the tests! :) Here they are:Proof-of-Study #4.asmHere is a recursive sorting algorithm that you will convert into assembly:void sort (int[] data, int lowIndex, int highIndex){ print ("Entering sort: ") print (lowIndex) print (" ") print (highIndex) print ("\n") if (lowIndex >= highIndex) print ("Leaving sort: ") print (lowIndex) print (" ") print (highIndex) print ("\n") return tempIndex = lowIndex centerIndex = lowIndex centerValue = data[highIndex] while (tempIndex < highIndex) tempValue = data[tempIndex] if (tempValue < centerValue) data[tempIndex] = data[centerIndex] data[centerIndex] = tempValue centerIndex = centerIndex + 1 tempIndex = tempIndex + 1 data[highIndex] = data[centerIndex] data[centerIndex] = centerValue sort (data, centerIndex+1, highIndex) sort (data, lowIndex, centerIndex-1) print ("Leaving sort: ") print (lowIndex) print (" ") print (highIndex) print ("\n") return}Note that the code looks similar to Java, C, or many other languages. It has variables (assumed to be integers or arrays), a loop, and 'if' statements. The loop and 'if' statements use indentation to show scope.When converting this algorithm, use only these registers for variables:Variable Register Notesdata $s1 Array address, it arrives in $a0 but your code will copy $a0 to $s1 and use $s1 insteadlowIndex $s2 integer, it arrives in $a1 but your code will copy $a1 to $s2 and use $s2 insteadhighIndex $s3 integer, it arrives in $a2 but your code will copy $a2 to $s3 and use $s3 insteadtempValue $t0 integertempIndex $t1 integercenterValue $t2 integercenterIndex $t3 integerWhen needed, you can use $t4-$t9 for additional temporary computations (addresses, etc.), but not for program variables. You may use pseudoinstructions.You will need to add code to the function to properly create a stack frame and to preserve registers appropriately. Follow the convention covered in class (required). Clearly comment your code. You may write the assembly code for your function separately, or you may write it as part of this test program (easier):Do not optimize your program. Each C/Java statement should be independently translated to assembly. Don't avoid writing code because you want to reuse a previous temporary value - always write the complete code for each statement. (You can verify correctness much faster by doing it this way.)After you convert the statements, add the code to create the stack frame and do preservation of registers.The code is recursive. Be careful to preserve the needed temporary variable(s) just before you make the first function call, and restore it/them when the function call completes.If you're curious, note that I adapted a quicksort algorithm to be easy to code in assembly.Do not add sorting code (or other critical statements) to 'main' because it won't be in our version of main. You can change your main as needed for testing (but remember that we will not use your 'main' function).Your sort procedure should be contiguous statements. Don't embed other functions within your sort function. We'll only copy your sort function into our test code, and it needs to be easy for us to extract it.
Computers and Technology
1 answer:
sweet-ann [11.9K]3 years ago
8 0
I idk :) ok study is (((47437)
You might be interested in
Write a program that asks the user to enter a number within the range of 1 through 10. Use a switch statement to display the Rom
Studentka2010 [4]

Answer:

// program in C++.

// headers

#include <bits/stdc++.h>

using namespace std;

// main function

int main()

{

// Variable

   int num;

   cout << "Enter a number between 1 and 10: ";

   // read input

   cin >> num;

   // validate input number

   while(num<1||num>10)

   {

   // if input is wrong then print error message

       cout<<"Wrong input!!Enter again:";

       // read again

       cin>>num;

   }

   // print output

   cout << "The Roman numeral for "<<num<<" is:";

   // switch

   switch (num)

   {

       case 1:

       // if input is 1

           cout<<"I"<<endl;

           // exit the switch

           break;

       case 2:

       // if input is 2

           cout<<"II"<<endl;

           // exit the switch

           break;

       case 3:

       // if input is 3

           cout<<"III"<<endl;

           // exit the switch

           break;

       case 4:

       // if input is 4

           cout<<"IV"<<endl;

           // exit the switch

           break;

       case 5:

       // if input is 5

           cout<<"V"<<endl;

           // exit the switch

           break;

       case 6:

       // if input is 6

           cout<<"VI"<<endl;

           // exit the switch

           break;

       case 7:

       // if input is 7

           cout<<"VII"<<endl;

           // exit the switch

           break;

       case 8:

       // if input is 8

           cout<<"VIII"<<endl;

           // exit the switch

           break;

       case 9:

       // if input is 9

           cout<<"IX"<<endl;

           // exit the switch

           break;

       case 10:

       // if input is 10

           cout<<"X"<<endl;

           // exit the switch

           break;

         // default

       default:

           break;

   }

return 0;

}

Explanation:

Read a number from usr and assign it to variable "num". If the input number is less than 1 or greater than 10 then ask again to enter a number until user  enter a number between 1-10 only.Then with the help of switch() function print  the equivalent Roman number.

Output:

Enter a number between 1 and 10: -5                                                                                        

Wrong input!!Enter again:12                                                                                                

Wrong input!!Enter again:6                                                                                                

The Roman numeral for 6 is:VI

7 0
3 years ago
Why is IP configuration used with its components for network, broadcast, host addresses, and local host?
matrenka [14]

Answer:

GeoLocation

Explanation:

It is based on geolocation and wireless provider so it differs based on where and what hope this helps!

3 0
3 years ago
On a system with paging, a process cannot access memory that it does not own. Why? How could the operating system allow access t
kompoz [17]

Answer:

  • Because the page is not in its page table
  • The operating system could allow access to other memory by allowing entries for non-process memory to be added to the process page table

Explanation:

On a system with paging, a process cannot access memory that it does not own because the page is not in its page table also the operating system controls the contents of the table,therefore it limits a process of accessing to only the physical pages allocated to the process.

The operating system could allow access to other memory by allowing entries for non-process memory to be added to the process page table.that way two processes that needs to exchange  data can efficiently do that . i.e creating a very efficient inter-process communication

7 0
3 years ago
The ____________ is a wildcard character that is used to search for an unknown single character.
mafiozo [28]
Asteristik or as we see as (*)
5 0
3 years ago
If a user has just added a simple triangle shape into a diagram, how can the triangle be adjusted? Check all that apply. by maki
lesantik [10]
The first two make the most sense.
I hope this helps!
7 0
3 years ago
Read 2 more answers
Other questions:
  • The document asks about dependents because the number can
    12·2 answers
  • When you need to cut new external threads on a bolt, what tool should you use?
    7·2 answers
  • What year did Elvis die? Right answer 1977.
    14·1 answer
  • Websites whose URL’s contain tildes (~) are usually published by the government. True or false?
    8·2 answers
  • In a large organization, how do you typically request permission to perform a network change?
    6·1 answer
  • Sistema binario, realizar el pasaje de binario a decimal; 00110011 11101100 11100001 11001100 10010101 11001111 10000001 1000110
    14·1 answer
  • CAN SOMEONE PLEASE HELP ME WITH THIS PLEASE ?!!!!!!!!
    14·1 answer
  • List four things that must be taken into consideration when evaluating different resources of information (and explain ANY ONE f
    8·1 answer
  • GMI = $4,666.67 Total Monthly Deductions $1,131.00 What is the Net Monthly Income (GMI - Total Monthly Deductions) =
    9·1 answer
  • 22. Write the following in full un computer
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!