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

Write an assembly language program to compute: y - (x - 4)(x - 14) for the range

ID: 3664032 • Letter: W

Question

Write an assembly language program to compute: y - (x - 4)(x - 14) for the range 0 x 10, by stepping one by one through the range. During each iteration, print out a message stating the current value of x and the corresponding value of y. Make sure to define the values of the constants 4 and 14 as constants al and a2 - the TA may change these values to further test your code. Try to eliminate as many nop instructions as possible and also try to minimize the length of your code. You may run the program using gdb to verify correctness. Make sure to pay close attention to the requirements above. Output Format: For input of x = 0, output y = 56 For input of x = 1, output y = 39 For input of x =10, output y = -24 Requirements: Follow the requirements as described above. Make sure to comment your code. Name your source file 'lastnamc2.m'. [It is a.m file rather than a,s file since you will have macro definitions.]

Explanation / Answer

below are the code:

define (x_r, L0 )
define (y_r, L1 )

.global main
Save % sp , - 96 ,% sp
clr % x_r !initialize x

loop :
sub % x_r , 4 ,% o0 ! ( x - A1 )   

sub % x_r , 14 ,% o1 ! ( x - a2 )
Call . mul

mov % o0 ,% y_r !store result
add % x_r, 1 ,%x_r !x++
cmp %x_r,10

B1 loop
mov % o0,%y_r
mov 1,%g1
Ta 0

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