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
Which of the following statements is true of a time management plan? It is work in progress that need to be altered many times?
marusya05 [52]
Cake cake cake cake
3 0
3 years ago
To save a file so that it can be opened on most computers, select the _____ option.
romanna [79]
Save it on the cloud.
6 0
4 years ago
Read 2 more answers
What two things should you do before starting the design process
Charra [1.4K]

Answer: B and C

Explanation: Analyze the audience

                      Identify the problem

8 0
3 years ago
An administrator has just added a new update to the WSUS server and she wants to test the update to the test group. Which of the
DENIUS [597]

Answer:

a. gpupdate /force

Explanation:

Based on the information provided within the question it can be said that if the administrator does not want to wait she can use the command gpupdate /force. This command allows the individual to update both the local Group Policy settings and Active Directory-based settings. This the force tag makes it so that the policy is immediately update.

6 0
4 years ago
⣠⣤⣤⣤⣤⣤⣶⣦⣤⣄⡀⠀⠀⠀⠀⠀⠀⠀⠀
mestny [16]

Answer:

LOL sweet

Explanation:

4 0
3 years ago
Read 2 more answers
Other questions:
  • Build three classes that conform to the following interfaces. Use arrays in creating your classes (e.g., do not use the built-in
    8·1 answer
  • Which amendment discussed in the unit do you think has the greatest effect on your life? Why?
    14·1 answer
  • How do solar cells translate heat energy into mechanical energy
    13·1 answer
  • Cyberterrorism is the use of terrorism to attack (Points : 1) public libraries. computer based networks. government spy networks
    15·1 answer
  • A ________ is a user-interface component with two states: checked and unchecked. radio button check box menu item submenu item
    5·1 answer
  • Sally needs to copy data from the first worksheet to the fifth worksheet in her workbook. Which combination of keys will she use
    6·2 answers
  • What do you need for digital photography? 1. 2. 3.
    13·1 answer
  • Creating an accurate inventory is a challenge, given the speed at which data files are created, deleted, moved, and changed. It
    12·1 answer
  • **NEED HELP??!! Computer Science Questions!! KNOWING GIMP!!!!
    7·1 answer
  • Question 1 (1 point)
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!