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

easy68K code please!! Thank you! Please initialize an array [21, 16, 11, 1, 8, 2

ID: 3860876 • Letter: E

Question

easy68K code please!! Thank you!

Please initialize an array [21, 16, 11, 1, 8, 2, 12, 3, 5, 7] in your local memory. You will need to access these array elements as required below. (Use conditional branch to finish all these questions)
Display the array as what is shown in square brackets. (use comma to separate the numbers)

Print out the number of elements greater than 10. (Hint: loop through the array, compare each element with 10 and use a counter to record.)

Please paste your code and displayed results here.

Explanation / Answer

Code:-

ORG $400

MOVE.W #NUM,A2

LOOP:

MOVE.W LOOP_COUNTER,D0

CMP #10,D0

bcc exit_loop

MOVE.W #0,D1

ADD.W (A2)+,D1

EXT.L D1

MOVE.B #3,D0

TRAP #15

CMPW #10,D1

BCC SKIP_INCRE

MOVE.W COUNT,D0

ADDW #1,D0

MOVE.W D0,COUNT

SKIP_INCR:

MOVE.W LOOP_COUNTER,D0

ADDW #1,D0

MOVE.W D0,LOOP_COUNTER

bra LOOP

exit_loop:

MOVE.W COUNT,D1

EXT.L D1

MOVE.B #3,D0

TRAP #15

STOP #$2700

ORG $4000

NUM DC.W 21,16,11,1,8,2,12,3,5,7

COUNT DC.W 0

LOOP_COUNTER DC.W 0

Explanation:-

NOTE: first I display ,each element of the array and at last I display the count of the no of elements greater than value 10. I didn't separated them with a string or something.Numbers will be displayed one by one.last element printed will be the count