data # Data segment Array A: .word 0, 1, 2, 3, 4, 5, 6, 7, 8,...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
data # Data segment Array A: .word 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 Array B: .word #Array -space 40 text #Code Segment .egy Pointer $t0 # Sto remanmed as Pointer .eqv offset St1 # $t1 renamed as offset .eqv BaseAddressRegA St4 # St4 renamed as BaseAddress Rega .eqv BaseAddressRegB St5 # $t5 renamed as BaseAddressRegB eqy Effective AddressA $t6 # Stó renamed as EffectiveAddressA .eqy Effective AddressB St7 # $17 renamed as Effective AddressB #Array A with imtial values B is empty and is 10 word wide, 40 bytes space allocated # Print Any Arbitrary String Message .macro PrintAnyStringMessage (message) .data ArbitraryMessage: .asciiz %message #Empty space reserved to hold 40 letters .space 40 .text li $v0, 4 # Code to print character or srting message la $a0, ArbitraryMessage #Base address loaded into $a0 # Print message syscall .end_macro #Print Integers in hex, binary, etc PrintInteger(%n, %m) .inacro li $v0,%n move $20, %m syscall .end_macro .globl Main Main: PrintAnyStringMessage("Dr. Farmanullah Jan Says Welcome to Assembly Programming Session! \n") PrintAnyStringMessage("Perform: Array_B= Array_A+ 10 Using a for-loop! \n") li Pointer, 0 #Clear Pointer li offset, 0 #Clear offset la BaseAddressRegA, Array_A #Base address of Array_A is loaded into "BaseAddressRega" la BaseAddressRegB, Array_B #Base address of Array_B is loaded into "BaseAddressRegB" For Loop: add Effective AddressA, BaseAddressRegA, offset add EffectiveAddressB, BaseAddressRegB, offset lw $t8, 0(Effective AddressA) # $18 <== Array A[pointer] PrintAnyStringMessage(" Value Of Array_A =") PrintInteger(1, $18) addin $t9, $t8, 10 PrintAnyStringMessage("\n PrintInteger (1, $t9) sw $19, 0(Effective AddressB) #increment pointer addin Pointer, Pointer, 1 sll offset, Pointer, 2 ble Pointer, 9, For_Loop Stop: li $v0, 10 syscall # Effective addres for Array_A[pointer] # Effective addres for Array_B[poiner] # $t9 = Array_Alpointer] + 10 Value Of Array_B =") #Array_B[pointer] <== $19 # Pointer = Pointer + ! # Offset = (Pointer * 4) #Repeat the for_loop if Pointer < 10 # Simulator is halted Statement: Statement: Recode the above program to do the following task: Array_ A[k] =20* Array A[k] - 2*Array_B[k]; for k=0-20 Note: All = {0,1, 2,3,..., 19} Code: B[] A[]; Both sets are same. = data # Data segment Array A: .word 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 Array B: .word #Array -space 40 text #Code Segment .egy Pointer $t0 # Sto remanmed as Pointer .eqv offset St1 # $t1 renamed as offset .eqv BaseAddressRegA St4 # St4 renamed as BaseAddress Rega .eqv BaseAddressRegB St5 # $t5 renamed as BaseAddressRegB eqy Effective AddressA $t6 # Stó renamed as EffectiveAddressA .eqy Effective AddressB St7 # $17 renamed as Effective AddressB #Array A with imtial values B is empty and is 10 word wide, 40 bytes space allocated # Print Any Arbitrary String Message .macro PrintAnyStringMessage (message) .data ArbitraryMessage: .asciiz %message #Empty space reserved to hold 40 letters .space 40 .text li $v0, 4 # Code to print character or srting message la $a0, ArbitraryMessage #Base address loaded into $a0 # Print message syscall .end_macro #Print Integers in hex, binary, etc PrintInteger(%n, %m) .inacro li $v0,%n move $20, %m syscall .end_macro .globl Main Main: PrintAnyStringMessage("Dr. Farmanullah Jan Says Welcome to Assembly Programming Session! \n") PrintAnyStringMessage("Perform: Array_B= Array_A+ 10 Using a for-loop! \n") li Pointer, 0 #Clear Pointer li offset, 0 #Clear offset la BaseAddressRegA, Array_A #Base address of Array_A is loaded into "BaseAddressRega" la BaseAddressRegB, Array_B #Base address of Array_B is loaded into "BaseAddressRegB" For Loop: add Effective AddressA, BaseAddressRegA, offset add EffectiveAddressB, BaseAddressRegB, offset lw $t8, 0(Effective AddressA) # $18 <== Array A[pointer] PrintAnyStringMessage(" Value Of Array_A =") PrintInteger(1, $18) addin $t9, $t8, 10 PrintAnyStringMessage("\n PrintInteger (1, $t9) sw $19, 0(Effective AddressB) #increment pointer addin Pointer, Pointer, 1 sll offset, Pointer, 2 ble Pointer, 9, For_Loop Stop: li $v0, 10 syscall # Effective addres for Array_A[pointer] # Effective addres for Array_B[poiner] # $t9 = Array_Alpointer] + 10 Value Of Array_B =") #Array_B[pointer] <== $19 # Pointer = Pointer + ! # Offset = (Pointer * 4) #Repeat the for_loop if Pointer < 10 # Simulator is halted Statement: Statement: Recode the above program to do the following task: Array_ A[k] =20* Array A[k] - 2*Array_B[k]; for k=0-20 Note: All = {0,1, 2,3,..., 19} Code: B[] A[]; Both sets are same. =
Expert Answer:
Answer rating: 100% (QA)
The task is to adjust the given MIPS assembly language program in the images to perform a new operation on two arrays A and B As per the statement the ... View the full answer
Related Book For
Introduction to Java Programming, Comprehensive Version
ISBN: 978-0133761313
10th Edition
Authors: Y. Daniel Liang
Posted Date:
Students also viewed these programming questions
-
Kara just graduated from college and has never had a credit card. Having a convenience user credit philosophy, what factors are most important to Kara in acquiring a credit card?
-
As an alternative alphanumeric code, consider a code where punched holes in the columns of a card represent alphanumeric codes. The punched hole represents a 1; all other bits are 0. The Hollerith...
-
If the focal length of a lens is 3 centimeters and the image distance is 5 centimeters from the lens, what is the distance from the object to the lens?
-
Find an equation of the tangent plane at the given point. f(x, y) = x + y, (4,1)
-
A 0.100-A current is charging a capacitor that has square plates 5.00 cm on each side. The plate separation is 4.00 mm. Find (a) The time rate of change of electric flux between the plates and (b)...
-
For diagrams (a)-(d), compute the unknown values: B, C, V, x, respectively, using the minimum number of compound interest factors. (a) (b) (c) (d) :00 100 100 :-10% It 200 200 200 200 10% 10 I0 10 10...
-
Comparative data extracted from the general purpose financial statements and notes thereto of Express Delivery Ltd are presented below. Required (a) Prepare a trend analysis of the data. (b) Comment...
-
There are four radio stations in Midland. The stations have different formats (hard rock, classical, country/western, and easy listening), but each is concerned with the number of minutes of music...
-
Examine the thermodynamic aspects of renewable energy technologies, including solar thermal systems, wind turbines, and fuel cells, in terms of energy conversion efficiency, exergy analysis, and the...
-
Katie Scarlett is analyzing the 15-unit apartment building for a client for possible purchase. She expanded her analysis from just the DCF (Income) to include the Direct Cap (Income), the Cost and...
-
Simplify 6. 30. Enter your answer as an exact radical. Use sqrt(#) to write # Add Work Calculator Check Answer
-
I. DEFINE OR DESCRIBE THE FOLLOWING: 1. Operations 2. Operations Management 3. Efficiency 4. Effectiveness 5. Marketing 6. Trade Creditors 7. Bonds 8. Common Stocks 9. Retained Earnings 10. Open book...
-
Critically discuss what could go wrong in a project without a formal project charter and how having a comprehensive project carter overcomes these problems.
-
Progress Test: Profit v Cash The next five questions are based on the following information. Li Ming, a Business Studies graduate from Hong Kong, has settled in Scotland after her degree and intends...
-
This week's discussion revolves around the analysis and recording of financial transactions. At the onset of bookkeeping, the crucial steps involve preparing journal entries, ledger accounts, and the...
-
So the general consensus is that the global economy does not work well for wage workers. We have seen that unions, which serve as a means to build and maintain decent living standards for workers,...
-
Two big mirrors A and B are fitted side by side on a wall. A man is standing at such a distance from the wall that he can see the erect image of his face in both the mirrors. When the man starts...
-
Is it ethical to provide safety training in English to immigrant workers who speak little English, in order to reduce costs?
-
Suppose you wish to track how many times a program has been executed. You can store an int to count the file. Increase the count by 1 each time this program is executed. Let the program be...
-
Write a program that receives an ASCII code (an integer between 0 and 127) and displays its character. Here is a sample run: Enter an ASCII code: 69 The character for ASCII code 69 is E JEnter
-
Modify Listing 18.8, TowerOfHanoi.java, so that the program finds the number of moves needed to move n disks from tower A to tower B. Listing 1 import java.util.Scanner; 2 3 public class Tower0fHanoi...
-
Is the word anxiety a candidate for creating a stable pattern? If so, give reasons.
-
Define the real meaning of anxiety. What are the different meanings of this word?
-
Can you list six important benefits of this pattern?
Study smarter with the SolutionInn App