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
It is important to extract the Eclipse executable file from the .zip file in the Programs folder of your C:\ drive.
Mrrafil [7]

Answer:

True

Explanation:

5 0
3 years ago
If I delete the emoji free app will I still have the emojis on my phone?
egoroff_w [7]
<span>If you delete the Emoji application from your phone there is a possibility the Emoji's will still hang around. It all depends on the way you set up the app on your phone. Some people opt to have settings and changes to the app saved on their SD card and some don't. If you save updates and changes to the app to your SD card you will still have remnants on your phone after deleting the app</span>
5 0
4 years ago
Read 2 more answers
¿Cuál es el objetivo principal de los servicios?
sleet_krkn [62]
Ayudar a las personas que los contratan
8 0
3 years ago
Question 3 : what tool can diagnose and fix many common linux filesystem problems?
vaieri [72.5K]
The t<span>ool that can diagnose and fix many common linux file system problems is </span>fsck.  fsck, is Linux's file system check utility. It's similar in purpose to the DOS and Windows CHKDSK and ScanDisk utilities. 
3 0
3 years ago
Which of the following describes what a manufacturing engineer does?
Semmy [17]
What's the following is there a b c d or is it just writing it out
7 0
3 years ago
Read 2 more answers
Other questions:
  • What wired channel, commonly used for cable tv, consists of an insulated copper wire wrapped in a solid or braided shield placed
    12·1 answer
  • Harry wants to change the background of all of his presentation slides. Which slide will enable him to make this change to all t
    14·1 answer
  • When you start to type =av, what feature displays a list of functions and defined names?
    11·1 answer
  • I need help plz it keeps on happening and idk what to do
    12·1 answer
  • WILL GIVE BRAINLIEST!!!!!!!!
    9·1 answer
  • is a shell program in Windows that holds individual utilities called snap-ins, designed for administration and troubleshooting.
    11·1 answer
  • As of MySQL 5.5, which of the following is the default table storage engine?
    14·1 answer
  • In this lab, your task is to complete the following: Enable all of the necessary ports on each networking device that will allow
    9·1 answer
  • (25 POINTS) Some applications work on all devices while others work on some devices. True or False?
    13·1 answer
  • The Zoom feature allows you to either increase or decrease the size of your document on the screen,
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!