Assignment 4 for CSCI 255

Due date

This assignment must be submitted as a single file gcd.s for Assignment 4 of the CSCI 255 section on UNCA moodle by 11:00 PM on Wednesday, 17 November.

The task

Write in PIC assembly language the following recursive routine:

uint16 GCD(uint16 n, uint16 m) {
  if (n==m)
    return n ;
  else if (n<m)
    return GCD(m, n) ;
    return GCD(n-m, m) ;

Also, write a little "main" program to call your GCD.

Your program should used the stack frame format discussed on pages 192 to 196 and should have some strong similarities with the fib program of Figure 6.31.