(1) Given n points in the 3D space (xo, yo, zo), (x1, y1, z1), (xn-1,yn-1, zn-i), we use the following formulae to calculate their center point (xc, yc, zc)
xc=(x0+x1 + xn-1)/n
ye= (y0+ y1 + ••• Yn-1)/ n
zc= (Zo + Z1+ ••• Zn-1)/ n
Create an assembly program to implement the above formulae. The data segment of your program should look like the following.
.data
n: .word 7
x: .word 30, 12, 45, 34, 40, 14, 30
y: .word 32, 10, 39, 89, 24, 12, 67
z: .word 42, 20, 76, 23, 23, 65, 15
xc: .space 4
yc: .space 4
zc: .space 4
|
# This example has 7 points
# xo, xi, • • • Xn-I
# y0, y1, • • • yn-1
# z0, zi, • • • zn-1
# a word result
# a word result
# a word result
|
xc, yc, and zc are all integers. Ignore the remainders if there are any.
Please name your program xxxx.asm, where xxxx is the last four digits of your ID and e¬mail xxxx.asm to me. In your e-mail, just write Question 1 in the title and attach xxxx.asm to it.
Also in order to help comment on your program, please submit a hardcopy of your source code for this question. When the marker checks it, s/he will make comments on your hardcopy