Question: COMPUTER ASSEMBLY LANGUAGE 1.In this program data comes in pairs, say height and weight: .data pairs: .word 5 # number of pairs .word 60, 90
COMPUTER ASSEMBLY LANGUAGE
1.In this program data comes in pairs, say height and weight:
.data pairs:
.word 5 # number of pairs
.word 60, 90 # first pair: height, weight
.word 65, 105
.word 72, 256
.word 68, 270
.word 62, 115
Write a program that computes the average height and average weight. Leave the results in two registers.
2. Compute the dot product of two vectors. A vector is an array of integers. Both vectors are the same length. Ask the user for the length of the vectors. Then prompt for and read in the value of each element of each vector. Reserve space in memory for vectors of up to 10 elements, but allow vectors of any size one through 10.
.data
length: .word 0
vectorA: .space 40 # space for 10 integers
vectorB: .space 40 # space for 10 integers
The dot product of two vectors is the sum of the product of the corresponding elements. For example, (1, 2, 3) dot (4, 5, 6) is 1*4 + 2*5 + 3*6. After computing it, write out the dot product to the monitor.
3. (Please use stack to solve this problem) Write a subroutine that takes three arguments, A, X, and Y. It then computes A*X*Y and returns it. Use the subroutine to evaluate the following for various values of u and v:
5u2 - 12uv + 6v2.
Write a main method, in a loop, prompts the user for values of u and v and prints out the result. End the loop when the user enters zero for both u and v.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
