From: smolik andrew michael Subject: Re: Post your ECE291 exam questions here! Date: Monday, October 06, 1997 2:53 AM (a) Write a modular assembly far procedure called _gcf2 that uses the Euclidean algorithm (described below) to find and return the greatest common factor of two unsigned 16-bit integers "a1" and "a2" and may be called from a C/C++ function. The Euclidean algorithm states that if a = pq + r where a, p, q, and r are integers, then the greatest common factor of a and q equals the greatest common factor of q and r. To use the algorithm, note the procedure below in order to find gcf2 (a1, a2): If a1 / a2 = p1 with remainder a3 and a2 / a3 = p2 with remainder a4 and a3 / a4 = p3 with remainder a5 and ... a(n-1) / an = p(n-1) with remainder 0, Example GCF(21,18) Example GCF(18,3) Example GCF(3 ,0) Example GCF(99,78) Example GCF(78,21) Example GCF(21,15) Example GCF(15, 6) Example GCF( 6, 3) Example GCF( 3, 0) then an is the result of gcf2 (a1, a2). Assume that that C/C++ prototype of gcf2 is the following: extern unsigned int far gcf2 (unsigned int a1, unsigned int a2); (b) Now write another modular assembly far procedure called _gcfn that uses _gcf2 to compute and return the greatest common factor of "n" unsigned 16-bit integers stored in an array "a" and may be interfaced with C/C++. Assume the following C/C++ prototype: extern unsigned int far gcfn (unsigned int *a, unsigned int n); where "a" is a segment-and-offset pointer to the first element of the array of size "n", and "n" is word-sized (16 bits).