Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write a program to implement the arithmetic function F = 4.5X^2 + 3Y - 1.5Z. The

ID: 2313646 • Letter: W

Question

Write a program to implement the arithmetic function F = 4.5X^2 + 3Y - 1.5Z. The numbers X, Y, and Z are 8-bit integers stored in registers D0, D1 and D2, respectively. The calculated value of F should be stored in memory starting at $2000. Test your program by initializing D0, D1, and D2 with different values and verify the results. [For e.g. D0, D1, D2 = 1, 2, 3, 4, 5] Write a program to compute the dot product of two vectors A and B. C = A.B = A_xB_x + A_yB_y + A_zB_z The components of vector A (A_x, A_y and A_z) are stored in memory at address VEC_A, and those of vector B at address VEC_B. All components are 8-bit signed numbers. The result of the dot product (scalar) should be stored in memory starting at address RESULT. Use the most suitable addressing modes. [Hint: for signed numbers instructions MULS must be used; refer to lecture notes] VEC_A DC.B 2, 4, 6 VEC_B DC.B 1, 3, 5 RESULT DS.W 0 Write a program using EASy68K to multiply the contents of D0.W by 13 without using the MUL instruction. Write a program using EASy68K to divide the contents of D0.W by 9 without using the DIV instruction.

Explanation / Answer

12.

for x=2000 : 2002
X=input('Enter X value : ');
Y=input('Enter Y value : ');
Z=input('Enter Z value : ');
D0=X;
D1=Y;
D2=Z;
F=4.5*power(X,2)-3*Y-1.5*Z
end

result

Enter X value : 1
Enter Y value : 2
Enter Z value : 3

F =

    -6

Enter X value : 4
Enter Y value : 5
Enter Z value : 6

F =

    48

Enter X value : 7
Enter Y value : 8
Enter Z value : 9

F =

   183

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote